diff options
author | Michael Roitzsch <mroi@users.sourceforge.net> | 2003-02-13 16:24:27 +0000 |
---|---|---|
committer | Michael Roitzsch <mroi@users.sourceforge.net> | 2003-02-13 16:24:27 +0000 |
commit | bd64e5e9c5585ec37708dd3659be94a08ca97487 (patch) | |
tree | a707ee51fc2b4e40e388d85ccc5ba53969405b7d | |
parent | 032c05d1de6354a4dcd5c98c278a5f728c25b8c8 (diff) | |
download | xine-lib-bd64e5e9c5585ec37708dd3659be94a08ca97487.tar.gz xine-lib-bd64e5e9c5585ec37708dd3659be94a08ca97487.tar.bz2 |
use the requested channel number when querying for the language
(the _cool_ menu in xine-ui displays the correct languages now)
CVS patchset: 4144
CVS date: 2003/02/13 16:24:27
-rw-r--r-- | src/input/input_dvd.c | 89 | ||||
-rw-r--r-- | src/input/input_plugin.h | 4 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 34 |
3 files changed, 69 insertions, 58 deletions
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 27d13166d..52b31b546 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_dvd.c,v 1.126 2003/02/11 15:17:10 mroi Exp $ + * $Id: input_dvd.c,v 1.127 2003/02/13 16:24:27 mroi Exp $ * */ @@ -1052,37 +1052,39 @@ static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, case INPUT_OPTIONAL_DATA_AUDIOLANG: { uint16_t lang; - int8_t channel; + int channel = *((int *)data); + int8_t dvd_channel; /* Be paranoid */ if(this && this->stream && this->dvdnav) { if(!(dvdnav_is_domain_vts(this->dvdnav))) { sprintf(data, "%s", "menu"); - goto __audio_success; + if (channel <= 0) + return INPUT_OPTIONAL_SUCCESS; + else + return INPUT_OPTIONAL_UNSUPPORTED; } - channel = (int8_t) xine_get_audio_channel(this->stream); - /* printf("input_dvd: ********* AUDIO CHANNEL = %d\n", channel); */ - channel = dvdnav_get_audio_logical_stream(this->dvdnav, channel); - if(channel != -1) { - lang = dvdnav_audio_stream_to_lang(this->dvdnav, channel); + if (channel == -1) + dvd_channel = dvdnav_get_audio_logical_stream(this->dvdnav, this->stream->audio_channel_auto); + else + dvd_channel = dvdnav_get_audio_logical_stream(this->dvdnav, channel); + + if(dvd_channel != -1) { + lang = dvdnav_audio_stream_to_lang(this->dvdnav, dvd_channel); - if(lang != 0xffff) { + if(lang != 0xffff) sprintf(data, " %c%c", lang >> 8, lang & 0xff); - } - else { - sprintf(data, "%3i", xine_get_audio_channel(this->stream)); + else + sprintf(data, " %c%c", '?', '?'); + return INPUT_OPTIONAL_SUCCESS; + } else { + if (channel == -1) { + sprintf(data, "%s", "none"); + return INPUT_OPTIONAL_SUCCESS; } - } - else { - channel = xine_get_audio_channel(this->stream); - sprintf(data, "%3i", channel); } - - __audio_success: - /* printf("input_dvd: ********** RETURNING '%s'\n", (char *)data); */ - return INPUT_OPTIONAL_SUCCESS; } return INPUT_OPTIONAL_UNSUPPORTED; } @@ -1091,44 +1093,39 @@ static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, case INPUT_OPTIONAL_DATA_SPULANG: { uint16_t lang; - int8_t channel; + int channel = *((int *)data); + int8_t dvd_channel; /* Be paranoid */ if(this && this->stream && this->dvdnav) { if(!(dvdnav_is_domain_vts(this->dvdnav))) { sprintf(data, "%s", "menu"); - goto __spu_success; + if (channel <= 0) + return INPUT_OPTIONAL_SUCCESS; + else + return INPUT_OPTIONAL_UNSUPPORTED; } - channel = (int8_t) xine_get_spu_channel(this->stream); - /* printf("input_dvd: ********* SPU CHANNEL = %i\n", channel); */ if(channel == -1) - channel = dvdnav_get_spu_logical_stream(this->dvdnav, this->stream->spu_channel); + dvd_channel = dvdnav_get_spu_logical_stream(this->dvdnav, this->stream->spu_channel_auto); else - channel = dvdnav_get_spu_logical_stream(this->dvdnav, channel); - - if(channel != -1) { - lang = dvdnav_spu_stream_to_lang(this->dvdnav, channel); + dvd_channel = dvdnav_get_spu_logical_stream(this->dvdnav, channel); - if(lang != 0xffff) { + if(dvd_channel != -1) { + lang = dvdnav_spu_stream_to_lang(this->dvdnav, dvd_channel); + + if(lang != 0xffff) sprintf(data, " %c%c", lang >> 8, lang & 0xff); - } - else { - sprintf(data, "%3i", xine_get_spu_channel(this->stream)); - } - } - else { - channel = xine_get_spu_channel(this->stream); - if(channel == -1) - sprintf(data, "%s", "none"); else - sprintf(data, "%3i", channel); + sprintf(data, " %c%c", '?', '?'); + return INPUT_OPTIONAL_SUCCESS; + } else { + if(channel == -1) { + sprintf(data, "%s", "none"); + return INPUT_OPTIONAL_SUCCESS; + } } - - __spu_success: - /* printf("input_dvd: ********** RETURNING '%s'\n", (char *)data); */ - return INPUT_OPTIONAL_SUCCESS; } return INPUT_OPTIONAL_UNSUPPORTED; } @@ -1655,6 +1652,10 @@ static void *init_class (xine_t *xine, void *data) { /* * $Log: input_dvd.c,v $ + * Revision 1.127 2003/02/13 16:24:27 mroi + * use the requested channel number when querying for the language + * (the _cool_ menu in xine-ui displays the correct languages now) + * * Revision 1.126 2003/02/11 15:17:10 mroi * enable libdvdcss title key cache * diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index d66b97939..d0600bb43 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_plugin.h,v 1.44 2003/01/31 14:06:15 miguelfreitas Exp $ + * $Id: input_plugin.h,v 1.45 2003/02/13 16:24:27 mroi Exp $ */ #ifndef HAVE_INPUT_PLUGIN_H @@ -219,6 +219,8 @@ struct input_plugin_s { * input plugin knows something about audio/spu languages, * e.g. knows that audio stream #0 is english, * audio stream #1 is german, ... + * *((int *)data) will provide the requested channel number + * and awaits the language back in (char *)data */ #define INPUT_CAP_AUDIOLANG 0x00000008 diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index afb982ed5..7028f8fa0 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.228 2003/02/06 00:09:20 miguelfreitas Exp $ + * $Id: xine.c,v 1.229 2003/02/13 16:24:28 mroi Exp $ * * top-level xine functions * @@ -1312,9 +1312,11 @@ int xine_get_spu_lang (xine_stream_t *stream, int channel, char *lang) { **/ if (stream->demux_plugin) { if (stream->demux_plugin->get_capabilities (stream->demux_plugin) & DEMUX_CAP_SPULANG) { - stream->demux_plugin->get_optional_data (stream->demux_plugin, lang, - DEMUX_OPTIONAL_DATA_SPULANG); - return 1; + /* pass the channel number to the plugin in the data field */ + *((int *)lang) = channel; + if (stream->demux_plugin->get_optional_data (stream->demux_plugin, lang, + DEMUX_OPTIONAL_DATA_SPULANG) == DEMUX_OPTIONAL_SUCCESS) + return 1; } } @@ -1323,9 +1325,11 @@ int xine_get_spu_lang (xine_stream_t *stream, int channel, char *lang) { **/ if (stream->input_plugin) { if (stream->input_plugin->get_capabilities (stream->input_plugin) & INPUT_CAP_SPULANG) { - stream->input_plugin->get_optional_data (stream->input_plugin, lang, - INPUT_OPTIONAL_DATA_SPULANG); - return 1; + /* pass the channel number to the plugin in the data field */ + *((int *)lang) = channel; + if (stream->input_plugin->get_optional_data (stream->input_plugin, lang, + INPUT_OPTIONAL_DATA_SPULANG) == INPUT_OPTIONAL_SUCCESS) + return 1; } } @@ -1336,17 +1340,21 @@ int xine_get_audio_lang (xine_stream_t *stream, int channel, char *lang) { if (stream->demux_plugin) { if (stream->demux_plugin->get_capabilities (stream->demux_plugin) & DEMUX_CAP_AUDIOLANG) { - stream->demux_plugin->get_optional_data (stream->demux_plugin, lang, - DEMUX_OPTIONAL_DATA_AUDIOLANG); - return 1; + /* pass the channel number to the plugin in the data field */ + *((int *)lang) = channel; + if (stream->demux_plugin->get_optional_data (stream->demux_plugin, lang, + DEMUX_OPTIONAL_DATA_AUDIOLANG) == DEMUX_OPTIONAL_SUCCESS) + return 1; } } if (stream->input_plugin) { if (stream->input_plugin->get_capabilities (stream->input_plugin) & INPUT_CAP_AUDIOLANG) { - stream->input_plugin->get_optional_data (stream->input_plugin, lang, - INPUT_OPTIONAL_DATA_AUDIOLANG); - return 1; + /* pass the channel number to the plugin in the data field */ + *((int *)lang) = channel; + if (stream->input_plugin->get_optional_data (stream->input_plugin, lang, + INPUT_OPTIONAL_DATA_AUDIOLANG) == INPUT_OPTIONAL_SUCCESS) + return 1; } } |