mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
- id add_iterate_bin(bin)
Original commit message from CVS: add functions for optimized bin iteration (may move or rename): - id add_iterate_bin(bin) - remove_iterate_bin(id) - iterate_bin_all(bin)
This commit is contained in:
parent
9a3256eeb1
commit
5b2442792a
6 changed files with 142 additions and 6 deletions
|
@ -38,6 +38,34 @@
|
|||
(gtype-id "GST_TYPE_PROPS_ENTRY")
|
||||
)
|
||||
|
||||
;;
|
||||
;; Accelerate common GstBin iterate loop
|
||||
;;
|
||||
|
||||
(define-function iterate_bin_all
|
||||
(c-name "iterate_bin_all")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GstBin*" "bin")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function add_iterate_bin
|
||||
(c-name "add_iterate_bin")
|
||||
(return-type "guint")
|
||||
(parameters
|
||||
'("GstBin*" "bin")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function remove_iterate_bin
|
||||
(c-name "remove_iterate_bin")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("guint" "id")
|
||||
)
|
||||
)
|
||||
|
||||
;;
|
||||
;; HACK
|
||||
;;
|
||||
|
|
|
@ -19,6 +19,46 @@
|
|||
* Author: David I. Lehn <dlehn@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
#include "pygobject.h"
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include "gstreamer-fixes.h"
|
||||
|
||||
void iterate_bin_all(GstBin *bin) {
|
||||
g_return_if_fail(bin != NULL);
|
||||
g_return_if_fail(GST_IS_BIN(bin));
|
||||
|
||||
pyg_unblock_threads();
|
||||
while (gst_bin_iterate(bin));
|
||||
pyg_block_threads();
|
||||
}
|
||||
|
||||
static gboolean iterate_bin(gpointer data) {
|
||||
GstBin *bin;
|
||||
|
||||
bin = GST_BIN(data);
|
||||
return gst_bin_iterate(bin);
|
||||
}
|
||||
|
||||
static void iterate_bin_destroy(gpointer data) {
|
||||
GstBin *bin;
|
||||
|
||||
bin = GST_BIN(data);
|
||||
gst_object_unref(GST_OBJECT(bin));
|
||||
}
|
||||
|
||||
guint add_iterate_bin(GstBin *bin) {
|
||||
g_return_val_if_fail(bin != NULL, FALSE);
|
||||
g_return_val_if_fail(GST_IS_BIN(bin), FALSE);
|
||||
|
||||
gst_object_ref(GST_OBJECT(bin));
|
||||
return g_idle_add_full(
|
||||
G_PRIORITY_DEFAULT_IDLE,
|
||||
iterate_bin,
|
||||
bin,
|
||||
iterate_bin_destroy);
|
||||
}
|
||||
|
||||
void remove_iterate_bin(guint id) {
|
||||
g_source_remove(id);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@
|
|||
#include <gst/gstqueue.h>
|
||||
#include <gst/gsttypefind.h>
|
||||
|
||||
/* 0.4.1 headers had typo: s/gst/get/ */
|
||||
#define GST_TYPE_CAPS (_gst_caps_type)
|
||||
#define GST_TYPE_PROPS (_gst_props_type)
|
||||
void iterate_bin_all(GstBin *bin);
|
||||
guint add_iterate_bin(GstBin *bin);
|
||||
void remove_iterate_bin(guint id);
|
||||
|
|
|
@ -38,6 +38,34 @@
|
|||
(gtype-id "GST_TYPE_PROPS_ENTRY")
|
||||
)
|
||||
|
||||
;;
|
||||
;; Accelerate common GstBin iterate loop
|
||||
;;
|
||||
|
||||
(define-function iterate_bin_all
|
||||
(c-name "iterate_bin_all")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GstBin*" "bin")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function add_iterate_bin
|
||||
(c-name "add_iterate_bin")
|
||||
(return-type "guint")
|
||||
(parameters
|
||||
'("GstBin*" "bin")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function remove_iterate_bin
|
||||
(c-name "remove_iterate_bin")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("guint" "id")
|
||||
)
|
||||
)
|
||||
|
||||
;;
|
||||
;; HACK
|
||||
;;
|
||||
|
|
|
@ -19,6 +19,46 @@
|
|||
* Author: David I. Lehn <dlehn@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
#include "pygobject.h"
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include "gstreamer-fixes.h"
|
||||
|
||||
void iterate_bin_all(GstBin *bin) {
|
||||
g_return_if_fail(bin != NULL);
|
||||
g_return_if_fail(GST_IS_BIN(bin));
|
||||
|
||||
pyg_unblock_threads();
|
||||
while (gst_bin_iterate(bin));
|
||||
pyg_block_threads();
|
||||
}
|
||||
|
||||
static gboolean iterate_bin(gpointer data) {
|
||||
GstBin *bin;
|
||||
|
||||
bin = GST_BIN(data);
|
||||
return gst_bin_iterate(bin);
|
||||
}
|
||||
|
||||
static void iterate_bin_destroy(gpointer data) {
|
||||
GstBin *bin;
|
||||
|
||||
bin = GST_BIN(data);
|
||||
gst_object_unref(GST_OBJECT(bin));
|
||||
}
|
||||
|
||||
guint add_iterate_bin(GstBin *bin) {
|
||||
g_return_val_if_fail(bin != NULL, FALSE);
|
||||
g_return_val_if_fail(GST_IS_BIN(bin), FALSE);
|
||||
|
||||
gst_object_ref(GST_OBJECT(bin));
|
||||
return g_idle_add_full(
|
||||
G_PRIORITY_DEFAULT_IDLE,
|
||||
iterate_bin,
|
||||
bin,
|
||||
iterate_bin_destroy);
|
||||
}
|
||||
|
||||
void remove_iterate_bin(guint id) {
|
||||
g_source_remove(id);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@
|
|||
#include <gst/gstqueue.h>
|
||||
#include <gst/gsttypefind.h>
|
||||
|
||||
/* 0.4.1 headers had typo: s/gst/get/ */
|
||||
#define GST_TYPE_CAPS (_gst_caps_type)
|
||||
#define GST_TYPE_PROPS (_gst_props_type)
|
||||
void iterate_bin_all(GstBin *bin);
|
||||
guint add_iterate_bin(GstBin *bin);
|
||||
void remove_iterate_bin(guint id);
|
||||
|
|
Loading…
Reference in a new issue