[FFmpeg-devel] [PATCH 2/4] avcodec/dvdsubdec: extract every subtitle in a different file (debug).

Timothy Gu timothygu99 at gmail.com
Sun Sep 29 23:38:19 CEST 2013


On Sep 29, 2013 2:28 PM, "Clément Bœsch" <u at pkh.me> wrote:
>
> Even thought a generic solution would be more relevant, this is
> currently helpful while debugging.
> ---
>  libavcodec/dvdsubdec.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
> index 83ed27e..5951892 100644
> --- a/libavcodec/dvdsubdec.c
> +++ b/libavcodec/dvdsubdec.c
> @@ -35,6 +35,9 @@ typedef struct DVDSubContext
>    int      has_palette;
>    uint8_t  colormap[4];
>    uint8_t  alpha[256];
> +#ifdef DEBUG
> +  int sub_id;
> +#endif
>  } DVDSubContext;
>
>  static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha,
uint32_t *rgba, int num_values)
> @@ -504,11 +507,16 @@ static int dvdsub_decode(AVCodecContext *avctx,
>          goto no_subtitle;
>
>  #if defined(DEBUG)
> +    {
> +    char ppm_name[32];
> +
> +    snprintf(ppm_name, sizeof ppm_name, "/tmp/%05d.ppm", ctx->sub_id++);

I'm a terrible C programmer and I might miss something, but shouldn't it be
sizeof(ppm_name)?

>      av_dlog(NULL, "start=%d ms end =%d ms\n",
>              sub->start_display_time,
>              sub->end_display_time);
> -    ppm_save("/tmp/a.ppm", sub->rects[0]->pict.data[0],
> +    ppm_save(ppm_name, sub->rects[0]->pict.data[0],
>               sub->rects[0]->w, sub->rects[0]->h,
sub->rects[0]->pict.data[1]);
> +    }
>  #endif
>
>      *data_size = 1;
> --
> 1.8.4
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list