gst/videotestsrc/gstvideotestsrc.c: move fixation to a fixate function remove negotiate function, basesrc's is good e...

Original commit message from CVS:
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_class_init), (gst_videotestsrc_init),
(gst_videotestsrc_src_fixate):
move fixation to a fixate function
remove negotiate function, basesrc's is good enough
fixes a bug for check when using the element alone
This commit is contained in:
Thomas Vander Stichele 2005-11-14 12:15:01 +00:00
parent 560bc53f37
commit 38383d1d6f
2 changed files with 27 additions and 35 deletions

View file

@ -1,3 +1,12 @@
2005-11-14 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_class_init), (gst_videotestsrc_init),
(gst_videotestsrc_src_fixate):
move fixation to a fixate function
remove negotiate function, basesrc's is good enough
fixes a bug for check when using the element alone
2005-11-13 Edward Hervey <edward@fluendo.com>
* examples/seeking/seek.c: (do_seek), (accurate_toggle_cb),

View file

@ -77,7 +77,8 @@ static void gst_videotestsrc_get_property (GObject * object, guint prop_id,
static GstCaps *gst_videotestsrc_getcaps (GstBaseSrc * bsrc);
static gboolean gst_videotestsrc_setcaps (GstBaseSrc * bsrc, GstCaps * caps);
static gboolean gst_videotestsrc_negotiate (GstBaseSrc * bsrc);
static void gst_videotestsrc_src_fixate (GstPad * pad, GstCaps * caps);
static gboolean gst_videotestsrc_event (GstBaseSrc * bsrc, GstEvent * event);
static void gst_videotestsrc_get_times (GstBaseSrc * basesrc,
@ -146,7 +147,6 @@ gst_videotestsrc_class_init (GstVideoTestSrcClass * klass)
gstbasesrc_class->get_caps = gst_videotestsrc_getcaps;
gstbasesrc_class->set_caps = gst_videotestsrc_setcaps;
gstbasesrc_class->negotiate = gst_videotestsrc_negotiate;
gstbasesrc_class->event = gst_videotestsrc_event;
gstbasesrc_class->get_times = gst_videotestsrc_get_times;
@ -156,6 +156,10 @@ gst_videotestsrc_class_init (GstVideoTestSrcClass * klass)
static void
gst_videotestsrc_init (GstVideoTestSrc * src, GstVideoTestSrcClass * g_class)
{
GstPad *pad = GST_BASE_SRC_PAD (src);
gst_pad_set_fixatecaps_function (pad, gst_videotestsrc_src_fixate);
gst_videotestsrc_set_pattern (src, GST_VIDEOTESTSRC_SMPTE);
src->segment_start_frame = -1;
@ -165,6 +169,18 @@ gst_videotestsrc_init (GstVideoTestSrc * src, GstVideoTestSrcClass * g_class)
gst_base_src_set_live (GST_BASE_SRC (src), FALSE);
}
static void
gst_videotestsrc_src_fixate (GstPad * pad, GstCaps * caps)
{
GstStructure *structure;
structure = gst_caps_get_structure (caps, 0);
gst_caps_structure_fixate_field_nearest_int (structure, "width", 320);
gst_caps_structure_fixate_field_nearest_int (structure, "height", 240);
gst_caps_structure_fixate_field_nearest_double (structure, "framerate", 30.0);
}
static void
gst_videotestsrc_set_pattern (GstVideoTestSrc * videotestsrc, int pattern_type)
{
@ -311,39 +327,6 @@ gst_videotestsrc_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
return res;
}
static gboolean
gst_videotestsrc_negotiate (GstBaseSrc * bsrc)
{
GstCaps *caps;
GstCaps *temp;
gboolean result = FALSE;
/* get all possible caps on this link */
caps = gst_pad_get_allowed_caps (GST_BASE_SRC_PAD (bsrc));
temp = gst_caps_normalize (caps);
gst_caps_unref (caps);
caps = temp;
if (gst_caps_get_size (caps) > 0) {
GstStructure *structure;
/* pick the first one */
gst_caps_truncate (caps);
structure = gst_caps_get_structure (caps, 0);
gst_caps_structure_fixate_field_nearest_int (structure, "width", 320);
gst_caps_structure_fixate_field_nearest_int (structure, "height", 240);
gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
30.0);
result = gst_pad_set_caps (GST_BASE_SRC_PAD (bsrc), caps);
gst_caps_unref (caps);
}
return result;
}
static gboolean
gst_videotestsrc_event (GstBaseSrc * bsrc, GstEvent * event)
{