Mercurial > mplayer.hg
comparison mplayer.c @ 20949:fdc42ef57a58
handle video stream switch using 'switch_video' property'
author | nicodvb |
---|---|
date | Thu, 16 Nov 2006 21:25:35 +0000 |
parents | 6baefa24946f |
children | c0bcec5150a3 |
comparison
equal
deleted
inserted
replaced
20948:7c91b80cabc1 | 20949:fdc42ef57a58 |
---|---|
1840 sh_audio = sh2; | 1840 sh_audio = sh2; |
1841 reinit_audio_chain(); | 1841 reinit_audio_chain(); |
1842 } | 1842 } |
1843 } | 1843 } |
1844 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_TRACK=%d\n", audio_id); | 1844 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_TRACK=%d\n", audio_id); |
1845 break; | |
1846 default: | |
1847 return M_PROPERTY_NOT_IMPLEMENTED; | |
1848 } | |
1849 | |
1850 return 1; | |
1851 } | |
1852 | |
1853 static int reinit_video_chain(void); | |
1854 /// Selected video id (RW) | |
1855 static int mp_property_video(m_option_t* prop,int action,void* arg) { | |
1856 int current_id = -1; | |
1857 | |
1858 if(!sh_video) return M_PROPERTY_UNAVAILABLE; | |
1859 | |
1860 switch(action) { | |
1861 case M_PROPERTY_GET: | |
1862 if(!arg) return 0; | |
1863 *(int*)arg = video_id; | |
1864 return 1; | |
1865 case M_PROPERTY_PRINT: | |
1866 if(!arg) return 0; | |
1867 | |
1868 if (video_id < 0) | |
1869 *(char**)arg = strdup(MSGTR_Disabled); | |
1870 else { | |
1871 char lang[40] = MSGTR_Unknown; | |
1872 *(char**)arg = malloc(64); | |
1873 snprintf(*(char**)arg, 64, "(%d)", video_id, lang); | |
1874 } | |
1875 return 1; | |
1876 | |
1877 case M_PROPERTY_STEP_UP: | |
1878 current_id = demuxer->video->id; | |
1879 video_id = demuxer_switch_video(demuxer, -1); | |
1880 if(video_id > -1 && demuxer->video->id != current_id) { | |
1881 sh_video_t *sh2; | |
1882 uninit_player(INITED_VCODEC | (fixed_vo ? 0 : INITED_VO)); | |
1883 sh2 = demuxer->v_streams[demuxer->video->id]; | |
1884 if(sh2) { | |
1885 sh2->ds = demuxer->video; | |
1886 sh_video = sh2; | |
1887 reinit_video_chain(); | |
1888 } | |
1889 } | |
1890 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_TRACK=%d\n", video_id); | |
1845 | 1891 |
1846 break; | 1892 break; |
1847 default: | 1893 default: |
1848 return M_PROPERTY_NOT_IMPLEMENTED; | 1894 return M_PROPERTY_NOT_IMPLEMENTED; |
1849 } | 1895 } |
2456 0, 0, 0, NULL }, | 2502 0, 0, 0, NULL }, |
2457 { "fps", mp_property_fps, CONF_TYPE_FLOAT, | 2503 { "fps", mp_property_fps, CONF_TYPE_FLOAT, |
2458 0, 0, 0, NULL }, | 2504 0, 0, 0, NULL }, |
2459 { "aspect", mp_property_aspect, CONF_TYPE_FLOAT, | 2505 { "aspect", mp_property_aspect, CONF_TYPE_FLOAT, |
2460 0, 0, 0, NULL }, | 2506 0, 0, 0, NULL }, |
2507 { "switch_video", mp_property_video, CONF_TYPE_INT, | |
2508 -1, -1, 0, NULL }, | |
2461 | 2509 |
2462 // Subs | 2510 // Subs |
2463 { "sub", mp_property_sub, CONF_TYPE_INT, | 2511 { "sub", mp_property_sub, CONF_TYPE_INT, |
2464 M_OPT_MIN, -1, 0, NULL }, | 2512 M_OPT_MIN, -1, 0, NULL }, |
2465 { "sub_delay", mp_property_sub_delay, CONF_TYPE_FLOAT, | 2513 { "sub_delay", mp_property_sub_delay, CONF_TYPE_FLOAT, |