Mercurial > mplayer.hg
changeset 3753:d3fc41a04cb7
dvd language->aid/sid functions
author | arpi |
---|---|
date | Wed, 26 Dec 2001 00:16:09 +0000 |
parents | 61244d76348f |
children | 174e473f582d |
files | libmpdemux/open.c libmpdemux/stream.h |
diffstat | 2 files changed, 41 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/open.c Wed Dec 26 00:13:59 2001 +0000 +++ b/libmpdemux/open.c Wed Dec 26 00:16:09 2001 +0000 @@ -261,7 +261,7 @@ tmp, d->audio_streams[d->nr_of_channels].id ); - + d->nr_of_channels++; } } @@ -403,8 +403,44 @@ } +#ifdef USE_DVDREAD -#ifdef USE_DVDREAD +int dvd_aid_from_lang(stream_t *stream, unsigned char* lang){ +dvd_priv_t *d=stream->priv; +int code,i; + while(lang && strlen(lang)>=2){ + code=lang[1]|(lang[0]<<8); + for(i=0;i<d->nr_of_channels;i++){ + if(d->audio_streams[i].language==code){ + mp_msg(MSGT_OPEN,MSGL_INFO,"Selected DVD audio channel: %d language: %c%c\n", + d->audio_streams[i].id, lang[0],lang[1]); + return d->audio_streams[i].id; + } +// printf("%X != %X (%c%c)\n",code,d->audio_streams[i].language,lang[0],lang[1]); + } + lang+=2; while (lang[0]==',' || lang[0]==' ') ++lang; + } + mp_msg(MSGT_OPEN,MSGL_INFO,"No matching DVD audio language found!\n"); + return -1; +} + +int dvd_sid_from_lang(stream_t *stream, unsigned char* lang){ +dvd_priv_t *d=stream->priv; +int code,i; + while(lang && strlen(lang)>=2){ + code=lang[1]|(lang[0]<<8); + for(i=0;i<d->nr_of_subtitles;i++){ + if(d->subtitles[i].language==code){ + mp_msg(MSGT_OPEN,MSGL_INFO,"Selected DVD subtitle channel: %d language: %c%c\n", + d->subtitles[i].id, lang[0],lang[1]); + return d->subtitles[i].id; + } + } + lang+=2; while (lang[0]==',' || lang[0]==' ') ++lang; + } + mp_msg(MSGT_OPEN,MSGL_INFO,"No matching DVD subtitle language found!\n"); + return -1; +} static int dvd_next_cell(dvd_priv_t *d){ int next_cell=d->cur_cell;
--- a/libmpdemux/stream.h Wed Dec 26 00:13:59 2001 +0000 +++ b/libmpdemux/stream.h Wed Dec 26 00:16:09 2001 +0000 @@ -203,6 +203,9 @@ stream_language_t subtitles[32]; } dvd_priv_t; +int dvd_aid_from_lang(stream_t *stream, unsigned char* lang); +int dvd_sid_from_lang(stream_t *stream, unsigned char* lang); + #endif #endif // __STREAM_H