changeset 21000:cc3cbc7985f1

implemented M_PROPERTY_SET in mp_property_{audio,video}
author nicodvb
date Sat, 18 Nov 2006 12:34:06 +0000
parents 1cf17aafeca1
children 0a9d4999368b
files mplayer.c
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mplayer.c	Sat Nov 18 12:32:12 2006 +0000
+++ b/mplayer.c	Sat Nov 18 12:34:06 2006 +0000
@@ -1795,7 +1795,7 @@
 
 /// Selected audio id (RW)
 static int mp_property_audio(m_option_t* prop,int action,void* arg) {
-    int current_id = -1;
+    int current_id = -1, tmp;
 
     if(!sh_audio) return M_PROPERTY_UNAVAILABLE;
 
@@ -1829,8 +1829,13 @@
         return M_PROPERTY_OK;
 
     case M_PROPERTY_STEP_UP:
+    case M_PROPERTY_SET:
+        if(action==M_PROPERTY_SET && arg)
+            tmp = *((int*)arg);
+        else
+            tmp = -1;
         current_id = demuxer->audio->id;
-        audio_id = demuxer_switch_audio(demuxer, -1);
+        audio_id = demuxer_switch_audio(demuxer, tmp);
         if(audio_id > -1 && demuxer->audio->id != current_id) {
           sh_audio_t *sh2;
           uninit_player(INITED_AO | INITED_ACODEC);
@@ -1852,7 +1857,7 @@
 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;
+    int current_id = -1, tmp;
 
     if(!sh_video) return M_PROPERTY_UNAVAILABLE;
 
@@ -1874,8 +1879,13 @@
         return M_PROPERTY_OK;
 
     case M_PROPERTY_STEP_UP:
+    case M_PROPERTY_SET:
         current_id = demuxer->video->id;
-        video_id = demuxer_switch_video(demuxer, -1);
+        if(action==M_PROPERTY_SET && arg)
+            tmp = *((int*)arg);
+        else
+            tmp = -1;
+        video_id = demuxer_switch_video(demuxer, tmp);
         if(video_id > -1 && demuxer->video->id != current_id) {
           sh_video_t *sh2;
           uninit_player(INITED_VCODEC | (fixed_vo ? 0 : INITED_VO));