[Ffmpeg-devel] [Patch] DVB Subtitle decoder

Michael Niedermayer michaelni
Mon Jul 11 00:50:12 CEST 2005


Hi

On Saturday 09 July 2005 01:00, Ian Caulfield wrote:
> On Fri, 8 Jul 2005, Ian Caulfield wrote:
> > On Fri, 8 Jul 2005, Nico Sabbi wrote:
> >> Ian Caulfield wrote:
> >>> Hi,
> >>>
> >>> The attached patch adds a DVB subtitle decoder. I've had to fiddle the
> >>> AVSubtitle struct to get it to work efficiently; the patch includes
> >>> tweaks to the existing subtitle code. I've also fiddled slightly with
> >>> the mpegts parser to allow it to detect DVB subtitles.
> >>>
> >>> Issues still outstanding:
> >>>  - The 'end_display_time' is currently inaccurate - it gives the page
> >>>    timeout rather than the time it is replaced by the next subtitle
> >>>  - The parser is a bit of a hack to reassemble PES packets. I welcome
> >>>    suggestions of better ways to implement it
> >>>  - If there are multiple subtitle streams on one PID, only one will be
> >>>    decoded. To fix this it is necessary to associate more than one
> >>>    AVStream with a pid - not sure how to do this.
> >>>
> >>> Please let me know if you have any comments/suggestions.
> >>
> >> Can you upload a sample to www.mplayerhq.hu/MPlayer/incoming please?
> >
> > By sample, do you mean the patch files or a sample file it can decode?
>
> Never mind, uploading sample dvbsubtest.ts now.
>
> Also, have spotted a typo in the code (don't edit code that's #ifdef'ed
> out!) - new source file reattached.

> static uint16_t getbe16(const uint8_t *p)
> {
>     return (p[0] << 8) | p[1];
> }

why not use BE_16() ?


> static unsigned char cropTbl[256 + 2 * MAX_NEG_CROP];

code duplication, this already exists in dsputil.*


>     while (ptr != NULL) {
>         ptr = ptr->next;
>     }
>
>     ptr = first;

the while loop above seems useless


>     while (ptr != NULL && ptr->id != object_id) {
>         ptr = ptr->next;
>     }
>   
>     if (ptr != NULL && ptr->id == object_id)
>         return ptr;
>        
>     return NULL;

the 'if(...)' and the 'return NULL;' are useless too


>                   if (obj2 != object)
>                        abort();

libavcodec is a library, you cannot just call abort() in a lib


> static int get_bits(int num, uint8_t **srcbuf, uint8_t *sbuf_end, int 
*bit_pos)

why dont you use bitstream.c/h?

[...]
-- 
Michael





More information about the ffmpeg-devel mailing list