From 804bf91570a24b949a6c68530daaf9162df9a234 Mon Sep 17 00:00:00 2001 From: mplayer-svn Date: Sun, 19 Feb 2012 13:15:41 +0000 Subject: commands, dvd, dvdnav, bluray: cleanup sub/audio track language display Code cleanup: Use a stream_control instead of global functions to get the language associate with a audio or subtitle stream from the streaming layer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34736 b3059339-0415-0410-9bf9-f77b7e298cf2 Support showing the stream language with br:// playback. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34737 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix DVDs showing the subtitle language as "unknown" for a long time. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34777 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar Note: heavily modified by wm4 for this fork of mplayer. --- stream/stream_dvd.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'stream/stream_dvd.c') diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index b9ffafed8f..e3e1595619 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -24,6 +24,7 @@ #include #include "config.h" +#include "talloc.h" #include "mp_msg.h" #include @@ -112,7 +113,7 @@ int dvd_chapter_from_cell(dvd_priv_t* dvd,int title,int cell) return chapter; } -int dvd_lang_from_aid(stream_t *stream, int id) { +static int dvd_lang_from_aid(stream_t *stream, int id) { dvd_priv_t *d; int i; if (!stream) return 0; @@ -155,7 +156,7 @@ int dvd_number_of_subs(stream_t *stream) { return maxid + 1; } -int dvd_lang_from_sid(stream_t *stream, int id) { +static int dvd_lang_from_sid(stream_t *stream, int id) { int i; dvd_priv_t *d; if (!stream) return 0; @@ -687,6 +688,23 @@ static int control(stream_t *stream,int cmd,void* arg) d->angle_seek = 1; return 1; } + case STREAM_CTRL_GET_LANG: + { + struct stream_lang_req *req = arg; + int lang = 0; + switch(req->type) { + case stream_ctrl_audio: + lang = dvd_lang_from_aid(stream, req->id); + break; + case stream_ctrl_sub: + lang = dvd_lang_from_sid(stream, req->id); + break; + } + if (!lang) + break; + req->name = talloc_strdup(NULL, (char[]) {lang >> 8, lang, 0}); + return STREAM_OK; + } } return STREAM_UNSUPPORTED; } -- cgit v1.2.3