Make the stream language an argument to the stream creation function
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sat, 10 Jul 2010 18:47:59 +0000 (18:47 +0000)
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sat, 10 Jul 2010 18:47:59 +0000 (18:47 +0000)
so that some code can be shared.

git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@31675 b3059339-0415-0410-9bf9-f77b7e298cf2

30 files changed:
libmpdemux/asfheader.c
libmpdemux/aviheader.c
libmpdemux/demux_aac.c
libmpdemux/demux_audio.c
libmpdemux/demux_avs.c
libmpdemux/demux_film.c
libmpdemux/demux_lavf.c
libmpdemux/demux_lmlm4.c
libmpdemux/demux_mkv.c
libmpdemux/demux_mov.c
libmpdemux/demux_mpc.c
libmpdemux/demux_mpg.c
libmpdemux/demux_nemesi.c
libmpdemux/demux_nsv.c
libmpdemux/demux_nut.c
libmpdemux/demux_ogg.c
libmpdemux/demux_pva.c
libmpdemux/demux_rawaudio.c
libmpdemux/demux_rawdv.c
libmpdemux/demux_real.c
libmpdemux/demux_realaud.c
libmpdemux/demux_roq.c
libmpdemux/demux_smjpeg.c
libmpdemux/demux_ts.c
libmpdemux/demux_ty.c
libmpdemux/demux_viv.c
libmpdemux/demux_vqf.c
libmpdemux/demux_xmms.c
libmpdemux/demuxer.c
libmpdemux/stheader.h

index f31eda3..2a62b2d 100644 (file)
@@ -440,7 +440,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
       le2me_ASF_stream_header_t(streamh);
       audio_pos += 64; //16+16+4+4+4+16+4;
       buffer = &hdr[audio_pos];
-      sh_audio=new_sh_audio(demuxer,streamh->stream_no & 0x7F);
+      sh_audio=new_sh_audio(demuxer,streamh->stream_no & 0x7F, NULL);
       sh_audio->needs_parsing = 1;
       mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "asfheader", streamh->stream_no & 0x7F);
       ++audio_streams;
