[MPlayer-dev-eng] Re: [PATCH] OSD: audio switching visualization
Paul TT
paultt at hackerjournal.it
Sun Nov 6 16:44:05 CET 2005
On Sun, 6 Nov 2005 16:05:07 +0100
Tobias Diedrich <ranma at tdiedrich.de> wrote:
> Paul TT wrote:
>
> > +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;
> > + int i, num;
> > +
> > + num = 0;
> > + for (i = 0; i < mkv_d->num_tracks; i++)
> > + {
> > + track = mkv_d->tracks[i];
> > + if (track->type == MATROSKA_TRACK_AUDIO)
> > + num++;
> > + if (num == (track_num + 1))
> > + {
> > + if ((track->language != NULL) &&
> > + strcmp(track->language, "und"))
> > + strncpy(lang, track->language, maxlen);
> ^^^^^^^
> Since we now have a working strlcpy, we might as well use it here. :-)
yep, true
> > case MP_CMD_SWITCH_AUDIO : {
> > - int v = demuxer_switch_audio(demuxer, cmd->args[0].v.i);
> > + audio_id = demuxer_switch_audio(demuxer, cmd->args[0].v.i);
> ^^^^^^^^
> Does this compile? I'd expect "int audio_id".
is the global audio_id :-)
i should have saved it after, so i used it directly...
> > if (identify)
> > - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_AUDIO_TRACK=%d\n", v);
> > + mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_AUDIO_TRACK=%d\n",
audio_id);
> > + osd_show_audio_changed = 9;
> ^
> This should depend on video fps, e.g. sh_video->fps/2.
> For example some detelecined avis are 120fps, then this would be
> very short.
mhhh, this could be subject for another patch... this value is this
number for every other osd msg.... but i think you're definitely right!
we could define it at beginning of osd code, based on that fps, what do
you think???
> > + if (osd_show_audio_changed) {
> > + char lang[10] = MSGTR_OSDunknown;
> ^^^^^^^^
> Should be longer or not use a fixed size buffer.
> Other languages and encodings might need more characters...
yes, i'll write that as was done for similar code about subtitles...
thanx
More information about the MPlayer-dev-eng
mailing list