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");
176 char data_string[256];
184 snprintf(data_string,
sizeof(data_string),
"\\\\%d.%d.%d.%d\\%s\\%d",
245 if (read_result != 8) {
246 if(read_result < 0) {
248 "Error reading packet header: %d (%s)\n",
249 read_result, strerror(
AVUNERROR(read_result)));
253 "The server closed the connection\n");
261 int length_remaining, hr;
265 if(read_result != 4) {
267 "Reading command packet length failed: %d (%s)\n",
269 read_result < 0 ? strerror(
AVUNERROR(read_result)) :
270 "The server closed the connection");
271 return read_result < 0 ? read_result :
AVERROR(EIO);
275 av_dlog(
NULL,
"Length remaining is %d\n", length_remaining);
277 if (length_remaining < 0
278 || length_remaining >
sizeof(mms->
in_buffer) - 12) {
280 "Incoming packet length %d exceeds bufsize %zu\n",
281 length_remaining,
sizeof(mms->
in_buffer) - 12);
286 if (read_result != length_remaining) {
288 "Reading pkt data (length=%d) failed: %d (%s)\n",
289 length_remaining, read_result,
290 read_result < 0 ? strerror(
AVUNERROR(read_result)) :
291 "The server closed the connection");
292 return read_result < 0 ? read_result :
AVERROR(EIO);
297 "Server sent a message with packet type 0x%x and error status code 0x%08x\n", packet_type, hr);
301 int length_remaining;
308 length_remaining = (tmp - 8) & 0xffff;
313 if (length_remaining < 0
314 || length_remaining >
sizeof(mms->
in_buffer) - 8) {
316 "Data length %d is invalid or too large (max=%zu)\n",
317 length_remaining,
sizeof(mms->
in_buffer));
323 if(read_result != length_remaining) {
325 "Failed to read packet data of size %d: %d (%s)\n",
326 length_remaining, read_result,
327 read_result < 0 ? strerror(
AVUNERROR(read_result)) :
328 "The server closed the connection");
329 return read_result < 0 ? read_result :
AVERROR(EIO);
351 }
else if(packet_id_type == mmst->
packet_id) {
354 av_dlog(
NULL,
"packet id type %d is old.", packet_id_type);
378 int ret = send_fun(mmst);
380 av_dlog(
NULL,
"Send Packet error before expecting recv packet %d\n", expect_type);
387 "Corrupt stream (unexpected packet type 0x%x, expected 0x%x)\n",
419 char data_string[256];
425 snprintf(data_string,
sizeof(data_string),
426 "NSPlayer/7.0.0.1956; {%s}; Host: %s",
427 "7E667F5D-A661-495E-A512-F55686DDA178", mmst->
host);
515 sizeof(mmst->
path), uri);
549 "The server does not support MMST (try MMSH or RTSP)\n");
576 av_dlog(
NULL,
"Leaving open (failure: %d)\n", err);
602 "Incoming pktlen %d is larger than ASF pktsize %d\n",
609 av_dlog(
NULL,
"Read ASF media packet size is zero!\n");