annotate rtpdec_asf.c @ 6419:abd88124e6a9 libavformat

Fix two compiler arnings related to printf-format of sizeof()-statements.
author rbultje
date Sat, 28 Aug 2010 23:56:56 +0000
parents 7eafa931f4e4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"
6339
491eea5c52d6 Remove mostly unnecessary rtpdec_*.h files, store the declarations in one file
mstorsjo
parents: 6297
diff changeset
32 #include "rtpdec_formats.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
cb49c916b7f4 Fix implicit cast warning
mstorsjo
parents: 5969
diff changeset
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) {
6296
7e7f9248ec87 rtpdec_asf: Handle RTSP-MS packet splitting
mstorsjo
parents: 6277
diff changeset
171 int off, out_len = 0;
5111
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
6296
7e7f9248ec87 rtpdec_asf: Handle RTSP-MS packet splitting
mstorsjo
parents: 6277
diff changeset
176 av_freep(&asf->buf);
7e7f9248ec87 rtpdec_asf: Handle RTSP-MS packet splitting
mstorsjo
parents: 6277
diff changeset
177
5111
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
178 init_put_byte(pb, buf, len, 0, NULL, NULL, NULL, NULL);
6296
7e7f9248ec87 rtpdec_asf: Handle RTSP-MS packet splitting
mstorsjo
parents: 6277
diff changeset
179
7e7f9248ec87 rtpdec_asf: Handle RTSP-MS packet splitting
mstorsjo
parents: 6277
diff changeset
180 while (url_ftell(pb) + 4 < len) {
6297
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
181 int start_off = url_ftell(pb);
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
182
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
183 mflags = get_byte(pb);
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
184 if (mflags & 0x80)
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
185 flags |= RTP_FLAG_KEY;
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
186 len_off = get_be24(pb);
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
187 if (mflags & 0x20) /**< relative timestamp */
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
188 url_fskip(pb, 4);
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
189 if (mflags & 0x10) /**< has duration */
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
190 url_fskip(pb, 4);
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
191 if (mflags & 0x8) /**< has location ID */
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
192 url_fskip(pb, 4);
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
193 off = url_ftell(pb);
6296
7e7f9248ec87 rtpdec_asf: Handle RTSP-MS packet splitting
mstorsjo
parents: 6277
diff changeset
194
6297
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
195 if (!(mflags & 0x40)) {
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
196 /**
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
197 * If 0x40 is not set, the len_off field specifies an offset
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
198 * of this packet's payload data in the complete (reassembled)
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
199 * ASF packet. This is used to spread one ASF packet over
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
200 * multiple RTP packets.
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
201 */
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
202 if (asf->pktbuf && len_off != url_ftell(asf->pktbuf)) {
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
203 uint8_t *p;
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
204 url_close_dyn_buf(asf->pktbuf, &p);
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
205 asf->pktbuf = NULL;
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
206 av_free(p);
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
207 }
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
208 if (!len_off && !asf->pktbuf &&
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
209 (res = url_open_dyn_buf(&asf->pktbuf)) < 0)
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
210 return res;
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
211 if (!asf->pktbuf)
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
212 return AVERROR(EIO);
5111
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
213
6297
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
214 put_buffer(asf->pktbuf, buf + off, len - off);
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
215 url_fskip(pb, len - off);
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
216 if (!(flags & RTP_FLAG_MARKER))
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
217 return -1;
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
218 out_len = url_close_dyn_buf(asf->pktbuf, &asf->buf);
5111
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
219 asf->pktbuf = NULL;
6297
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
220 } else {
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
221 /**
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
222 * If 0x40 is set, the len_off field specifies the length of
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
223 * the next ASF packet that can be read from this payload
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
224 * data alone. This is commonly the same as the payload size,
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
225 * but could be less in case of packet splitting (i.e.
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
226 * multiple ASF packets in one RTP packet).
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
227 */
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
228
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
229 int cur_len = start_off + len_off - off;
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
230 int prev_len = out_len;
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
231 out_len += cur_len;
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
232 asf->buf = av_realloc(asf->buf, out_len);
6377
7eafa931f4e4 Prevent overflow on random input.
rbultje
parents: 6339
diff changeset
233 memcpy(asf->buf + prev_len, buf + off,
7eafa931f4e4 Prevent overflow on random input.
rbultje
parents: 6339
diff changeset
234 FFMIN(cur_len, len - off));
6297
241c4063d058 Reindent, rewrap long comment lines to keep line length below 80 chars
mstorsjo
parents: 6296
diff changeset
235 url_fskip(pb, cur_len);
5111
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 }
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
238
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
239 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
240 pb->pos += rt->asf_pb_pos;
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
241 pb->eof_reached = 0;
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
242 rt->asf_ctx->pb = pb;
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
243 }
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
244
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
245 for (;;) {
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
246 int i;
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
247
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
248 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
249 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
250 if (res != 0)
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
251 break;
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
252 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
253 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
254 pkt->stream_index = i;
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
255 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
256 }
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 av_free_packet(pkt);
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
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
261 return res == 1 ? -1 : res;
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
5114
51b1a9987537 Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents: 5113
diff changeset
264 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
265 {
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
266 return av_mallocz(sizeof(PayloadContext));
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
267 }
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
268
5114
51b1a9987537 Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents: 5113
diff changeset
269 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
270 {
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
271 if (asf->pktbuf) {
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
272 uint8_t *p = NULL;
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
273 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
274 asf->pktbuf = NULL;
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
275 av_free(p);
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
276 }
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
277 av_freep(&asf->buf);
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
278 av_free(asf);
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
279 }
aa0edc246bca Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents: 4754
diff changeset
280
4754
c78617194786 Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents: 4746
diff changeset
281 #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
282 RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \
5113
75e51cba276e Use named initializers and use new/free_context() instead of extradata()
rbultje
parents: 5111
diff changeset
283 .enc_name = s, \
75e51cba276e Use named initializers and use new/free_context() instead of extradata()
rbultje
parents: 5111
diff changeset
284 .codec_type = t, \
75e51cba276e Use named initializers and use new/free_context() instead of extradata()
rbultje
parents: 5111
diff changeset
285 .codec_id = CODEC_ID_NONE, \
75e51cba276e Use named initializers and use new/free_context() instead of extradata()
rbultje
parents: 5111
diff changeset
286 .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
287 .open = asfrtp_new_context, \
75e51cba276e Use named initializers and use new/free_context() instead of extradata()
rbultje
parents: 5111
diff changeset
288 .close = asfrtp_free_context, \
75e51cba276e Use named initializers and use new/free_context() instead of extradata()
rbultje
parents: 5111
diff changeset
289 .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
290 };
c78617194786 Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents: 4746
diff changeset
291
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5726
diff changeset
292 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
293 RTP_ASF_HANDLER(asf_pfa, "x-asf-pf", AVMEDIA_TYPE_AUDIO);