Mercurial > mplayer.hg
changeset 26083:19fa7a56ed04
Fill sh_audio_t.lang in lavf and mkv demuxers. Use it for printing audio track
language when available.
author | eugeni |
---|---|
date | Fri, 29 Feb 2008 17:25:37 +0000 |
parents | 026b1ac69d47 |
children | ec5749eb6f5f |
files | command.c libmpdemux/demux_lavf.c libmpdemux/demux_mkv.c libmpdemux/matroska.h |
diffstat | 4 files changed, 7 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/command.c Fri Feb 29 17:25:33 2008 +0000 +++ b/command.c Fri Feb 29 17:25:37 2008 +0000 @@ -810,8 +810,9 @@ *(char **) arg = strdup(MSGTR_Disabled); else { char lang[40] = MSGTR_Unknown; - if (mpctx->demuxer->type == DEMUXER_TYPE_MATROSKA) - demux_mkv_get_audio_lang(mpctx->demuxer, audio_id, lang, 9); + sh_audio_t* sh = mpctx->sh_audio; + if (sh && sh->lang) + av_strlcpy(lang, sh->lang, 40); #ifdef USE_DVDREAD else if (mpctx->stream->type == STREAMTYPE_DVD) { int code = dvd_lang_from_aid(mpctx->stream, audio_id);
--- a/libmpdemux/demux_lavf.c Fri Feb 29 17:25:33 2008 +0000 +++ b/libmpdemux/demux_lavf.c Fri Feb 29 17:25:37 2008 +0000 @@ -335,6 +335,8 @@ sh_audio->format = 0x7; break; } + if (st->language) + sh_audio->lang = strdup(st->language); if(mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf, MSGL_V); if((audio_lang && st->language[0] && !strncmp(audio_lang, st->language, 3)) || (demuxer->audio->id == i || demuxer->audio->id == -1)) {
--- a/libmpdemux/demux_mkv.c Fri Feb 29 17:25:33 2008 +0000 +++ b/libmpdemux/demux_mkv.c Fri Feb 29 17:25:37 2008 +0000 @@ -1873,6 +1873,8 @@ if(!sh_a) return 1; mkv_d->audio_tracks[mkv_d->last_aid] = track->tnum; + if (track->language && (strcmp(track->language, "und") != 0)) + sh_a->lang = strdup(track->language); sh_a->ds = demuxer->audio; sh_a->wf = malloc (sizeof (WAVEFORMATEX)); if (track->ms_compat && (track->private_size >= sizeof(WAVEFORMATEX))) @@ -3502,27 +3504,6 @@ av_strlcpy(lang, track->language, maxlen); } -/** \brief Get the language code for an audio track. - - Retrieves the language code for an audio track if it is known. - If the language code is "und" then do not copy it ("und" = "undefined"). - - \param demuxer The demuxer to work on - \param track_num The n'th audio track to get the language from - \param lang Store the language here - \param maxlen The maximum number of characters to copy into lang -*/ -void -demux_mkv_get_audio_lang(demuxer_t *demuxer, int track_num, char *lang, - int maxlen) -{ - mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv; - mkv_track_t *track = demux_mkv_find_track_by_num (mkv_d, track_num, MATROSKA_TRACK_AUDIO); - if (track && track->language && strcmp(track->language, "und")) - av_strlcpy(lang, track->language, maxlen); -} - - const demuxer_desc_t demuxer_desc_matroska = { "Matroska demuxer", "mkv",
--- a/libmpdemux/matroska.h Fri Feb 29 17:25:33 2008 +0000 +++ b/libmpdemux/matroska.h Fri Feb 29 17:25:37 2008 +0000 @@ -62,8 +62,6 @@ #define MKV_S_ASS "S_ASS" // Deprecated int demux_mkv_change_subs(demuxer_t *demuxer, int new_num); -void demux_mkv_get_audio_lang(demuxer_t *demuxer, int track_num, char *lang, - int maxlen); void demux_mkv_get_sub_lang(demuxer_t *demuxer, int track_num, char *lang, int maxlen);