[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeextragear-2/kmplayer/src [POSSIBLY UNSAFE]
From:       Koos Vriezen <koos.vriezen () xs4all ! nl>
Date:       2003-12-30 2:59:12
[Download RAW message or body]

CVS commit by vriezen: 

Support for Xine audio visualization post plugin through audio.visualization property


  M +32 -0     xineplayer.cpp   1.30 [POSSIBLY UNSAFE: printf]


--- kdeextragear-2/kmplayer/src/xineplayer.cpp  #1.29:1.30
@@ -77,4 +77,5 @@ static xine_stream_t       *sub_stream;
 static xine_video_port_t   *vo_port;
 static xine_audio_port_t   *ao_port;
+static xine_post_t         *post_plugin;
 static xine_event_queue_t  *event_queue;
 static x11_visual_t         vis;
@@ -147,4 +148,21 @@ static void frame_output_cb(void * /*dat
 }
 
+static void xine_config_cb (void * /*user_data*/, xine_cfg_entry_t * entry) {
+    fprintf (stderr, "xine_config_cb %s\n", entry->enum_values[entry->num_value]);
+    if (!stream)
+        return;
+    mutex.lock ();
+    if (post_plugin) {
+        xine_post_wire_audio_port (xine_get_audio_source (stream), ao_port);
+        xine_post_dispose (xine, post_plugin);
+        post_plugin = 0L;
+    }
+    if (strcmp (entry->enum_values[entry->num_value], "none")) {
+        post_plugin = xine_post_init (xine, entry->enum_values[entry->num_value], 0, \
&ao_port, &vo_port); +        xine_post_wire (xine_get_audio_source (stream), \
xine_post_input (post_plugin, (char *) "audio in")); +    }
+    mutex.unlock ();
+}
+
 static void event_listener(void * /*user_data*/, const xine_event_t *event) {
     if (event->stream != stream)
@@ -394,4 +412,13 @@ void KXinePlayer::init () {
 
     ao_port = xine_open_audio_driver (xine, d->ao_driver, NULL);
+    const char *const * pp = xine_list_post_plugins_typed (xine, \
XINE_POST_TYPE_AUDIO_VISUALIZATION); +    int i;
+    for (i = 0; pp[i]; i++);
+    const char ** options = new const char * [i+2];
+    options[0] = "none";
+    for (i = 0; pp[i]; i++)
+        options[i+1] = pp[i];
+    options[i+1] = 0L;
+    xine_config_register_enum (xine, "audio.visualization", 0, (char ** ) options, \
0L, 0L, 0, xine_config_cb, 0L);  }
 
@@ -510,5 +537,10 @@ void KXinePlayer::play () {
         return;
     }
+    bool audio_vis = !xine_get_stream_info (stream, XINE_STREAM_INFO_HAS_VIDEO);
+    xine_cfg_entry_t cfg_entry;
+    audio_vis &= xine_config_lookup_entry (xine, "audio.visualization", &cfg_entry);
     mutex.unlock ();
+    if (audio_vis)
+        xine_config_cb (0L, &cfg_entry);
     if (callback)
         firstframe = 1;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic