ffmpeg.c: transcode_video(): do not go through filter network if encoding is not...
authorNicolas Noirbent <nicolas.noirbent@smartjog.com>
Fri, 13 Jan 2012 08:58:16 +0000 (09:58 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 13 Jan 2012 14:57:34 +0000 (15:57 +0100)
This fixes a segmentation fault when doing a transcoding and a stream
copy of the same input stream at the same time, e.g.:

ffmpeg -i in.mkv -c:v mpeg2video transcode.m2v -c copy copy.ts

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ffmpeg.c

index 085bb00..2ee4032 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2078,7 +2078,7 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
     frame_sample_aspect= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, "sample_aspect_ratio");
     for(i=0;i<nb_output_streams;i++) {
         OutputStream *ost = ost = &output_streams[i];
-        if(check_output_constraints(ist, ost)){
+        if(check_output_constraints(ist, ost) && ost->encoding_needed){
             if (!frame_sample_aspect->num)
                 *frame_sample_aspect = ist->st->sample_aspect_ratio;
             decoded_frame->pts = ist->pts;