[MPlayer-dev-eng] [PATCH] dvdnav: osd show audio and spu lang code

Nico Sabbi nicola_sabbi at fastwebnet.it
Sun Dec 10 18:35:48 CET 2006


Ötvös Attila wrote:
> Hi All!
> 
> Comment?

yes: what about adding a description of the code when you post a patch?

> 
> Best regards.
> Attila
> 
> 
> ------------------------------------------------------------------------
> 
> --- mplayer.c	2006-12-10 12:20:33.000000000 +0100
> +++ mplayer.c	2006-12-10 15:08:59.000000000 +0100
> @@ -1848,7 +1848,7 @@
>              if (demuxer->type == DEMUXER_TYPE_MATROSKA)
>                  demux_mkv_get_audio_lang(demuxer, audio_id, lang, 9);
>  #ifdef USE_DVDREAD
> -            else {
> +            if (demuxer->type != DEMUXER_TYPE_MATROSKA && stream->type==STREAMTYPE_DVD) {
>                  int code = dvd_lang_from_aid(stream, audio_id);
>                  if (code) {
>                      lang[0] = code >> 8;
> @@ -1857,6 +1857,16 @@
>                  }
>              }
>  #endif
> +#ifdef USE_DVDNAV
> +            if (demuxer->type != DEMUXER_TYPE_MATROSKA && stream->type==STREAMTYPE_DVDNAV) {
> +                int code = dvdnav_lang_from_aid(stream, audio_id);
> +                if (code) {
> +                    lang[0] = code >> 8;
> +                    lang[1] = code;
> +                    lang[2] = 0;
> +                }
> +            }
> +#endif
>              *(char**)arg = malloc(64);
>              snprintf(*(char**)arg, 64, "(%d) %s", audio_id, lang);
>          }
> @@ -2263,7 +2273,7 @@
>              return M_PROPERTY_OK;
>          }
>  #ifdef USE_DVDREAD
> -        if (vo_spudec && dvdsub_id >= 0) {
> +        if (vo_spudec && dvdsub_id >= 0 && stream->type==STREAMTYPE_DVD) {
>              char lang[3];
>              int code = dvd_lang_from_sid(stream, dvdsub_id);
>                  lang[0] = code >> 8;
> @@ -2274,6 +2284,18 @@
>              return M_PROPERTY_OK;
>          }
>  #endif
> +#ifdef USE_DVDNAV
> +        if (vo_spudec && dvdsub_id >= 0 && stream->type==STREAMTYPE_DVDNAV) {
> +            char lang[3];
> +            int code = dvdnav_lang_from_sid(stream, dvdsub_id);
> +                lang[0] = code >> 8;
> +                lang[1] = code;
> +                lang[2] = 0;
> +            snprintf(*(char**)arg, 63, "(%d) %s",
> +                     dvdsub_id, lang);
> +            return M_PROPERTY_OK;
> +        }
> +#endif


committed in a simplified form


>          if (dvdsub_id >= 0) {
>              snprintf(*(char**)arg, 63, "(%d) %s", dvdsub_id, MSGTR_Unknown);
>              return M_PROPERTY_OK;
> --- stream/stream_dvdnav.h	2006-12-10 12:19:58.000000000 +0100
> +++ stream/stream_dvdnav.h	2006-12-10 16:12:31.000000000 +0100
> @@ -31,6 +31,8 @@
>  
>  int dvdnav_number_of_subs(stream_t *stream);
>  int dvdnav_sid_from_lang(stream_t *stream, unsigned char *language);
> +int dvdnav_lang_from_aid(stream_t *stream, int aid);
> +int dvdnav_lang_from_sid(stream_t *stream, int sid);
>  int mp_dvdnav_handle_input(stream_t *stream, int cmd, int *button);
>  void mp_dvdnav_update_mouse_pos(stream_t *stream, int32_t x, int32_t y, int* button);
>  void mp_dvdnav_get_highlight (stream_t *stream, nav_highlight_t *hl);
> --- stream/stream_dvdnav.c	2006-12-10 12:19:58.000000000 +0100
> +++ stream/stream_dvdnav.c	2006-12-10 16:10:24.000000000 +0100
> @@ -499,6 +499,27 @@
>    return -1;
>  }
>  
> +int dvdnav_lang_from_aid(stream_t *stream, int aid) {
> +    uint8_t lg;
> +    uint16_t lang;
> +    dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv;
> +    lg = dvdnav_get_audio_logical_stream(priv->dvdnav, aid & 0x1F);
> +    if(lg == 0xff) return 0;
> +    lang = dvdnav_audio_stream_to_lang(priv->dvdnav, lg);
> +    if(lang == 0xffff) return 0;
> +    return lang;
> +}

there's no 1:1 mappinf between aid and dvdnav's audio logical id;
rejected

> +
> +int dvdnav_lang_from_sid(stream_t *stream, int sid) {
> +    uint8_t lg;
> +    uint16_t lang;
> +    dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv;
> +    lg = dvdnav_get_spu_logical_stream(priv->dvdnav, sid);
> +    if(lg == 0xff) return 0;
> +    lang = dvdnav_spu_stream_to_lang(priv->dvdnav, lg);
> +    if(lang == 0xffff) return 0;
> +    return lang;
> +}
>  /**
>   * \brief dvdnav_number_of_subs() returns the count of available subtitles
>   * \param stream: - stream pointer
> 

applied this one

-- 
"Without a frontend, mplayer is useless" - someone in mplayer-users




More information about the MPlayer-dev-eng mailing list