changeset 18775:bdcbf1070680

support for -alang
author nicodvb
date Wed, 21 Jun 2006 19:24:17 +0000
parents 332e5ad0ed53
children 4fe83f5212fe
files libmpdemux/demux_lavf.c
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_lavf.c	Wed Jun 21 17:50:50 2006 +0000
+++ b/libmpdemux/demux_lavf.c	Wed Jun 21 19:24:17 2006 +0000
@@ -37,6 +37,8 @@
 
 #define PROBE_BUF_SIZE 2048
 
+extern char *audio_lang;
+
 typedef struct lavf_priv_t{
     AVInputFormat *avif;
     AVFormatContext *avfc;
@@ -244,12 +246,14 @@
                 break;
             }
             if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf, MSGL_V);
-            if(demuxer->audio->id != i && demuxer->audio->id != -1)
+	    if((audio_lang && st->language[0] && !strncmp(audio_lang, st->language, 3))
+	        || (demuxer->audio->id == i || demuxer->audio->id == -1)
+	    ) {
+	        demuxer->audio->id = i;
+                demuxer->audio->sh= demuxer->a_streams[i];
+	    }
+            else
                 st->discard= AVDISCARD_ALL;
-            else{
-                demuxer->audio->id = i;
-                demuxer->audio->sh= demuxer->a_streams[i];
-            }
             break;}
         case CODEC_TYPE_VIDEO:{
             BITMAPINFOHEADER *bih=calloc(sizeof(BITMAPINFOHEADER) + codec->extradata_size,1);