summaryrefslogtreecommitdiff
path: root/avconv.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-11 02:23:55 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-11 02:44:43 +0100
commit0e7fc3cafe838b32c3af73954acf9de2f9240ffd (patch)
treef0c534b98818c2712dbeed7f08b4ba831e0de23d /avconv.c
parenta9bd29e15e8d4ab4afaba7c31ebc0063c1df2db9 (diff)
parent9472d37d8e137df1e78e973b8b0e0d5607a799d5 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits) rv34: frame-level multi-threading mpegvideo: claim ownership of referenced pictures aacsbr: prevent out of bounds memcpy(). ipmovie: fix pts for CODEC_ID_INTERPLAY_DPCM sierravmd: fix audio pts bethsoftvideo: Use bytestream2 functions to prevent buffer overreads. bmpenc: support for PIX_FMT_RGB444 swscale: fix crash in fast_bilinear code when compiled with -mred-zone. swscale: specify register type. rv34: use get_bits_left() avconv: reinitialize the filtergraph on resolution change. vsrc_buffer: error on changing frame parameters. avconv: fix -copyinkf. fate: Update file checksums after the mov muxer change in a78dbada55d6 movenc: Don't store a nonzero creation time if nothing was set by the caller bmpdec: support for rgb444 with bitfields compression rgb2rgb: allow conversion for <15 bpp doc: fix stray reference to FFmpeg v4l2: use C99 struct initializer v4l2: poll the file descriptor ... Conflicts: avconv.c libavcodec/aacsbr.c libavcodec/bethsoftvideo.c libavcodec/kmvc.c libavdevice/v4l2.c libavfilter/vsrc_buffer.c libswscale/swscale_unscaled.c libswscale/x86/input.asm tests/ref/acodec/alac tests/ref/acodec/pcm_s16be tests/ref/acodec/pcm_s24be tests/ref/acodec/pcm_s32be tests/ref/acodec/pcm_s8 tests/ref/lavf/mov tests/ref/vsynth1/dnxhd_1080i tests/ref/vsynth1/mpeg4 tests/ref/vsynth1/qtrle tests/ref/vsynth1/svq1 tests/ref/vsynth2/dnxhd_1080i tests/ref/vsynth2/mpeg4 tests/ref/vsynth2/qtrle tests/ref/vsynth2/svq1 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'avconv.c')
-rw-r--r--avconv.c49
1 files changed, 35 insertions, 14 deletions
diff --git a/avconv.c b/avconv.c
index 9fae43a5c2..5f0422cc5d 100644
--- a/avconv.c
+++ b/avconv.c
@@ -638,7 +638,6 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost)
if ((ret = avfilter_graph_parse(ost->graph, ost->avfilter, &inputs, &outputs, NULL)) < 0)
return ret;
- av_freep(&ost->avfilter);
} else {
if ((ret = avfilter_link(last_filter, 0, ost->output_video_filter, 0)) < 0)
return ret;
@@ -767,6 +766,10 @@ void exit_program(int ret)
bsfc = next;
}
output_streams[i].bitstream_filters = NULL;
+
+#if CONFIG_AVFILTER
+ av_freep(&output_streams[i].avfilter);
+#endif
}
for (i = 0; i < nb_input_files; i++) {
avformat_close_input(&input_files[i].ctx);
@@ -1302,6 +1305,7 @@ static void do_subtitle_out(AVFormatContext *s,
static int bit_buffer_size = 1024 * 256;
static uint8_t *bit_buffer = NULL;
+#if !CONFIG_AVFILTER
static void do_video_resample(OutputStream *ost,
InputStream *ist,
AVFrame *in_picture,
@@ -1316,7 +1320,6 @@ static void do_video_resample(OutputStream *ost,
ost->resample_height != dec->height ||
ost->resample_pix_fmt != dec->pix_fmt;
-#if !CONFIG_AVFILTER
if (resample_changed) {
av_log(NULL, AV_LOG_INFO,
"Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
@@ -1332,6 +1335,7 @@ static void do_video_resample(OutputStream *ost,
dec->height != enc->height ||
dec->pix_fmt != enc->pix_fmt;
+
if (ost->video_resample) {
*out_picture = &ost->resample_frame;
if (!ost->img_resample_ctx || resample_changed) {
@@ -1357,21 +1361,13 @@ static void do_video_resample(OutputStream *ost,
sws_scale(ost->img_resample_ctx, in_picture->data, in_picture->linesize,
0, ost->resample_height, (*out_picture)->data, (*out_picture)->linesize);
}
-#else
- if (resample_changed) {
- avfilter_graph_free(&ost->graph);
- if (configure_video_filters(ist, ost)) {
- av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\n");
- exit_program(1);
- }
- }
-#endif
if (resample_changed) {
ost->resample_width = dec->width;
ost->resample_height = dec->height;
ost->resample_pix_fmt = dec->pix_fmt;
}
}
+#endif
static void do_video_out(AVFormatContext *s,
@@ -1426,7 +1422,11 @@ static void do_video_out(AVFormatContext *s,
if (nb_frames <= 0)
return;
+#if !CONFIG_AVFILTER
do_video_resample(ost, ist, in_picture, &final_picture);
+#else
+ final_picture = in_picture;
+#endif
/* duplicates frame if needed */
for (i = 0; i < nb_frames; i++) {
@@ -2012,12 +2012,33 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
for (i = 0; i < nb_output_streams; i++) {
OutputStream *ost = &output_streams[i];
- int frame_size;
+ int frame_size, resample_changed;
if (!check_output_constraints(ist, ost) || !ost->encoding_needed)
continue;
#if CONFIG_AVFILTER
+ resample_changed = ost->resample_width != decoded_frame->width ||
+ ost->resample_height != decoded_frame->height ||
+ ost->resample_pix_fmt != decoded_frame->format;
+ if (resample_changed) {
+ av_log(NULL, AV_LOG_INFO,
+ "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
+ ist->file_index, ist->st->index,
+ ost->resample_width, ost->resample_height, av_get_pix_fmt_name(ost->resample_pix_fmt),
+ decoded_frame->width, decoded_frame->height, av_get_pix_fmt_name(decoded_frame->format));
+
+ avfilter_graph_free(&ost->graph);
+ if (configure_video_filters(ist, ost)) {
+ av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\n");
+ exit_program(1);
+ }
+
+ ost->resample_width = decoded_frame->width;
+ ost->resample_height = decoded_frame->height;
+ ost->resample_pix_fmt = decoded_frame->format;
+ }
+
if (!decoded_frame->sample_aspect_ratio.num)
decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio;
decoded_frame->pts = ist->pts;
@@ -3736,13 +3757,13 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
ost->top_field_first = -1;
MATCH_PER_STREAM_OPT(top_field_first, i, ost->top_field_first, oc, st);
- MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i, ost->copy_initial_nonkeyframes, oc ,st);
-
#if CONFIG_AVFILTER
MATCH_PER_STREAM_OPT(filters, str, filters, oc, st);
if (filters)
ost->avfilter = av_strdup(filters);
#endif
+ } else {
+ MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i, ost->copy_initial_nonkeyframes, oc ,st);
}
return ost;