Mercurial > mplayer.hg
changeset 2935:bc6cb25ad067
add dvd audio stream detect
author | pontscho |
---|---|
date | Fri, 16 Nov 2001 22:26:57 +0000 |
parents | ce3ca95ffba3 |
children | 53d168c38d29 |
files | libmpdemux/open.c libmpdemux/stream.h |
diffstat | 2 files changed, 99 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/open.c Fri Nov 16 22:26:47 2001 +0000 +++ b/libmpdemux/open.c Fri Nov 16 22:26:57 2001 +0000 @@ -47,24 +47,8 @@ #define LIBDVDREAD_VERSION DVDREAD_VERSION(0,8,0) #endif - -typedef struct { - dvd_reader_t *dvd; - dvd_file_t *title; - ifo_handle_t *vmg_file; - tt_srpt_t *tt_srpt; - ifo_handle_t *vts_file; - vts_ptt_srpt_t *vts_ptt_srpt; - pgc_t *cur_pgc; - // - int cur_cell; - int cur_pack; - int cell_last_pack; - // Navi: - int packs_left; - dsi_t dsi_pack; - int angle_seek; -} dvd_priv_t; +char * dvd_audio_stream_types[8] = + { "ac3","unknown","mpeg1","mpeg2ext","lpcm","unknown","dts" }; #endif @@ -222,6 +206,68 @@ d->vts_file=vts_file; /** + * Check number of audio channels and types + */ +// fprintf( stderr,"[open] nr_audio streams: %d\n",vts_file->vtsi_mat->nr_of_vts_audio_streams ); + { + int ac3aid = 128; + int mpegaid = 0; + int pcmaid = 160; + + d->nr_of_channels=0; + + if ( vts_file->vts_pgcit ) + { + int i; + for ( i=0;i<8;i++ ) + if ( vts_file->vts_pgcit->pgci_srp[0].pgc->audio_control[i] & 0x8000 ) + { + audio_attr_t * audio = &vts_file->vtsi_mat->vts_audio_attr[i]; + int language = 0; + char tmp[] = "unknown"; + + if ( audio->lang_type == 1 ) + { + language=audio->lang_code; + tmp[0]=language>>8; + tmp[1]=language&0xff; + tmp[2]=0; + } + + d->audio_streams[d->nr_of_channels].language=language; + d->audio_streams[d->nr_of_channels].id=0; + switch ( audio->audio_format ) + { + case 0: // ac3 + case 6: // dts + d->audio_streams[d->nr_of_channels].id=ac3aid; + ac3aid++; + break; + case 2: // mpeg layer 1/2/3 + case 3: // mpeg2 ext + d->audio_streams[d->nr_of_channels].id=mpegaid; + mpegaid++; + break; + case 4: // lpcm + d->audio_streams[d->nr_of_channels].id=pcmaid; + pcmaid++; + break; + } + + mp_msg(MSGT_OPEN,MSGL_V,"[open] audio stream: %d audio format: %s language: %s aid: %d\n", + d->nr_of_channels, + dvd_audio_stream_types[ audio->audio_format ], + tmp, + d->audio_streams[d->nr_of_channels].id + ); + + d->nr_of_channels++; + } + } + mp_msg(MSGT_OPEN,MSGL_V,"[open] %d audio channel found on disk.\n",d->nr_of_channels ); + } + + /** * Determine which program chain we want to watch. This is based on the * chapter number. */
--- a/libmpdemux/stream.h Fri Nov 16 22:26:47 2001 +0000 +++ b/libmpdemux/stream.h Fri Nov 16 22:26:57 2001 +0000 @@ -158,4 +158,39 @@ extern int dvd_angle; //#endif +#ifdef USE_DVDREAD + +#include <dvdread/dvd_reader.h> +#include <dvdread/ifo_types.h> +#include <dvdread/ifo_read.h> +#include <dvdread/nav_read.h> + +typedef struct { + int id; // 0 - 31 mpeg; 128 - 159 ac3; 160 - 191 pcm + int language; +} audio_stream_t; + +typedef struct { + dvd_reader_t *dvd; + dvd_file_t *title; + ifo_handle_t *vmg_file; + tt_srpt_t *tt_srpt; + ifo_handle_t *vts_file; + vts_ptt_srpt_t *vts_ptt_srpt; + pgc_t *cur_pgc; +// + int cur_cell; + int cur_pack; + int cell_last_pack; +// Navi: + int packs_left; + dsi_t dsi_pack; + int angle_seek; +// audio datas + int nr_of_channels; + audio_stream_t audio_streams[8]; +} dvd_priv_t; + +#endif + #endif // __STREAM_H