diff options
author | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-12-10 17:25:54 +0000 |
---|---|---|
committer | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-12-10 17:25:54 +0000 |
commit | a59ebe0c2db41e2f37f644f43dac8ab3825fd151 (patch) | |
tree | 1bc85c439111b0465874481703a1822e48edd976 /stream | |
parent | b5b3b6a41a47fabf81b79fec27b417fafb4dcbc0 (diff) | |
download | mpv-a59ebe0c2db41e2f37f644f43dac8ab3825fd151.tar.bz2 mpv-a59ebe0c2db41e2f37f644f43dac8ab3825fd151.tar.xz |
added function to return the language of the specified subtitle id. Patch by
o o
O tvos Attila
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21576 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream_dvdnav.c | 21 | ||||
-rw-r--r-- | stream/stream_dvdnav.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c index 641a8ad676..c651837ed2 100644 --- a/stream/stream_dvdnav.c +++ b/stream/stream_dvdnav.c @@ -500,6 +500,27 @@ int dvdnav_sid_from_lang(stream_t *stream, unsigned char *language) { } /** + * \brief dvdnav_lang_from_sid() assigns to buf the language corresponding to subtitle id 'sid' + * \param stream: - stream pointer + * \param sid: physical subtitle id + * \param buf: buffer to contain the 2-chars language string + * \return 0 on error, 1 if successful + */ +int dvdnav_lang_from_sid(stream_t *stream, int sid, unsigned char *buf) { + uint8_t lg, k; + uint16_t lang; + dvdnav_priv_t *priv=(dvdnav_priv_t*)stream->priv; + if(sid < 0) return 0; + lg = dvdnav_get_spu_logical_stream(priv->dvdnav, sid); + lang = dvdnav_spu_stream_to_lang(priv->dvdnav, lg); + if(lang == 0xffff) return 0; + buf[0] = lang >> 8; + buf[1] = lang & 0xFF; + buf[2] = 0; + return 1; +} + +/** * \brief dvdnav_number_of_subs() returns the count of available subtitles * \param stream: - stream pointer * \return 0 on error, something meaningful otherwise diff --git a/stream/stream_dvdnav.h b/stream/stream_dvdnav.h index 726187ec40..4d10eb4b6a 100644 --- a/stream/stream_dvdnav.h +++ b/stream/stream_dvdnav.h @@ -31,6 +31,7 @@ typedef struct { int dvdnav_number_of_subs(stream_t *stream); int dvdnav_sid_from_lang(stream_t *stream, unsigned char *language); +int dvdnav_lang_from_sid(stream_t *stream, int sid, unsigned char *buf); int mp_dvdnav_handle_input(stream_t *stream, int cmd, int *button); void mp_dvdnav_update_mouse_pos(stream_t *stream, int32_t x, int32_t y, int* button); void mp_dvdnav_get_highlight (stream_t *stream, nav_highlight_t *hl); |