Mercurial > mplayer.hg
changeset 21603:4bfdaf8bcae5
implemented dvdnav_lang_from_aid() to retrieve audio language
author | nicodvb |
---|---|
date | Thu, 14 Dec 2006 23:08:09 +0000 |
parents | ba96ae573d7f |
children | de2084d888cd |
files | stream/stream_dvdnav.c stream/stream_dvdnav.h |
diffstat | 2 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/stream/stream_dvdnav.c Thu Dec 14 22:37:13 2006 +0000 +++ b/stream/stream_dvdnav.c Thu Dec 14 23:08:09 2006 +0000 @@ -515,6 +515,36 @@ return -1; } +/** + * \brief dvdnav_lang_from_aid() assigns to buf the language corresponding to audio id 'aid' + * \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_aid(stream_t *stream, int aid, unsigned char *buf) { + uint8_t lg; + uint16_t lang; + dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv; + + if(aid >= 0x80 && aid < 0x88) + aid -= 0x80; + else if(aid >= 0x88 && aid <= 0x8F) + aid -= 0x88; + else if(aid >= 0xA0 && aid <= 0xAF) + aid -= 0xA0; + if(aid < 0) + return 0; + lg = dvdnav_get_audio_logical_stream(priv->dvdnav, aid); + if(lg == 0xff) return 0; + lang = dvdnav_audio_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_sid_from_lang() returns the subtitle id corresponding to the language code 'lang'
--- a/stream/stream_dvdnav.h Thu Dec 14 22:37:13 2006 +0000 +++ b/stream/stream_dvdnav.h Thu Dec 14 23:08:09 2006 +0000 @@ -31,6 +31,7 @@ int dvdnav_number_of_subs(stream_t *stream); int dvdnav_aid_from_lang(stream_t *stream, unsigned char *language); +int dvdnav_lang_from_aid(stream_t *stream, int id, unsigned char *buf); 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);