本文整理汇总了C++中GST_IS_EVENT函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_IS_EVENT函数的具体用法?C++ GST_IS_EVENT怎么用?C++ GST_IS_EVENT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GST_IS_EVENT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gst_overlay_loop
static void
gst_overlay_loop (GstElement * element)
{
GstOverlay *overlay;
GstBuffer *out;
GstBuffer *in1 = NULL, *in2 = NULL, *in3 = NULL;
int size;
overlay = GST_OVERLAY (element);
in1 = GST_BUFFER (gst_pad_pull (overlay->sinkpad1));
if (GST_IS_EVENT (in1)) {
gst_pad_push (overlay->srcpad, GST_DATA (in1));
/* FIXME */
return;
}
in2 = GST_BUFFER (gst_pad_pull (overlay->sinkpad2));
if (GST_IS_EVENT (in2)) {
gst_pad_push (overlay->srcpad, GST_DATA (in2));
/* FIXME */
return;
}
in3 = GST_BUFFER (gst_pad_pull (overlay->sinkpad3));
if (GST_IS_EVENT (in3)) {
gst_pad_push (overlay->srcpad, GST_DATA (in3));
/* FIXME */
return;
}
g_return_if_fail (in1 != NULL);
g_return_if_fail (in2 != NULL);
g_return_if_fail (in3 != NULL);
size = (overlay->width * overlay->height * 3) / 2;
g_return_if_fail (GST_BUFFER_SIZE (in1) != size);
g_return_if_fail (GST_BUFFER_SIZE (in2) != size);
g_return_if_fail (GST_BUFFER_SIZE (in3) != size);
out = gst_buffer_new_and_alloc (size);
gst_overlay_blend_i420 (GST_BUFFER_DATA (out),
GST_BUFFER_DATA (in1),
GST_BUFFER_DATA (in2),
GST_BUFFER_DATA (in3), overlay->width, overlay->height);
GST_BUFFER_TIMESTAMP (out) = GST_BUFFER_TIMESTAMP (in1);
GST_BUFFER_DURATION (out) = GST_BUFFER_DURATION (in1);
gst_buffer_unref (in1);
gst_buffer_unref (in2);
gst_buffer_unref (in3);
gst_pad_push (overlay->srcpad, GST_DATA (out));
}
示例2: gst_sdlvideosink_navigation_send_event
static void
gst_sdlvideosink_navigation_send_event (GstNavigation * navigation,
GstStructure * structure)
{
GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (navigation);
GstEvent *event;
GstVideoRectangle dst = { 0, };
GstVideoRectangle src = { 0, };
GstVideoRectangle result;
double x, y, old_x, old_y;
GstPad *pad = NULL;
src.w = GST_VIDEO_SINK_WIDTH (sdlvideosink);
src.h = GST_VIDEO_SINK_HEIGHT (sdlvideosink);
dst.w = sdlvideosink->width;
dst.h = sdlvideosink->height;
gst_video_sink_center_rect (src, dst, &result, FALSE);
event = gst_event_new_navigation (structure);
/* Our coordinates can be wrong here if we centered the video */
/* Converting pointer coordinates to the non scaled geometry */
if (gst_structure_get_double (structure, "pointer_x", &old_x)) {
x = old_x;
if (x >= result.x && x <= (result.x + result.w)) {
x -= result.x;
x *= sdlvideosink->width;
x /= result.w;
} else {
x = 0;
}
GST_DEBUG_OBJECT (sdlvideosink, "translated navigation event x "
"coordinate from %f to %f", old_x, x);
gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE, x, NULL);
}
if (gst_structure_get_double (structure, "pointer_y", &old_y)) {
y = old_y;
if (y >= result.y && y <= (result.y + result.h)) {
y -= result.y;
y *= sdlvideosink->height;
y /= result.h;
} else {
y = 0;
}
GST_DEBUG_OBJECT (sdlvideosink, "translated navigation event y "
"coordinate from %f to %f", old_y, y);
gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE, y, NULL);
}
pad = gst_pad_get_peer (GST_VIDEO_SINK_PAD (sdlvideosink));
if (GST_IS_PAD (pad) && GST_IS_EVENT (event)) {
gst_pad_send_event (pad, event);
gst_object_unref (pad);
}
}
示例3: gst_event_get_structure
/**
* gst_event_get_structure:
* @event: The #GstEvent.
*
* Access the structure of the event.
*
* Returns: The structure of the event. The structure is still
* owned by the event, which means that you should not free it and
* that the pointer becomes invalid when you free the event.
*
* MT safe.
*/
const GstStructure *
gst_event_get_structure (GstEvent * event)
{
g_return_val_if_fail (GST_IS_EVENT (event), NULL);
return event->structure;
}
示例4: gst_event_get_seqnum
/**
* gst_event_get_seqnum:
* @event: A #GstEvent.
*
* Retrieve the sequence number of a event.
*
* Events have ever-incrementing sequence numbers, which may also be set
* explicitly via gst_event_set_seqnum(). Sequence numbers are typically used to
* indicate that a event corresponds to some other set of events or messages,
* for example an EOS event corresponding to a SEEK event. It is considered good
* practice to make this correspondence when possible, though it is not
* required.
*
* Note that events and messages share the same sequence number incrementor;
* two events or messages will never have the same sequence number unless
* that correspondence was made explicitly.
*
* Returns: The event's sequence number.
*
* MT safe.
*/
guint32
gst_event_get_seqnum (GstEvent * event)
{
g_return_val_if_fail (GST_IS_EVENT (event), -1);
return GST_EVENT_SEQNUM (event);
}
示例5: gst_event_get_structure
/**
* gst_event_get_structure:
* @event: The #GstEvent.
*
* Access the structure of the event.
*
* Returns: The structure of the event. The structure is still
* owned by the event, which means that you should not free it and
* that the pointer becomes invalid when you free the event.
*
* MT safe.
*/
const GstStructure *
gst_event_get_structure (GstEvent * event)
{
g_return_val_if_fail (GST_IS_EVENT (event), NULL);
return GST_EVENT_STRUCTURE (event);
}
示例6: shmdata_base_reader_reset_time
gboolean
shmdata_base_reader_reset_time (GstPad *pad,
GstMiniObject * mini_obj,
gpointer user_data)
{
shmdata_base_reader_t *context = (shmdata_base_reader_t *) user_data;
if (GST_IS_EVENT (mini_obj))
{
//g_debug ("EVENT %s", GST_EVENT_TYPE_NAME (GST_EVENT_CAST(mini_obj)));
}
else if (GST_IS_BUFFER (mini_obj))
{
GstBuffer *buffer = GST_BUFFER_CAST (mini_obj);
/* g_debug ("shmdata writer data frame (%p), data size %d, timestamp %llu, caps %s", */
/* GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer), */
/* GST_TIME_AS_MSECONDS (GST_BUFFER_TIMESTAMP (buffer)), */
/* gst_caps_to_string (GST_BUFFER_CAPS (buffer))); */
if (context->timereset_)
{
context->timeshift_ = GST_BUFFER_TIMESTAMP (buffer);
context->timereset_ = FALSE;
}
GST_BUFFER_TIMESTAMP (buffer) =
GST_BUFFER_TIMESTAMP (buffer) - context->timeshift_;
}
else if (GST_IS_MESSAGE (mini_obj))
{
}
return TRUE;
}
示例7: gst_event_parse_step
/**
* gst_event_parse_step:
* @event: The event to query
* @format: (out) (allow-none): a pointer to store the format in
* @amount: (out) (allow-none): a pointer to store the amount in
* @rate: (out) (allow-none): a pointer to store the rate in
* @flush: (out) (allow-none): a pointer to store the flush boolean in
* @intermediate: (out) (allow-none): a pointer to store the intermediate
* boolean in
*
* Parse the step event.
*/
void
gst_event_parse_step (GstEvent * event, GstFormat * format, guint64 * amount,
gdouble * rate, gboolean * flush, gboolean * intermediate)
{
const GstStructure *structure;
g_return_if_fail (GST_IS_EVENT (event));
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STEP);
structure = GST_EVENT_STRUCTURE (event);
if (format)
*format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT)));
if (amount)
*amount = g_value_get_uint64 (gst_structure_id_get_value (structure,
GST_QUARK (AMOUNT)));
if (rate)
*rate = g_value_get_double (gst_structure_id_get_value (structure,
GST_QUARK (RATE)));
if (flush)
*flush = g_value_get_boolean (gst_structure_id_get_value (structure,
GST_QUARK (FLUSH)));
if (intermediate)
*intermediate = g_value_get_boolean (gst_structure_id_get_value (structure,
GST_QUARK (INTERMEDIATE)));
}
示例8: probe_cb
/* Data probe cb to drop everything but count buffers and events */
static GstPadProbeReturn
probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
{
gint count = 0;
const gchar *count_type = NULL;
GstMiniObject *obj = GST_PAD_PROBE_INFO_DATA (info);
GST_LOG_OBJECT (pad, "got data");
if (GST_IS_BUFFER (obj)) {
count_type = "buffer_count";
} else if (GST_IS_EVENT (obj)) {
count_type = "event_count";
} else {
g_assert_not_reached ();
}
/* increment and store count */
count = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (pad), count_type));
count++;
g_object_set_data (G_OBJECT (pad), count_type, GINT_TO_POINTER (count));
/* drop every buffer */
return GST_IS_BUFFER (obj) ? GST_PAD_PROBE_DROP : GST_PAD_PROBE_PASS;
}
示例9: gst_event_parse_qos
/**
* gst_event_parse_qos:
* @event: The event to query
* @type: (out): A pointer to store the QoS type in
* @proportion: (out): A pointer to store the proportion in
* @diff: (out): A pointer to store the diff in
* @timestamp: (out): A pointer to store the timestamp in
*
* Get the type, proportion, diff and timestamp in the qos event. See
* gst_event_new_qos() for more information about the different QoS values.
*/
void
gst_event_parse_qos (GstEvent * event, GstQOSType * type,
gdouble * proportion, GstClockTimeDiff * diff, GstClockTime * timestamp)
{
const GstStructure *structure;
g_return_if_fail (GST_IS_EVENT (event));
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_QOS);
structure = GST_EVENT_STRUCTURE (event);
if (type)
*type = (GstQOSType)
g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (TYPE)));
if (proportion)
*proportion =
g_value_get_double (gst_structure_id_get_value (structure,
GST_QUARK (PROPORTION)));
if (diff)
*diff =
g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (DIFF)));
if (timestamp)
*timestamp =
g_value_get_uint64 (gst_structure_id_get_value (structure,
GST_QUARK (TIMESTAMP)));
}
示例10: gst_event_parse_buffer_size
/**
* gst_event_parse_buffer_size:
* @event: The event to query
* @format: (out): A pointer to store the format in
* @minsize: (out): A pointer to store the minsize in
* @maxsize: (out): A pointer to store the maxsize in
* @async: (out): A pointer to store the async-flag in
*
* Get the format, minsize, maxsize and async-flag in the buffersize event.
*/
void
gst_event_parse_buffer_size (GstEvent * event, GstFormat * format,
gint64 * minsize, gint64 * maxsize, gboolean * async)
{
const GstStructure *structure;
g_return_if_fail (GST_IS_EVENT (event));
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_BUFFERSIZE);
structure = GST_EVENT_STRUCTURE (event);
if (format)
*format = (GstFormat)
g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT)));
if (minsize)
*minsize =
g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (MINSIZE)));
if (maxsize)
*maxsize =
g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (MAXSIZE)));
if (async)
*async =
g_value_get_boolean (gst_structure_id_get_value (structure,
GST_QUARK (ASYNC)));
}
示例11: gst_event_set_seqnum
/**
* gst_event_set_seqnum:
* @event: A #GstEvent.
* @seqnum: A sequence number.
*
* Set the sequence number of a event.
*
* This function might be called by the creator of a event to indicate that the
* event relates to other events or messages. See gst_event_get_seqnum() for
* more information.
*
* MT safe.
*/
void
gst_event_set_seqnum (GstEvent * event, guint32 seqnum)
{
g_return_if_fail (GST_IS_EVENT (event));
GST_EVENT_SEQNUM (event) = seqnum;
}
示例12: event_counter
static GstPadProbeReturn
event_counter (GstObject * pad, GstPadProbeInfo * info, gpointer user_data)
{
GstEvent *event = GST_PAD_PROBE_INFO_EVENT (info);
fail_unless (event != NULL);
fail_unless (GST_IS_EVENT (event));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_STREAM_START:
++nb_stream_start_event;
break;
case GST_EVENT_CAPS:
++nb_caps_event;
break;
case GST_EVENT_SEGMENT:
++nb_segment_event;
break;
case GST_EVENT_GAP:
++nb_gap_event;
break;
default:
break;
}
return GST_PAD_PROBE_OK;
}
示例13: dxr3videosink_chain
static void
dxr3videosink_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
Dxr3VideoSink *sink;
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
sink = DXR3VIDEOSINK (gst_pad_get_parent (pad));
if (GST_IS_EVENT (buf)) {
dxr3videosink_handle_event (pad, GST_EVENT (buf));
return;
}
/* fprintf (stderr, "^^^^^^ Video block\n"); */
if (sink->cur_buf == NULL) {
sink->cur_buf = buf;
} else {
sink->cur_buf = gst_buffer_append (sink->cur_buf, buf);
}
sink->last_ts = GST_BUFFER_TIMESTAMP (buf);
dxr3videosink_parse_data (sink);
}
示例14: gst_mikmod_loop
static void
gst_mikmod_loop (GstElement * element)
{
GstMikMod *mikmod;
GstBuffer *buffer_in;
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_MIKMOD (element));
mikmod = GST_MIKMOD (element);
srcpad = mikmod->srcpad;
mikmod->Buffer = NULL;
if (!mikmod->initialized) {
while ((buffer_in = GST_BUFFER (gst_pad_pull (mikmod->sinkpad)))) {
if (GST_IS_EVENT (buffer_in)) {
GstEvent *event = GST_EVENT (buffer_in);
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS)
break;
} else {
if (mikmod->Buffer) {
mikmod->Buffer = gst_buffer_append (mikmod->Buffer, buffer_in);
} else {
mikmod->Buffer = buffer_in;
}
}
}
if (!GST_PAD_CAPS (mikmod->srcpad)) {
if (GST_PAD_LINK_SUCCESSFUL (gst_pad_renegotiate (mikmod->srcpad))) {
GST_ELEMENT_ERROR (mikmod, CORE, NEGOTIATION, (NULL), (NULL));
return;
}
}
MikMod_RegisterDriver (&drv_gst);
MikMod_RegisterAllLoaders ();
MikMod_Init ("");
reader = GST_READER_new (mikmod);
module = Player_LoadGeneric (reader, 64, 0);
gst_buffer_unref (mikmod->Buffer);
if (!Player_Active ())
Player_Start (module);
mikmod->initialized = TRUE;
}
if (Player_Active ()) {
timestamp = (module->sngtime / 1024.0) * GST_SECOND;
drv_gst.Update ();
} else {
gst_element_set_eos (GST_ELEMENT (mikmod));
gst_pad_push (mikmod->srcpad, GST_DATA (gst_event_new (GST_EVENT_EOS)));
}
}
示例15: handle_queued_objects
static gboolean
handle_queued_objects (APP_STATE_T * state)
{
GstMiniObject *object = NULL;
g_mutex_lock (&state->queue_lock);
if (state->flushing) {
g_cond_broadcast (&state->cond);
goto beach;
} else if (g_async_queue_length (state->queue) == 0) {
goto beach;
}
if ((object = g_async_queue_try_pop (state->queue))) {
if (GST_IS_BUFFER (object)) {
GstBuffer *buffer = GST_BUFFER_CAST (object);
update_image (state, buffer);
render_scene (state);
gst_buffer_unref (buffer);
if (!SYNC_BUFFERS) {
object = NULL;
}
} else if (GST_IS_QUERY (object)) {
GstQuery *query = GST_QUERY_CAST (object);
GstStructure *s = (GstStructure *) gst_query_get_structure (query);
if (gst_structure_has_name (s, "not-used")) {
g_assert_not_reached ();
} else {
g_assert_not_reached ();
}
} else if (GST_IS_EVENT (object)) {
GstEvent *event = GST_EVENT_CAST (object);
g_print ("\nevent %p %s\n", event,
gst_event_type_get_name (GST_EVENT_TYPE (event)));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
flush_internal (state);
break;
default:
break;
}
gst_event_unref (event);
object = NULL;
}
}
if (object) {
state->popped_obj = object;
g_cond_broadcast (&state->cond);
}
beach:
g_mutex_unlock (&state->queue_lock);
return FALSE;
}