summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandra Hájková <alexandra@khirnov.net>2016-04-16 12:17:24 +0200
committerAlexandra Hájková <alexandra@khirnov.net>2016-05-22 16:48:00 +0200
commit97a6c724d94a9846704d25919b0d7f3fbe569e2f (patch)
treecd6f32e9cd1232f169c21619e26027409b077bce
parent85375937376bbcebdccace0f831c145f10a72638 (diff)
mov: convert to the new bitstream reader
-rw-r--r--libavformat/mov.c8
-rw-r--r--libavformat/movenc.c40
2 files changed, 24 insertions, 24 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 125919fa57..14d822b546 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -42,7 +42,7 @@
#include "avio_internal.h"
#include "riff.h"
#include "isom.h"
-#include "libavcodec/get_bits.h"
+#include "libavcodec/bitstream.h"
#include "id3v1.h"
#include "mov_chan.h"
#include "replaygain.h"
@@ -1997,7 +1997,7 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVStream *st;
MOVStreamContext *sc;
unsigned int i, entries, sample_size, field_size, num_bytes;
- GetBitContext gb;
+ BitstreamContext bc;
unsigned char* buf;
int ret;
@@ -2055,10 +2055,10 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return ret;
}
- init_get_bits(&gb, buf, 8*num_bytes);
+ bitstream_init(&bc, buf, 8*num_bytes);
for (i = 0; i < entries && !pb->eof_reached; i++) {
- sc->sample_sizes[i] = get_bits_long(&gb, field_size);
+ sc->sample_sizes[i] = bitstream_read(&bc, field_size);
sc->data_size += sc->sample_sizes[i];
}
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index aadfa06a5a..4c8f2cbe1a 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -31,7 +31,7 @@
#include "avio.h"
#include "isom.h"
#include "avc.h"
-#include "libavcodec/get_bits.h"
+#include "libavcodec/bitstream.h"
#include "libavcodec/put_bits.h"
#include "libavcodec/vc1_common.h"
#include "internal.h"
@@ -239,7 +239,7 @@ static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_ac3_tag(AVIOContext *pb, MOVTrack *track)
{
- GetBitContext gbc;
+ BitstreamContext bcc;
PutBitContext pbc;
uint8_t buf[3];
int fscod, bsid, bsmod, acmod, lfeon, frmsizecod;
@@ -250,21 +250,21 @@ static int mov_write_ac3_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, 11);
ffio_wfourcc(pb, "dac3");
- init_get_bits(&gbc, track->vos_data + 4, (track->vos_len - 4) * 8);
- fscod = get_bits(&gbc, 2);
- frmsizecod = get_bits(&gbc, 6);
- bsid = get_bits(&gbc, 5);
- bsmod = get_bits(&gbc, 3);
- acmod = get_bits(&gbc, 3);
+ bitstream_init(&bcc, track->vos_data + 4, (track->vos_len - 4) * 8);
+ fscod = bitstream_read(&bcc, 2);
+ frmsizecod = bitstream_read(&bcc, 6);
+ bsid = bitstream_read(&bcc, 5);
+ bsmod = bitstream_read(&bcc, 3);
+ acmod = bitstream_read(&bcc, 3);
if (acmod == 2) {
- skip_bits(&gbc, 2); // dsurmod
+ bitstream_skip(&bcc, 2); // dsurmod
} else {
if ((acmod & 1) && acmod != 1)
- skip_bits(&gbc, 2); // cmixlev
+ bitstream_skip(&bcc, 2); // cmixlev
if (acmod & 4)
- skip_bits(&gbc, 2); // surmixlev
+ bitstream_skip(&bcc, 2); // surmixlev
}
- lfeon = get_bits1(&gbc);
+ lfeon = bitstream_read_bit(&bcc);
init_put_bits(&pbc, buf, sizeof(buf));
put_bits(&pbc, 2, fscod);
@@ -461,28 +461,28 @@ static int mov_write_dvc1_structs(MOVTrack *track, uint8_t *buf)
return AVERROR(ENOMEM);
start = find_next_marker(track->vos_data, end);
for (next = start; next < end; start = next) {
- GetBitContext gb;
+ BitstreamContext bc;
int size;
next = find_next_marker(start + 4, end);
size = next - start - 4;
if (size <= 0)
continue;
unescaped_size = vc1_unescape_buffer(start + 4, size, unescaped);
- init_get_bits(&gb, unescaped, 8 * unescaped_size);
+ bitstream_init(&bc, unescaped, 8 * unescaped_size);
if (AV_RB32(start) == VC1_CODE_SEQHDR) {
- int profile = get_bits(&gb, 2);
+ int profile = bitstream_read(&bc, 2);
if (profile != PROFILE_ADVANCED) {
av_free(unescaped);
return AVERROR(ENOSYS);
}
seq_found = 1;
- level = get_bits(&gb, 3);
+ level = bitstream_read(&bc, 3);
/* chromaformat, frmrtq_postproc, bitrtq_postproc, postprocflag,
* width, height */
- skip_bits_long(&gb, 2 + 3 + 5 + 1 + 2*12);
- skip_bits(&gb, 1); /* broadcast */
- interlace = get_bits1(&gb);
- skip_bits(&gb, 4); /* tfcntrflag, finterpflag, reserved, psf */
+ bitstream_skip(&bc, 2 + 3 + 5 + 1 + 2*12);
+ bitstream_skip(&bc, 1); /* broadcast */
+ interlace = bitstream_read_bit(&bc);
+ bitstream_skip(&bc, 4); /* tfcntrflag, finterpflag, reserved, psf */
}
}
if (!seq_found) {