@@ -478,7 +478,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
     if (pos > hdr_len) goto len_err_out;
     switch(ASF_LOAD_GUID_PREFIX(streamh->type)){
       case ASF_GUID_PREFIX_audio_stream: {
-        sh_audio_t* sh_audio=new_sh_audio(demuxer,streamh->stream_no & 0x7F);
+        sh_audio_t* sh_audio=new_sh_audio(demuxer,streamh->stream_no & 0x7F, NULL);
         mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "asfheader", streamh->stream_no & 0x7F);
         ++audio_streams;
         if (!asf_init_audio_stream(demuxer, asf, sh_audio, streamh, &pos, &buffer, hdr, hdr_len))
index 1721159..bc6b007 100644 (file)
@@ -206,7 +206,7 @@ while(1){
         sh_video->stream_delay = (float)sh_video->video.dwStart * sh_video->video.dwScale/sh_video->video.dwRate;
       } else
       if(h.fccType==streamtypeAUDIO){
-        sh_audio=new_sh_audio(demuxer,stream_id);
+        sh_audio=new_sh_audio(demuxer,stream_id, NULL);
         mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "aviheader", stream_id);
         memcpy(&sh_audio->audio,&h,sizeof(h));
         sh_audio->stream_delay = (float)sh_audio->audio.dwStart * sh_audio->audio.dwScale/sh_audio->audio.dwRate;
index 54493fb..621b58d 100644 (file)
@@ -127,7 +127,7 @@ static demuxer_t* demux_aac_open(demuxer_t *demuxer)
 {
        sh_audio_t *sh;
 
-       sh = new_sh_audio(demuxer, 0);
+       sh = new_sh_audio(demuxer, 0, NULL);
        sh->ds = demuxer->audio;
        sh->format = mmioFOURCC('M', 'P', '4', 'A');
        demuxer->audio->id = 0;
index 8417ae4..d4bea37 100644 (file)
@@ -326,7 +326,7 @@ static int demux_audio_open(demuxer_t* demuxer) {
   if(!frmt)
     return 0;
 
-  sh_audio = new_sh_audio(demuxer,0);
+  sh_audio = new_sh_audio(demuxer,0, NULL);
 
   switch(frmt) {
   case MP3:
index 3b922b0..1f30f5d 100644 (file)
@@ -324,7 +324,7 @@ static demuxer_t* demux_open_avs(demuxer_t* demuxer)
       }
     if (audio_samplesize)
     {
-        sh_audio_t *sh_audio = new_sh_audio(demuxer, 0);
+        sh_audio_t *sh_audio = new_sh_audio(demuxer, 0, NULL);
         found = 1;
         mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Clip has audio -> Channels = %d - Freq = %d\n", AVS->video_info->nchannels, AVS->video_info->audio_samples_per_second);
 
index 0737e87..c2bf87c 100644 (file)
@@ -321,7 +321,7 @@ static demuxer_t* demux_open_film(demuxer_t* demuxer)
         if (audio_channels > 0)
         {
           // create and initialize the audio stream header
-          sh_audio = new_sh_audio(demuxer, 0);
+          sh_audio = new_sh_audio(demuxer, 0, NULL);
           demuxer->audio->id = 0;
           demuxer->audio->sh = sh_audio;
           sh_audio->ds = demuxer->audio;
@@ -353,7 +353,7 @@ static demuxer_t* demux_open_film(demuxer_t* demuxer)
         // otherwise, make some assumptions about the audio
 
         // create and initialize the audio stream header
-        sh_audio = new_sh_audio(demuxer, 0);
+        sh_audio = new_sh_audio(demuxer, 0, NULL);
         demuxer->audio->sh = sh_audio;
         sh_audio->ds = demuxer->audio;
 
index 7774f5d..aee13f5 100644 (file)
@@ -271,7 +271,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
         case CODEC_TYPE_AUDIO:{
             WAVEFORMATEX *wf;
             sh_audio_t* sh_audio;
-            sh_audio = new_sh_audio_aid(demuxer, i, priv->audio_streams);
+            sh_audio = new_sh_audio_aid(demuxer, i, priv->audio_streams, lang ? lang->value : NULL);
             if(!sh_audio)
                 break;
             stream_type = "audio";
@@ -329,10 +329,6 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
             }
             if (title && title->value)
                 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_NAME=%s\n", priv->audio_streams, title->value);
-            if (lang && lang->value) {
-              sh_audio->lang = strdup(lang->value);
-              mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_LANG=%s\n", priv->audio_streams, sh_audio->lang);
-            }
             if (st->disposition & AV_DISPOSITION_DEFAULT)
               sh_audio->default_track = 1;
             if(mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf, MSGL_V);
@@ -432,7 +428,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
                 type = 'p';
             else
                 break;
-            sh_sub = new_sh_sub_sid(demuxer, i, priv->sub_streams);
+            sh_sub = new_sh_sub_sid(demuxer, i, priv->sub_streams, lang ? lang->value : NULL);
             if(!sh_sub) break;
             stream_type = "subtitle";
             priv->sstreams[priv->sub_streams] = i;
@@ -444,10 +440,6 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
             }
             if (title && title->value)
                 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_NAME=%s\n", priv->sub_streams, title->value);
-            if (lang && lang->value) {
-              sh_sub->lang = strdup(lang->value);
-              mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n", priv->sub_streams, sh_sub->lang);
-            }
             if (st->disposition & AV_DISPOSITION_DEFAULT)
               sh_sub->default_track = 1;
             stream_id = priv->sub_streams++;
index 9657db2..154cd55 100644 (file)
@@ -247,7 +247,7 @@ static int demux_lmlm4_fill_buffer(demuxer_t *demux, demux_stream_t *ds)
             return -1; //goto hdr;
         }
        if(demux->audio->id==-1){
-           if(!demux->a_streams[id]) new_sh_audio(demux,id);
+           if(!demux->a_streams[id]) new_sh_audio(demux,id, NULL);
            demux->audio->id=id;
            demux->audio->sh=demux->a_streams[id];
            ((sh_audio_t*)(demux->audio->sh))->format=0x50; // mpeg audio layer 1/2
@@ -320,7 +320,7 @@ static demuxer_t* demux_open_lmlm4(demuxer_t* demuxer){
     sh_video->bih->biCompression = sh_video->format;
     sh_video->bih->biSizeImage = sh_video->disp_w*sh_video->disp_h;
 
-    sh_audio = new_sh_audio(demuxer, 0);
+    sh_audio = new_sh_audio(demuxer, 0, NULL);
     demuxer->audio->sh = sh_audio;
     sh_audio->ds = demuxer->audio;
 
index 4063f4b..faccf9e 100644 (file)
@@ -1414,8 +1414,6 @@ static void display_create_tracks(demuxer_t *demuxer)
             if (mkv_d->tracks[i]->name)
                 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_NAME=%s\n", aid,
                        mkv_d->tracks[i]->name);
-            mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_LANG=%s\n", aid,
-                   mkv_d->tracks[i]->language);
             sprintf(str, "-aid %u, -alang %.5s", aid++,
                     mkv_d->tracks[i]->language);
             break;
@@ -1610,14 +1608,13 @@ static int demux_mkv_open_audio(demuxer_t *demuxer, mkv_track_t *track,
                                 int aid)
 {
     mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
-    sh_audio_t *sh_a = new_sh_audio_aid(demuxer, track->tnum, aid);
+    sh_audio_t *sh_a = new_sh_audio_aid(demuxer, track->tnum, aid,
+                                        track->language);
     demux_packet_t *dp;
     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->default_track = track->default_track;
     sh_a->ds = demuxer->audio;
     sh_a->wf = malloc(sizeof(WAVEFORMATEX));
@@ -1898,7 +1895,7 @@ static int demux_mkv_open_sub(demuxer_t *demuxer, mkv_track_t *track,
     if (track->subtitle_type != MATROSKA_SUBTYPE_UNKNOWN) {
         int size, m;
         uint8_t *buffer;
-        sh_sub_t *sh = new_sh_sub_sid(demuxer, track->tnum, sid);
+        sh_sub_t *sh = new_sh_sub_sid(demuxer, track->tnum, sid, track->language);
         track->sh_sub = sh;
         sh->type = 't';
         if (track->subtitle_type == MATROSKA_SUBTYPE_VOBSUB)
@@ -1915,8 +1912,6 @@ static int demux_mkv_open_sub(demuxer_t *demuxer, mkv_track_t *track,
         sh->extradata = malloc(track->private_size);
         memcpy(sh->extradata, track->private_data, track->private_size);
         sh->extradata_len = track->private_size;
-        if (track->language && (strcmp(track->language, "und") != 0))
-            sh->lang = strdup(track->language);
         sh->default_track = track->default_track;
     } else {
         mp_msg(MSGT_DEMUX, MSGL_ERR,
index a8ca20f..8e8b03d 100644 (file)
@@ -1338,7 +1338,7 @@ static void lschunks(demuxer_t* demuxer,int level,off_t endpos,mov_track_t* trak
            mov_build_index(trak,priv->timescale);
            switch(trak->type){
            case MOV_TRAK_AUDIO: {
-               sh_audio_t* sh=new_sh_audio(demuxer,priv->track_db);
+               sh_audio_t* sh=new_sh_audio(demuxer,priv->track_db, NULL);
                mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "mov", priv->track_db);
                gen_sh_audio(sh, trak, priv->timescale);
                break;
@@ -1353,7 +1353,7 @@ static void lschunks(demuxer_t* demuxer,int level,off_t endpos,mov_track_t* trak
                if (trak->fourcc == mmioFOURCC('m','p','4','s') ||
                    trak->fourcc == mmioFOURCC('t','x','3','g') ||
                    trak->fourcc == mmioFOURCC('t','e','x','t')) {
-                       sh_sub_t *sh = new_sh_sub(demuxer, priv->track_db);
+                       sh_sub_t *sh = new_sh_sub(demuxer, priv->track_db, NULL);
                        mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_SubtitleID, "mov", priv->track_db);
                        if (trak->fourcc == mmioFOURCC('m','p','4','s'))
                                init_vobsub(sh, trak);
index dee3b5c..e9bde98 100644 (file)
@@ -93,7 +93,7 @@ static demuxer_t *demux_mpc_open(demuxer_t* demuxer) {
   sh_audio_t* sh_audio;
   da_priv_t* priv = demuxer->priv;
 
-  sh_audio = new_sh_audio(demuxer,0);
+  sh_audio = new_sh_audio(demuxer,0, NULL);
 
   {
     char *wf = calloc(1, sizeof(WAVEFORMATEX) + HDR_SIZE);
index 80c769b..ad66416 100644 (file)
@@ -269,7 +269,7 @@ static void new_audio_stream(demuxer_t *demux, int aid){
   if(!demux->a_streams[aid]){
     mpg_demuxer_t *mpg_d=(mpg_demuxer_t*)demux->priv;
     sh_audio_t* sh_a;
-    new_sh_audio(demux,aid);
+    new_sh_audio(demux,aid, NULL);
     sh_a = (sh_audio_t*)demux->a_streams[aid];
     sh_a->needs_parsing = 1;
     switch(aid & 0xE0){  // 1110 0000 b  (high 3 bit: type  low 5: id)
@@ -477,15 +477,13 @@ static int demux_mpg_read_packet(demuxer_t *demux,int id){
         aid&=0x1F;
 
         if(!demux->s_streams[aid]){
-            sh_sub_t *sh = new_sh_sub(demux, aid);
+            sh_sub_t *sh = new_sh_sub(demux, aid, NULL);
             if (sh) sh->type = 'v';
             mp_msg(MSGT_DEMUX,MSGL_V,"==> Found subtitle: %d\n",aid);
         }
 
         if(demux->sub->id > -1)
           demux->sub->id &= 0x1F;
-        if(!dvdsub_lang && demux->sub->id == -1)
-          demux->sub->id = aid;
         if(demux->sub->id==aid){
             ds=demux->sub;
         }
index 3d2d413..a5401dd 100644 (file)
@@ -222,7 +222,7 @@ static demuxer_t* demux_open_rtp(demuxer_t* demuxer)
 
         if (ptinfo->type == AU) {
             if (ndsd->session[NEMESI_SESSION_AUDIO] == NULL) {
-                sh_audio_t* sh_audio = new_sh_audio(demuxer,0);
+                sh_audio_t* sh_audio = new_sh_audio(demuxer,0, NULL);
                 WAVEFORMATEX* wf;
                 demux_stream_t* d_audio = demuxer->audio;
                 demuxer->audio->id = 0;
index fbb6e9c..a6628fc 100644 (file)
@@ -194,7 +194,7 @@ static demuxer_t* demux_open_nsv ( demuxer_t* demuxer )
         //   bytes 8-11   audio codec fourcc
         // PCM fourcc needs extra parsing for every audio chunk, yet to implement
         if((demuxer->audio->id != -2) && strncmp(hdr+8,"NONE", 4)){//&&strncmp(hdr+8,"VLB ", 4)){
-            sh_audio = new_sh_audio ( demuxer, 0 );
+            sh_audio = new_sh_audio ( demuxer, 0, NULL );
             demuxer->audio->id = 0;
             demuxer->audio->sh = sh_audio;
             sh_audio->format=mmioFOURCC(hdr[8],hdr[9],hdr[10],hdr[11]);
index 559d839..84d7b6c 100644 (file)
@@ -113,7 +113,7 @@ static demuxer_t * demux_open_nut(demuxer_t * demuxer) {
                        WAVEFORMATEX *wf =
                                calloc(sizeof(WAVEFORMATEX) +
                                              s[i].codec_specific_len, 1);
-                       sh_audio_t* sh_audio = new_sh_audio(demuxer, i);
+                       sh_audio_t* sh_audio = new_sh_audio(demuxer, i, NULL);
                        int j;
                        mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "nut", i);
 
index 58876c6..6d40fa1 100644 (file)
@@ -862,7 +862,7 @@ int demux_ogg_open(demuxer_t *demuxer)
 
         // Check for Vorbis
         if (pack.bytes >= 7 && !strncmp(&pack.packet[1], "vorbis", 6)) {
-            sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio);
+            sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio, NULL);
             sh_a->format = FOURCC_VORBIS;
             ogg_d->subs[ogg_d->num_sub].vorbis = 1;
             ogg_d->subs[ogg_d->num_sub].id     = n_audio;
@@ -871,7 +871,7 @@ int demux_ogg_open(demuxer_t *demuxer)
                    "[Ogg] stream %d: audio (Vorbis), -aid %d\n",
                    ogg_d->num_sub, n_audio - 1);
         } else if (pack.bytes >= 80 && !strncmp(pack.packet, "Speex", 5)) {
-            sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio);
+            sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio, NULL);
             sh_a->wf         = calloc(1, sizeof(WAVEFORMATEX) + pack.bytes);
             sh_a->format     = FOURCC_SPEEX;
             sh_a->samplerate = sh_a->wf->nSamplesPerSec = AV_RL32(&pack.packet[36]);
@@ -938,7 +938,7 @@ int demux_ogg_open(demuxer_t *demuxer)
             theora_info_clear(&inf);
 #endif /* CONFIG_OGGTHEORA */
         } else if (pack.bytes >= 4 && !strncmp (&pack.packet[0], "fLaC", 4)) {
-            sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio);
+            sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio, NULL);
             sh_a->format = mmioFOURCC('f', 'L', 'a', 'C');
             ogg_d->subs[ogg_d->num_sub].id = n_audio;
             n_audio++;
@@ -948,7 +948,7 @@ int demux_ogg_open(demuxer_t *demuxer)
                    "[Ogg] stream %d: audio (FLAC), -aid %d\n",
                    ogg_d->num_sub, n_audio - 1);
         } else if (pack.bytes >= 51 && !strncmp(&pack.packet[1], "FLAC", 4)) {
-            sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio);
+            sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio, NULL);
             sh_a->format = mmioFOURCC('f', 'L', 'a', 'C');
             ogg_d->subs[ogg_d->num_sub].id = n_audio;
             n_audio++;
@@ -995,7 +995,7 @@ int demux_ogg_open(demuxer_t *demuxer)
             } else if (AV_RL32(pack.packet + 96) == 0x05589F81) {
                 unsigned int extra_size;
 
-                sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio);
+                sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio, NULL);
                 extra_size = AV_RL16(pack.packet + 140);
                 sh_a->wf         = calloc(1, sizeof(WAVEFORMATEX) + extra_size);
                 sh_a->format     = sh_a->wf->wFormatTag     = AV_RL16(pack.packet + 124);
@@ -1072,7 +1072,7 @@ int demux_ogg_open(demuxer_t *demuxer)
                     extra_offset  = 4;
                 }
 
-                sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio);
+                sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio, NULL);
                 sh_a->wf         = calloc(1, sizeof(WAVEFORMATEX) + extra_size);
                 sh_a->format     = sh_a->wf->wFormatTag = strtol(buffer, NULL, 16);
                 sh_a->channels   = sh_a->wf->nChannels  = AV_RL16(&st->sh.audio.channels);
@@ -1105,7 +1105,7 @@ int demux_ogg_open(demuxer_t *demuxer)
                 ogg_d->subs[ogg_d->num_sub].id         = ogg_d->n_text;
                 if (demuxer->sub->id == ogg_d->n_text)
                     text_id = ogg_d->num_sub;
-                new_sh_sub(demuxer, ogg_d->n_text);
+                new_sh_sub(demuxer, ogg_d->n_text, NULL);
                 ogg_d->n_text++;
                 ogg_d->text_ids = realloc_struct(ogg_d->text_ids, ogg_d->n_text, sizeof(*ogg_d->text_ids));
                 ogg_d->text_ids[ogg_d->n_text - 1] = ogg_d->num_sub;
@@ -1387,7 +1387,7 @@ demuxer_t *init_avi_with_ogg(demuxer_t *demuxer)
 
     // Finish setting up the ogg demuxer
     od->priv = ogg_d;
-    sh_audio = new_sh_audio(od, 0);
+    sh_audio = new_sh_audio(od, 0, NULL);
     od->audio->id = 0;
     od->video->id = -2;
     od->audio->sh = sh_audio;
index 39fad12..5160cdc 100644 (file)
@@ -133,7 +133,7 @@ static int pva_check_file(demuxer_t * demuxer)
 static demuxer_t * demux_open_pva (demuxer_t * demuxer)
 {
        sh_video_t *sh_video = new_sh_video(demuxer,0);
-        sh_audio_t *sh_audio = new_sh_audio(demuxer,0);
+        sh_audio_t *sh_audio = new_sh_audio(demuxer,0, NULL);
 
 
        pva_priv_t * priv;
index 949b2d5..00e9196 100644 (file)
@@ -50,7 +50,7 @@ static demuxer_t* demux_rawaudio_open(demuxer_t* demuxer) {
   sh_audio_t* sh_audio;
   WAVEFORMATEX* w;
 
-  sh_audio = new_sh_audio(demuxer,0);
+  sh_audio = new_sh_audio(demuxer,0, NULL);
   sh_audio->wf = w = malloc(sizeof(WAVEFORMATEX));
   w->wFormatTag = sh_audio->format = format;
   w->nChannels = sh_audio->channels = channels;
index 7306841..8e2edaa 100644 (file)
@@ -207,7 +207,7 @@ static demuxer_t* demux_open_rawdv(demuxer_t* demuxer)
 
    mp_msg(MSGT_DEMUXER,MSGL_V,"demux_open_rawdv() seek to %qu, size: %d, dv_dec->frame_size: %d\n",frames->current_filepos,frames->frame_size, dv_decoder->frame_size);
     if (dv_decoder->audio != NULL && demuxer->audio->id>=-1){
-       sh_audio_t *sh_audio =  new_sh_audio(demuxer, 0);
+       sh_audio_t *sh_audio =  new_sh_audio(demuxer, 0, NULL);
        demuxer->audio->id = 0;
            demuxer->audio->sh = sh_audio;
            sh_audio->ds = demuxer->audio;
index 59dffa8..331dde0 100644 (file)
@@ -1264,7 +1264,7 @@ static demuxer_t* demux_open_real(demuxer_t* demuxer)
                    mp_msg(MSGT_DEMUX,MSGL_V,"Audio: can't find .ra in codec data\n");
                } else {
                    /* audio header */
-                   sh_audio_t *sh = new_sh_audio(demuxer, stream_id);
+                   sh_audio_t *sh = new_sh_audio(demuxer, stream_id, NULL);
                    char buf[128]; /* for codec name */
                    int frame_size;
                    int sub_packet_size;
@@ -1476,7 +1476,7 @@ static demuxer_t* demux_open_real(demuxer_t* demuxer)
 #endif
                }
          } else if (strstr(mimet,"X-MP3-draft-00")) {
-                   sh_audio_t *sh = new_sh_audio(demuxer, stream_id);
+                   sh_audio_t *sh = new_sh_audio(demuxer, stream_id, NULL);
                    mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "real", stream_id);
 
                    /* Emulate WAVEFORMATEX struct: */
index dbb1f73..c15e618 100644 (file)
@@ -172,7 +172,7 @@ static demuxer_t* demux_open_ra(demuxer_t* demuxer)
        memset(ra_priv, 0, sizeof(ra_priv_t));
 
        demuxer->priv = ra_priv;
-       sh = new_sh_audio(demuxer, 0);
+       sh = new_sh_audio(demuxer, 0, NULL);
        demuxer->audio->id = 0;
        sh->ds=demuxer->audio;
        demuxer->audio->sh = sh;
index e51fab6..72a96fc 100644 (file)
@@ -168,7 +168,7 @@ static demuxer_t* demux_open_roq(demuxer_t* demuxer)
       if (sh_audio == NULL)
       {
         // make the header first
-        sh_audio = new_sh_audio(demuxer, 0);
+        sh_audio = new_sh_audio(demuxer, 0, NULL);
         // make sure the demuxer knows about the new stream header
         demuxer->audio->id = 0;
         demuxer->audio->sh = sh_audio;
index 273ff09..059393d 100644 (file)
@@ -149,7 +149,7 @@ static demuxer_t* demux_open_smjpeg(demuxer_t* demuxer){
            sh_video->bih->biSizeImage = sh_video->disp_w*sh_video->disp_h;
            break;
        case mmioFOURCC('_','S','N','D'):
-           sh_audio = new_sh_audio(demuxer, 0);
+           sh_audio = new_sh_audio(demuxer, 0, NULL);
            demuxer->audio->id = 0;
            demuxer->audio->sh = sh_audio;
            sh_audio->ds = demuxer->audio;
index 3934ded..2e2568c 100644 (file)
@@ -339,10 +339,9 @@ static void ts_add_stream(demuxer_t * demuxer, ES_stream_t *es)
 
        if((IS_AUDIO(es->type) || IS_AUDIO(es->subtype)) && priv->last_aid+1 < MAX_A_STREAMS)
        {
-               sh_audio_t *sh = new_sh_audio_aid(demuxer, priv->last_aid, es->pid);
+               sh_audio_t *sh = new_sh_audio_aid(demuxer, priv->last_aid, es->pid, pid_lang_from_pmt(priv, es->pid));
                if(sh)
                {
-                       const char *lang = pid_lang_from_pmt(priv, es->pid);
                        sh->needs_parsing = 1;
                        sh->format = IS_AUDIO(es->type) ? es->type : es->subtype;
                        sh->ds = demuxer->audio;
@@ -351,8 +350,6 @@ static void ts_add_stream(demuxer_t * demuxer, ES_stream_t *es)
                        priv->ts.streams[es->pid].sh = sh;
                        priv->ts.streams[es->pid].type = TYPE_AUDIO;
                        mp_msg(MSGT_DEMUX, MSGL_V, "\r\nADDED AUDIO PID %d, type: %x stream n. %d\r\n", es->pid, sh->format, priv->last_aid);
-                       if (lang && lang[0])
-                               mp_msg(MSGT_IDENTIFY, MSGL_V, "ID_AID_%d_LANG=%s\n", es->pid, lang);
                        priv->last_aid++;
                }
 
index af75bc3..b7bc9c1 100644 (file)
@@ -569,7 +569,7 @@ static int demux_ty_fill_buffer( demuxer_t *demux, demux_stream_t *dsds )
                }
 
                demux->audio->id = aid;
-               if( !demux->a_streams[ aid ] ) new_sh_audio( demux, aid );
+               if( !demux->a_streams[ aid ] ) new_sh_audio( demux, aid, NULL );
                if( demux->audio->id == aid )
                {
                   demux_stream_t *ds = demux->audio;
index 3cf6f5c..761bed5 100644 (file)
@@ -648,7 +648,7 @@ if (demuxer->audio->id >= -1){
   if(!ds_fill_buffer(demuxer->audio)){
     mp_msg(MSGT_DEMUX,MSGL_ERR,"VIVO: " MSGTR_MissingAudioStream);
   } else
-{              sh_audio_t* sh=new_sh_audio(demuxer,1);
+{              sh_audio_t* sh=new_sh_audio(demuxer,1, NULL);
 
                /* Select audio codec */
                if (priv->audio_codec == 0)
index 4ec8865..c637b8d 100644 (file)
@@ -48,7 +48,7 @@ static demuxer_t* demux_open_vqf(demuxer_t* demuxer) {
 
   s = demuxer->stream;
 
-  sh_audio = new_sh_audio(demuxer,0);
+  sh_audio = new_sh_audio(demuxer,0, NULL);
   sh_audio->wf = w = malloc(sizeof(WAVEFORMATEX)+sizeof(headerInfo));
   hi = (headerInfo *)&w[1];
   memset(hi,0,sizeof(headerInfo));
index 8edbc2f..61c9ad3 100644 (file)
@@ -265,7 +265,7 @@ static int demux_xmms_open(demuxer_t* demuxer) {
     memset(xmms_audiobuffer,0,XMMS_PACKETSIZE);
 
     xmms_channels=0;
-    sh_audio = new_sh_audio(demuxer,0);
+    sh_audio = new_sh_audio(demuxer,0, NULL);
     sh_audio->wf = w = malloc(sizeof(WAVEFORMATEX));
     w->wFormatTag = sh_audio->format = format;
 
index 1933fe9..7519d16 100644 (file)
@@ -254,7 +254,7 @@ demuxer_t *new_demuxer(stream_t *stream, int type, int a_id, int v_id,
     return d;
 }
 
-sh_sub_t *new_sh_sub_sid(demuxer_t *demuxer, int id, int sid)
+sh_sub_t *new_sh_sub_sid(demuxer_t *demuxer, int id, int sid, const char *lang)
 {
     if (id > MAX_S_STREAMS - 1 || id < 0) {
         mp_msg(MSGT_DEMUXER, MSGL_WARN,
@@ -269,6 +269,10 @@ sh_sub_t *new_sh_sub_sid(demuxer_t *demuxer, int id, int sid)
         demuxer->s_streams[id] = sh;
         sh->sid = sid;
         mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SUBTITLE_ID=%d\n", sid);
+        if (lang && lang[0] && strcmp(lang, "und")) {
+            sh->lang = strdup(lang);
+            mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n", sid, lang);
+        }
     }
     if (sid == dvdsub_id) {
         demuxer->sub->id = id;
@@ -292,7 +296,7 @@ static void free_sh_sub(sh_sub_t *sh)
     free(sh);
 }
 
-sh_audio_t *new_sh_audio_aid(demuxer_t *demuxer, int id, int aid)
+sh_audio_t *new_sh_audio_aid(demuxer_t *demuxer, int id, int aid, const char *lang)
 {
     if (id > MAX_A_STREAMS - 1 || id < 0) {
         mp_msg(MSGT_DEMUXER, MSGL_WARN,
@@ -314,6 +318,10 @@ sh_audio_t *new_sh_audio_aid(demuxer_t *demuxer, int id, int aid)
         sh->audio_out_minsize = 8192;   /* default size, maybe not enough for Win32/ACM */
         sh->pts = MP_NOPTS_VALUE;
         mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_ID=%d\n", aid);
+        if (lang && lang[0] && strcmp(lang, "und")) {
+            sh->lang = strdup(lang);
+            mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_LANG=%s\n", aid, lang);
+        }
     }
     return demuxer->a_streams[id];
 }
index 5a2000c..65ad42c 100644 (file)
@@ -131,12 +131,12 @@ typedef struct sh_sub {
 } sh_sub_t;
 
 // demuxer.c:
-#define new_sh_audio(d, i) new_sh_audio_aid(d, i, i)
-sh_audio_t* new_sh_audio_aid(demuxer_t *demuxer,int id,int aid);
+#define new_sh_audio(d, i, l) new_sh_audio_aid(d, i, i, l)
+sh_audio_t* new_sh_audio_aid(demuxer_t *demuxer,int id,int aid, const char *lang);
 #define new_sh_video(d, i) new_sh_video_vid(d, i, i)
 sh_video_t* new_sh_video_vid(demuxer_t *demuxer,int id,int vid);
-#define new_sh_sub(d, i) new_sh_sub_sid(d, i, i)
-sh_sub_t *new_sh_sub_sid(demuxer_t *demuxer, int id, int sid);
+#define new_sh_sub(d, i, l) new_sh_sub_sid(d, i, i, l)
+sh_sub_t *new_sh_sub_sid(demuxer_t *demuxer, int id, int sid, const char *lang);
 void free_sh_audio(demuxer_t *demuxer, int id);
 void free_sh_video(sh_video_t *sh);