mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 15:48:23 +00:00
add num-buffers property
Original commit message from CVS: add num-buffers property
This commit is contained in:
parent
71c057b0f2
commit
220f6adf6c
3 changed files with 34 additions and 1 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,4 +1,14 @@
|
|||
2004-04-26 Benjamin Otte <otte@gnome.org>
|
||||
2004-04-27 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* Makefile.am:
|
||||
* gst/videotestsrc/gstvideotestsrc.c:
|
||||
(gst_videotestsrc_class_init), (gst_videotestsrc_change_state),
|
||||
(gst_videotestsrc_init), (gst_videotestsrc_get),
|
||||
(gst_videotestsrc_set_property), (gst_videotestsrc_get_property):
|
||||
* gst/videotestsrc/gstvideotestsrc.h:
|
||||
add num-buffers property
|
||||
|
||||
2004-04-26 Benjamin Otte <otte@gnome.org>
|
||||
|
||||
* ext/mad/gstid3tag.c: (plugin_init):
|
||||
set id3mux rank to NONE so it doesn't confuse spider
|
||||
|
|
|
@ -52,6 +52,7 @@ enum
|
|||
ARG_0,
|
||||
ARG_TYPE,
|
||||
ARG_SYNC,
|
||||
ARG_NUM_BUFFERS,
|
||||
/* FILL ME */
|
||||
};
|
||||
|
||||
|
@ -162,6 +163,10 @@ gst_videotestsrc_class_init (GstVideotestsrcClass * klass)
|
|||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC,
|
||||
g_param_spec_boolean ("sync", "Sync", "Synchronize to clock", TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_BUFFERS,
|
||||
g_param_spec_int ("num-buffers", "num-buffers",
|
||||
"Number of buffers to output before sending EOS", -1, G_MAXINT,
|
||||
0, G_PARAM_READWRITE));
|
||||
|
||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
|
||||
|
@ -263,6 +268,7 @@ gst_videotestsrc_change_state (GstElement * element)
|
|||
case GST_STATE_NULL_TO_READY:
|
||||
break;
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
videotestsrc->num_buffers_left = videotestsrc->num_buffers;
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
break;
|
||||
|
@ -352,6 +358,8 @@ gst_videotestsrc_init (GstVideotestsrc * videotestsrc)
|
|||
|
||||
gst_videotestsrc_set_pattern (videotestsrc, GST_VIDEOTESTSRC_SMPTE);
|
||||
|
||||
videotestsrc->num_buffers = -1;
|
||||
videotestsrc->num_buffers_left = -1;
|
||||
videotestsrc->sync = TRUE;
|
||||
}
|
||||
|
||||
|
@ -447,6 +455,14 @@ gst_videotestsrc_get (GstPad * pad)
|
|||
}
|
||||
GST_BUFFER_DURATION (buf) = GST_SECOND / (double) videotestsrc->rate;
|
||||
|
||||
if (videotestsrc->num_buffers_left == 0) {
|
||||
gst_element_set_eos (GST_ELEMENT (videotestsrc));
|
||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
||||
} else {
|
||||
if (videotestsrc->num_buffers_left > 0)
|
||||
videotestsrc->num_buffers_left--;
|
||||
}
|
||||
|
||||
return GST_DATA (buf);
|
||||
}
|
||||
|
||||
|
@ -489,6 +505,9 @@ gst_videotestsrc_set_property (GObject * object, guint prop_id,
|
|||
case ARG_SYNC:
|
||||
src->sync = g_value_get_boolean (value);
|
||||
break;
|
||||
case ARG_NUM_BUFFERS:
|
||||
src->num_buffers = g_value_get_int (value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -511,6 +530,9 @@ gst_videotestsrc_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
case ARG_SYNC:
|
||||
g_value_set_boolean (value, src->sync);
|
||||
break;
|
||||
case ARG_NUM_BUFFERS:
|
||||
g_value_set_int (value, src->num_buffers);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
|
@ -68,6 +68,7 @@ struct _GstVideotestsrc {
|
|||
gdouble rate;
|
||||
int type;
|
||||
GstClock *clock;
|
||||
gint num_buffers, num_buffers_left;
|
||||
|
||||
void (*make_image)(GstVideotestsrc *v, unsigned char *dest, int w, int h);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue