Mercurial > libavformat.hg
annotate rtpdec_asf.c @ 6283:0969c3bcb267 libavformat
Remove an assert that was no longer correct nor relevant
author | mstorsjo |
---|---|
date | Tue, 20 Jul 2010 09:58:30 +0000 |
parents | 8659c871d021 |
children | 7e7f9248ec87 |
rev | line source |
---|---|
4744
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
1 /* |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
2 * Microsoft RTP/ASF support. |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
3 * Copyright (c) 2008 Ronald S. Bultje |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
4 * |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
5 * This file is part of FFmpeg. |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
6 * |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
11 * |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
16 * |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
20 */ |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
21 |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
22 /** |
5969
178de7695c6c
Remove explicit filename from Doxygen @file commands.
diego
parents:
5910
diff
changeset
|
23 * @file |
4744
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
24 * @brief Microsoft RTP/ASF support |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
25 * @author Ronald S. Bultje <rbultje@ronald.bitfreak.net> |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
26 */ |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
27 |
6277
8659c871d021
rtpdec_asf: Include lavu headers using quotes instead of angle brackets
mstorsjo
parents:
6234
diff
changeset
|
28 #include "libavutil/base64.h" |
8659c871d021
rtpdec_asf: Include lavu headers using quotes instead of angle brackets
mstorsjo
parents:
6234
diff
changeset
|
29 #include "libavutil/avstring.h" |
8659c871d021
rtpdec_asf: Include lavu headers using quotes instead of angle brackets
mstorsjo
parents:
6234
diff
changeset
|
30 #include "libavutil/intreadwrite.h" |
4754
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
31 #include "rtp.h" |
5726
04b39763b51b
Rename RTP depacketizer files from rtp_* to rtpdec_*
mstorsjo
parents:
5664
diff
changeset
|
32 #include "rtpdec_asf.h" |
4744
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
33 #include "rtsp.h" |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
34 #include "asf.h" |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
35 |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
36 /** |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
37 * From MSDN 2.2.1.4, we learn that ASF data packets over RTP should not |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
38 * contain any padding. Unfortunately, the header min/max_pktsize are not |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
39 * updated (thus making min_pktsize invalid). Here, we "fix" these faulty |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
40 * min_pktsize values in the ASF file header. |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
41 * @return 0 on success, <0 on failure (currently -1). |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
42 */ |
5114
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
43 static int rtp_asf_fix_header(uint8_t *buf, int len) |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
44 { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
45 uint8_t *p = buf, *end = buf + len; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
46 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
47 if (len < sizeof(ff_asf_guid) * 2 + 22 || |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
48 memcmp(p, ff_asf_header, sizeof(ff_asf_guid))) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
49 return -1; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
50 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
51 p += sizeof(ff_asf_guid) + 14; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
52 do { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
53 uint64_t chunksize = AV_RL64(p + sizeof(ff_asf_guid)); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
54 if (memcmp(p, ff_asf_file_header, sizeof(ff_asf_guid))) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
55 if (chunksize > end - p) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
56 return -1; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
57 p += chunksize; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
58 continue; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
59 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
60 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
61 /* skip most of the file header, to min_pktsize */ |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
62 p += 6 * 8 + 3 * 4 + sizeof(ff_asf_guid) * 2; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
63 if (p + 8 <= end && AV_RL32(p) == AV_RL32(p + 4)) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
64 /* and set that to zero */ |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
65 AV_WL32(p, 0); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
66 return 0; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
67 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
68 break; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
69 } while (end - p >= sizeof(ff_asf_guid) + 8); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
70 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
71 return -1; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
72 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
73 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
74 /** |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
75 * The following code is basically a buffered ByteIOContext, |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
76 * with the added benefit of returning -EAGAIN (instead of 0) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
77 * on packet boundaries, such that the ASF demuxer can return |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
78 * safely and resume business at the next packet. |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
79 */ |
5114
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
80 static int packetizer_read(void *opaque, uint8_t *buf, int buf_size) |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
81 { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
82 return AVERROR(EAGAIN); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
83 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
84 |
5114
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
85 static void init_packetizer(ByteIOContext *pb, uint8_t *buf, int len) |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
86 { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
87 init_put_byte(pb, buf, len, 0, NULL, packetizer_read, NULL, NULL); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
88 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
89 /* this "fills" the buffer with its current content */ |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
90 pb->pos = len; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
91 pb->buf_end = buf + len; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
92 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
93 |
6234
0287312dda71
rtpdec_asf: Propagate errors from the chained av_open_input_stream
mstorsjo
parents:
6181
diff
changeset
|
94 int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) |
4744
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
95 { |
6234
0287312dda71
rtpdec_asf: Propagate errors from the chained av_open_input_stream
mstorsjo
parents:
6181
diff
changeset
|
96 int ret = 0; |
4744
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
97 if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) { |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
98 ByteIOContext pb; |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
99 RTSPState *rt = s->priv_data; |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
100 int len = strlen(p) * 6 / 8; |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
101 char *buf = av_mallocz(len); |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
102 av_base64_decode(buf, p, len); |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
103 |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
104 if (rtp_asf_fix_header(buf, len) < 0) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
105 av_log(s, AV_LOG_ERROR, |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
106 "Failed to fix invalid RTSP-MS/ASF min_pktsize\n"); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
107 init_packetizer(&pb, buf, len); |
4744
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
108 if (rt->asf_ctx) { |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
109 av_close_input_stream(rt->asf_ctx); |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
110 rt->asf_ctx = NULL; |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
111 } |
6234
0287312dda71
rtpdec_asf: Propagate errors from the chained av_open_input_stream
mstorsjo
parents:
6181
diff
changeset
|
112 ret = av_open_input_stream(&rt->asf_ctx, &pb, "", &asf_demuxer, NULL); |
0287312dda71
rtpdec_asf: Propagate errors from the chained av_open_input_stream
mstorsjo
parents:
6181
diff
changeset
|
113 if (ret < 0) |
0287312dda71
rtpdec_asf: Propagate errors from the chained av_open_input_stream
mstorsjo
parents:
6181
diff
changeset
|
114 return ret; |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
115 rt->asf_pb_pos = url_ftell(&pb); |
4744
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
116 av_free(buf); |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
117 rt->asf_ctx->pb = NULL; |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
118 } |
6234
0287312dda71
rtpdec_asf: Propagate errors from the chained av_open_input_stream
mstorsjo
parents:
6181
diff
changeset
|
119 return ret; |
4744
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
120 } |
4754
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
121 |
5114
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
122 static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index, |
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
123 PayloadContext *asf, const char *line) |
4754
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
124 { |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
125 if (av_strstart(line, "stream:", &line)) { |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
126 RTSPState *rt = s->priv_data; |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
127 |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
128 s->streams[stream_index]->id = strtol(line, NULL, 10); |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
129 |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
130 if (rt->asf_ctx) { |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
131 int i; |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
132 |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
133 for (i = 0; i < rt->asf_ctx->nb_streams; i++) { |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
134 if (s->streams[stream_index]->id == rt->asf_ctx->streams[i]->id) { |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
135 *s->streams[stream_index]->codec = |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
136 *rt->asf_ctx->streams[i]->codec; |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
137 rt->asf_ctx->streams[i]->codec->extradata_size = 0; |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
138 rt->asf_ctx->streams[i]->codec->extradata = NULL; |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
139 av_set_pts_info(s->streams[stream_index], 32, 1, 1000); |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
140 } |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
141 } |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
142 } |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
143 } |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
144 |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
145 return 0; |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
146 } |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
147 |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
148 struct PayloadContext { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
149 ByteIOContext *pktbuf, pb; |
6181 | 150 uint8_t *buf; |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
151 }; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
152 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
153 /** |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
154 * @return 0 when a packet was written into /p pkt, and no more data is left; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
155 * 1 when a packet was written into /p pkt, and more packets might be left; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
156 * <0 when not enough data was provided to return a full packet, or on error. |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
157 */ |
5114
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
158 static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, |
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
159 AVStream *st, AVPacket *pkt, |
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
160 uint32_t *timestamp, |
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
161 const uint8_t *buf, int len, int flags) |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
162 { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
163 ByteIOContext *pb = &asf->pb; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
164 int res, mflags, len_off; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
165 RTSPState *rt = s->priv_data; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
166 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
167 if (!rt->asf_ctx) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
168 return -1; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
169 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
170 if (len > 0) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
171 int off, out_len; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
172 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
173 if (len < 4) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
174 return -1; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
175 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
176 init_put_byte(pb, buf, len, 0, NULL, NULL, NULL, NULL); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
177 mflags = get_byte(pb); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
178 if (mflags & 0x80) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
179 flags |= RTP_FLAG_KEY; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
180 len_off = get_be24(pb); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
181 if (mflags & 0x20) /**< relative timestamp */ |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
182 url_fskip(pb, 4); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
183 if (mflags & 0x10) /**< has duration */ |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
184 url_fskip(pb, 4); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
185 if (mflags & 0x8) /**< has location ID */ |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
186 url_fskip(pb, 4); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
187 off = url_ftell(pb); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
188 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
189 av_freep(&asf->buf); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
190 if (!(mflags & 0x40)) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
191 /** |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
192 * If 0x40 is not set, the len_off field specifies an offset of this |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
193 * packet's payload data in the complete (reassembled) ASF packet. |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
194 * This is used to spread one ASF packet over multiple RTP packets. |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
195 */ |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
196 if (asf->pktbuf && len_off != url_ftell(asf->pktbuf)) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
197 uint8_t *p; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
198 url_close_dyn_buf(asf->pktbuf, &p); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
199 asf->pktbuf = NULL; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
200 av_free(p); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
201 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
202 if (!len_off && !asf->pktbuf && |
5664 | 203 (res = url_open_dyn_buf(&asf->pktbuf)) < 0) |
5663 | 204 return res; |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
205 if (!asf->pktbuf) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
206 return AVERROR(EIO); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
207 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
208 put_buffer(asf->pktbuf, buf + off, len - off); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
209 if (!(flags & RTP_FLAG_MARKER)) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
210 return -1; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
211 out_len = url_close_dyn_buf(asf->pktbuf, &asf->buf); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
212 asf->pktbuf = NULL; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
213 } else { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
214 /** |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
215 * If 0x40 is set, the len_off field specifies the length of the |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
216 * next ASF packet that can be read from this payload data alone. |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
217 * This is commonly the same as the payload size, but could be |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
218 * less in case of packet splitting (i.e. multiple ASF packets in |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
219 * one RTP packet). |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
220 */ |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
221 if (len_off != len) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
222 av_log_missing_feature(s, |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
223 "RTSP-MS packet splitting", 1); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
224 return -1; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
225 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
226 asf->buf = av_malloc(len - off); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
227 out_len = len - off; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
228 memcpy(asf->buf, buf + off, len - off); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
229 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
230 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
231 init_packetizer(pb, asf->buf, out_len); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
232 pb->pos += rt->asf_pb_pos; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
233 pb->eof_reached = 0; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
234 rt->asf_ctx->pb = pb; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
235 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
236 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
237 for (;;) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
238 int i; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
239 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
240 res = av_read_packet(rt->asf_ctx, pkt); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
241 rt->asf_pb_pos = url_ftell(pb); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
242 if (res != 0) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
243 break; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
244 for (i = 0; i < s->nb_streams; i++) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
245 if (s->streams[i]->id == rt->asf_ctx->streams[pkt->stream_index]->id) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
246 pkt->stream_index = i; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
247 return 1; // FIXME: return 0 if last packet |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
248 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
249 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
250 av_free_packet(pkt); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
251 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
252 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
253 return res == 1 ? -1 : res; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
254 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
255 |
5114
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
256 static PayloadContext *asfrtp_new_context(void) |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
257 { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
258 return av_mallocz(sizeof(PayloadContext)); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
259 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
260 |
5114
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
261 static void asfrtp_free_context(PayloadContext *asf) |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
262 { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
263 if (asf->pktbuf) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
264 uint8_t *p = NULL; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
265 url_close_dyn_buf(asf->pktbuf, &p); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
266 asf->pktbuf = NULL; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
267 av_free(p); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
268 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
269 av_freep(&asf->buf); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
270 av_free(asf); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
271 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
272 |
4754
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
273 #define RTP_ASF_HANDLER(n, s, t) \ |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
274 RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \ |
5113
75e51cba276e
Use named initializers and use new/free_context() instead of extradata()
rbultje
parents:
5111
diff
changeset
|
275 .enc_name = s, \ |
75e51cba276e
Use named initializers and use new/free_context() instead of extradata()
rbultje
parents:
5111
diff
changeset
|
276 .codec_type = t, \ |
75e51cba276e
Use named initializers and use new/free_context() instead of extradata()
rbultje
parents:
5111
diff
changeset
|
277 .codec_id = CODEC_ID_NONE, \ |
75e51cba276e
Use named initializers and use new/free_context() instead of extradata()
rbultje
parents:
5111
diff
changeset
|
278 .parse_sdp_a_line = asfrtp_parse_sdp_line, \ |
75e51cba276e
Use named initializers and use new/free_context() instead of extradata()
rbultje
parents:
5111
diff
changeset
|
279 .open = asfrtp_new_context, \ |
75e51cba276e
Use named initializers and use new/free_context() instead of extradata()
rbultje
parents:
5111
diff
changeset
|
280 .close = asfrtp_free_context, \ |
75e51cba276e
Use named initializers and use new/free_context() instead of extradata()
rbultje
parents:
5111
diff
changeset
|
281 .parse_packet = asfrtp_parse_packet, \ |
4754
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
282 }; |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
283 |
5910
536e5527c1e0
Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents:
5726
diff
changeset
|
284 RTP_ASF_HANDLER(asf_pfv, "x-asf-pf", AVMEDIA_TYPE_VIDEO); |
536e5527c1e0
Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents:
5726
diff
changeset
|
285 RTP_ASF_HANDLER(asf_pfa, "x-asf-pf", AVMEDIA_TYPE_AUDIO); |