annotate rtpdec_xiph.c @ 6347:e2834a83d6a8 libavformat

rtpdec_xiph: Split packets in the depacketizer The vorbis decoder doesn't handle more than one audio frame packed into the same AVPacket, so they need to be split in the depacketizer.
author mstorsjo
date Thu, 05 Aug 2010 04:42:36 +0000
parents a90f19fbad6f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
1 /*
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
2 * Xiph RTP Protocols
5921
f8d4cc91c798 Merge Vorbis / Theora depayloaders.
rbultje
parents: 5920
diff changeset
3 * Copyright (c) 2009 Colin McQuillian
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
4 * Copyright (c) 2010 Josh Allmann
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
5 *
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
6 * This file is part of FFmpeg.
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
7 *
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
12 *
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
16 * Lesser General Public License for more details.
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
17 *
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
21 */
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
22
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
23 /**
5969
178de7695c6c Remove explicit filename from Doxygen @file commands.
diego
parents: 5953
diff changeset
24 * @file
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
25 * @brief Xiph / RTP Code
5921
f8d4cc91c798 Merge Vorbis / Theora depayloaders.
rbultje
parents: 5920
diff changeset
26 * @author Colin McQuillan <m.niloc@gmail.com>
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
27 * @author Josh Allmann <joshua.allmann@gmail.com>
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
28 */
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
29
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
30 #include "libavutil/avstring.h"
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
31 #include "libavutil/base64.h"
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
32 #include "libavcodec/bytestream.h"
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
33
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
34 #include <assert.h>
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
35
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
36 #include "rtpdec.h"
6339
491eea5c52d6 Remove mostly unnecessary rtpdec_*.h files, store the declarations in one file
mstorsjo
parents: 6332
diff changeset
37 #include "rtpdec_formats.h"
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
38
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
39 /**
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
40 * RTP/Xiph specific private data.
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
41 */
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
42 struct PayloadContext {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
43 unsigned ident; ///< 24-bit stream configuration identifier
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
44 uint32_t timestamp;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
45 ByteIOContext* fragment; ///< buffer for split payloads
6347
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
46 uint8_t *split_buf;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
47 int split_pos, split_buf_len, split_buf_size;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
48 int split_pkts;
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
49 };
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
50
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
51 static PayloadContext *xiph_new_context(void)
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
52 {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
53 return av_mallocz(sizeof(PayloadContext));
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
54 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
55
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
56 static inline void free_fragment_if_needed(PayloadContext * data)
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
57 {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
58 if (data->fragment) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
59 uint8_t* p;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
60 url_close_dyn_buf(data->fragment, &p);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
61 av_free(p);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
62 data->fragment = NULL;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
63 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
64 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
65
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
66 static void xiph_free_context(PayloadContext * data)
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
67 {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
68 free_fragment_if_needed(data);
6347
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
69 av_free(data->split_buf);
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
70 av_free(data);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
71 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
72
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
73 static int xiph_handle_packet(AVFormatContext * ctx,
5920
c07680f39362 Reindent after r22766.
rbultje
parents: 5919
diff changeset
74 PayloadContext * data,
c07680f39362 Reindent after r22766.
rbultje
parents: 5919
diff changeset
75 AVStream * st,
c07680f39362 Reindent after r22766.
rbultje
parents: 5919
diff changeset
76 AVPacket * pkt,
c07680f39362 Reindent after r22766.
rbultje
parents: 5919
diff changeset
77 uint32_t * timestamp,
c07680f39362 Reindent after r22766.
rbultje
parents: 5919
diff changeset
78 const uint8_t * buf, int len, int flags)
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
79 {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
80
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
81 int ident, fragmented, tdt, num_pkts, pkt_len;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
82
6347
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
83 if (!buf) {
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
84 if (!data->split_buf || data->split_pos + 2 > data->split_buf_len ||
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
85 data->split_pkts <= 0) {
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
86 av_log(ctx, AV_LOG_ERROR, "No more data to return\n");
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
87 return AVERROR_INVALIDDATA;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
88 }
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
89 pkt_len = AV_RB16(data->split_buf + data->split_pos);
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
90 data->split_pos += 2;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
91 if (data->split_pos + pkt_len > data->split_buf_len) {
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
92 av_log(ctx, AV_LOG_ERROR, "Not enough data to return\n");
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
93 return AVERROR_INVALIDDATA;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
94 }
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
95 if (av_new_packet(pkt, pkt_len)) {
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
96 av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
97 return AVERROR(ENOMEM);
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
98 }
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
99 pkt->stream_index = st->index;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
100 memcpy(pkt->data, data->split_buf + data->split_pos, pkt_len);
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
101 data->split_pos += pkt_len;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
102 data->split_pkts--;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
103 return data->split_pkts > 0;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
104 }
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
105
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
106 if (len < 6) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
107 av_log(ctx, AV_LOG_ERROR, "Invalid %d byte packet\n", len);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
108 return AVERROR_INVALIDDATA;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
109 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
110
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
111 // read xiph rtp headers
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
112 ident = AV_RB24(buf);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
113 fragmented = buf[3] >> 6;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
114 tdt = (buf[3] >> 4) & 3;
6343
a90f19fbad6f rtpdec_xiph: Correct the bitmask for num_pkts
mstorsjo
parents: 6339
diff changeset
115 num_pkts = buf[3] & 0xf;
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
116 pkt_len = AV_RB16(buf + 4);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
117
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
118 if (pkt_len > len - 6) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
119 av_log(ctx, AV_LOG_ERROR,
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
120 "Invalid packet length %d in %d byte packet\n", pkt_len,
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
121 len);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
122 return AVERROR_INVALIDDATA;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
123 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
124
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
125 if (ident != data->ident) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
126 av_log(ctx, AV_LOG_ERROR,
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
127 "Unimplemented Xiph SDP configuration change detected\n");
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
128 return AVERROR_PATCHWELCOME;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
129 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
130
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
131 if (tdt) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
132 av_log(ctx, AV_LOG_ERROR,
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
133 "Unimplemented RTP Xiph packet settings (%d,%d,%d)\n",
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
134 fragmented, tdt, num_pkts);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
135 return AVERROR_PATCHWELCOME;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
136 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
137
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
138 buf += 6; // move past header bits
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
139 len -= 6;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
140
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
141 if (fragmented == 0) {
6347
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
142 if (av_new_packet(pkt, pkt_len)) {
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
143 av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
5930
08cd1179a20d Replace all remaining occurrences of AVERROR_NOMEM with
stefano
parents: 5922
diff changeset
144 return AVERROR(ENOMEM);
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
145 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
146 pkt->stream_index = st->index;
6347
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
147 memcpy(pkt->data, buf, pkt_len);
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
148 buf += pkt_len;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
149 len -= pkt_len;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
150 num_pkts--;
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
151
6347
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
152 if (num_pkts > 0) {
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
153 if (len > data->split_buf_size || !data->split_buf) {
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
154 av_freep(&data->split_buf);
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
155 data->split_buf_size = 2 * len;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
156 data->split_buf = av_malloc(data->split_buf_size);
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
157 if (!data->split_buf) {
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
158 av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
159 av_free_packet(pkt);
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
160 return AVERROR(ENOMEM);
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
161 }
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
162 }
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
163 memcpy(data->split_buf, buf, len);
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
164 data->split_buf_len = len;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
165 data->split_pos = 0;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
166 data->split_pkts = num_pkts;
e2834a83d6a8 rtpdec_xiph: Split packets in the depacketizer
mstorsjo
parents: 6343
diff changeset
167 return 1;
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
168 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
169
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
170 return 0;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
171
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
172 } else if (fragmented == 1) {
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
173 // start of xiph data fragment
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
174 int res;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
175
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
176 // end packet has been lost somewhere, so drop buffered data
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
177 free_fragment_if_needed(data);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
178
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
179 if((res = url_open_dyn_buf(&data->fragment)) < 0)
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
180 return res;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
181
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
182 put_buffer(data->fragment, buf, pkt_len);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
183 data->timestamp = *timestamp;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
184
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
185 } else {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
186 assert(fragmented < 4);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
187 if (data->timestamp != *timestamp) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
188 // skip if fragmented timestamp is incorrect;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
189 // a start packet has been lost somewhere
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
190 free_fragment_if_needed(data);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
191 av_log(ctx, AV_LOG_ERROR, "RTP timestamps don't match!\n");
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
192 return AVERROR_INVALIDDATA;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
193 }
6322
408722fc3bf1 rtpdec_xiph: Drop RTP packets that come in without a prior fragment start marker.
mstorsjo
parents: 6280
diff changeset
194 if (!data->fragment) {
408722fc3bf1 rtpdec_xiph: Drop RTP packets that come in without a prior fragment start marker.
mstorsjo
parents: 6280
diff changeset
195 av_log(ctx, AV_LOG_WARNING,
408722fc3bf1 rtpdec_xiph: Drop RTP packets that come in without a prior fragment start marker.
mstorsjo
parents: 6280
diff changeset
196 "Received packet without a start fragment; dropping.\n");
408722fc3bf1 rtpdec_xiph: Drop RTP packets that come in without a prior fragment start marker.
mstorsjo
parents: 6280
diff changeset
197 return AVERROR(EAGAIN);
408722fc3bf1 rtpdec_xiph: Drop RTP packets that come in without a prior fragment start marker.
mstorsjo
parents: 6280
diff changeset
198 }
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
199
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
200 // copy data to fragment buffer
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
201 put_buffer(data->fragment, buf, pkt_len);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
202
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
203 if (fragmented == 3) {
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
204 // end of xiph data packet
6280
eec2da728944 rtpdec_xiph: Avoid extra memcpy in Xiph RTP depacketizer
mstorsjo
parents: 6194
diff changeset
205 av_init_packet(pkt);
eec2da728944 rtpdec_xiph: Avoid extra memcpy in Xiph RTP depacketizer
mstorsjo
parents: 6194
diff changeset
206 pkt->size = url_close_dyn_buf(data->fragment, &pkt->data);
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
207
6280
eec2da728944 rtpdec_xiph: Avoid extra memcpy in Xiph RTP depacketizer
mstorsjo
parents: 6194
diff changeset
208 if (pkt->size < 0) {
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
209 av_log(ctx, AV_LOG_ERROR,
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
210 "Error occurred when getting fragment buffer.");
6280
eec2da728944 rtpdec_xiph: Avoid extra memcpy in Xiph RTP depacketizer
mstorsjo
parents: 6194
diff changeset
211 return pkt->size;
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
212 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
213
6280
eec2da728944 rtpdec_xiph: Avoid extra memcpy in Xiph RTP depacketizer
mstorsjo
parents: 6194
diff changeset
214 pkt->stream_index = st->index;
eec2da728944 rtpdec_xiph: Avoid extra memcpy in Xiph RTP depacketizer
mstorsjo
parents: 6194
diff changeset
215 pkt->destruct = av_destruct_packet;
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
216
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
217 data->fragment = NULL;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
218
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
219 return 0;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
220 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
221 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
222
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
223 return AVERROR(EAGAIN);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
224 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
225
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
226 /**
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
227 * Length encoding described in RFC5215 section 3.1.1.
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
228 */
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
229 static int get_base128(const uint8_t ** buf, const uint8_t * buf_end)
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
230 {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
231 int n = 0;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
232 for (; *buf < buf_end; ++*buf) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
233 n <<= 7;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
234 n += **buf & 0x7f;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
235 if (!(**buf & 0x80)) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
236 ++*buf;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
237 return n;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
238 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
239 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
240 return 0;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
241 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
242
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
243 /**
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
244 * Based off parse_packed_headers in Vorbis RTP
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
245 */
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
246 static unsigned int
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
247 parse_packed_headers(const uint8_t * packed_headers,
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
248 const uint8_t * packed_headers_end,
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
249 AVCodecContext * codec, PayloadContext * xiph_data)
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
250 {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
251
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
252 unsigned num_packed, num_headers, length, length1, length2, extradata_alloc;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
253 uint8_t *ptr;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
254
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
255 if (packed_headers_end - packed_headers < 9) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
256 av_log(codec, AV_LOG_ERROR,
6116
49eedb93140e Fix printf format warnings
siretart
parents: 5969
diff changeset
257 "Invalid %td byte packed header.",
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
258 packed_headers_end - packed_headers);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
259 return AVERROR_INVALIDDATA;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
260 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
261
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
262 num_packed = bytestream_get_be32(&packed_headers);
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
263 xiph_data->ident = bytestream_get_be24(&packed_headers);
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
264 length = bytestream_get_be16(&packed_headers);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
265 num_headers = get_base128(&packed_headers, packed_headers_end);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
266 length1 = get_base128(&packed_headers, packed_headers_end);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
267 length2 = get_base128(&packed_headers, packed_headers_end);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
268
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
269 if (num_packed != 1 || num_headers > 3) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
270 av_log(codec, AV_LOG_ERROR,
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
271 "Unimplemented number of headers: %d packed headers, %d headers\n",
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
272 num_packed, num_headers);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
273 return AVERROR_PATCHWELCOME;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
274 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
275
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
276 if (packed_headers_end - packed_headers != length ||
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
277 length1 > length || length2 > length - length1) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
278 av_log(codec, AV_LOG_ERROR,
6116
49eedb93140e Fix printf format warnings
siretart
parents: 5969
diff changeset
279 "Bad packed header lengths (%d,%d,%td,%d)\n", length1,
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
280 length2, packed_headers_end - packed_headers, length);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
281 return AVERROR_INVALIDDATA;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
282 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
283
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
284 /* allocate extra space:
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
285 * -- length/255 +2 for xiphlacing
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
286 * -- one for the '2' marker
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
287 * -- FF_INPUT_BUFFER_PADDING_SIZE required */
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
288 extradata_alloc = length + length/255 + 3 + FF_INPUT_BUFFER_PADDING_SIZE;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
289
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
290 ptr = codec->extradata = av_malloc(extradata_alloc);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
291 if (!ptr) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
292 av_log(codec, AV_LOG_ERROR, "Out of memory\n");
5930
08cd1179a20d Replace all remaining occurrences of AVERROR_NOMEM with
stefano
parents: 5922
diff changeset
293 return AVERROR(ENOMEM);
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
294 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
295 *ptr++ = 2;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
296 ptr += av_xiphlacing(ptr, length1);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
297 ptr += av_xiphlacing(ptr, length2);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
298 memcpy(ptr, packed_headers, length);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
299 ptr += length;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
300 codec->extradata_size = ptr - codec->extradata;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
301 // clear out remaining parts of the buffer
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
302 memset(ptr, 0, extradata_alloc - codec->extradata_size);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
303
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
304 return 0;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
305 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
306
6194
6c03f060caad rtpdec: Cleanup FMTP parsing code in Xiph RTP depacketizer
mstorsjo
parents: 6116
diff changeset
307 static int xiph_parse_fmtp_pair(AVStream* stream,
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
308 PayloadContext *xiph_data,
5920
c07680f39362 Reindent after r22766.
rbultje
parents: 5919
diff changeset
309 char *attr, char *value)
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
310 {
6194
6c03f060caad rtpdec: Cleanup FMTP parsing code in Xiph RTP depacketizer
mstorsjo
parents: 6116
diff changeset
311 AVCodecContext *codec = stream->codec;
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
312 int result = 0;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
313
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
314 if (!strcmp(attr, "sampling")) {
6332
2f14ee83c673 rtpdec_xiph: Handle the sampling SDP parameter
mstorsjo
parents: 6322
diff changeset
315 if (!strcmp(value, "YCbCr-4:2:0")) {
2f14ee83c673 rtpdec_xiph: Handle the sampling SDP parameter
mstorsjo
parents: 6322
diff changeset
316 codec->pix_fmt = PIX_FMT_YUV420P;
2f14ee83c673 rtpdec_xiph: Handle the sampling SDP parameter
mstorsjo
parents: 6322
diff changeset
317 } else if (!strcmp(value, "YCbCr-4:4:2")) {
2f14ee83c673 rtpdec_xiph: Handle the sampling SDP parameter
mstorsjo
parents: 6322
diff changeset
318 codec->pix_fmt = PIX_FMT_YUV422P;
2f14ee83c673 rtpdec_xiph: Handle the sampling SDP parameter
mstorsjo
parents: 6322
diff changeset
319 } else if (!strcmp(value, "YCbCr-4:4:4")) {
2f14ee83c673 rtpdec_xiph: Handle the sampling SDP parameter
mstorsjo
parents: 6322
diff changeset
320 codec->pix_fmt = PIX_FMT_YUV444P;
2f14ee83c673 rtpdec_xiph: Handle the sampling SDP parameter
mstorsjo
parents: 6322
diff changeset
321 } else {
2f14ee83c673 rtpdec_xiph: Handle the sampling SDP parameter
mstorsjo
parents: 6322
diff changeset
322 av_log(codec, AV_LOG_ERROR,
2f14ee83c673 rtpdec_xiph: Handle the sampling SDP parameter
mstorsjo
parents: 6322
diff changeset
323 "Unsupported pixel format %s\n", attr);
2f14ee83c673 rtpdec_xiph: Handle the sampling SDP parameter
mstorsjo
parents: 6322
diff changeset
324 return AVERROR_INVALIDDATA;
2f14ee83c673 rtpdec_xiph: Handle the sampling SDP parameter
mstorsjo
parents: 6322
diff changeset
325 }
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
326 } else if (!strcmp(attr, "width")) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
327 /* This is an integer between 1 and 1048561
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
328 * and MUST be in multiples of 16. */
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
329 codec->width = atoi(value);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
330 return 0;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
331 } else if (!strcmp(attr, "height")) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
332 /* This is an integer between 1 and 1048561
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
333 * and MUST be in multiples of 16. */
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
334 codec->height = atoi(value);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
335 return 0;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
336 } else if (!strcmp(attr, "delivery-method")) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
337 /* Possible values are: inline, in_band, out_band/specific_name. */
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
338 return AVERROR_PATCHWELCOME;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
339 } else if (!strcmp(attr, "configuration-uri")) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
340 /* NOTE: configuration-uri is supported only under 2 conditions:
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
341 *--after the delivery-method tag
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
342 * --with a delivery-method value of out_band */
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
343 return AVERROR_PATCHWELCOME;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
344 } else if (!strcmp(attr, "configuration")) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
345 /* NOTE: configuration is supported only AFTER the delivery-method tag
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
346 * The configuration value is a base64 encoded packed header */
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
347 uint8_t *decoded_packet = NULL;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
348 int packet_size;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
349 size_t decoded_alloc = strlen(value) / 4 * 3 + 4;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
350
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
351 if (decoded_alloc <= INT_MAX) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
352 decoded_packet = av_malloc(decoded_alloc);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
353 if (decoded_packet) {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
354 packet_size =
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
355 av_base64_decode(decoded_packet, value, decoded_alloc);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
356
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
357 result = parse_packed_headers
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
358 (decoded_packet, decoded_packet + packet_size, codec,
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
359 xiph_data);
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
360 } else {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
361 av_log(codec, AV_LOG_ERROR,
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
362 "Out of memory while decoding SDP configuration.\n");
5930
08cd1179a20d Replace all remaining occurrences of AVERROR_NOMEM with
stefano
parents: 5922
diff changeset
363 result = AVERROR(ENOMEM);
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
364 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
365 } else {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
366 av_log(codec, AV_LOG_ERROR, "Packet too large\n");
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
367 result = AVERROR_INVALIDDATA;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
368 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
369 av_free(decoded_packet);
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
370 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
371 return result;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
372 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
373
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
374 static int xiph_parse_sdp_line(AVFormatContext *s, int st_index,
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
375 PayloadContext *data, const char *line)
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
376 {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
377 const char *p;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
378
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
379 if (av_strstart(line, "fmtp:", &p)) {
6194
6c03f060caad rtpdec: Cleanup FMTP parsing code in Xiph RTP depacketizer
mstorsjo
parents: 6116
diff changeset
380 return ff_parse_fmtp(s->streams[st_index], data, p,
6c03f060caad rtpdec: Cleanup FMTP parsing code in Xiph RTP depacketizer
mstorsjo
parents: 6116
diff changeset
381 xiph_parse_fmtp_pair);
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
382 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
383
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
384 return 0;
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
385 }
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
386
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
387 RTPDynamicProtocolHandler ff_theora_dynamic_handler = {
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
388 .enc_name = "theora",
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
389 .codec_type = AVMEDIA_TYPE_VIDEO,
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
390 .codec_id = CODEC_ID_THEORA,
5919
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
391 .parse_sdp_a_line = xiph_parse_sdp_line,
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
392 .open = xiph_new_context,
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
393 .close = xiph_free_context,
abd4e9638613 Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents: 5918
diff changeset
394 .parse_packet = xiph_handle_packet
5918
e3b4d7181606 Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff changeset
395 };
5921
f8d4cc91c798 Merge Vorbis / Theora depayloaders.
rbultje
parents: 5920
diff changeset
396
f8d4cc91c798 Merge Vorbis / Theora depayloaders.
rbultje
parents: 5920
diff changeset
397 RTPDynamicProtocolHandler ff_vorbis_dynamic_handler = {
f8d4cc91c798 Merge Vorbis / Theora depayloaders.
rbultje
parents: 5920
diff changeset
398 .enc_name = "vorbis",
5922
1141ba6decd2 Change a case of CODEC_TYPE_ into AVMEDIA_TYPE_
mstorsjo
parents: 5921
diff changeset
399 .codec_type = AVMEDIA_TYPE_AUDIO,
5921
f8d4cc91c798 Merge Vorbis / Theora depayloaders.
rbultje
parents: 5920
diff changeset
400 .codec_id = CODEC_ID_VORBIS,
f8d4cc91c798 Merge Vorbis / Theora depayloaders.
rbultje
parents: 5920
diff changeset
401 .parse_sdp_a_line = xiph_parse_sdp_line,
f8d4cc91c798 Merge Vorbis / Theora depayloaders.
rbultje
parents: 5920
diff changeset
402 .open = xiph_new_context,
f8d4cc91c798 Merge Vorbis / Theora depayloaders.
rbultje
parents: 5920
diff changeset
403 .close = xiph_free_context,
f8d4cc91c798 Merge Vorbis / Theora depayloaders.
rbultje
parents: 5920
diff changeset
404 .parse_packet = xiph_handle_packet
f8d4cc91c798 Merge Vorbis / Theora depayloaders.
rbultje
parents: 5920
diff changeset
405 };