Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
a895292f
Commit
a895292f
authored
Apr 16, 2016
by
Alexandra Hájková
Committed by
Diego Biurrun
Jan 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mov: Convert to the new bitstream reader
parent
44129e38
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
24 deletions
+27
-24
mov.c
libavformat/mov.c
+6
-4
movenc.c
libavformat/movenc.c
+21
-20
No files found.
libavformat/mov.c
View file @
a895292f
...
...
@@ -39,13 +39,15 @@
#include "libavutil/pixdesc.h"
#include "libavutil/spherical.h"
#include "libavutil/stereo3d.h"
#include "libavcodec/ac3tab.h"
#include "libavcodec/bitstream.h"
#include "avformat.h"
#include "internal.h"
#include "avio_internal.h"
#include "riff.h"
#include "isom.h"
#include "libavcodec/get_bits.h"
#include "id3v1.h"
#include "mov_chan.h"
#include "replaygain.h"
...
...
@@ -2078,7 +2080,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
;
...
...
@@ -2136,10 +2138,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
];
}
...
...
libavformat/movenc.c
View file @
a895292f
...
...
@@ -31,7 +31,8 @@
#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"
...
...
@@ -240,7 +241,7 @@ static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track)
static
int
mov_write_ac3_tag
(
AVIOContext
*
pb
,
MOVTrack
*
track
)
{
GetBitContext
g
bc
;
BitstreamContext
bc
;
PutBitContext
pbc
;
uint8_t
buf
[
3
];
int
fscod
,
bsid
,
bsmod
,
acmod
,
lfeon
,
frmsizecod
;
...
...
@@ -251,21 +252,21 @@ static int mov_write_ac3_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32
(
pb
,
11
);
ffio_wfourcc
(
pb
,
"dac3"
);
init_get_bits
(
&
g
bc
,
track
->
vos_data
+
4
,
(
track
->
vos_len
-
4
)
*
8
);
fscod
=
get_bits
(
&
g
bc
,
2
);
frmsizecod
=
get_bits
(
&
g
bc
,
6
);
bsid
=
get_bits
(
&
g
bc
,
5
);
bsmod
=
get_bits
(
&
g
bc
,
3
);
acmod
=
get_bits
(
&
g
bc
,
3
);
bitstream_init
(
&
bc
,
track
->
vos_data
+
4
,
(
track
->
vos_len
-
4
)
*
8
);
fscod
=
bitstream_read
(
&
bc
,
2
);
frmsizecod
=
bitstream_read
(
&
bc
,
6
);
bsid
=
bitstream_read
(
&
bc
,
5
);
bsmod
=
bitstream_read
(
&
bc
,
3
);
acmod
=
bitstream_read
(
&
bc
,
3
);
if
(
acmod
==
2
)
{
skip_bits
(
&
g
bc
,
2
);
// dsurmod
bitstream_skip
(
&
bc
,
2
);
// dsurmod
}
else
{
if
((
acmod
&
1
)
&&
acmod
!=
1
)
skip_bits
(
&
g
bc
,
2
);
// cmixlev
bitstream_skip
(
&
bc
,
2
);
// cmixlev
if
(
acmod
&
4
)
skip_bits
(
&
g
bc
,
2
);
// surmixlev
bitstream_skip
(
&
bc
,
2
);
// surmixlev
}
lfeon
=
get_bits1
(
&
g
bc
);
lfeon
=
bitstream_read_bit
(
&
bc
);
init_put_bits
(
&
pbc
,
buf
,
sizeof
(
buf
));
put_bits
(
&
pbc
,
2
,
fscod
);
...
...
@@ -462,28 +463,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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment