[FFmpeg-devel] [PATCH] dvbsub fix transcoding

Michael Niedermayer michaelni at gmx.at
Fri Jun 20 15:53:28 CEST 2014


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140620/8c0de634/attachment.asc>


More information about the ffmpeg-devel mailing list