[FFmpeg-devel] [PATCH/RFC] Fix dvbsub framing inconsistencies/add dvbsub bsf

Tomas Härdin tomas.hardin
Thu Sep 30 13:43:12 CEST 2010


On Wed, 2010-09-29 at 19:34 +0200, Reimar D?ffinger wrote:
> On Tue, Sep 28, 2010 at 01:50:40PM +0200, Tomas H?rdin wrote:
> > diff --git a/libavcodec/dvbsub.c b/libavcodec/dvbsub.c
> > index ea55cae..08e05d4 100644
> > --- a/libavcodec/dvbsub.c
> > +++ b/libavcodec/dvbsub.c
> > @@ -208,6 +208,7 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s,
> >      if (h->num_rects == 0 || h->rects == NULL)
> >          return -1;
> >  
> > +    *q++ = 0x20; /* data_identifier */
> >      *q++ = 0x00; /* subtitle_stream_id */
> 
> > @@ -1429,7 +1429,8 @@ static int dvbsub_decode(AVCodecContext *avctx,
> >      if (buf_size <= 2)
> >          return -1;
> >  
> > -    p = buf;
> > +    //skip data_identifier and subtitle_stream_id
> > +    p = buf + 2;
> 
> I guess it might be useful to set/query the subtitle_stream_id, though
> I admit that's a separate issue.
> But please add a space between // and the text.

Done

> Otherwise I think it's ok, however I suspect this change might cause
> issue with applications that use their own demuxer with the dvb subtitle
> decoder, no idea if that is likely to be a real issue and whether
> we should try to do something about it...

For that case I made it check that the packet is in PES format, log an
error and fail.

I also noticed the decoder failed due to the last check in the function.
Adjusting p_end back one byte fixed that problem. That check should
probably just print a warning instead of erroring out, or at least print
an error instead of a debug message.

With the attached patch, the following works:

* Remuxing
* Decoding (both original and remuxed file)

Issues:

* Need -copyinkf when remuxing. Demuxer problably needs a strategic
patch

* Transcoding dvbsub -> dvbsub doesn't work (didn't before either).
Every other packet in my sample is a "stop displaying last sub" packet,
which gives sub->num_rects == 0 which lavc refuses to encode. Not sure
how to handle this

/Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dvbsub_option_4_2.patch
Type: text/x-patch
Size: 9152 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100930/4645e6a6/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100930/4645e6a6/attachment.pgp>



More information about the ffmpeg-devel mailing list