本文整理汇总了C++中GST_MESSAGE_SRC函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_MESSAGE_SRC函数的具体用法?C++ GST_MESSAGE_SRC怎么用?C++ GST_MESSAGE_SRC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GST_MESSAGE_SRC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_window
static GstBusSyncReply
create_window(GstBus *bus, GstMessage *msg, gpointer data)
{
preview_t *preview = (preview_t*)data;
switch (GST_MESSAGE_TYPE(msg))
{
case GST_MESSAGE_ELEMENT:
{
#if GST_CHECK_VERSION(1, 0, 0)
if (!gst_is_video_overlay_prepare_window_handle_message(msg))
return GST_BUS_PASS;
gst_video_overlay_set_window_handle(
GST_VIDEO_OVERLAY(GST_MESSAGE_SRC(msg)), preview->xid);
#else
if (!gst_structure_has_name(msg->structure, "prepare-xwindow-id"))
return GST_BUS_PASS;
#if !defined(_WIN32)
gst_x_overlay_set_xwindow_id(
GST_X_OVERLAY(GST_MESSAGE_SRC(msg)), preview->xid);
#else
gst_directdraw_sink_set_window_id(
GST_X_OVERLAY(GST_MESSAGE_SRC(msg)), preview->xid);
#endif
#endif
gst_message_unref(msg);
return GST_BUS_DROP;
} break;
default:
{
} break;
}
return GST_BUS_PASS;
}
示例2: create_window
static GstBusSyncReply create_window (GstBus* bus, GstMessage* message, GtkWidget* widget)
{
GtkAllocation allocation;
if (gst_gtk_handle_need_context (bus, message, NULL))
return GST_BUS_DROP;
// ignore anything but 'prepare-window-handle' element messages
if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
return GST_BUS_PASS;
if (!gst_is_video_overlay_prepare_window_handle_message (message))
return GST_BUS_PASS;
g_print ("setting window handle %p\n", widget);
gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), widget);
gtk_widget_get_allocation (widget, &allocation);
gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), allocation.x, allocation.y, allocation.width, allocation.height);
gst_message_unref (message);
return GST_BUS_DROP;
}
示例3: message_received
static void
message_received (GstBus * bus, GstMessage * message, GstPipeline * bin)
{
GST_INFO ("bus message from \"%" GST_PTR_FORMAT "\": %" GST_PTR_FORMAT,
GST_MESSAGE_SRC (message), message);
switch (message->type) {
case GST_MESSAGE_EOS:
g_main_loop_quit (main_loop);
break;
case GST_MESSAGE_WARNING:{
GError *gerror;
gchar *debug;
gst_message_parse_warning (message, &gerror, &debug);
gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug);
g_error_free (gerror);
g_free (debug);
break;
}
case GST_MESSAGE_ERROR:{
GError *gerror;
gchar *debug;
gst_message_parse_error (message, &gerror, &debug);
gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug);
g_error_free (gerror);
g_free (debug);
g_main_loop_quit (main_loop);
break;
}
default:
break;
}
}
示例4: _test_reverse_negotiation_message
static void
_test_reverse_negotiation_message (GstBus * bus, GstMessage * message,
GMainLoop * loop)
{
GError *err = NULL;
gchar *debug;
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_ERROR:
gst_message_parse_error (message, &err, &debug);
gst_object_default_error (GST_MESSAGE_SRC (message), err, debug);
g_error_free (err);
g_free (debug);
g_assert_not_reached ();
break;
case GST_MESSAGE_WARNING:
gst_message_parse_warning (message, &err, &debug);
gst_object_default_error (GST_MESSAGE_SRC (message), err, debug);
g_error_free (err);
g_free (debug);
g_assert_not_reached ();
break;
case GST_MESSAGE_EOS:
g_main_loop_quit (loop);
break;
default:
break;
}
}
示例5: bus_callback
static gboolean
bus_callback (GstBus * bus, GstMessage * message, gpointer data)
{
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_ERROR:{
GError *err;
gchar *debug;
gst_message_parse_error (message, &err, &debug);
g_print ("Error: %s\n", err->message);
g_error_free (err);
g_free (debug);
/* Write debug graph to file */
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (camerabin),
GST_DEBUG_GRAPH_SHOW_ALL, "camerabin.error");
g_main_loop_quit (loop);
break;
}
case GST_MESSAGE_STATE_CHANGED:
if (GST_IS_BIN (GST_MESSAGE_SRC (message))) {
GstState oldstate, newstate;
gst_message_parse_state_changed (message, &oldstate, &newstate, NULL);
GST_DEBUG_OBJECT (GST_MESSAGE_SRC (message), "state-changed: %s -> %s",
gst_element_state_get_name (oldstate),
gst_element_state_get_name (newstate));
}
break;
case GST_MESSAGE_EOS:
/* end-of-stream */
GST_INFO ("got eos() - should not happen");
g_main_loop_quit (loop);
break;
case GST_MESSAGE_ELEMENT:
if (GST_MESSAGE_SRC (message) == (GstObject *) camerabin) {
const GstStructure *structure = gst_message_get_structure (message);
if (gst_structure_has_name (structure, "image-done")) {
#ifndef GST_DISABLE_GST_DEBUG
const gchar *fname = gst_structure_get_string (structure, "filename");
GST_DEBUG ("image done: %s", fname);
#endif
if (capture_count < capture_total) {
g_idle_add ((GSourceFunc) run_pipeline, NULL);
} else {
g_main_loop_quit (loop);
}
}
}
break;
default:
/* unhandled message */
break;
}
return TRUE;
}
示例6: default_msg_handler
static bool default_msg_handler( decoder_t *p_dec, GstMessage *p_msg )
{
bool err = false;
switch( GST_MESSAGE_TYPE( p_msg ) ){
case GST_MESSAGE_ERROR:
{
gchar *psz_debug;
GError *p_error;
gst_message_parse_error( p_msg, &p_error, &psz_debug );
g_free( psz_debug );
msg_Err( p_dec, "Error from %s: %s",
GST_ELEMENT_NAME( GST_MESSAGE_SRC( p_msg ) ),
p_error->message );
g_error_free( p_error );
err = true;
}
break;
case GST_MESSAGE_WARNING:
{
gchar *psz_debug;
GError *p_error;
gst_message_parse_warning( p_msg, &p_error, &psz_debug );
g_free( psz_debug );
msg_Warn( p_dec, "Warning from %s: %s",
GST_ELEMENT_NAME( GST_MESSAGE_SRC( p_msg ) ),
p_error->message );
g_error_free( p_error );
}
break;
case GST_MESSAGE_INFO:
{
gchar *psz_debug;
GError *p_error;
gst_message_parse_info( p_msg, &p_error, &psz_debug );
g_free( psz_debug );
msg_Info( p_dec, "Info from %s: %s",
GST_ELEMENT_NAME( GST_MESSAGE_SRC( p_msg ) ),
p_error->message );
g_error_free( p_error );
}
break;
default:
break;
}
return err;
}
示例7: message_received
static void
message_received (GstBus * bus, GstMessage * message, gpointer user_data)
{
if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR) {
GST_WARNING_OBJECT (GST_MESSAGE_SRC (message), "error: %" GST_PTR_FORMAT,
message);
} else {
GST_DEBUG_OBJECT (GST_MESSAGE_SRC (message), "eos: %" GST_PTR_FORMAT,
message);
}
g_main_loop_quit (user_data);
}
示例8: typefind_message_received
static void
typefind_message_received (GstBus * bus, GstMessage * message,
gpointer user_data)
{
if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR) {
GST_WARNING_OBJECT (GST_MESSAGE_SRC (message),
"error for '%s': %" GST_PTR_FORMAT, (gchar *) user_data, message);
} else {
GST_DEBUG_OBJECT (GST_MESSAGE_SRC (message),
"eos for '%s': %" GST_PTR_FORMAT, (gchar *) user_data, message);
}
g_main_loop_quit (typefind_main_loop);
}
示例9: ges_validate_handle_request_state_change
void
ges_validate_handle_request_state_change (GstMessage * message,
GApplication * application)
{
GstState state;
gst_message_parse_request_state (message, &state);
if (GST_IS_VALIDATE_SCENARIO (GST_MESSAGE_SRC (message))
&& state == GST_STATE_NULL) {
gst_validate_printf (GST_MESSAGE_SRC (message),
"State change request NULL, " "quiting application\n");
g_application_quit (application);
}
}
示例10: create_window
static GstBusSyncReply
create_window (GstBus * bus, GstMessage * message, gpointer data)
{
GstGLClutterActor **actor = (GstGLClutterActor **) data;
static gint count = 0;
static GMutex mutex;
// ignore anything but 'prepare-window-handle' element messages
if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
return GST_BUS_PASS;
if (!gst_is_video_overlay_prepare_window_handle_message (message))
return GST_BUS_PASS;
g_mutex_lock (&mutex);
if (count < N_ACTORS) {
g_message ("adding actor %d", count);
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC
(message)), actor[count]->win);
clutter_threads_add_idle ((GSourceFunc) create_actor, actor[count]);
count++;
}
g_mutex_unlock (&mutex);
gst_message_unref (message);
return GST_BUS_DROP;
}
示例11: handle_message
static gboolean
handle_message (GstBus * bus, GstMessage * message, gpointer data)
{
GstElement *bin = GST_ELEMENT_CAST (data);
switch (message->type) {
case GST_MESSAGE_EOS:
g_message ("got EOS");
g_main_loop_quit (loop);
break;
case GST_MESSAGE_WARNING:
case GST_MESSAGE_ERROR:
{
GError *gerror;
gchar *debug;
if (message->type == GST_MESSAGE_ERROR)
gst_message_parse_error (message, &gerror, &debug);
else
gst_message_parse_warning (message, &gerror, &debug);
gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug);
g_error_free (gerror);
g_free (debug);
g_main_loop_quit (loop);
break;
}
case GST_MESSAGE_ASYNC_DONE:
g_timeout_add (40, (GSourceFunc) do_step, bin);
break;
default:
break;
}
return TRUE;
}
示例12: pointerDetector_receive_message
void
pointerDetector_receive_message (GstBus *bus, GstMessage *message, gpointer pointerDetector)
{
const GstStructure *st;
gchar *windowID;
const gchar *type;
std::string windowIDStr, typeStr;
PointerDetectorFilter *filter = (PointerDetectorFilter *) pointerDetector;
if (GST_MESSAGE_SRC (message) != GST_OBJECT (filter->pointerDetector) ||
GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
return;
st = gst_message_get_structure (message);
type = gst_structure_get_name (st);
if ( (g_strcmp0 (type, "window-out") != 0) &&
(g_strcmp0 (type, "window-in") != 0) ) {
GST_WARNING ("The message does not have the correct name");
return;
}
if (!gst_structure_get (st, "window", G_TYPE_STRING , &windowID, NULL) ) {
GST_WARNING ("The message does not contain the window ID");
return;
}
windowIDStr = windowID;
typeStr = type;
g_free (windowID);
filter->raiseEvent (typeStr, windowIDStr);
}
示例13: my_bus_callback
static gboolean
my_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
{
GstElement *sender = (GstElement *) GST_MESSAGE_SRC (message);
const gchar *name = gst_element_get_name (sender);
GMainLoop *loop = (GMainLoop *) data;
g_print ("Got %s message from %s\n", GST_MESSAGE_TYPE_NAME (message), name);
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_ERROR:{
GError *err;
gchar *debug;
gst_message_parse_error (message, &err, &debug);
g_print ("Error: %s (%s)\n", err->message, debug);
g_error_free (err);
g_free (debug);
g_main_loop_quit (loop);
break;
}
case GST_MESSAGE_EOS:
/* end-of-stream */
g_main_loop_quit (loop);
break;
default:
/* unhandled message */
break;
}
return TRUE;
}
示例14: BufferingMessageReceived
void GstEnginePipeline::BufferingMessageReceived(GstMessage* msg) {
// Only handle buffering messages from the queue2 element in audiobin - not
// the one that's created automatically by uridecodebin.
if (GST_ELEMENT(GST_MESSAGE_SRC(msg)) != queue_) {
return;
}
// If we are loading new next track, we don't have to pause the playback.
// The buffering is for the next track and not the current one.
if (emit_track_ended_on_stream_start_) {
qLog(Debug) << "Buffering next track";
return;
}
int percent = 0;
gst_message_parse_buffering(msg, &percent);
const GstState current_state = state();
if (percent == 0 && current_state == GST_STATE_PLAYING && !buffering_) {
buffering_ = true;
emit BufferingStarted();
SetState(GST_STATE_PAUSED);
} else if (percent == 100 && buffering_) {
buffering_ = false;
emit BufferingFinished();
SetState(GST_STATE_PLAYING);
} else if (buffering_) {
emit BufferingProgress(percent);
}
}
示例15: busMessage
void ZBarFilterImpl::busMessage (GstMessage *message)
{
if (GST_MESSAGE_SRC (message) == GST_OBJECT (zbar) &&
GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) {
const GstStructure *st;
guint64 ts;
gchar *type, *symbol;
st = gst_message_get_structure (message);
if (g_strcmp0 (gst_structure_get_name (st), "barcode") != 0) {
return;
}
if (!gst_structure_get (st, "timestamp", G_TYPE_UINT64, &ts,
"type", G_TYPE_STRING, &type, "symbol",
G_TYPE_STRING, &symbol, NULL) ) {
return;
}
std::string symbolStr (symbol);
std::string typeStr (type);
g_free (type);
g_free (symbol);
barcodeDetected (ts, typeStr, symbolStr);
}
}