[MPlayer-cvslog] r27021 - in trunk/stream: stream_dvdnav.c stream_dvdnav.h
ben
subversion at mplayerhq.hu
Sat Jun 7 15:06:27 CEST 2008
Author: ben
Date: Sat Jun 7 15:06:27 2008
New Revision: 27021
Log:
Add routine that provides audio ID corresponding to logical number
in dvdnav stream.
Modified:
trunk/stream/stream_dvdnav.c
trunk/stream/stream_dvdnav.h
Modified: trunk/stream/stream_dvdnav.c
==============================================================================
--- trunk/stream/stream_dvdnav.c (original)
+++ trunk/stream/stream_dvdnav.c Sat Jun 7 15:06:27 2008
@@ -682,6 +682,38 @@ void mp_dvdnav_update_mouse_pos(stream_t
}
/**
+ * \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
Modified: trunk/stream/stream_dvdnav.h
==============================================================================
--- trunk/stream/stream_dvdnav.h (original)
+++ trunk/stream/stream_dvdnav.h Sat Jun 7 15:06:27 2008
@@ -17,6 +17,7 @@ typedef struct {
} 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);
More information about the MPlayer-cvslog
mailing list