summaryrefslogtreecommitdiffstats
path: root/stream/stream_dvdnav.c
diff options
context:
space:
mode:
authornicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-12-14 23:08:09 +0000
committernicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-12-14 23:08:09 +0000
commitb55a18019fec460902b6a1f1e5d598486e0fc957 (patch)
tree05de9620168890a50154ec859946de5fc2b4f1df /stream/stream_dvdnav.c
parent1b36df0c8597342add338bf4f7669fe44ee52f75 (diff)
downloadmpv-b55a18019fec460902b6a1f1e5d598486e0fc957.tar.bz2
mpv-b55a18019fec460902b6a1f1e5d598486e0fc957.tar.xz
implemented dvdnav_lang_from_aid() to retrieve audio language
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21619 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream/stream_dvdnav.c')
-rw-r--r--stream/stream_dvdnav.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c
index 90172be1ab..e5fd6028c1 100644
--- a/stream/stream_dvdnav.c
+++ b/stream/stream_dvdnav.c
@@ -515,6 +515,36 @@ int dvdnav_aid_from_lang(stream_t *stream, unsigned char *language) {
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'