[FFmpeg-devel] [PATCH] dvbsub fix transcoding

Anshul Maheshwari anshul.ffmpeg at gmail.com
Fri Jun 20 18:27:04 CEST 2014


On Fri, Jun 20, 2014 at 7:23 PM, Michael Niedermayer <michaelni at gmx.at>
wrote:

> On Fri, Jun 20, 2014 at 04:06:51PM +0530, anshul wrote:
> > On 06/16/2014 12:07 AM, Michael Niedermayer wrote:
> > >diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
> > >index e6e746d..c213524 100644
> > >--- a/libavcodec/dvbsubdec.c
> > >+++ b/libavcodec/dvbsubdec.c
> > >@@ -234,6 +234,9 @@ typedef struct DVBSubContext {
> > >
> > >      int version;
> > >      int time_out;
> > >+    int compute_edt; /**< if 1 end display time calculated using pts
> > >+                          if 0 (Default) calculated using pts */
> > >"using pts" in both cases is wrong
> > >
> > It was a typo corrected.
> > >>+    int64_t prev_start;
> > >>      DVBSubRegion *region_list;
> > >>      DVBSubCLUT   *clut_list;
> > >>      DVBSubObject *object_list;
> > >>@@ -771,7 +774,8 @@ static void save_subtitle_set(AVCodecContext
> *avctx, AVSubtitle *sub)
> > >>      int i;
> > >>      int offset_x=0, offset_y=0;
> > >>
> > >>-    sub->end_display_time = ctx->time_out * 1000;
> > >>+    if(ctx->compute_edt == 0)
> > >>+        sub->end_display_time = ctx->time_out * 1000;
> > >>
> > >>      if (display_def) {
> > >>          offset_x = display_def->x;
> > >>@@ -786,6 +790,8 @@ static void save_subtitle_set(AVCodecContext
> *avctx, AVSubtitle *sub)
> > >>      }
> > >>
> > >>      if (sub->num_rects > 0) {
> > >>+        if(ctx->compute_edt == 1 && ctx->prev_start)
> > >>
> > >prev_start == 0 is the wrong thing to check for here, 0 shouldnt be
> > >special, it could be a valid timestamp
> > >
> > changed it to AV_NOPTS
> > >>+            sub->end_display_time = av_rescale_q((sub->pts -
> ctx->prev_start )/90, AV_TIME_BASE_Q, avctx->time_base) - 1;
> > >the /90 looks wrong as well
> > >rescaling happen between 2 timebases, there should not be a 3rd factor
> > >dividing the input before av_rescale_q()
> > >
> > done
> > >>          sub->rects = av_mallocz_array(sizeof(*sub->rects),
> sub->num_rects);
> > >>          for(i=0; i<sub->num_rects; i++)
> > >>              sub->rects[i] = av_mallocz(sizeof(*sub->rects[i]));
> > >>@@ -837,6 +843,8 @@ static void save_subtitle_set(AVCodecContext
> *avctx, AVSubtitle *sub)
> > >>              i++;
> > >>          }
> > >>      }
> > >>+    if(ctx->compute_edt == 1)
> > >>+        FFSWAP(int64_t,ctx->prev_start,sub->pts);
> > >>  }
> > >>
> > >IIRC there can be "things" like for example differnent languages and
> > >for example the begin of the english subtitle doesnt signify the end
> > >of the previous german one
> > >
> > >also after this patch the "int *data_size," from the dvbsub_decode()
> > >function will be wrongly set
> > >
> > for different language different dvbcontext are made, because we do
> > not support
> > or have code for different language with same elementry stream id.
> > therefor no worry.
>
> >
> > *data_size was not set after this patch, but I think it is not set
> > correctly now or before
>
> data_size looks like it is set correctly before the patch but
> incorrectly afterwards
> data_size must be set to non zero when data is retured and 0 when not
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Opposition brings concord. Out of discord comes the fairest harmony.
> -- Heraclitus
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> new patch attached
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fix-transcoding-dvbsub-to-dvbsub.patch
Type: text/x-patch
Size: 5299 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140620/c8180c9e/attachment.bin>


More information about the ffmpeg-devel mailing list