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
a78dd826
Commit
a78dd826
authored
Feb 07, 2012
by
Clément Bœsch
Committed by
Clément Bœsch
Feb 10, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffmpeg: move video stats code to do_video_out().
This will allow some simplifications in transcode_video().
parent
cf310601
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
ffmpeg.c
ffmpeg.c
+7
-8
No files found.
ffmpeg.c
View file @
a78dd826
...
@@ -1444,18 +1444,20 @@ static void do_video_resample(OutputStream *ost,
...
@@ -1444,18 +1444,20 @@ static void do_video_resample(OutputStream *ost,
#endif
#endif
}
}
static
void
do_video_stats
(
AVFormatContext
*
os
,
OutputStream
*
ost
,
int
frame_size
);
static
void
do_video_out
(
AVFormatContext
*
s
,
static
void
do_video_out
(
AVFormatContext
*
s
,
OutputStream
*
ost
,
OutputStream
*
ost
,
InputStream
*
ist
,
InputStream
*
ist
,
AVFrame
*
in_picture
,
AVFrame
*
in_picture
,
int
*
frame_size
,
float
quality
)
float
quality
)
{
{
int
nb_frames
,
i
,
ret
,
format_video_sync
;
int
nb_frames
,
i
,
ret
,
format_video_sync
;
AVFrame
*
final_picture
;
AVFrame
*
final_picture
;
AVCodecContext
*
enc
;
AVCodecContext
*
enc
;
double
sync_ipts
;
double
sync_ipts
;
double
duration
=
0
;
double
duration
=
0
;
int
frame_size
=
0
;
enc
=
ost
->
st
->
codec
;
enc
=
ost
->
st
->
codec
;
...
@@ -1472,8 +1474,6 @@ static void do_video_out(AVFormatContext *s,
...
@@ -1472,8 +1474,6 @@ static void do_video_out(AVFormatContext *s,
/* by default, we output a single frame */
/* by default, we output a single frame */
nb_frames
=
1
;
nb_frames
=
1
;
*
frame_size
=
0
;
format_video_sync
=
video_sync_method
;
format_video_sync
=
video_sync_method
;
if
(
format_video_sync
==
VSYNC_AUTO
)
if
(
format_video_sync
==
VSYNC_AUTO
)
format_video_sync
=
(
s
->
oformat
->
flags
&
AVFMT_VARIABLE_FPS
)
?
((
s
->
oformat
->
flags
&
AVFMT_NOTIMESTAMPS
)
?
VSYNC_PASSTHROUGH
:
VSYNC_VFR
)
:
1
;
format_video_sync
=
(
s
->
oformat
->
flags
&
AVFMT_VARIABLE_FPS
)
?
((
s
->
oformat
->
flags
&
AVFMT_NOTIMESTAMPS
)
?
VSYNC_PASSTHROUGH
:
VSYNC_VFR
)
:
1
;
...
@@ -1571,7 +1571,7 @@ static void do_video_out(AVFormatContext *s,
...
@@ -1571,7 +1571,7 @@ static void do_video_out(AVFormatContext *s,
pkt
.
pts
=
pkt
.
dts
=
AV_NOPTS_VALUE
;
pkt
.
pts
=
pkt
.
dts
=
AV_NOPTS_VALUE
;
write_frame
(
s
,
&
pkt
,
ost
);
write_frame
(
s
,
&
pkt
,
ost
);
*
frame_size
=
pkt
.
size
;
frame_size
=
pkt
.
size
;
video_size
+=
pkt
.
size
;
video_size
+=
pkt
.
size
;
/* if two pass, output log */
/* if two pass, output log */
...
@@ -1588,6 +1588,8 @@ static void do_video_out(AVFormatContext *s,
...
@@ -1588,6 +1588,8 @@ static void do_video_out(AVFormatContext *s,
*/
*/
ost
->
frame_number
++
;
ost
->
frame_number
++
;
}
}
if
(
vstats_filename
&&
frame_size
)
do_video_stats
(
output_files
[
ost
->
file_index
].
ctx
,
ost
,
frame_size
);
}
}
static
double
psnr
(
double
d
)
static
double
psnr
(
double
d
)
...
@@ -2121,7 +2123,6 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
...
@@ -2121,7 +2123,6 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
for
(
i
=
0
;
i
<
nb_output_streams
;
i
++
)
{
for
(
i
=
0
;
i
<
nb_output_streams
;
i
++
)
{
AVFrame
*
filtered_frame
=
NULL
;
AVFrame
*
filtered_frame
=
NULL
;
OutputStream
*
ost
=
&
output_streams
[
i
];
OutputStream
*
ost
=
&
output_streams
[
i
];
int
frame_size
;
if
(
!
check_output_constraints
(
ist
,
ost
)
||
!
ost
->
encoding_needed
)
if
(
!
check_output_constraints
(
ist
,
ost
)
||
!
ost
->
encoding_needed
)
continue
;
continue
;
...
@@ -2150,10 +2151,8 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
...
@@ -2150,10 +2151,8 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
filtered_frame
=
decoded_frame
;
filtered_frame
=
decoded_frame
;
#endif
#endif
do_video_out
(
output_files
[
ost
->
file_index
].
ctx
,
ost
,
ist
,
filtered_frame
,
&
frame_size
,
do_video_out
(
output_files
[
ost
->
file_index
].
ctx
,
ost
,
ist
,
filtered_frame
,
same_quant
?
quality
:
ost
->
st
->
codec
->
global_quality
);
same_quant
?
quality
:
ost
->
st
->
codec
->
global_quality
);
if
(
vstats_filename
&&
frame_size
)
do_video_stats
(
output_files
[
ost
->
file_index
].
ctx
,
ost
,
frame_size
);
#if CONFIG_AVFILTER
#if CONFIG_AVFILTER
cont:
cont:
avfilter_unref_buffer
(
ost
->
picref
);
avfilter_unref_buffer
(
ost
->
picref
);
...
...
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