FFmpeg: libavformat/rtpdec_latm.c Source File
Go to the documentation of this file. 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
43 const uint8_t *buf,
int len, uint16_t seq,
45 {
47
48 if (buf) {
49 if (!
data->dyn_buf ||
data->timestamp != *timestamp) {
52
53 data->timestamp = *timestamp;
56 }
58
65 }
66
70 }
71
72 cur_len = 0;
77 break;
78 }
79 if (
data->pos + cur_len >
data->len) {
82 }
83
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 */
107 audio_mux_version =
get_bits(&gb, 1);
108 same_time_framing =
get_bits(&gb, 1);
112 if (audio_mux_version != 0 || same_time_framing != 1 || num_programs != 0 ||
113 num_layers != 0) {
115 audio_mux_version, same_time_framing,
116 num_programs, num_layers);
118 goto end;
119 }
122 goto end;
123 }
126
127 end:
130 }
131
134 const char *attr,
const char *
value)
135 {
136 int res;
137
138 if (!strcmp(attr, "config")) {
140 if (res < 0)
141 return res;
142 } else if (!strcmp(attr, "cpresent")) {
143 int cpresent = atoi(
value);
144 if (cpresent != 0)
146 "RTP MP4A-LATM with in-band configuration");
147 }
148
149 return 0;
150 }
151
154 {
155 const char *p;
156
157 if (st_index < 0)
158 return 0;
159
162
163 return 0;
164 }
165
174 };
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
static int get_bits_left(GetBitContext *gb)
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static int parse_fmtp(AVFormatContext *s, AVStream *stream, PayloadContext *data, const char *attr, const char *value)
int ff_parse_fmtp(AVFormatContext *s, AVStream *stream, PayloadContext *data, const char *p, int(*parse_fmtp)(AVFormatContext *s, AVStream *stream, PayloadContext *data, const char *attr, const char *value))
#define RTP_FLAG_MARKER
RTP marker bit was set for this packet.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
uint32_t timestamp
current frame timestamp
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int parse_fmtp_config(AVStream *st, const char *value)
static double val(void *priv, double ch)
static int latm_parse_sdp_line(AVFormatContext *s, int st_index, PayloadContext *data, const char *line)
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
static void latm_close_context(PayloadContext *data)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
const RTPDynamicProtocolHandler ff_mp4a_latm_dynamic_handler
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int extradata_size
Size of the extradata content in bytes.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
#define i(width, name, range_min, range_max)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
#define AV_INPUT_BUFFER_PADDING_SIZE
uint8_t * buf
the temporary storage buffer
int index
stream index in AVFormatContext
static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index, int flush)
Parse a packet, add all split parts to parse_queue.
#define avpriv_request_sample(...)
static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags)
This structure stores compressed data.
#define flags(name, subs,...)
RTP/JPEG specific private data.
Generated on Wed Aug 24 2022 21:42:19 for FFmpeg by
doxygen
1.8.17