[theora-dev] FFmpeg Theora encoding patch

Eric Dantan Rzewnicki eric at zhevny.com
Wed Jan 31 21:40:19 PST 2007


On Sat, Jan 06, 2007 at 03:51:28PM +0000, Paul Richards wrote:
> Hi,
> ===================================================================
> +static int encode_init(AVCodecContext* avc_context)
> +{
> +    theora_info t_info;
> +    theora_comment t_comment;
> +    ogg_packet o_packet;
> +    unsigned int offset;
> +    TheoraContext *h = avc_context->priv_data;
> +
> +    /** Check pixel format contraints */
> +    if (check_constraints(avc_context) != 0) {
> +        return -1;
> +    }
> +    
> +    /** Set up the theora_info struct */
> +    theora_info_init( &t_info );
> +    t_info.width = avc_context->width;
> +    t_info.height = avc_context->height;
> +    t_info.frame_width = avc_context->width;
> +    t_info.frame_height = avc_context->height;
> +    t_info.offset_x = 0;
> +    t_info.offset_y = 0;
> +    t_info.fps_numerator = avc_context->time_base.den;
> +    t_info.fps_denominator = avc_context->time_base.num;

This is a naive and probably dumb question ... but why do you flip the
numerator and denominator here?

> +    if (avc_context->sample_aspect_ratio.num != 0) {
> +        t_info.aspect_numerator = avc_context->sample_aspect_ratio.num;
> +        t_info.aspect_denominator = avc_context->sample_aspect_ratio.den;
> +    } else {
> +        t_info.aspect_numerator = 1;
> +        t_info.aspect_denominator = 1;


-Eric Rz.


More information about the theora-dev mailing list