Browse code

ffprobe: only decode frame if the codec is available

Fix crash when a stream codec is unknown, in particular fix trac
ticket #1243.

Stefano Sabatini authored on 2012/07/15 22:56:02
Showing 1 changed files
... ...
@@ -1661,6 +1661,7 @@ static av_always_inline int get_decoded_frame(AVFormatContext *fmt_ctx,
1661 1661
     int ret = 0;
1662 1662
 
1663 1663
     *got_frame = 0;
1664
+    if (dec_ctx->codec) {
1664 1665
     switch (dec_ctx->codec_type) {
1665 1666
     case AVMEDIA_TYPE_VIDEO:
1666 1667
         ret = avcodec_decode_video2(dec_ctx, frame, got_frame, pkt);
... ...
@@ -1670,6 +1671,7 @@ static av_always_inline int get_decoded_frame(AVFormatContext *fmt_ctx,
1670 1670
         ret = avcodec_decode_audio4(dec_ctx, frame, got_frame, pkt);
1671 1671
         break;
1672 1672
     }
1673
+    }
1673 1674
 
1674 1675
     return ret;
1675 1676
 }