Mercurial > libavformat.hg
annotate rtp_asf.c @ 5670:7fa188f69c22 libavformat
Rename RTSP_STATE_PLAYING to _STREAMING, since that better covers the
future use of the rtsp* codebase for RTSP muxing.
Patch by Martin Storsj <$firstname $firstname st>.
author | rbultje |
---|---|
date | Fri, 19 Feb 2010 16:26:21 +0000 |
parents | 6c380241df7c |
children |
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 /** |
4746 | 23 * @file libavformat/rtp_asf.c |
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 |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
28 #include <libavutil/base64.h> |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
29 #include <libavutil/avstring.h> |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
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" |
4744
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
32 #include "rtp_asf.h" |
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 |
4744
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
94 void ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
95 { |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
96 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
|
97 ByteIOContext pb; |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
98 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
|
99 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
|
100 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
|
101 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
|
102 |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
103 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
|
104 av_log(s, AV_LOG_ERROR, |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
105 "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
|
106 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
|
107 if (rt->asf_ctx) { |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
108 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
|
109 rt->asf_ctx = NULL; |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
110 } |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
111 av_open_input_stream(&rt->asf_ctx, &pb, "", &asf_demuxer, NULL); |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
112 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
|
113 av_free(buf); |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
114 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
|
115 } |
51899c07a4f1
Add RTP/ASF header parsing, which is part of the SDP of these streams. See
rbultje
parents:
diff
changeset
|
116 } |
4754
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
117 |
5114
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
118 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
|
119 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
|
120 { |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
121 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
|
122 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
|
123 |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
124 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
|
125 |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
126 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
|
127 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
|
128 |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
129 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
|
130 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
|
131 *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
|
132 *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
|
133 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
|
134 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
|
135 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
|
136 } |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
137 } |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
138 } |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
139 } |
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 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
|
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 |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
144 struct PayloadContext { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
145 ByteIOContext *pktbuf, pb; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
146 char *buf; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
147 }; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
148 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
149 /** |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
150 * @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
|
151 * 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
|
152 * <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
|
153 */ |
5114
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
154 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
|
155 AVStream *st, AVPacket *pkt, |
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
156 uint32_t *timestamp, |
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
157 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
|
158 { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
159 ByteIOContext *pb = &asf->pb; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
160 int res, mflags, len_off; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
161 RTSPState *rt = s->priv_data; |
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 if (!rt->asf_ctx) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
164 return -1; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
165 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
166 if (len > 0) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
167 int off, out_len; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
168 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
169 if (len < 4) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
170 return -1; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
171 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
172 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
|
173 mflags = get_byte(pb); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
174 if (mflags & 0x80) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
175 flags |= RTP_FLAG_KEY; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
176 len_off = get_be24(pb); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
177 if (mflags & 0x20) /**< relative timestamp */ |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
178 url_fskip(pb, 4); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
179 if (mflags & 0x10) /**< has duration */ |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
180 url_fskip(pb, 4); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
181 if (mflags & 0x8) /**< has location ID */ |
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 off = url_ftell(pb); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
184 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
185 av_freep(&asf->buf); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
186 if (!(mflags & 0x40)) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
187 /** |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
188 * 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
|
189 * 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
|
190 * 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
|
191 */ |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
192 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
|
193 uint8_t *p; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
194 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
|
195 asf->pktbuf = NULL; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
196 av_free(p); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
197 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
198 if (!len_off && !asf->pktbuf && |
5664 | 199 (res = url_open_dyn_buf(&asf->pktbuf)) < 0) |
5663 | 200 return res; |
5111
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
201 if (!asf->pktbuf) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
202 return AVERROR(EIO); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
203 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
204 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
|
205 if (!(flags & RTP_FLAG_MARKER)) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
206 return -1; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
207 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
|
208 asf->pktbuf = NULL; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
209 } else { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
210 /** |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
211 * 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
|
212 * 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
|
213 * 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
|
214 * 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
|
215 * one RTP packet). |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
216 */ |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
217 if (len_off != len) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
218 av_log_missing_feature(s, |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
219 "RTSP-MS packet splitting", 1); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
220 return -1; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
221 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
222 asf->buf = av_malloc(len - off); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
223 out_len = len - off; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
224 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
|
225 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
226 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
227 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
|
228 pb->pos += rt->asf_pb_pos; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
229 pb->eof_reached = 0; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
230 rt->asf_ctx->pb = pb; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
231 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
232 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
233 for (;;) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
234 int i; |
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 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
|
237 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
|
238 if (res != 0) |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
239 break; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
240 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
|
241 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
|
242 pkt->stream_index = i; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
243 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
|
244 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
245 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
246 av_free_packet(pkt); |
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 |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
249 return res == 1 ? -1 : res; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
250 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
251 |
5114
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
252 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
|
253 { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
254 return av_mallocz(sizeof(PayloadContext)); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
255 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
256 |
5114
51b1a9987537
Cosmetics: remove spaces between function name and arguments in declaration,
rbultje
parents:
5113
diff
changeset
|
257 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
|
258 { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
259 if (asf->pktbuf) { |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
260 uint8_t *p = NULL; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
261 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
|
262 asf->pktbuf = NULL; |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
263 av_free(p); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
264 } |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
265 av_freep(&asf->buf); |
aa0edc246bca
Implement RTSP-MS/ASF packet parsing - this completes RTSP-MS support. See
rbultje
parents:
4754
diff
changeset
|
266 av_free(asf); |
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 |
4754
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
269 #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
|
270 RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \ |
5113
75e51cba276e
Use named initializers and use new/free_context() instead of extradata()
rbultje
parents:
5111
diff
changeset
|
271 .enc_name = s, \ |
75e51cba276e
Use named initializers and use new/free_context() instead of extradata()
rbultje
parents:
5111
diff
changeset
|
272 .codec_type = t, \ |
75e51cba276e
Use named initializers and use new/free_context() instead of extradata()
rbultje
parents:
5111
diff
changeset
|
273 .codec_id = CODEC_ID_NONE, \ |
75e51cba276e
Use named initializers and use new/free_context() instead of extradata()
rbultje
parents:
5111
diff
changeset
|
274 .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
|
275 .open = asfrtp_new_context, \ |
75e51cba276e
Use named initializers and use new/free_context() instead of extradata()
rbultje
parents:
5111
diff
changeset
|
276 .close = asfrtp_free_context, \ |
75e51cba276e
Use named initializers and use new/free_context() instead of extradata()
rbultje
parents:
5111
diff
changeset
|
277 .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
|
278 }; |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
279 |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
280 RTP_ASF_HANDLER(asf_pfv, "x-asf-pf", CODEC_TYPE_VIDEO); |
c78617194786
Assign the x-pf-asf payload string to be decoded by rtp_asf.c, and add a
rbultje
parents:
4746
diff
changeset
|
281 RTP_ASF_HANDLER(asf_pfa, "x-asf-pf", CODEC_TYPE_AUDIO); |