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
61dd3197
Commit
61dd3197
authored
Oct 27, 2013
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay: add frame duration estimated from frame rate to VideoPicture
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
105d4748
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
ffplay.c
ffplay.c
+8
-2
No files found.
ffplay.c
View file @
61dd3197
...
@@ -121,6 +121,7 @@ typedef struct PacketQueue {
...
@@ -121,6 +121,7 @@ typedef struct PacketQueue {
typedef
struct
VideoPicture
{
typedef
struct
VideoPicture
{
double
pts
;
// presentation timestamp for this picture
double
pts
;
// presentation timestamp for this picture
double
duration
;
// estimated duration based on frame rate
int64_t
pos
;
// byte position in file
int64_t
pos
;
// byte position in file
SDL_Overlay
*
bmp
;
SDL_Overlay
*
bmp
;
int
width
,
height
;
/* source height & width */
int
width
,
height
;
/* source height & width */
...
@@ -1549,7 +1550,7 @@ static void duplicate_right_border_pixels(SDL_Overlay *bmp) {
...
@@ -1549,7 +1550,7 @@ static void duplicate_right_border_pixels(SDL_Overlay *bmp) {
}
}
}
}
static
int
queue_picture
(
VideoState
*
is
,
AVFrame
*
src_frame
,
double
pts
,
int64_t
pos
,
int
serial
)
static
int
queue_picture
(
VideoState
*
is
,
AVFrame
*
src_frame
,
double
pts
,
double
duration
,
int64_t
pos
,
int
serial
)
{
{
VideoPicture
*
vp
;
VideoPicture
*
vp
;
...
@@ -1646,6 +1647,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, int64_t
...
@@ -1646,6 +1647,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, int64_t
SDL_UnlockYUVOverlay
(
vp
->
bmp
);
SDL_UnlockYUVOverlay
(
vp
->
bmp
);
vp
->
pts
=
pts
;
vp
->
pts
=
pts
;
vp
->
duration
=
duration
;
vp
->
pos
=
pos
;
vp
->
pos
=
pos
;
vp
->
serial
=
serial
;
vp
->
serial
=
serial
;
...
@@ -1909,9 +1911,11 @@ static int video_thread(void *arg)
...
@@ -1909,9 +1911,11 @@ static int video_thread(void *arg)
VideoState
*
is
=
arg
;
VideoState
*
is
=
arg
;
AVFrame
*
frame
=
av_frame_alloc
();
AVFrame
*
frame
=
av_frame_alloc
();
double
pts
;
double
pts
;
double
duration
;
int
ret
;
int
ret
;
int
serial
=
0
;
int
serial
=
0
;
AVRational
tb
=
is
->
video_st
->
time_base
;
AVRational
tb
=
is
->
video_st
->
time_base
;
AVRational
frame_rate
=
av_guess_frame_rate
(
is
->
ic
,
is
->
video_st
,
NULL
);
#if CONFIG_AVFILTER
#if CONFIG_AVFILTER
AVFilterGraph
*
graph
=
avfilter_graph_alloc
();
AVFilterGraph
*
graph
=
avfilter_graph_alloc
();
...
@@ -1962,6 +1966,7 @@ static int video_thread(void *arg)
...
@@ -1962,6 +1966,7 @@ static int video_thread(void *arg)
last_h
=
frame
->
height
;
last_h
=
frame
->
height
;
last_format
=
frame
->
format
;
last_format
=
frame
->
format
;
last_serial
=
serial
;
last_serial
=
serial
;
frame_rate
=
filt_out
->
inputs
[
0
]
->
frame_rate
;
}
}
ret
=
av_buffersrc_add_frame
(
filt_in
,
frame
);
ret
=
av_buffersrc_add_frame
(
filt_in
,
frame
);
...
@@ -1987,8 +1992,9 @@ static int video_thread(void *arg)
...
@@ -1987,8 +1992,9 @@ static int video_thread(void *arg)
is
->
frame_last_filter_delay
=
0
;
is
->
frame_last_filter_delay
=
0
;
tb
=
filt_out
->
inputs
[
0
]
->
time_base
;
tb
=
filt_out
->
inputs
[
0
]
->
time_base
;
#endif
#endif
duration
=
(
frame_rate
.
num
&&
frame_rate
.
den
?
av_q2d
((
AVRational
){
frame_rate
.
den
,
frame_rate
.
num
})
:
0
);
pts
=
(
frame
->
pts
==
AV_NOPTS_VALUE
)
?
NAN
:
frame
->
pts
*
av_q2d
(
tb
);
pts
=
(
frame
->
pts
==
AV_NOPTS_VALUE
)
?
NAN
:
frame
->
pts
*
av_q2d
(
tb
);
ret
=
queue_picture
(
is
,
frame
,
pts
,
av_frame_get_pkt_pos
(
frame
),
serial
);
ret
=
queue_picture
(
is
,
frame
,
pts
,
duration
,
av_frame_get_pkt_pos
(
frame
),
serial
);
av_frame_unref
(
frame
);
av_frame_unref
(
frame
);
#if CONFIG_AVFILTER
#if CONFIG_AVFILTER
}
}
...
...
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