diff options
author | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-11-16 21:25:35 +0000 |
---|---|---|
committer | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-11-16 21:25:35 +0000 |
commit | 17fde01155db9a3ab8329970ebda6a758c309cbc (patch) | |
tree | 0f9d7f0c0624ed13de5bd372188bc3bdd8c6999d /mplayer.c | |
parent | 96e829fc9c37f01952f3ccb8785ea0a8e9046937 (diff) | |
download | mpv-17fde01155db9a3ab8329970ebda6a758c309cbc.tar.bz2 mpv-17fde01155db9a3ab8329970ebda6a758c309cbc.tar.xz |
handle video stream switch using 'switch_video' property'
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20965 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 48 |
1 files changed, 48 insertions, 0 deletions
@@ -1842,6 +1842,52 @@ static int mp_property_audio(m_option_t* prop,int action,void* arg) { } } mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_TRACK=%d\n", audio_id); + break; + default: + return M_PROPERTY_NOT_IMPLEMENTED; + } + + return 1; +} + +static int reinit_video_chain(void); +/// Selected video id (RW) +static int mp_property_video(m_option_t* prop,int action,void* arg) { + int current_id = -1; + + if(!sh_video) return M_PROPERTY_UNAVAILABLE; + + switch(action) { + case M_PROPERTY_GET: + if(!arg) return 0; + *(int*)arg = video_id; + return 1; + case M_PROPERTY_PRINT: + if(!arg) return 0; + + if (video_id < 0) + *(char**)arg = strdup(MSGTR_Disabled); + else { + char lang[40] = MSGTR_Unknown; + *(char**)arg = malloc(64); + snprintf(*(char**)arg, 64, "(%d)", video_id, lang); + } + return 1; + + case M_PROPERTY_STEP_UP: + current_id = demuxer->video->id; + video_id = demuxer_switch_video(demuxer, -1); + if(video_id > -1 && demuxer->video->id != current_id) { + sh_video_t *sh2; + uninit_player(INITED_VCODEC | (fixed_vo ? 0 : INITED_VO)); + sh2 = demuxer->v_streams[demuxer->video->id]; + if(sh2) { + sh2->ds = demuxer->video; + sh_video = sh2; + reinit_video_chain(); + } + } + mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_TRACK=%d\n", video_id); break; default: @@ -2458,6 +2504,8 @@ static m_option_t mp_properties[] = { 0, 0, 0, NULL }, { "aspect", mp_property_aspect, CONF_TYPE_FLOAT, 0, 0, 0, NULL }, + { "switch_video", mp_property_video, CONF_TYPE_INT, + -1, -1, 0, NULL }, // Subs { "sub", mp_property_sub, CONF_TYPE_INT, |