Browse code

Fail earlier for unsupported resolutions or pixel formats when encoding dv.

Patch by Tomas Härdin, tomas D hardin A codemill D se

Originally committed as revision 20803 to svn://svn.ffmpeg.org/ffmpeg/trunk

Tomas Härdin authored on 2009/12/12 08:56:49
Showing 1 changed files
... ...
@@ -398,6 +398,17 @@ static av_cold int dvvideo_init(AVCodecContext *avctx)
398 398
     return 0;
399 399
 }
400 400
 
401
+static av_cold int dvvideo_init_encoder(AVCodecContext *avctx)
402
+{
403
+    if (!ff_dv_codec_profile(avctx)) {
404
+        av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video\n",
405
+               avctx->width, avctx->height, avcodec_get_pix_fmt_name(avctx->pix_fmt));
406
+        return -1;
407
+    }
408
+
409
+    return dvvideo_init(avctx);
410
+}
411
+
401 412
 // #define VLC_DEBUG
402 413
 // #define printf(...) av_log(NULL, AV_LOG_ERROR, __VA_ARGS__)
403 414
 
... ...
@@ -1326,7 +1337,7 @@ AVCodec dvvideo_encoder = {
1326 1326
     CODEC_TYPE_VIDEO,
1327 1327
     CODEC_ID_DVVIDEO,
1328 1328
     sizeof(DVVideoContext),
1329
-    dvvideo_init,
1329
+    dvvideo_init_encoder,
1330 1330
     dvvideo_encode_frame,
1331 1331
     .pix_fmts  = (const enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, PIX_FMT_NONE},
1332 1332
     .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),