1 /*
2 * RTP Depacketization of MP4A-LATM, RFC 3016
3 * Copyright (c) 2010 Martin Storsjo
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
27
33 };
34
36 {
39 }
40
45 {
47
48 if (buf) {
52
56 }
58
65 }
66
70 }
71
72 cur_len = 0;
73 while (data->
pos < data->
len) {
76 if (val != 0xff)
77 break;
78 }
79 if (data->
pos + cur_len > data->
len) {
82 }
83
86 memcpy(pkt->
data, data->
buf + data->
pos, cur_len);
89 return data->
pos < data->
len;
90 }
91
93 {
97 int audio_mux_version, same_time_framing, num_programs, num_layers;
98
99 /* Pad this buffer, too, to avoid out of bounds reads with get_bits below */
101 if (!config)
105 audio_mux_version =
get_bits(&gb, 1);
106 same_time_framing =
get_bits(&gb, 1);
110 if (audio_mux_version != 0 || same_time_framing != 1 || num_programs != 0 ||
111 num_layers != 0) {
113 audio_mux_version, same_time_framing,
114 num_programs, num_layers);
117 }
122 }
125
129 }
130
133 const char *attr,
const char *
value)
134 {
135 int res;
136
137 if (!strcmp(attr, "config")) {
139 if (res < 0)
140 return res;
141 } else if (!strcmp(attr, "cpresent")) {
142 int cpresent = atoi(value);
143 if (cpresent != 0)
145 "RTP MP4A-LATM with in-band configuration");
146 }
147
148 return 0;
149 }
150
153 {
154 const char *p;
155
156 if (st_index < 0)
157 return 0;
158
161
162 return 0;
163 }
164
173 };