Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
221e53b1
Commit
221e53b1
authored
Jan 09, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed vc1 packetizer.
parent
fe026cce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
11 deletions
+23
-11
modules/packetizer/vc1.c
modules/packetizer/vc1.c
+23
-11
No files found.
modules/packetizer/vc1.c
View file @
221e53b1
...
@@ -188,7 +188,7 @@ static void Close( vlc_object_t *p_this )
...
@@ -188,7 +188,7 @@ static void Close( vlc_object_t *p_this )
/*****************************************************************************
/*****************************************************************************
* Packetize: packetize an access unit
* Packetize: packetize an access unit
*****************************************************************************/
*****************************************************************************/
static
block_t
*
ParseIDU
(
decoder_t
*
p_dec
,
block_t
*
p_frag
);
static
block_t
*
ParseIDU
(
decoder_t
*
p_dec
,
b
ool
*
pb_used_ts
,
b
lock_t
*
p_frag
);
static
block_t
*
Packetize
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
static
block_t
*
Packetize
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
{
{
...
@@ -220,6 +220,8 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
...
@@ -220,6 +220,8 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
for
(
;;
)
for
(
;;
)
{
{
bool
b_used_ts
;
switch
(
p_sys
->
i_state
)
switch
(
p_sys
->
i_state
)
{
{
...
@@ -258,12 +260,10 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
...
@@ -258,12 +260,10 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
p_sys
->
i_offset
=
0
;
p_sys
->
i_offset
=
0
;
/* Parse and return complete frame */
/* Parse and return complete frame */
p_pic
=
ParseIDU
(
p_dec
,
p_pic
);
p_pic
=
ParseIDU
(
p_dec
,
&
b_used_ts
,
p_pic
);
/* Don't reuse the same timestamps several times */
/* Don't reuse the same timestamps several times */
if
(
p_sys
->
p_frame
&&
if
(
b_used_ts
)
p_sys
->
p_frame
->
i_dts
==
p_sys
->
bytestream
.
p_block
->
i_dts
&&
p_sys
->
p_frame
->
i_pts
==
p_sys
->
bytestream
.
p_block
->
i_pts
)
{
{
p_sys
->
bytestream
.
p_block
->
i_pts
=
-
1
;
p_sys
->
bytestream
.
p_block
->
i_pts
=
-
1
;
p_sys
->
bytestream
.
p_block
->
i_dts
=
-
1
;
p_sys
->
bytestream
.
p_block
->
i_dts
=
-
1
;
...
@@ -338,12 +338,13 @@ static void BuildExtraData( decoder_t *p_dec )
...
@@ -338,12 +338,13 @@ static void BuildExtraData( decoder_t *p_dec )
p_sys
->
ep
.
p_ep
->
p_buffer
,
p_sys
->
ep
.
p_ep
->
i_buffer
);
p_sys
->
ep
.
p_ep
->
p_buffer
,
p_sys
->
ep
.
p_ep
->
i_buffer
);
}
}
/* ParseIDU: parse an Independent Decoding Unit */
/* ParseIDU: parse an Independent Decoding Unit */
static
block_t
*
ParseIDU
(
decoder_t
*
p_dec
,
block_t
*
p_frag
)
static
block_t
*
ParseIDU
(
decoder_t
*
p_dec
,
b
ool
*
pb_used_ts
,
b
lock_t
*
p_frag
)
{
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
block_t
*
p_pic
;
block_t
*
p_pic
;
const
idu_type_t
idu
=
p_frag
->
p_buffer
[
3
];
const
idu_type_t
idu
=
p_frag
->
p_buffer
[
3
];
*
pb_used_ts
=
false
;
if
(
!
p_sys
->
b_sequence_header
&&
idu
!=
IDU_TYPE_SEQUENCE_HEADER
)
if
(
!
p_sys
->
b_sequence_header
&&
idu
!=
IDU_TYPE_SEQUENCE_HEADER
)
{
{
msg_Warn
(
p_dec
,
"waiting for sequence header"
);
msg_Warn
(
p_dec
,
"waiting for sequence header"
);
...
@@ -370,14 +371,23 @@ static block_t *ParseIDU( decoder_t *p_dec, block_t *p_frag )
...
@@ -370,14 +371,23 @@ static block_t *ParseIDU( decoder_t *p_dec, block_t *p_frag )
/* */
/* */
p_pic
=
block_ChainGather
(
p_sys
->
p_frame
);
p_pic
=
block_ChainGather
(
p_sys
->
p_frame
);
/* */
if
(
p_pic
->
i_dts
>
0
)
p_sys
->
i_interpolated_dts
=
p_pic
->
i_dts
;
/* We can interpolate dts/pts only if we have a frame rate */
/* We can interpolate dts/pts only if we have a frame rate */
if
(
p_dec
->
fmt_out
.
video
.
i_frame_rate
!=
0
&&
p_dec
->
fmt_out
.
video
.
i_frame_rate_base
!=
0
)
if
(
p_dec
->
fmt_out
.
video
.
i_frame_rate
!=
0
&&
p_dec
->
fmt_out
.
video
.
i_frame_rate_base
!=
0
)
{
{
//msg_Dbg( p_dec, "-------------- XXX0 dts=%"PRId64" pts=%"PRId64" interpolated=%"PRId64, p_pic->i_dts, p_pic->i_pts, p_sys->i_interpolated_dts );
if
(
p_sys
->
i_interpolated_dts
>
0
)
p_sys
->
i_interpolated_dts
+=
INT64_C
(
1000000
)
*
p_dec
->
fmt_out
.
video
.
i_frame_rate_base
/
p_dec
->
fmt_out
.
video
.
i_frame_rate
;
//msg_Dbg( p_dec, "-------------- XXX0 dts=%"PRId64" pts=%"PRId64" interpolated=%"PRId64,
// p_pic->i_dts, p_pic->i_pts, p_sys->i_interpolated_dts );
if
(
p_pic
->
i_dts
<=
0
)
if
(
p_pic
->
i_dts
<=
0
)
p_pic
->
i_dts
=
p_sys
->
i_interpolated_dts
;
p_pic
->
i_dts
=
p_sys
->
i_interpolated_dts
;
p_sys
->
i_interpolated_dts
+=
INT64_C
(
1000000
)
*
p_dec
->
fmt_out
.
video
.
i_frame_rate_base
/
p_dec
->
fmt_out
.
video
.
i_frame_rate
;
if
(
p_pic
->
i_pts
<=
0
)
if
(
p_pic
->
i_pts
<=
0
)
{
{
if
(
!
p_sys
->
sh
.
b_has_bframe
||
(
p_pic
->
i_flags
&
BLOCK_FLAG_TYPE_B
)
)
if
(
!
p_sys
->
sh
.
b_has_bframe
||
(
p_pic
->
i_flags
&
BLOCK_FLAG_TYPE_B
)
)
...
@@ -385,11 +395,11 @@ static block_t *ParseIDU( decoder_t *p_dec, block_t *p_frag )
...
@@ -385,11 +395,11 @@ static block_t *ParseIDU( decoder_t *p_dec, block_t *p_frag )
/* TODO compute pts for other case */
/* TODO compute pts for other case */
}
}
}
}
p_sys
->
i_interpolated_dts
=
p_pic
->
i_dts
;
//msg_Dbg( p_dec, "-------------- dts=%"PRId64" pts=%"PRId64, p_pic->i_dts, p_pic->i_pts );
//msg_Dbg( p_dec, "-------------- dts=%"PRId64" pts=%"PRId64, p_pic->i_dts, p_pic->i_pts );
/* Reset context */
/* Reset context */
p_sys
->
b_frame
=
false
;
p_sys
->
p_frame
=
NULL
;
p_sys
->
p_frame
=
NULL
;
p_sys
->
pp_last
=
&
p_sys
->
p_frame
;
p_sys
->
pp_last
=
&
p_sys
->
p_frame
;
}
}
...
@@ -398,10 +408,12 @@ static block_t *ParseIDU( decoder_t *p_dec, block_t *p_frag )
...
@@ -398,10 +408,12 @@ static block_t *ParseIDU( decoder_t *p_dec, block_t *p_frag )
if
(
p_sys
->
p_frame
)
if
(
p_sys
->
p_frame
)
{
{
block_t
*
p_frame
=
p_sys
->
p_frame
;
block_t
*
p_frame
=
p_sys
->
p_frame
;
if
(
p_frame
->
i_dts
<
0
)
if
(
p_frame
->
i_dts
<=
0
&&
p_frame
->
i_pts
<=
0
)
{
p_frame
->
i_dts
=
p_frag
->
i_dts
;
p_frame
->
i_dts
=
p_frag
->
i_dts
;
if
(
p_frame
->
i_pts
<
0
)
p_frame
->
i_pts
=
p_frag
->
i_pts
;
p_frame
->
i_pts
=
p_frag
->
i_pts
;
*
pb_used_ts
=
true
;
}
}
}
block_ChainLastAppend
(
&
p_sys
->
pp_last
,
p_frag
);
block_ChainLastAppend
(
&
p_sys
->
pp_last
,
p_frag
);
...
...
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