changeset 15580:fa5573007038

fix audio init crash
author joey
date Sat, 28 May 2005 20:12:09 +0000
parents 9493067fe39c
children 2e621c99354d
files libmpdemux/demux_ty.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_ty.c	Sat May 28 19:54:11 2005 +0000
+++ b/libmpdemux/demux_ty.c	Sat May 28 20:12:09 2005 +0000
@@ -635,7 +635,17 @@
                if( demux->audio->id == aid )
                {
                   ds = demux->audio;
-                  if( !ds->sh ) ds->sh = demux->a_streams[ aid ];
+                  if( !ds->sh ) {
+                    sh_audio_t* sh_a;
+                    ds->sh = demux->a_streams[ aid ];
+                    sh_a = (sh_audio_t*)ds->sh;
+                    switch(aid & 0xE0){  // 1110 0000 b  (high 3 bit: type  low 5: id)
+                      case 0x00: sh_a->format=0x50;break; // mpeg
+                      case 0xA0: sh_a->format=0x10001;break;  // dvd pcm
+                      case 0x80: if((aid & 0xF8) == 0x88) sh_a->format=0x2001;//dts
+                                  else sh_a->format=0x2000;break; // ac3
+                    }
+                 }
                }
             }