mirror of https://git.ffmpeg.org/ffmpeg.git
lavf/latmenc: use a local simplified copy of avpriv_copy_bits()
This is the only place in lavf where avpriv_copy_bits() is used, so this allows us to make avpriv_copy_bits() lavc-local.
This commit is contained in:
parent
2068ad5914
commit
886c601a70
|
@ -101,6 +101,17 @@ static int latm_write_header(AVFormatContext *s)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void copy_bits(PutBitContext *pb, const uint8_t *src, int length)
|
||||||
|
{
|
||||||
|
int words = length >> 4;
|
||||||
|
int bits = length & 15;
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < words; i++)
|
||||||
|
put_bits(pb, 16, AV_RB16(src + 2 * i));
|
||||||
|
if (bits)
|
||||||
|
put_bits(pb, bits, AV_RB16(src + 2 * words) >> (16 - bits));
|
||||||
|
}
|
||||||
|
|
||||||
static void latm_write_frame_header(AVFormatContext *s, PutBitContext *bs)
|
static void latm_write_frame_header(AVFormatContext *s, PutBitContext *bs)
|
||||||
{
|
{
|
||||||
LATMContext *ctx = s->priv_data;
|
LATMContext *ctx = s->priv_data;
|
||||||
|
@ -121,11 +132,11 @@ static void latm_write_frame_header(AVFormatContext *s, PutBitContext *bs)
|
||||||
/* AudioSpecificConfig */
|
/* AudioSpecificConfig */
|
||||||
if (ctx->object_type == AOT_ALS) {
|
if (ctx->object_type == AOT_ALS) {
|
||||||
header_size = (par->extradata_size - (ctx->off >> 3)) * 8;
|
header_size = (par->extradata_size - (ctx->off >> 3)) * 8;
|
||||||
avpriv_copy_bits(bs, &par->extradata[ctx->off >> 3], header_size);
|
copy_bits(bs, &par->extradata[ctx->off >> 3], header_size);
|
||||||
} else {
|
} else {
|
||||||
// + 3 assumes not scalable and dependsOnCoreCoder == 0,
|
// + 3 assumes not scalable and dependsOnCoreCoder == 0,
|
||||||
// see decode_ga_specific_config in libavcodec/aacdec.c
|
// see decode_ga_specific_config in libavcodec/aacdec.c
|
||||||
avpriv_copy_bits(bs, par->extradata, ctx->off + 3);
|
copy_bits(bs, par->extradata, ctx->off + 3);
|
||||||
|
|
||||||
if (!ctx->channel_conf) {
|
if (!ctx->channel_conf) {
|
||||||
GetBitContext gb;
|
GetBitContext gb;
|
||||||
|
@ -207,9 +218,9 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
// This allows us to remux our FATE AAC samples into latm
|
// This allows us to remux our FATE AAC samples into latm
|
||||||
// files that are still playable with minimal effort.
|
// files that are still playable with minimal effort.
|
||||||
put_bits(&bs, 8, pkt->data[0] & 0xfe);
|
put_bits(&bs, 8, pkt->data[0] & 0xfe);
|
||||||
avpriv_copy_bits(&bs, pkt->data + 1, 8*pkt->size - 8);
|
copy_bits(&bs, pkt->data + 1, 8*pkt->size - 8);
|
||||||
} else
|
} else
|
||||||
avpriv_copy_bits(&bs, pkt->data, 8*pkt->size);
|
copy_bits(&bs, pkt->data, 8*pkt->size);
|
||||||
|
|
||||||
flush_put_bits(&bs);
|
flush_put_bits(&bs);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue