Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
f7534de3
Commit
f7534de3
authored
Jul 29, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed recovery after end of preroll (seek).
parent
4dcaa605
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
22 deletions
+36
-22
modules/codec/avcodec/video.c
modules/codec/avcodec/video.c
+36
-22
No files found.
modules/codec/avcodec/video.c
View file @
f7534de3
...
@@ -94,6 +94,7 @@ static void ffmpeg_CopyPicture ( decoder_t *, picture_t *, AVFrame * );
...
@@ -94,6 +94,7 @@ static void ffmpeg_CopyPicture ( decoder_t *, picture_t *, AVFrame * );
static
int
ffmpeg_GetFrameBuf
(
struct
AVCodecContext
*
,
AVFrame
*
);
static
int
ffmpeg_GetFrameBuf
(
struct
AVCodecContext
*
,
AVFrame
*
);
static
int
ffmpeg_ReGetFrameBuf
(
struct
AVCodecContext
*
,
AVFrame
*
);
static
int
ffmpeg_ReGetFrameBuf
(
struct
AVCodecContext
*
,
AVFrame
*
);
static
void
ffmpeg_ReleaseFrameBuf
(
struct
AVCodecContext
*
,
AVFrame
*
);
static
void
ffmpeg_ReleaseFrameBuf
(
struct
AVCodecContext
*
,
AVFrame
*
);
static
void
ffmpeg_NextPts
(
decoder_t
*
,
int
i_block_rate
);
static
uint32_t
ffmpeg_CodecTag
(
vlc_fourcc_t
fcc
)
static
uint32_t
ffmpeg_CodecTag
(
vlc_fourcc_t
fcc
)
{
{
...
@@ -431,7 +432,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
...
@@ -431,7 +432,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
(
p_sys
->
i_late_frames
>
4
)
)
(
p_sys
->
i_late_frames
>
4
)
)
{
{
b_drawpicture
=
0
;
b_drawpicture
=
0
;
if
(
p_sys
->
i_late_frames
<
8
)
if
(
p_sys
->
i_late_frames
<
12
)
{
{
p_sys
->
p_context
->
skip_frame
=
p_sys
->
p_context
->
skip_frame
=
(
p_sys
->
i_skip_frame
<=
AVDISCARD_BIDIR
)
?
(
p_sys
->
i_skip_frame
<=
AVDISCARD_BIDIR
)
?
...
@@ -538,6 +539,10 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
...
@@ -538,6 +539,10 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
continue
;
continue
;
}
}
/* Set the PTS */
if
(
p_sys
->
p_ff_pic
->
pts
)
p_sys
->
i_pts
=
p_sys
->
p_ff_pic
->
pts
;
/* Update frame late count (except when doing preroll) */
/* Update frame late count (except when doing preroll) */
if
(
p_sys
->
i_pts
&&
decoder_GetDisplayDate
(
p_dec
,
p_sys
->
i_pts
)
<=
mdate
()
&&
if
(
p_sys
->
i_pts
&&
decoder_GetDisplayDate
(
p_dec
,
p_sys
->
i_pts
)
<=
mdate
()
&&
!
(
p_block
->
i_flags
&
BLOCK_FLAG_PREROLL
)
)
!
(
p_block
->
i_flags
&
BLOCK_FLAG_PREROLL
)
)
...
@@ -557,6 +562,8 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
...
@@ -557,6 +562,8 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
p_pic
=
(
picture_t
*
)
p_sys
->
p_ff_pic
->
opaque
;
p_pic
=
(
picture_t
*
)
p_sys
->
p_ff_pic
->
opaque
;
if
(
!
b_drawpicture
&&
p_pic
)
if
(
!
b_drawpicture
&&
p_pic
)
p_dec
->
pf_vout_buffer_del
(
p_dec
,
p_pic
);
p_dec
->
pf_vout_buffer_del
(
p_dec
,
p_pic
);
ffmpeg_NextPts
(
p_dec
,
p_block
->
i_rate
);
continue
;
continue
;
}
}
...
@@ -579,9 +586,6 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
...
@@ -579,9 +586,6 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
p_pic
=
(
picture_t
*
)
p_sys
->
p_ff_pic
->
opaque
;
p_pic
=
(
picture_t
*
)
p_sys
->
p_ff_pic
->
opaque
;
}
}
/* Set the PTS */
if
(
p_sys
->
p_ff_pic
->
pts
)
p_sys
->
i_pts
=
p_sys
->
p_ff_pic
->
pts
;
/* Sanity check (seems to be needed for some streams) */
/* Sanity check (seems to be needed for some streams) */
if
(
p_sys
->
p_ff_pic
->
pict_type
==
FF_B_TYPE
)
if
(
p_sys
->
p_ff_pic
->
pict_type
==
FF_B_TYPE
)
{
{
...
@@ -612,24 +616,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
...
@@ -612,24 +616,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
{
{
p_pic
->
date
=
p_sys
->
i_pts
;
p_pic
->
date
=
p_sys
->
i_pts
;
/* interpolate the next PTS */
ffmpeg_NextPts
(
p_dec
,
p_block
->
i_rate
);
if
(
p_dec
->
fmt_in
.
video
.
i_frame_rate
>
0
&&
p_dec
->
fmt_in
.
video
.
i_frame_rate_base
>
0
)
{
p_sys
->
i_pts
+=
INT64_C
(
1000000
)
*
(
2
+
p_sys
->
p_ff_pic
->
repeat_pict
)
*
p_dec
->
fmt_in
.
video
.
i_frame_rate_base
*
p_block
->
i_rate
/
INPUT_RATE_DEFAULT
/
(
2
*
p_dec
->
fmt_in
.
video
.
i_frame_rate
);
}
else
if
(
p_sys
->
p_context
->
time_base
.
den
>
0
)
{
p_sys
->
i_pts
+=
INT64_C
(
1000000
)
*
(
2
+
p_sys
->
p_ff_pic
->
repeat_pict
)
*
p_sys
->
p_context
->
time_base
.
num
*
p_block
->
i_rate
/
INPUT_RATE_DEFAULT
/
(
2
*
p_sys
->
p_context
->
time_base
.
den
);
}
if
(
p_sys
->
b_first_frame
)
if
(
p_sys
->
b_first_frame
)
{
{
...
@@ -923,3 +910,30 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
...
@@ -923,3 +910,30 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
p_dec
->
pf_picture_unlink
(
p_dec
,
p_pic
);
p_dec
->
pf_picture_unlink
(
p_dec
,
p_pic
);
}
}
}
}
static
void
ffmpeg_NextPts
(
decoder_t
*
p_dec
,
int
i_block_rate
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
if
(
p_sys
->
i_pts
<=
0
)
return
;
/* interpolate the next PTS */
if
(
p_dec
->
fmt_in
.
video
.
i_frame_rate
>
0
&&
p_dec
->
fmt_in
.
video
.
i_frame_rate_base
>
0
)
{
p_sys
->
i_pts
+=
INT64_C
(
1000000
)
*
(
2
+
p_sys
->
p_ff_pic
->
repeat_pict
)
*
p_dec
->
fmt_in
.
video
.
i_frame_rate_base
*
i_block_rate
/
INPUT_RATE_DEFAULT
/
(
2
*
p_dec
->
fmt_in
.
video
.
i_frame_rate
);
}
else
if
(
p_sys
->
p_context
->
time_base
.
den
>
0
)
{
p_sys
->
i_pts
+=
INT64_C
(
1000000
)
*
(
2
+
p_sys
->
p_ff_pic
->
repeat_pict
)
*
p_sys
->
p_context
->
time_base
.
num
*
i_block_rate
/
INPUT_RATE_DEFAULT
/
(
2
*
p_sys
->
p_context
->
time_base
.
den
);
}
}
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