[MPlayer-dev-eng] [PATCH] Port codebase to Theora 1.0 API

Diego Biurrun diego at biurrun.de
Tue Dec 20 12:05:31 CET 2011


On Fri, Dec 16, 2011 at 09:02:41PM +0100, Giorgio Vazzana wrote:
> 2011/12/16 Diego Biurrun <diego at biurrun.de>:
> >> -  memset(&op, 0, sizeof(op));
> >> -  r = theora_decode_header(&inf, &tc, &op);
> >> -  r = theora_decode_init(&st, &inf);
> >> -  t = theora_granule_time(&st, op.granulepos);
> >> -  r = theora_decode_packetin(&st, &op);
> >> -  r = theora_decode_YUVout(&st, &yuv);
> >> -  theora_clear(&st);
> >> -
> >> -  return 0;
> >> +  r = th_decode_headerin(&ti, &tc, &tsi, &op);
> >> +  tctx = th_decode_alloc(&ti, tsi);
> >> +  th_setup_free(tsi);
> >> +  t = th_granule_time(tctx, op.granulepos);
> >> +  r = th_decode_packetin(tctx, &op, NULL);
> >> +  r = th_decode_ycbcr_out(tctx, ycbcrbuf);
> >> +  th_decode_free(tctx);
> >
> > .. I wonder why the Theora check has to be so complicated to begin
> > with when 90% of the other codec library checks can be accomplished
> > with a simple function invocation.
> 
> Yes, to be honest I wondered why the configure script had such a
> complicate check in the first place too, but I didn't want to make too
> many changes in one patch.
> Anyway, in my opinion it's not necessary to include all that code,
> this can be simplified a lot: we just need to include the header, call
> a decode initialization function, and make sure that compiling and
> linking go well. See then new patch attached.

I think we can simplify it even further.

> --- configure	(revision 34447)
> +++ configure	(working copy)
> @@ -6234,53 +6234,35 @@
>  if test "$_theora" = auto ; then
>    _theora=no
>      cat > $TMPC << EOF
> +#include <theora/theoradec.h>
>  int main(void) {
> +  th_info ti;
> +  th_setup_info *tsi = NULL;
> +  th_dec_ctx *tctx;
> +  th_info_init(&ti);
> +  tctx = th_decode_alloc(&ti, tsi);
> +  th_setup_free(tsi);
>    return 0;
>  }
>  EOF

Do we need such a complex check?  Isn't just calling 

  th_info_init(NULL);

enough?

Diego


More information about the MPlayer-dev-eng mailing list