[MPlayer-cvslog] r26115 - in trunk: command.c libmpdemux/demux_lavf.c libmpdemux/demux_mkv.c libmpdemux/matroska.h

eugeni subversion at mplayerhq.hu
Fri Feb 29 18:25:37 CET 2008


Author: eugeni
Date: Fri Feb 29 18:25:37 2008
New Revision: 26115

Log:
Fill sh_audio_t.lang in lavf and mkv demuxers. Use it for printing audio track
language when available.


Modified:
   trunk/command.c
   trunk/libmpdemux/demux_lavf.c
   trunk/libmpdemux/demux_mkv.c
   trunk/libmpdemux/matroska.h

Modified: trunk/command.c
==============================================================================
--- trunk/command.c	(original)
+++ trunk/command.c	Fri Feb 29 18:25:37 2008
@@ -810,8 +810,9 @@ static int mp_property_audio(m_option_t 
 	    *(char **) arg = strdup(MSGTR_Disabled);
 	else {
 	    char lang[40] = MSGTR_Unknown;
-	    if (mpctx->demuxer->type == DEMUXER_TYPE_MATROSKA)
-		demux_mkv_get_audio_lang(mpctx->demuxer, audio_id, lang, 9);
+            sh_audio_t* sh = mpctx->sh_audio;
+            if (sh && sh->lang)
+                av_strlcpy(lang, sh->lang, 40);
 #ifdef USE_DVDREAD
 	    else if (mpctx->stream->type == STREAMTYPE_DVD) {
 		int code = dvd_lang_from_aid(mpctx->stream, audio_id);

Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c	(original)
+++ trunk/libmpdemux/demux_lavf.c	Fri Feb 29 18:25:37 2008
@@ -335,6 +335,8 @@ static void handle_stream(demuxer_t *dem
                     sh_audio->format = 0x7;
                     break;
             }
+            if (st->language)
+              sh_audio->lang = strdup(st->language);
             if(mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf, MSGL_V);
             if((audio_lang && st->language[0] && !strncmp(audio_lang, st->language, 3))
                 || (demuxer->audio->id == i || demuxer->audio->id == -1)) {

Modified: trunk/libmpdemux/demux_mkv.c
==============================================================================
--- trunk/libmpdemux/demux_mkv.c	(original)
+++ trunk/libmpdemux/demux_mkv.c	Fri Feb 29 18:25:37 2008
@@ -1873,6 +1873,8 @@ demux_mkv_open_audio (demuxer_t *demuxer
   if(!sh_a) return 1;
   mkv_d->audio_tracks[mkv_d->last_aid] = track->tnum;
 
+  if (track->language && (strcmp(track->language, "und") != 0))
+    sh_a->lang = strdup(track->language);
   sh_a->ds = demuxer->audio;
   sh_a->wf = malloc (sizeof (WAVEFORMATEX));
   if (track->ms_compat && (track->private_size >= sizeof(WAVEFORMATEX)))
@@ -3502,27 +3504,6 @@ demux_mkv_get_sub_lang(demuxer_t *demuxe
     av_strlcpy(lang, track->language, maxlen);
 }
 
-/** \brief Get the language code for an audio track.
-
-  Retrieves the language code for an audio track if it is known.
-  If the language code is "und" then do not copy it ("und" = "undefined").
-
-  \param demuxer The demuxer to work on
-  \param track_num The n'th audio track to get the language from
-  \param lang Store the language here
-  \param maxlen The maximum number of characters to copy into lang
-*/
-void
-demux_mkv_get_audio_lang(demuxer_t *demuxer, int track_num, char *lang,
-                       int maxlen)
-{
-  mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
-  mkv_track_t *track = demux_mkv_find_track_by_num (mkv_d, track_num, MATROSKA_TRACK_AUDIO);
-  if (track && track->language && strcmp(track->language, "und"))
-    av_strlcpy(lang, track->language, maxlen);
-}
-
-
 const demuxer_desc_t demuxer_desc_matroska = {
   "Matroska demuxer",
   "mkv",

Modified: trunk/libmpdemux/matroska.h
==============================================================================
--- trunk/libmpdemux/matroska.h	(original)
+++ trunk/libmpdemux/matroska.h	Fri Feb 29 18:25:37 2008
@@ -62,8 +62,6 @@
 #define MKV_S_ASS        "S_ASS" // Deprecated
 
 int demux_mkv_change_subs(demuxer_t *demuxer, int new_num);
-void demux_mkv_get_audio_lang(demuxer_t *demuxer, int track_num, char *lang,
-                            int maxlen);
 void demux_mkv_get_sub_lang(demuxer_t *demuxer, int track_num, char *lang,
                             int maxlen);
 



More information about the MPlayer-cvslog mailing list