40 #define LOCAL_ADDRESS 0xc0a80081 // FIXME get and use correct local ip address.
41 #define LOCAL_PORT 1037 // as above.
119 uint32_t prefix1, uint32_t prefix2)
130 int exact_length =
FFALIGN(len, 8);
131 int first_length= exact_length - 16;
132 int len8= first_length/8;
143 if(write_result != exact_length) {
145 "Failed to write data of length %d: %d (%s)\n",
146 exact_length, write_result,
147 write_result < 0 ? strerror(
AVUNERROR(write_result)) :
148 "The server closed the connection");
180 char data_string[256];
188 snprintf(data_string,
sizeof(data_string),
"\\\\%d.%d.%d.%d\\%s\\%d",
252 if (read_result != 8) {
253 if(read_result < 0) {
255 "Error reading packet header: %d (%s)\n",
256 read_result, strerror(
AVUNERROR(read_result)));
260 "The server closed the connection\n");
268 int length_remaining, hr;
272 if(read_result != 4) {
274 "Reading command packet length failed: %d (%s)\n",
276 read_result < 0 ? strerror(
AVUNERROR(read_result)) :
277 "The server closed the connection");
278 return read_result < 0 ? read_result :
AVERROR(EIO);
282 av_dlog(
NULL,
"Length remaining is %d\n", length_remaining);
284 if (length_remaining < 0
285 || length_remaining >
sizeof(mms->
in_buffer) - 12) {
288 length_remaining,
sizeof(mms->
in_buffer) - 12);
293 if (read_result != length_remaining) {
295 "Reading pkt data (length=%d) failed: %d (%s)\n",
296 length_remaining, read_result,
297 read_result < 0 ? strerror(
AVUNERROR(read_result)) :
298 "The server closed the connection");
299 return read_result < 0 ? read_result :
AVERROR(EIO);
304 "Server sent a message with packet type 0x%x and error status code 0x%08x\n", packet_type, hr);
308 int length_remaining;
315 length_remaining = (tmp - 8) & 0xffff;
320 if (length_remaining < 0
321 || length_remaining >
sizeof(mms->
in_buffer) - 8) {
323 "Data length %d is invalid or too large (max=%"SIZE_SPECIFIER")\n",
324 length_remaining,
sizeof(mms->
in_buffer));
330 if(read_result != length_remaining) {
332 "Failed to read packet data of size %d: %d (%s)\n",
333 length_remaining, read_result,
334 read_result < 0 ? strerror(
AVUNERROR(read_result)) :
335 "The server closed the connection");
336 return read_result < 0 ? read_result :
AVERROR(EIO);
358 }
else if(packet_id_type == mmst->
packet_id) {
361 av_dlog(
NULL,
"packet id type %d is old.", packet_id_type);
385 int ret = send_fun(mmst);
387 av_dlog(
NULL,
"Send Packet error before expecting recv packet %d\n", expect_type);
394 "Corrupt stream (unexpected packet type 0x%x, expected 0x%x)\n",
426 char data_string[256];
433 snprintf(data_string,
sizeof(data_string),
434 "NSPlayer/7.0.0.1956; {%s}; Host: %s",
435 "7E667F5D-A661-495E-A512-F55686DDA178", mmst->
host);
524 sizeof(mmst->
path), uri);
558 "The server does not support MMST (try MMSH or RTSP)\n");
585 av_dlog(
NULL,
"Leaving open (failure: %d)\n", err);
611 "Incoming pktlen %d is larger than ASF pktsize %d\n",
618 av_dlog(
NULL,
"Read ASF media packet size is zero!\n");