[FFmpeg-devel] [PATCH/RFC] Make dvvideo encoder less lenient wrt resolution and pixel format

Michael Niedermayer michaelni
Fri Dec 11 13:29:04 CET 2009


On Fri, Dec 11, 2009 at 09:17:49AM +0100, Tomas H?rdin wrote:
> Good morning
> 
> I've been using FFmpeg for a while and noticed somewhat recently that
> the dvvideo encoder accepts any resolution or pixel format in
> dvvideo_init(), which later might cause dvvideo_encode_frame() to fail.
> I believe this behavior is wrong since most other encoders are quite
> strict about which settings are allowed when they're opened - for
> instance h261 and h263.
> 
> The only reason I can see for not performing this check is if one is
> encoding to a container which allows switching DV profile mid-stream,
> which means supporting local headers, resolution changes and frame rate
> changes, which some containers might. However, this assumes the user
> does not know a valid resolution/pixel format combination with which to
> open the encoder in the first place. I find it unlikely that this would
> be the case very often.
> 
> Anyway, I've pasted a simple patch at the end of this message which adds
> a simple check in a separate init function for the encoder to correct
> this behavior. Please comment or simply merge.
> 
> Thanks for listening
> 
> /Tomas H?rdin
> 
> 
> 
> Index: libavcodec/dv.c
> ===================================================================
> --- libavcodec/dv.c	(revision 20796)
> +++ libavcodec/dv.c	(working copy)
> @@ -398,6 +398,15 @@
>      return 0;
>  }
>  
> +static av_cold int dvvideo_init_encoder(AVCodecContext *avctx) {
> +    if(!ff_dv_codec_profile(avctx)) {
> +        av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s
> video\n", avctx->width, avctx->height,
> avcodec_get_pix_fmt_name(avctx->pix_fmt));

retry without putting newlines in the middle of patches

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091211/72a49f03/attachment.pgp>



More information about the ffmpeg-devel mailing list