aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-26 00:16:09 +0000
committerGravatar arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-26 00:16:09 +0000
commit6c60debbb5c28176faac033d3c02f763c2d4756c (patch)
tree5006c209b635a18aff8137a68363bf1b6ba51358
parent1a9005e6011883e0805c672474ba7b2740e1db06 (diff)
dvd language->aid/sid functions
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3754 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libmpdemux/open.c40
-rw-r--r--libmpdemux/stream.h3
2 files changed, 41 insertions, 2 deletions
diff --git a/libmpdemux/open.c b/libmpdemux/open.c
index 6a6f8c20fe..c915905781 100644
--- a/libmpdemux/open.c
+++ b/libmpdemux/open.c
@@ -261,7 +261,7 @@ if(dvd_title){
tmp,
d->audio_streams[d->nr_of_channels].id
);
-
+
d->nr_of_channels++;
}
}
@@ -403,9 +403,45 @@ tv_err:
}
-
#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;
diff --git a/libmpdemux/stream.h b/libmpdemux/stream.h
index f10dbab862..d638a155f6 100644
--- a/libmpdemux/stream.h
+++ b/libmpdemux/stream.h
@@ -203,6 +203,9 @@ typedef struct {
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