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

Giorgio Vazzana mywing81 at gmail.com
Tue Dec 20 13:20:41 CET 2011


2011/12/20 Diego Biurrun <diego at biurrun.de>:
> 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?

It should work: I have tested it here, and I don't see any reason why
it would fail. After all FFmpeg uses a similar check for the encoder.
I have reduced it to one line, let me know if this is acceptable.

Giorgio Vazzana
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003_theora_new_api.diff
Type: text/x-patch
Size: 13968 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20111220/40183191/attachment.bin>


More information about the MPlayer-dev-eng mailing list