[MPlayer-cvslog] r36778 - in trunk: libmpdemux/demux_lavf.c libmpdemux/demuxer.c libmpdemux/demuxer.h mencoder.c mpcommon.c mpcommon.h mplayer.c
ib
subversion at mplayerhq.hu
Sun Feb 2 20:18:31 CET 2014
Author: ib
Date: Sun Feb 2 20:18:31 2014
New Revision: 36778
Log:
Add support for default of multiple video tracks.
Some container formats like matroska support multiple video tracks, one
of which may be flagged the 'default' one which thus should be played by
default.
Works with the lavf demuxer.
Modified:
trunk/libmpdemux/demux_lavf.c
trunk/libmpdemux/demuxer.c
trunk/libmpdemux/demuxer.h
trunk/mencoder.c
trunk/mpcommon.c
trunk/mpcommon.h
trunk/mplayer.c
Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c Sun Feb 2 11:54:37 2014 (r36777)
+++ trunk/libmpdemux/demux_lavf.c Sun Feb 2 20:18:31 2014 (r36778)
@@ -403,6 +403,8 @@ static void handle_stream(demuxer_t *dem
sh_video->i_bps=codec->bit_rate/8;
if (title && title->value)
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VID_%d_NAME=%s\n", priv->video_streams, title->value);
+ if (st->disposition & AV_DISPOSITION_DEFAULT)
+ sh_video->default_track = 1;
if (rot && rot->value)
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VID_%d_ROTATE=%s\n", priv->video_streams, rot->value);
mp_msg(MSGT_DEMUX,MSGL_DBG2,"aspect= %d*%d/(%d*%d)\n",
Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c Sun Feb 2 11:54:37 2014 (r36777)
+++ trunk/libmpdemux/demuxer.c Sun Feb 2 20:18:31 2014 (r36778)
@@ -1916,6 +1916,22 @@ int demuxer_default_audio_track(demuxer_
return -1;
}
+int demuxer_default_video_track(demuxer_t *d)
+{
+ int i;
+ for (i = 0; i < MAX_V_STREAMS; ++i) {
+ sh_video_t *sh = d->v_streams[i];
+ if (sh && sh->default_track)
+ return sh->vid;
+ }
+ for (i = 0; i < MAX_V_STREAMS; ++i) {
+ sh_video_t *sh = d->v_streams[i];
+ if (sh)
+ return sh->vid;
+ }
+ return -1;
+}
+
int demuxer_default_sub_track(demuxer_t *d)
{
int i;
Modified: trunk/libmpdemux/demuxer.h
==============================================================================
--- trunk/libmpdemux/demuxer.h Sun Feb 2 11:54:37 2014 (r36777)
+++ trunk/libmpdemux/demuxer.h Sun Feb 2 20:18:31 2014 (r36778)
@@ -486,6 +486,7 @@ int demuxer_sub_track_by_lang(demuxer_t*
// for subtitles, it is the first track with default attribute
// for audio, additionally, the first track is selected if no track has default attribute set
int demuxer_default_audio_track(demuxer_t* d);
+int demuxer_default_video_track(demuxer_t* d);
int demuxer_default_sub_track(demuxer_t* d);
#endif /* MPLAYER_DEMUXER_H */
Modified: trunk/mencoder.c
==============================================================================
--- trunk/mencoder.c Sun Feb 2 11:54:37 2014 (r36777)
+++ trunk/mencoder.c Sun Feb 2 20:18:31 2014 (r36778)
@@ -709,10 +709,10 @@ if(stream->type==STREAMTYPE_DVDNAV){
demux_program_t prog = { .progid = ts_prog };
if (demux_control(demuxer, DEMUXER_CTRL_IDENTIFY_PROGRAM, &prog) != DEMUXER_CTRL_NOTIMPL) {
audio_id = prog.aid; // switching is handled by select_audio below
- video_id = prog.vid;
- demuxer_switch_video(demuxer, video_id);
+ video_id = prog.vid; // switching is handled by select_video below
}
}
+ select_video(demuxer, video_id);
select_audio(demuxer, audio_id, audio_lang);
if (dvdsub_id == -1 && dvdsub_lang)
Modified: trunk/mpcommon.c
==============================================================================
--- trunk/mpcommon.c Sun Feb 2 11:54:37 2014 (r36777)
+++ trunk/mpcommon.c Sun Feb 2 20:18:31 2014 (r36778)
@@ -416,6 +416,16 @@ int select_audio(demuxer_t* demuxer, int
return demuxer->audio->id;
}
+int select_video(demuxer_t* demuxer, int video_id)
+{
+ if (video_id == -1)
+ video_id = demuxer_default_video_track(demuxer);
+ if (video_id != -1) // -1 (automatic) is the default behaviour of demuxers
+ demuxer_switch_video(demuxer, video_id);
+
+ return demuxer->video->id;
+}
+
/* Parse -noconfig common to both programs */
int disable_system_conf=0;
int disable_user_conf=0;
Modified: trunk/mpcommon.h
==============================================================================
--- trunk/mpcommon.h Sun Feb 2 11:54:37 2014 (r36777)
+++ trunk/mpcommon.h Sun Feb 2 20:18:31 2014 (r36778)
@@ -75,6 +75,7 @@ void init_vo_spudec(struct stream *strea
void update_subtitles(struct sh_video *sh_video, double refpts, demux_stream_t *d_dvdsub, int reset);
void update_teletext(struct sh_video *sh_video, demuxer_t *demuxer, int reset);
int select_audio(demuxer_t* demuxer, int audio_id, char* audio_lang);
+int select_video(demuxer_t* demuxer, int video_id);
void set_osd_subtitle(subtitle *subs);
int cfg_inc_verbose(m_option_t *conf);
Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c Sun Feb 2 11:54:37 2014 (r36777)
+++ trunk/mplayer.c Sun Feb 2 20:18:31 2014 (r36778)
@@ -3458,6 +3458,10 @@ goto_enable_cache:
int tmp = ts_prog;
mp_property_do("switch_program", M_PROPERTY_SET, &tmp, mpctx);
}
+
+ // select video stream
+ select_video(mpctx->demuxer, video_id);
+
// select audio stream
select_audio(mpctx->demuxer, audio_id, audio_lang);
More information about the MPlayer-cvslog
mailing list