[Ffmpeg-devel] Specifying codec restrictions

Michael Niedermayer michaelni
Sat Mar 4 15:29:58 CET 2006


Hi

On Sat, Mar 04, 2006 at 01:28:15PM +0000, M?ns Rullg?rd wrote:
> I've been thinking about this a bit, and I've come up with an idea:
> 
> typedef struct AVCodecRestriction {
>     AVRational framerate;
>     PixelFormat pixfmt;
>     int width;
>     int height;
>     int flags;
> } AVCodecRestriction;
> 
> #define FRAMERATE_ALL {0,0}
> #define FRAMERATE_ANY {1,0}
> #define RESOLUTION_ALL 0
> #define RESOLUTION_ANY -1
> #define PIXELFORMAT_ALL PIX_FMT_NONE
> #define PIXELFORMAT_ANY (PIX_FMT_NONE-1)
> 
> #define RESTRICTION_FLAG_WIDTH_MULTIPLE     1
> #define RESTRICTION_FLAG_HEIGHT_MULTIPLE    2
> #define RESTRICTION_FLAG_FRAMERATE_MULTIPLE 4
> 
> AVCodecRestriction mpeg2_restrictions[] = {
>     { {24000, 1001}, PIXELFORMAT_ANY, RESOLUTION_ALL, RESOLUTION_ALL, 0 },
>     { {   24,    1}, PIXELFORMAT_ANY, RESOLUTION_ALL, RESOLUTION_ALL, 0 },
>     { {   25,    1}, PIXELFORMAT_ANY, RESOLUTION_ALL, RESOLUTION_ALL, 0 },
>     { {30000, 1001}, PIXELFORMAT_ANY, RESOLUTION_ALL, RESOLUTION_ALL, 0 },
>     { {   30,    1}, PIXELFORMAT_ANY, RESOLUTION_ALL, RESOLUTION_ALL, 0 },
>     { {   50,    1}, PIXELFORMAT_ANY, RESOLUTION_ALL, RESOLUTION_ALL, 0 },
>     { {60000, 1001}, PIXELFORMAT_ANY, RESOLUTION_ALL, RESOLUTION_ALL, 0 },
>     { {   60,    1}, PIXELFORMAT_ANY, RESOLUTION_ALL, RESOLUTION_ALL, 0 },
>     { FRAMERATE_ANY, PIX_FMT_YUV420P, RESOLUTION_ALL, RESOLUTION_ALL, 0 },
> };
> 
> AVCodecRestriction h263_restrictions[] = {
>     { FRAME_RATE_ALL, PIX_FMT_YUV420P, 4, 4,
>       RESTRICTION_FLAG_WIDTH_MULTIPLE | RESTRICTION_FLAG_HEIGHT_MULTIPLE }
> };
> 
> AVCodecRestriction dv_restrictions[] = {
>     { {30000, 1001}, PIX_FMT_YUV411P, 720, 480, 0 },
>     { {   25,    1}, PIX_FMT_YUV420P, 720, 576, 0 },
> };
> 
> Does this make any sense at all?  Some more parameters should probably
> be added (SAR, audio stuff), and the constant names could be abbreviated.
> 
> Comments welcome.

it does make sense, but its quite complicated, i tried to come up with a more
generic or simpler system but sadly i was not too successfull, maybe

simply a flag which switches between dependant/indepandant values would be
enough?

so that

for mpeg:
supported_framerates   ={{24000, 1001}, {   24,    1}, ..., INDEPENDANT_END};
supported_pix_fmts     ={PIX_FMT_YUV420P, INDEPENDANT_END};
supported_resolutions  ={INDEPENDANT_END};

for h.263
supported_framerates   ={INDEPENDANT_END};
supported_pix_fmts     ={PIX_FMT_YUV420P, INDEPENDANT_END};
supported_resolutions  ={{-4,-4}, INDEPENDANT_END};

for dv
supported_framerates   ={{30000, 1001}  , {   25,    1}  , DEPENDANT_END};
supported_pix_fmts     ={PIX_FMT_YUV411P, PIX_FMT_YUV420P, DEPENDANT_END};
supported_resolutions  ={{720, 480}     , {720, 576}     , DEPENDANT_END};

[...]

-- 
Michael





More information about the ffmpeg-devel mailing list