35#define MAX_EXTRADATA_SIZE 1024
48 {
"smc-interval",
"StreamMuxConfig interval.",
54 .class_name =
"LATM/LOAS muxer",
110 int words = length >> 4;
111 int bits = length & 15;
113 for (
i = 0;
i < words;
i++)
145 if (!
ctx->channel_conf) {
172 uint8_t loas_header[] =
"\x56\xe0\x00";
178 if(
pkt->size > 2 &&
pkt->data[0] == 0x56 && (
pkt->data[1] >> 4) == 0xe &&
183 size_t side_data_size;
188 if (side_data_size) {
194 memcpy(par->
extradata, side_data, side_data_size);
200 if (
pkt->size > 0x1fff)
208 for (
i = 0;
i <=
pkt->size-255;
i+=255)
216 if (
pkt->size && (
pkt->data[0] & 0xe1) == 0x81) {
237 loas_header[1] |= (
len >> 8) & 0x1f;
238 loas_header[2] |=
len & 0xff;
256 if (
pkt->size > 2 && (
AV_RB16(
pkt->data) & 0xfff0) == 0xfff0)
266 .p.mime_type =
"audio/MP4A-LATM",
267 .p.extensions =
"latm,loas",
static AVFormatContext * ctx
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
#define i(width, name, range_min, range_max)
static const uint8_t bits[8]
bitstream reader API header.
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
#define MAX_EXTRADATA_SIZE
static int latm_write_header(AVFormatContext *s)
static void latm_write_frame_header(AVFormatContext *s, PutBitContext *bs)
static void copy_bits(PutBitContext *pb, const uint8_t *src, int length)
static const AVClass latm_muxer_class
static int latm_decode_extradata(AVFormatContext *s, uint8_t *buf, int size)
static int latm_check_bitstream(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
static int latm_write_packet(AVFormatContext *s, AVPacket *pkt)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int avpriv_mpeg4audio_get_config2(MPEG4AudioConfig *c, const uint8_t *buf, int size, int sync_extension, void *logctx)
Parse MPEG-4 systems extradata from a raw buffer to retrieve audio configuration.
@ AOT_ALS
Y Audio LosslesS.
@ AOT_SBR
Y Spectral Band Replication.
static int ff_copy_pce_data(PutBitContext *pb, GetBitContext *gb)
#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....
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
static int put_bytes_output(const PutBitContext *s)
Describe the class of an AVClass context structure.
This struct describes the properties of an encoded stream.
int extradata_size
Size of the extradata content in bytes.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
uint8_t buffer[0x1fff+MAX_EXTRADATA_SIZE+1024]
static int mod(int a, int b)
Modulo operation with only positive remainders.