Mercurial > libavformat.hg
annotate rtpdec_xiph.c @ 5953:c3ebc8d7af38 libavformat
Remove useless assert(), since this can (in theora) be used for any Xiph
codec, so there's no reason to (invalidly) limit it to only Theora.
Also fixes issue 1880 (compilation error on -DDEBUG).
| author | rbultje |
|---|---|
| date | Thu, 15 Apr 2010 13:30:12 +0000 |
| parents | 08cd1179a20d |
| children | 178de7695c6c |
| 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 | 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 /** |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
24 * @file libavformat/rtpdec_xiph.c |
|
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
25 * @brief Xiph / RTP Code |
| 5921 | 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" |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
37 #include "rtpdec_xiph.h" |
|
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 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
46 }; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
47 |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
48 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
|
49 { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
50 return av_mallocz(sizeof(PayloadContext)); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
51 } |
|
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 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
|
54 { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
55 if (data->fragment) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
56 uint8_t* p; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
57 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
|
58 av_free(p); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
59 data->fragment = NULL; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
60 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
61 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
62 |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
63 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
|
64 { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
65 free_fragment_if_needed(data); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
66 av_free(data); |
|
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 |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
69 static int xiph_handle_packet(AVFormatContext * ctx, |
| 5920 | 70 PayloadContext * data, |
| 71 AVStream * st, | |
| 72 AVPacket * pkt, | |
| 73 uint32_t * timestamp, | |
| 74 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
|
75 { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
76 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
77 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
|
78 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
79 if (len < 6) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
80 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
|
81 return AVERROR_INVALIDDATA; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
82 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
83 |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
84 // read xiph rtp headers |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
85 ident = AV_RB24(buf); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
86 fragmented = buf[3] >> 6; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
87 tdt = (buf[3] >> 4) & 3; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
88 num_pkts = buf[3] & 7; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
89 pkt_len = AV_RB16(buf + 4); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
90 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
91 if (pkt_len > len - 6) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
92 av_log(ctx, AV_LOG_ERROR, |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
93 "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
|
94 len); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
95 return AVERROR_INVALIDDATA; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
96 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
97 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
98 if (ident != data->ident) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
99 av_log(ctx, AV_LOG_ERROR, |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
100 "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
|
101 return AVERROR_PATCHWELCOME; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
102 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
103 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
104 if (tdt) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
105 av_log(ctx, AV_LOG_ERROR, |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
106 "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
|
107 fragmented, tdt, num_pkts); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
108 return AVERROR_PATCHWELCOME; |
|
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 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
111 buf += 6; // move past header bits |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
112 len -= 6; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
113 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
114 if (fragmented == 0) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
115 // whole frame(s) |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
116 int i, data_len, write_len; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
117 buf -= 2; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
118 len += 2; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
119 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
120 // fast first pass to calculate total length |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
121 for (i = 0, data_len = 0; (i < num_pkts) && (len >= 2); i++) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
122 int off = data_len + (i << 1); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
123 pkt_len = AV_RB16(buf + off); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
124 data_len += pkt_len; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
125 len -= pkt_len + 2; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
126 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
127 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
128 if (len < 0 || i < num_pkts) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
129 av_log(ctx, AV_LOG_ERROR, |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
130 "Bad packet: %d bytes left at frame %d of %d\n", |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
131 len, i, num_pkts); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
132 return AVERROR_INVALIDDATA; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
133 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
134 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
135 if (av_new_packet(pkt, data_len)) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
136 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
|
137 return AVERROR(ENOMEM); |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
138 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
139 pkt->stream_index = st->index; |
|
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 // concatenate frames |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
142 for (i = 0, write_len = 0; write_len < data_len; i++) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
143 pkt_len = AV_RB16(buf); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
144 buf += 2; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
145 memcpy(pkt->data + write_len, buf, pkt_len); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
146 write_len += pkt_len; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
147 buf += pkt_len; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
148 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
149 assert(write_len == data_len); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
150 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
151 return 0; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
152 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
153 } else if (fragmented == 1) { |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
154 // start of xiph data fragment |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
155 int res; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
156 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
157 // 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
|
158 free_fragment_if_needed(data); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
159 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
160 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
|
161 return res; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
162 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
163 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
|
164 data->timestamp = *timestamp; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
165 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
166 } else { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
167 assert(fragmented < 4); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
168 if (data->timestamp != *timestamp) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
169 // skip if fragmented timestamp is incorrect; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
170 // 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
|
171 free_fragment_if_needed(data); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
172 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
|
173 return AVERROR_INVALIDDATA; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
174 } |
|
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 // copy data to fragment buffer |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
177 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
|
178 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
179 if (fragmented == 3) { |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
180 // end of xiph data packet |
|
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
181 uint8_t* xiph_data; |
|
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
182 int frame_size = url_close_dyn_buf(data->fragment, &xiph_data); |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
183 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
184 if (frame_size < 0) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
185 av_log(ctx, AV_LOG_ERROR, |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
186 "Error occurred when getting fragment buffer."); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
187 return frame_size; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
188 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
189 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
190 if (av_new_packet(pkt, frame_size)) { |
|
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, "Out of memory.\n"); |
|
5930
08cd1179a20d
Replace all remaining occurrences of AVERROR_NOMEM with
stefano
parents:
5922
diff
changeset
|
192 return AVERROR(ENOMEM); |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
193 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
194 |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
195 memcpy(pkt->data, xiph_data, frame_size); |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
196 pkt->stream_index = st->index; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
197 |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
198 av_free(xiph_data); |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
199 data->fragment = NULL; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
200 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
201 return 0; |
|
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 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
204 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
205 return AVERROR(EAGAIN); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
206 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
207 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
208 /** |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
209 * 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
|
210 */ |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
211 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
|
212 { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
213 int n = 0; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
214 for (; *buf < buf_end; ++*buf) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
215 n <<= 7; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
216 n += **buf & 0x7f; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
217 if (!(**buf & 0x80)) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
218 ++*buf; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
219 return n; |
|
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 return 0; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
223 } |
|
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 * 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
|
227 */ |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
228 static unsigned int |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
229 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
|
230 const uint8_t * packed_headers_end, |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
231 AVCodecContext * codec, PayloadContext * xiph_data) |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
232 { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
233 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
234 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
|
235 uint8_t *ptr; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
236 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
237 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
|
238 av_log(codec, AV_LOG_ERROR, |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
239 "Invalid %d byte packed header.", |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
240 packed_headers_end - packed_headers); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
241 return AVERROR_INVALIDDATA; |
|
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 num_packed = bytestream_get_be32(&packed_headers); |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
245 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
|
246 length = bytestream_get_be16(&packed_headers); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
247 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
|
248 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
|
249 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
|
250 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
251 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
|
252 av_log(codec, AV_LOG_ERROR, |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
253 "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
|
254 num_packed, num_headers); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
255 return AVERROR_PATCHWELCOME; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
256 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
257 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
258 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
|
259 length1 > length || length2 > length - length1) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
260 av_log(codec, AV_LOG_ERROR, |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
261 "Bad packed header lengths (%d,%d,%d,%d)\n", length1, |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
262 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
|
263 return AVERROR_INVALIDDATA; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
264 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
265 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
266 /* allocate extra space: |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
267 * -- length/255 +2 for xiphlacing |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
268 * -- one for the '2' marker |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
269 * -- FF_INPUT_BUFFER_PADDING_SIZE required */ |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
270 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
|
271 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
272 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
|
273 if (!ptr) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
274 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
|
275 return AVERROR(ENOMEM); |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
276 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
277 *ptr++ = 2; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
278 ptr += av_xiphlacing(ptr, length1); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
279 ptr += av_xiphlacing(ptr, length2); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
280 memcpy(ptr, packed_headers, length); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
281 ptr += length; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
282 codec->extradata_size = ptr - codec->extradata; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
283 // 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
|
284 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
|
285 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
286 return 0; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
287 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
288 |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
289 static int xiph_parse_fmtp_pair(AVCodecContext * codec, |
|
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
290 PayloadContext *xiph_data, |
| 5920 | 291 char *attr, char *value) |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
292 { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
293 int result = 0; |
|
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 if (!strcmp(attr, "sampling")) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
296 return AVERROR_PATCHWELCOME; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
297 } else if (!strcmp(attr, "width")) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
298 /* 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
|
299 * 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
|
300 codec->width = atoi(value); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
301 return 0; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
302 } else if (!strcmp(attr, "height")) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
303 /* 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
|
304 * 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
|
305 codec->height = atoi(value); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
306 return 0; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
307 } else if (!strcmp(attr, "delivery-method")) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
308 /* 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
|
309 return AVERROR_PATCHWELCOME; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
310 } else if (!strcmp(attr, "configuration-uri")) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
311 /* 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
|
312 *--after the delivery-method tag |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
313 * --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
|
314 return AVERROR_PATCHWELCOME; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
315 } else if (!strcmp(attr, "configuration")) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
316 /* 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
|
317 * 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
|
318 uint8_t *decoded_packet = NULL; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
319 int packet_size; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
320 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
|
321 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
322 if (decoded_alloc <= INT_MAX) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
323 decoded_packet = av_malloc(decoded_alloc); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
324 if (decoded_packet) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
325 packet_size = |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
326 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
|
327 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
328 result = parse_packed_headers |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
329 (decoded_packet, decoded_packet + packet_size, codec, |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
330 xiph_data); |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
331 } else { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
332 av_log(codec, AV_LOG_ERROR, |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
333 "Out of memory while decoding SDP configuration.\n"); |
|
5930
08cd1179a20d
Replace all remaining occurrences of AVERROR_NOMEM with
stefano
parents:
5922
diff
changeset
|
334 result = AVERROR(ENOMEM); |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
335 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
336 } else { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
337 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
|
338 result = AVERROR_INVALIDDATA; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
339 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
340 av_free(decoded_packet); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
341 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
342 return result; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
343 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
344 |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
345 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
|
346 PayloadContext *data, const char *line) |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
347 { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
348 const char *p; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
349 char *value; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
350 char attr[25]; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
351 int value_size = strlen(line), attr_size = sizeof(attr), res = 0; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
352 AVCodecContext* codec = s->streams[st_index]->codec; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
353 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
354 assert(data); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
355 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
356 if (!(value = av_malloc(value_size))) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
357 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
|
358 return AVERROR(ENOMEM); |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
359 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
360 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
361 if (av_strstart(line, "fmtp:", &p)) { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
362 // remove protocol identifier |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
363 while (*p && *p == ' ') p++; // strip spaces |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
364 while (*p && *p != ' ') p++; // eat protocol identifier |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
365 while (*p && *p == ' ') p++; // strip trailing spaces |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
366 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
367 while (ff_rtsp_next_attr_and_value(&p, |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
368 attr, attr_size, |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
369 value, value_size)) { |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
370 res = xiph_parse_fmtp_pair(codec, data, attr, value); |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
371 if (res < 0 && res != AVERROR_PATCHWELCOME) |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
372 return res; |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
373 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
374 } |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
375 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
376 av_free(value); |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
377 return 0; |
|
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 |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
380 RTPDynamicProtocolHandler ff_theora_dynamic_handler = { |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
381 .enc_name = "theora", |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
382 .codec_type = AVMEDIA_TYPE_VIDEO, |
|
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
383 .codec_id = CODEC_ID_THEORA, |
|
5919
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
384 .parse_sdp_a_line = xiph_parse_sdp_line, |
|
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
385 .open = xiph_new_context, |
|
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
386 .close = xiph_free_context, |
|
abd4e9638613
Rename functions / comments from "Theora" to "Xiph" where relevant.
rbultje
parents:
5918
diff
changeset
|
387 .parse_packet = xiph_handle_packet |
|
5918
e3b4d7181606
Rename rtpdec_theora.[ch] to rtpdec_xiph.[ch], as a preparation for merging
rbultje
parents:
diff
changeset
|
388 }; |
| 5921 | 389 |
| 390 RTPDynamicProtocolHandler ff_vorbis_dynamic_handler = { | |
| 391 .enc_name = "vorbis", | |
| 5922 | 392 .codec_type = AVMEDIA_TYPE_AUDIO, |
| 5921 | 393 .codec_id = CODEC_ID_VORBIS, |
| 394 .parse_sdp_a_line = xiph_parse_sdp_line, | |
| 395 .open = xiph_new_context, | |
| 396 .close = xiph_free_context, | |
| 397 .parse_packet = xiph_handle_packet | |
| 398 }; |
