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
8d1997ad
Commit
8d1997ad
authored
Apr 16, 2016
by
Alexandra Hájková
Committed by
Diego Biurrun
Nov 24, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegts: Convert to the new bitstream reader
parent
178b4ea5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
23 deletions
+25
-23
mpegts.c
libavformat/mpegts.c
+25
-23
No files found.
libavformat/mpegts.c
View file @
8d1997ad
...
@@ -26,9 +26,11 @@
...
@@ -26,9 +26,11 @@
#include "libavutil/dict.h"
#include "libavutil/dict.h"
#include "libavutil/mathematics.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/opt.h"
#include "libavcodec/bitstream.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/get_bits.h"
#include "libavcodec/opus.h"
#include "libavcodec/opus.h"
#include "avformat.h"
#include "avformat.h"
#include "mpegts.h"
#include "mpegts.h"
#include "internal.h"
#include "internal.h"
...
@@ -735,56 +737,56 @@ static void new_pes_packet(PESContext *pes, AVPacket *pkt)
...
@@ -735,56 +737,56 @@ static void new_pes_packet(PESContext *pes, AVPacket *pkt)
static
int
read_sl_header
(
PESContext
*
pes
,
SLConfigDescr
*
sl
,
static
int
read_sl_header
(
PESContext
*
pes
,
SLConfigDescr
*
sl
,
const
uint8_t
*
buf
,
int
buf_size
)
const
uint8_t
*
buf
,
int
buf_size
)
{
{
GetBitContext
gb
;
BitstreamContext
bc
;
int
au_start_flag
=
0
,
au_end_flag
=
0
,
ocr_flag
=
0
,
idle_flag
=
0
;
int
au_start_flag
=
0
,
au_end_flag
=
0
,
ocr_flag
=
0
,
idle_flag
=
0
;
int
padding_flag
=
0
,
padding_bits
=
0
,
inst_bitrate_flag
=
0
;
int
padding_flag
=
0
,
padding_bits
=
0
,
inst_bitrate_flag
=
0
;
int
dts_flag
=
-
1
,
cts_flag
=
-
1
;
int
dts_flag
=
-
1
,
cts_flag
=
-
1
;
int64_t
dts
=
AV_NOPTS_VALUE
,
cts
=
AV_NOPTS_VALUE
;
int64_t
dts
=
AV_NOPTS_VALUE
,
cts
=
AV_NOPTS_VALUE
;
init_get_bits
(
&
gb
,
buf
,
buf_size
*
8
);
bitstream_init
(
&
bc
,
buf
,
buf_size
*
8
);
if
(
sl
->
use_au_start
)
if
(
sl
->
use_au_start
)
au_start_flag
=
get_bits1
(
&
gb
);
au_start_flag
=
bitstream_read_bit
(
&
bc
);
if
(
sl
->
use_au_end
)
if
(
sl
->
use_au_end
)
au_end_flag
=
get_bits1
(
&
gb
);
au_end_flag
=
bitstream_read_bit
(
&
bc
);
if
(
!
sl
->
use_au_start
&&
!
sl
->
use_au_end
)
if
(
!
sl
->
use_au_start
&&
!
sl
->
use_au_end
)
au_start_flag
=
au_end_flag
=
1
;
au_start_flag
=
au_end_flag
=
1
;
if
(
sl
->
ocr_len
>
0
)
if
(
sl
->
ocr_len
>
0
)
ocr_flag
=
get_bits1
(
&
gb
);
ocr_flag
=
bitstream_read_bit
(
&
bc
);
if
(
sl
->
use_idle
)
if
(
sl
->
use_idle
)
idle_flag
=
get_bits1
(
&
gb
);
idle_flag
=
bitstream_read_bit
(
&
bc
);
if
(
sl
->
use_padding
)
if
(
sl
->
use_padding
)
padding_flag
=
get_bits1
(
&
gb
);
padding_flag
=
bitstream_read_bit
(
&
bc
);
if
(
padding_flag
)
if
(
padding_flag
)
padding_bits
=
get_bits
(
&
gb
,
3
);
padding_bits
=
bitstream_read
(
&
bc
,
3
);
if
(
!
idle_flag
&&
(
!
padding_flag
||
padding_bits
!=
0
))
{
if
(
!
idle_flag
&&
(
!
padding_flag
||
padding_bits
!=
0
))
{
if
(
sl
->
packet_seq_num_len
)
if
(
sl
->
packet_seq_num_len
)
skip_bits_long
(
&
gb
,
sl
->
packet_seq_num_len
);
bitstream_skip
(
&
bc
,
sl
->
packet_seq_num_len
);
if
(
sl
->
degr_prior_len
)
if
(
sl
->
degr_prior_len
)
if
(
get_bits1
(
&
gb
))
if
(
bitstream_read_bit
(
&
bc
))
skip_bits
(
&
gb
,
sl
->
degr_prior_len
);
bitstream_skip
(
&
bc
,
sl
->
degr_prior_len
);
if
(
ocr_flag
)
if
(
ocr_flag
)
skip_bits_long
(
&
gb
,
sl
->
ocr_len
);
bitstream_skip
(
&
bc
,
sl
->
ocr_len
);
if
(
au_start_flag
)
{
if
(
au_start_flag
)
{
if
(
sl
->
use_rand_acc_pt
)
if
(
sl
->
use_rand_acc_pt
)
get_bits1
(
&
gb
);
bitstream_read_bit
(
&
bc
);
if
(
sl
->
au_seq_num_len
>
0
)
if
(
sl
->
au_seq_num_len
>
0
)
skip_bits_long
(
&
gb
,
sl
->
au_seq_num_len
);
bitstream_skip
(
&
bc
,
sl
->
au_seq_num_len
);
if
(
sl
->
use_timestamps
)
{
if
(
sl
->
use_timestamps
)
{
dts_flag
=
get_bits1
(
&
gb
);
dts_flag
=
bitstream_read_bit
(
&
bc
);
cts_flag
=
get_bits1
(
&
gb
);
cts_flag
=
bitstream_read_bit
(
&
bc
);
}
}
}
}
if
(
sl
->
inst_bitrate_len
)
if
(
sl
->
inst_bitrate_len
)
inst_bitrate_flag
=
get_bits1
(
&
gb
);
inst_bitrate_flag
=
bitstream_read_bit
(
&
bc
);
if
(
dts_flag
==
1
)
if
(
dts_flag
==
1
)
dts
=
get_bits64
(
&
gb
,
sl
->
timestamp_len
);
dts
=
bitstream_read_63
(
&
bc
,
sl
->
timestamp_len
);
if
(
cts_flag
==
1
)
if
(
cts_flag
==
1
)
cts
=
get_bits64
(
&
gb
,
sl
->
timestamp_len
);
cts
=
bitstream_read_63
(
&
bc
,
sl
->
timestamp_len
);
if
(
sl
->
au_len
>
0
)
if
(
sl
->
au_len
>
0
)
skip_bits_long
(
&
gb
,
sl
->
au_len
);
bitstream_skip
(
&
bc
,
sl
->
au_len
);
if
(
inst_bitrate_flag
)
if
(
inst_bitrate_flag
)
skip_bits_long
(
&
gb
,
sl
->
inst_bitrate_len
);
bitstream_skip
(
&
bc
,
sl
->
inst_bitrate_len
);
}
}
if
(
dts
!=
AV_NOPTS_VALUE
)
if
(
dts
!=
AV_NOPTS_VALUE
)
...
@@ -795,7 +797,7 @@ static int read_sl_header(PESContext *pes, SLConfigDescr *sl,
...
@@ -795,7 +797,7 @@ static int read_sl_header(PESContext *pes, SLConfigDescr *sl,
if
(
sl
->
timestamp_len
&&
sl
->
timestamp_res
)
if
(
sl
->
timestamp_len
&&
sl
->
timestamp_res
)
avpriv_set_pts_info
(
pes
->
st
,
sl
->
timestamp_len
,
1
,
sl
->
timestamp_res
);
avpriv_set_pts_info
(
pes
->
st
,
sl
->
timestamp_len
,
1
,
sl
->
timestamp_res
);
return
(
get_bits_count
(
&
gb
)
+
7
)
>>
3
;
return
(
bitstream_tell
(
&
bc
)
+
7
)
>>
3
;
}
}
/* return non zero if a packet could be constructed */
/* return non zero if a packet could be constructed */
...
...
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