Go to the documentation of this file.
35 #include "config_components.h"
48 if (srate_hz != 8000 && srate_hz != 16000 && srate_hz != 24000 &&
49 srate_hz != 32000 && srate_hz != 48000 && srate_hz != 96000) {
52 "Invalid LC3 sample rate: %d Hz.\n", srate_hz);
56 if (frame_us != 2500 && frame_us != 5000 &&
57 frame_us != 7500 && frame_us != 10000) {
60 "Invalid LC3 frame duration: %.1f ms.\n", frame_us / 1000.
f);
67 #if CONFIG_LC3_DEMUXER
69 typedef struct LC3DemuxContext {
76 int frame_us, srate_hz;
95 LC3DemuxContext *lc3 =
s->priv_data;
97 uint16_t
tag, hdr_size;
99 int srate_hz, frame_us,
channels, bit_rate;
100 int ep_mode, hr_mode;
101 int num_extra_params;
107 if (
tag != 0x1ccc || hdr_size < 9 *
sizeof(uint16_t))
110 num_extra_params = hdr_size /
sizeof(uint16_t) - 9;
118 hr_mode = num_extra_params >= 1 &&
avio_rl16(
s->pb);
144 lc3->frame_samples =
av_rescale(frame_us, srate_hz, 1000*1000);
146 delay =
av_rescale(frame_us == 7500 ? 4000 : 2500, srate_hz, 1000*1000);
147 lc3->end_dts = length ? length + delay : -1;
154 LC3DemuxContext *lc3 =
s->priv_data;
167 remaining_samples = lc3->end_dts < 0 ? lc3->frame_samples :
177 .p.extensions =
"lc3",
179 .priv_data_size =
sizeof(LC3DemuxContext),
195 int frame_us, ep_mode, hr_mode;
210 avio_wl16(
s->pb, (9 + hr_mode) *
sizeof(uint16_t));
233 .p.extensions =
"lc3",
240 .write_header = lc3_write_header,
241 .write_packet = lc3_write_packet,
static int frame_samples(const SyncQueue *sq, SyncQueueFrame frame)
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
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
enum AVMediaType codec_type
General type of the encoded data.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int buf_size
Size of buf except extra allocated bytes.
#define FF_OFMT_FLAG_ONLY_DEFAULT_CODECS
If this flag is set, then the only permitted audio/video/subtitle codec ids are AVOutputFormat....
int nb_channels
Number of channels in this layout.
void avpriv_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
Update cur_dts of all streams based on the given timestamp and AVStream.
void avio_wl16(AVIOContext *s, unsigned int val)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int64_t duration
Decoding: duration of the stream, in stream time base.
unsigned int avio_rl16(AVIOContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Rational number (pair of numerator and denominator).
This structure contains the data a format has to probe a file.
AVChannelLayout ch_layout
Audio only.
int sample_rate
Audio only.
int extradata_size
Size of the extradata content in bytes.
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void avio_wl32(AVIOContext *s, unsigned int val)
static int read_header(FFV1Context *f, RangeCoder *c)
static int check_frame_length(void *avcl, int srate_hz, int frame_us)
#define FF_OFMT_FLAG_MAX_ONE_OF_EACH
If this flag is set, it indicates that for each codec type whose corresponding default codec (i....
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
unsigned int avio_rb16(AVIOContext *s)
static int read_probe(const AVProbeData *p)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
int64_t pos
byte position in stream, -1 if unknown
void avio_wb16(AVIOContext *s, unsigned int val)
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16