Mercurial > mplayer.hg
changeset 26989:1c6b9d0c63aa
Add routine that provides audio ID corresponding to logical number
in dvdnav stream.
author | ben |
---|---|
date | Sat, 07 Jun 2008 13:06:27 +0000 |
parents | 21ce55d8dde0 |
children | 9077741c9ed6 |
files | stream/stream_dvdnav.c stream/stream_dvdnav.h |
diffstat | 2 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/stream/stream_dvdnav.c Sat Jun 07 13:04:53 2008 +0000 +++ b/stream/stream_dvdnav.c Sat Jun 07 13:06:27 2008 +0000 @@ -682,6 +682,38 @@ } /** + * \brief mp_dvdnav_aid_from_audio_num() returns the audio id corresponding to the logical number + * \param stream: - stream pointer + * \param audio_num: - logical number + * \return -1 on error, current subtitle id if successful + */ +int mp_dvdnav_aid_from_audio_num(stream_t *stream, int audio_num) { + dvdnav_priv_t * priv = stream->priv; + int k; + uint8_t format, lg; + + for(k=0; k<32; k++) { + lg = dvdnav_get_audio_logical_stream(priv->dvdnav, k); + if (lg == 0xff) continue; + if (lg != audio_num) continue; + format = dvdnav_audio_stream_format(priv->dvdnav, lg); + switch(format) { + case DVDNAV_FORMAT_AC3: + return k+128; + case DVDNAV_FORMAT_DTS: + return k+136; + case DVDNAV_FORMAT_LPCM: + return k+160; + case DVDNAV_FORMAT_MPEGAUDIO: + return k; + default: + return -1; + } + } + return -1; +} + +/** * \brief mp_dvdnav_aid_from_lang() returns the audio id corresponding to the language code 'lang' * \param stream: - stream pointer * \param lang: 2-characters language code[s], eventually separated by spaces of commas
--- a/stream/stream_dvdnav.h Sat Jun 07 13:04:53 2008 +0000 +++ b/stream/stream_dvdnav.h Sat Jun 07 13:06:27 2008 +0000 @@ -17,6 +17,7 @@ } nav_highlight_t; int mp_dvdnav_number_of_subs(stream_t *stream); +int mp_dvdnav_aid_from_audio_num(stream_t *stream, int audio_num); int mp_dvdnav_aid_from_lang(stream_t *stream, unsigned char *language); int mp_dvdnav_lang_from_aid(stream_t *stream, int id, unsigned char *buf); int mp_dvdnav_sid_from_lang(stream_t *stream, unsigned char *language);