[theora-dev] FFmpeg Theora encoding patch
Paul Richards
paul.richards at gmail.com
Thu Feb 1 01:09:46 PST 2007
In AVCodecContext the time_base gives the time period between frames.
In theora_info they want the frame rate.. These are the inverse of
each other. :)
I perhaps should have put a little comment there.
On 01/02/07, Eric Dantan Rzewnicki <eric at zhevny.com> wrote:
> 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.
>
--
Paul Richards
More information about the theora-dev
mailing list