Mercurial > libavcodec.hg
comparison dv.c @ 10675:03d02e21b432 libavcodec
Fail earlier for unsupported resolutions or pixel formats when encoding
dv.
Patch by Tomas H¸«£rdin, tomas D hardin A codemill D se
author | cehoyos |
---|---|
date | Fri, 11 Dec 2009 23:56:49 +0000 |
parents | 9f16f997c41b |
children | d1ddb9a28c47 |
comparison
equal
deleted
inserted
replaced
10674:f04468776158 | 10675:03d02e21b432 |
---|---|
394 avctx->coded_frame = &s->picture; | 394 avctx->coded_frame = &s->picture; |
395 s->avctx = avctx; | 395 s->avctx = avctx; |
396 avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; | 396 avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; |
397 | 397 |
398 return 0; | 398 return 0; |
399 } | |
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); | |
399 } | 410 } |
400 | 411 |
401 // #define VLC_DEBUG | 412 // #define VLC_DEBUG |
402 // #define printf(...) av_log(NULL, AV_LOG_ERROR, __VA_ARGS__) | 413 // #define printf(...) av_log(NULL, AV_LOG_ERROR, __VA_ARGS__) |
403 | 414 |
1324 AVCodec dvvideo_encoder = { | 1335 AVCodec dvvideo_encoder = { |
1325 "dvvideo", | 1336 "dvvideo", |
1326 CODEC_TYPE_VIDEO, | 1337 CODEC_TYPE_VIDEO, |
1327 CODEC_ID_DVVIDEO, | 1338 CODEC_ID_DVVIDEO, |
1328 sizeof(DVVideoContext), | 1339 sizeof(DVVideoContext), |
1329 dvvideo_init, | 1340 dvvideo_init_encoder, |
1330 dvvideo_encode_frame, | 1341 dvvideo_encode_frame, |
1331 .pix_fmts = (const enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, PIX_FMT_NONE}, | 1342 .pix_fmts = (const enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, PIX_FMT_NONE}, |
1332 .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"), | 1343 .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"), |
1333 }; | 1344 }; |
1334 #endif // CONFIG_DVVIDEO_ENCODER | 1345 #endif // CONFIG_DVVIDEO_ENCODER |