[MPlayer-dev-eng] [PATCH] add support for subtitles thru lavf

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Jul 14 10:16:09 CEST 2007


Hello,
On Sat, Jul 14, 2007 at 12:23:29AM +0200, Aurelien Jacobs wrote:
[...]
> -#ifdef USE_LIBAVFORMAT
> -	if (mpctx->demuxer->type == DEMUXER_TYPE_LAVF && dvdsub_id >= 0) {
> -	    char *lang = demux_lavf_sub_lang(mpctx->demuxer, dvdsub_id);
> -	    snprintf(*(char **) arg, 63, "(%d) %s", dvdsub_id, lang);
> -	    return M_PROPERTY_OK;
> +    if (dvdsub_id >= 0) {
> +        char lang[4];
> +        if (demux_control(mpctx->demuxer, DEMUXER_CTRL_GET_SUB_LANG,
> +                          lang) == DEMUXER_CTRL_OK) {
> +            snprintf(*(char **) arg, 63, "(%d) %s", dvdsub_id, lang);
> +            return M_PROPERTY_OK;
> +        }

Indentation does not match surrounding or previous code (old codec uses
tabs).

> Index: libmpdemux/demuxer.h
> ===================================================================
> --- libmpdemux/demuxer.h	(revision 23777)
> +++ libmpdemux/demuxer.h	(working copy)
> @@ -81,6 +81,7 @@
>  #define DEMUXER_CTRL_RESYNC 13
>  #define DEMUXER_CTRL_SWITCH_VIDEO 14
>  #define DEMUXER_CTRL_IDENTIFY_PROGRAM 15
> +#define DEMUXER_CTRL_GET_SUB_LANG 16

Please document the argument. I think it must be a pointer to a buffer
of size 4 and it must be filled with a zero-terminated string by the
demuxer.
Maybe adding and using wrapper function in demuxer.c that e.g. ensures
zero-termination or maybe sets it to some default if the control isn't
implemented would be nice?

Greetings,
Reimar Döffinger



More information about the MPlayer-dev-eng mailing list