---
avconv.c | 53 +++++++++++++++++++++++++----------------------------
1 file changed, 25 insertions(+), 28 deletions(-)
To be squashed with the previous patch maybe.
diff --git a/avconv.c b/avconv.c
index f7c264a..50ec688 100644
--- a/avconv.c
+++ b/avconv.c
@@ -452,7 +452,7 @@ static void do_video_out(AVFormatContext *s,
AVFrame *in_picture,
int *frame_size)
{
- int ret, format_video_sync;
+ int ret, format_video_sync, got_packet;
AVPacket pkt;
AVCodecContext *enc = ost->enc_ctx;
@@ -488,40 +488,37 @@ static void do_video_out(AVFormatContext *s,
if (ost->frame_number >= ost->max_frames)
return;
- {
- int got_packet;
+ if (enc->flags & (AV_CODEC_FLAG_INTERLACED_DCT |
AV_CODEC_FLAG_INTERLACED_ME) &&
+ ost->top_field_first >= 0)
+ in_picture->top_field_first = !!ost->top_field_first;
- if (enc->flags & (AV_CODEC_FLAG_INTERLACED_DCT |
AV_CODEC_FLAG_INTERLACED_ME) &&
- ost->top_field_first >= 0)
- in_picture->top_field_first = !!ost->top_field_first;
-
- in_picture->quality = enc->global_quality;
- in_picture->pict_type = 0;
- if (ost->forced_kf_index < ost->forced_kf_count &&
- in_picture->pts >= ost->forced_kf_pts[ost->forced_kf_index]) {
- in_picture->pict_type = AV_PICTURE_TYPE_I;
- ost->forced_kf_index++;
- }
+ in_picture->quality = enc->global_quality;
+ in_picture->pict_type = 0;
+ if (ost->forced_kf_index < ost->forced_kf_count &&
+ in_picture->pts >= ost->forced_kf_pts[ost->forced_kf_index]) {
+ in_picture->pict_type = AV_PICTURE_TYPE_I;
+ ost->forced_kf_index++;
+ }
- ost->frames_encoded++;
+ ost->frames_encoded++;
- ret = avcodec_encode_video2(enc, &pkt, in_picture, &got_packet);
- if (ret < 0) {
- av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n");
- exit_program(1);
- }
+ ret = avcodec_encode_video2(enc, &pkt, in_picture, &got_packet);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n");
+ exit_program(1);
+ }
- if (got_packet) {
- av_packet_rescale_ts(&pkt, enc->time_base, ost->st->time_base);
- write_frame(s, &pkt, ost);
- *frame_size = pkt.size;
+ if (got_packet) {
+ av_packet_rescale_ts(&pkt, enc->time_base, ost->st->time_base);
+ write_frame(s, &pkt, ost);
+ *frame_size = pkt.size;
- /* if two pass, output log */
- if (ost->logfile && enc->stats_out) {
- fprintf(ost->logfile, "%s", enc->stats_out);
- }
+ /* if two pass, output log */
+ if (ost->logfile && enc->stats_out) {
+ fprintf(ost->logfile, "%s", enc->stats_out);
}
}
+
ost->sync_opts++;
/*
* For video, number of frames in == number of packets out.
--
2.5.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel