[MPlayer-cvslog] r31675 - in trunk/libmpdemux: asfheader.c aviheader.c demux_aac.c demux_audio.c demux_avs.c demux_film.c demux_lavf.c demux_lmlm4.c demux_mkv.c demux_mov.c demux_mpc.c demux_mpg.c demux_nemesi.c de...

reimar subversion at mplayerhq.hu
Sat Jul 10 20:47:59 CEST 2010


Author: reimar
Date: Sat Jul 10 20:47:59 2010
New Revision: 31675

Log:
Make the stream language an argument to the stream creation function
so that some code can be shared.

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

Modified: trunk/libmpdemux/asfheader.c
==============================================================================
--- trunk/libmpdemux/asfheader.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/asfheader.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -440,7 +440,7 @@ int read_asf_header(demuxer_t *demuxer,s
       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,s
     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))

Modified: trunk/libmpdemux/aviheader.c
==============================================================================
--- trunk/libmpdemux/aviheader.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/aviheader.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -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;

Modified: trunk/libmpdemux/demux_aac.c
==============================================================================
--- trunk/libmpdemux/demux_aac.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_aac.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -127,7 +127,7 @@ static demuxer_t* demux_aac_open(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;

Modified: trunk/libmpdemux/demux_audio.c
==============================================================================
--- trunk/libmpdemux/demux_audio.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_audio.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -326,7 +326,7 @@ static int demux_audio_open(demuxer_t* d
   if(!frmt)
     return 0;
 
-  sh_audio = new_sh_audio(demuxer,0);
+  sh_audio = new_sh_audio(demuxer,0, NULL);
 
   switch(frmt) {
   case MP3:

Modified: trunk/libmpdemux/demux_avs.c
==============================================================================
--- trunk/libmpdemux/demux_avs.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_avs.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -324,7 +324,7 @@ static demuxer_t* demux_open_avs(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);
 

Modified: trunk/libmpdemux/demux_film.c
==============================================================================
--- trunk/libmpdemux/demux_film.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_film.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -321,7 +321,7 @@ static demuxer_t* demux_open_film(demuxe
         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(demuxe
         // 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;
 

Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_lavf.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -271,7 +271,7 @@ static void handle_stream(demuxer_t *dem
         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 *dem
             }
             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 *dem
                 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 *dem
             }
             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++;

Modified: trunk/libmpdemux/demux_lmlm4.c
==============================================================================
--- trunk/libmpdemux/demux_lmlm4.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_lmlm4.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -247,7 +247,7 @@ static int demux_lmlm4_fill_buffer(demux
             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(demux
     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;
 

Modified: trunk/libmpdemux/demux_mkv.c
==============================================================================
--- trunk/libmpdemux/demux_mkv.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_mkv.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -1414,8 +1414,6 @@ static void display_create_tracks(demuxe
             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_
                                 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 
     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 
         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,

Modified: trunk/libmpdemux/demux_mov.c
==============================================================================
--- trunk/libmpdemux/demux_mov.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_mov.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -1338,7 +1338,7 @@ static void lschunks(demuxer_t* demuxer,
 	    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,
 		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);

Modified: trunk/libmpdemux/demux_mpc.c
==============================================================================
--- trunk/libmpdemux/demux_mpc.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_mpc.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -93,7 +93,7 @@ static demuxer_t *demux_mpc_open(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);

Modified: trunk/libmpdemux/demux_mpg.c
==============================================================================
--- trunk/libmpdemux/demux_mpg.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_mpg.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -269,7 +269,7 @@ static void new_audio_stream(demuxer_t *
   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
         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;
         }

Modified: trunk/libmpdemux/demux_nemesi.c
==============================================================================
--- trunk/libmpdemux/demux_nemesi.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_nemesi.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -222,7 +222,7 @@ static demuxer_t* demux_open_rtp(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;

Modified: trunk/libmpdemux/demux_nsv.c
==============================================================================
--- trunk/libmpdemux/demux_nsv.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_nsv.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -194,7 +194,7 @@ static demuxer_t* demux_open_nsv ( demux
         //   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]);

Modified: trunk/libmpdemux/demux_nut.c
==============================================================================
--- trunk/libmpdemux/demux_nut.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_nut.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -113,7 +113,7 @@ static demuxer_t * demux_open_nut(demuxe
 			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);
 

Modified: trunk/libmpdemux/demux_ogg.c
==============================================================================
--- trunk/libmpdemux/demux_ogg.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_ogg.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -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 *
 
     // 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;

Modified: trunk/libmpdemux/demux_pva.c
==============================================================================
--- trunk/libmpdemux/demux_pva.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_pva.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -133,7 +133,7 @@ static int pva_check_file(demuxer_t * de
 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;

Modified: trunk/libmpdemux/demux_rawaudio.c
==============================================================================
--- trunk/libmpdemux/demux_rawaudio.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_rawaudio.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -50,7 +50,7 @@ static demuxer_t* demux_rawaudio_open(de
   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;

Modified: trunk/libmpdemux/demux_rawdv.c
==============================================================================
--- trunk/libmpdemux/demux_rawdv.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_rawdv.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -207,7 +207,7 @@ static demuxer_t* demux_open_rawdv(demux
 
    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;

Modified: trunk/libmpdemux/demux_real.c
==============================================================================
--- trunk/libmpdemux/demux_real.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_real.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -1264,7 +1264,7 @@ static demuxer_t* demux_open_real(demuxe
 		    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(demuxe
 #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: */

Modified: trunk/libmpdemux/demux_realaud.c
==============================================================================
--- trunk/libmpdemux/demux_realaud.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_realaud.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -172,7 +172,7 @@ static demuxer_t* demux_open_ra(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;

Modified: trunk/libmpdemux/demux_roq.c
==============================================================================
--- trunk/libmpdemux/demux_roq.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_roq.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -168,7 +168,7 @@ static demuxer_t* demux_open_roq(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;

Modified: trunk/libmpdemux/demux_smjpeg.c
==============================================================================
--- trunk/libmpdemux/demux_smjpeg.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_smjpeg.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -149,7 +149,7 @@ static demuxer_t* demux_open_smjpeg(demu
 	    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;

Modified: trunk/libmpdemux/demux_ts.c
==============================================================================
--- trunk/libmpdemux/demux_ts.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_ts.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -339,10 +339,9 @@ static void ts_add_stream(demuxer_t * de
 
 	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 * de
 			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++;
 		}
 

Modified: trunk/libmpdemux/demux_ty.c
==============================================================================
--- trunk/libmpdemux/demux_ty.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_ty.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -569,7 +569,7 @@ static int demux_ty_fill_buffer( demuxer
                }
 
                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;

Modified: trunk/libmpdemux/demux_viv.c
==============================================================================
--- trunk/libmpdemux/demux_viv.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_viv.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -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)

Modified: trunk/libmpdemux/demux_vqf.c
==============================================================================
--- trunk/libmpdemux/demux_vqf.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_vqf.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -48,7 +48,7 @@ static demuxer_t* demux_open_vqf(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));

Modified: trunk/libmpdemux/demux_xmms.c
==============================================================================
--- trunk/libmpdemux/demux_xmms.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demux_xmms.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -265,7 +265,7 @@ static int demux_xmms_open(demuxer_t* de
     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;
 

Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/demuxer.c	Sat Jul 10 20:47:59 2010	(r31675)
@@ -254,7 +254,7 @@ demuxer_t *new_demuxer(stream_t *stream,
     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 *demu
         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 *
         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];
 }

Modified: trunk/libmpdemux/stheader.h
==============================================================================
--- trunk/libmpdemux/stheader.h	Sat Jul 10 20:11:05 2010	(r31674)
+++ trunk/libmpdemux/stheader.h	Sat Jul 10 20:47:59 2010	(r31675)
@@ -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);
 


More information about the MPlayer-cvslog mailing list