Commit a32d944a authored by Wim Taymans's avatar Wim Taymans

fix for caps api changes

parent 75694826
......@@ -72,7 +72,7 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420"))
);
static void gst_aasink_fixate (GstBaseSink * bsink, GstCaps * caps);
static GstCaps *gst_aasink_fixate (GstBaseSink * bsink, GstCaps * caps);
static gboolean gst_aasink_setcaps (GstBaseSink * bsink, GstCaps * caps);
static void gst_aasink_get_times (GstBaseSink * bsink, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end);
......@@ -227,18 +227,22 @@ gst_aasink_class_init (GstAASinkClass * klass)
gstvideosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_aasink_show_frame);
}
static void
static GstCaps *
gst_aasink_fixate (GstBaseSink * bsink, GstCaps * caps)
{
GstStructure *structure;
caps = gst_caps_make_writable (caps);
structure = gst_caps_get_structure (caps, 0);
gst_structure_fixate_field_nearest_int (structure, "width", 320);
gst_structure_fixate_field_nearest_int (structure, "height", 240);
gst_structure_fixate_field_nearest_fraction (structure, "framerate", 30, 1);
GST_BASE_SINK_CLASS (parent_class)->fixate (bsink, caps);
caps = GST_BASE_SINK_CLASS (parent_class)->fixate (bsink, caps);
return caps;
}
static gboolean
......
......@@ -270,8 +270,8 @@ gst_pixbufscale_fixate_caps (GstBaseTransform * base, GstPadDirection direction,
GstStructure *ins, *outs;
const GValue *from_par, *to_par;
othercaps = gst_caps_truncate (othercaps);
othercaps = gst_caps_make_writable (othercaps);
gst_caps_truncate (othercaps);
GST_DEBUG_OBJECT (base, "trying to fixate othercaps %" GST_PTR_FORMAT
" based on caps %" GST_PTR_FORMAT, othercaps, caps);
......
......@@ -1271,7 +1271,7 @@ gst_jpeg_dec_negotiate (GstJpegDec * dec, gint width, gint height, gint clrspc)
gst_caps_unref (caps);
caps = gst_caps_copy_nth (allowed_caps, i);
/* sigh, ds and _parse_caps need fixed caps for parsing, fixate */
gst_caps_fixate (caps);
caps = gst_caps_fixate (caps);
GST_LOG_OBJECT (dec, "checking caps %" GST_PTR_FORMAT, caps);
if (!gst_video_info_from_caps (&tmpinfo, caps))
......
......@@ -334,7 +334,7 @@ gst_jpegenc_getcaps (GstPad * pad, GstCaps * filter)
if ((val = gst_structure_get_value (s, "framerate")))
gst_structure_set_value (structure, "framerate", val);
gst_caps_merge_structure (caps, structure);
caps = gst_caps_merge_structure (caps, structure);
}
}
......
......@@ -1294,12 +1294,11 @@ gst_pulsesrc_negotiate (GstBaseSrc * basesrc)
}
if (caps) {
/* take first (and best, since they are sorted) possibility */
caps = gst_caps_make_writable (caps);
gst_caps_truncate (caps);
caps = gst_caps_truncate (caps);
/* now fixate */
if (!gst_caps_is_empty (caps)) {
GST_BASE_SRC_CLASS (parent_class)->fixate (basesrc, caps);
caps = GST_BASE_SRC_CLASS (parent_class)->fixate (basesrc, caps);
GST_DEBUG_OBJECT (basesrc, "fixated to: %" GST_PTR_FORMAT, caps);
if (gst_caps_is_any (caps)) {
......
......@@ -271,7 +271,7 @@ gst_goom_src_negotiate (GstGoom * goom)
if (gst_caps_is_empty (target))
goto no_format;
gst_caps_truncate (target);
target = gst_caps_truncate (target);
} else {
target = templ;
}
......
......@@ -268,8 +268,7 @@ gst_goom_src_negotiate (GstGoom * goom)
if (gst_caps_is_empty (target))
goto no_format;
target = gst_caps_make_writable (target);
gst_caps_truncate (target);
target = gst_caps_truncate (target);
} else {
target = gst_caps_copy (templ);
}
......
......@@ -206,16 +206,16 @@ gst_rtp_h263p_pay_setcaps (GstRTPBasePayload * payload, GstCaps * caps)
return res;
}
static void
static GstCaps *
caps_append (GstCaps * caps, GstStructure * in_s, guint x, guint y, guint mpi)
{
GstStructure *s;
if (!in_s)
return;
return caps;
if (mpi < 1 || mpi > 32)
return;
return caps;
s = gst_structure_copy (in_s);
......@@ -224,7 +224,9 @@ caps_append (GstCaps * caps, GstStructure * in_s, guint x, guint y, guint mpi)
"height", GST_TYPE_INT_RANGE, 1, y,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 30000, 1001 * mpi, NULL);
gst_caps_merge_structure (caps, s);
caps = gst_caps_merge_structure (caps, s);
return caps;
}
......@@ -383,7 +385,7 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad,
"width", GST_TYPE_INT_RANGE, 1, 176,
"height", GST_TYPE_INT_RANGE, 1, 144,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 30000, 2002, NULL);
gst_caps_merge_structure (caps, new_s);
caps = gst_caps_merge_structure (caps, new_s);
} else if (level <= 20) {
GstStructure *s_copy = gst_structure_copy (new_s);
......@@ -391,20 +393,20 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad,
"width", GST_TYPE_INT_RANGE, 1, 352,
"height", GST_TYPE_INT_RANGE, 1, 288,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 30000, 2002, NULL);
gst_caps_merge_structure (caps, new_s);
caps = gst_caps_merge_structure (caps, new_s);
gst_structure_set (s_copy,
"width", GST_TYPE_INT_RANGE, 1, 176,
"height", GST_TYPE_INT_RANGE, 1, 144,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 30000, 1001, NULL);
gst_caps_merge_structure (caps, s_copy);
caps = gst_caps_merge_structure (caps, s_copy);
} else if (level <= 40) {
gst_structure_set (new_s,
"width", GST_TYPE_INT_RANGE, 1, 352,
"height", GST_TYPE_INT_RANGE, 1, 288,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 30000, 1001, NULL);
gst_caps_merge_structure (caps, new_s);
caps = gst_caps_merge_structure (caps, new_s);
} else if (level <= 50) {
GstStructure *s_copy = gst_structure_copy (new_s);
......@@ -412,13 +414,13 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad,
"width", GST_TYPE_INT_RANGE, 1, 352,
"height", GST_TYPE_INT_RANGE, 1, 288,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 50, 1, NULL);
gst_caps_merge_structure (caps, new_s);
caps = gst_caps_merge_structure (caps, new_s);
gst_structure_set (s_copy,
"width", GST_TYPE_INT_RANGE, 1, 352,
"height", GST_TYPE_INT_RANGE, 1, 240,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 60000, 1001, NULL);
gst_caps_merge_structure (caps, s_copy);
caps = gst_caps_merge_structure (caps, s_copy);
} else if (level <= 60) {
GstStructure *s_copy = gst_structure_copy (new_s);
......@@ -426,13 +428,13 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad,
"width", GST_TYPE_INT_RANGE, 1, 720,
"height", GST_TYPE_INT_RANGE, 1, 288,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 50, 1, NULL);
gst_caps_merge_structure (caps, new_s);
caps = gst_caps_merge_structure (caps, new_s);
gst_structure_set (s_copy,
"width", GST_TYPE_INT_RANGE, 1, 720,
"height", GST_TYPE_INT_RANGE, 1, 240,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 60000, 1001, NULL);
gst_caps_merge_structure (caps, s_copy);
caps = gst_caps_merge_structure (caps, s_copy);
} else if (level <= 70) {
GstStructure *s_copy = gst_structure_copy (new_s);
......@@ -440,15 +442,15 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad,
"width", GST_TYPE_INT_RANGE, 1, 720,
"height", GST_TYPE_INT_RANGE, 1, 576,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 50, 1, NULL);
gst_caps_merge_structure (caps, new_s);
caps = gst_caps_merge_structure (caps, new_s);
gst_structure_set (s_copy,
"width", GST_TYPE_INT_RANGE, 1, 720,
"height", GST_TYPE_INT_RANGE, 1, 480,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 60000, 1001, NULL);
gst_caps_merge_structure (caps, s_copy);
caps = gst_caps_merge_structure (caps, s_copy);
} else {
gst_caps_merge_structure (caps, new_s);
caps = gst_caps_merge_structure (caps, new_s);
}
} else {
......@@ -460,7 +462,7 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad,
GST_DEBUG_OBJECT (rtph263ppay, "No profile or level specified"
" for H263-2000, defaulting to baseline H263");
gst_caps_merge_structure (caps, new_s);
caps = gst_caps_merge_structure (caps, new_s);
}
} else {
gboolean f = FALSE, i = FALSE, j = FALSE, t = FALSE;
......@@ -523,7 +525,7 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad,
unsigned int xmax, ymax, mpi;
if (sscanf (str, "%u,%u,%u", &xmax, &ymax, &mpi) == 3) {
if (xmax % 4 && ymax % 4 && mpi >= 1 && mpi <= 32) {
caps_append (caps, new_s, xmax, ymax, mpi);
caps = caps_append (caps, new_s, xmax, ymax, mpi);
added = TRUE;
} else {
GST_WARNING_OBJECT (rtph263ppay, "Invalid custom framesize/MPI"
......@@ -538,42 +540,42 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad,
str = gst_structure_get_string (s, "16cif");
if (str) {
int mpi = atoi (str);
caps_append (caps, new_s, 1408, 1152, mpi);
caps = caps_append (caps, new_s, 1408, 1152, mpi);
added = TRUE;
}
str = gst_structure_get_string (s, "4cif");
if (str) {
int mpi = atoi (str);
caps_append (caps, new_s, 704, 576, mpi);
caps = caps_append (caps, new_s, 704, 576, mpi);
added = TRUE;
}
str = gst_structure_get_string (s, "cif");
if (str) {
int mpi = atoi (str);
caps_append (caps, new_s, 352, 288, mpi);
caps = caps_append (caps, new_s, 352, 288, mpi);
added = TRUE;
}
str = gst_structure_get_string (s, "qcif");
if (str) {
int mpi = atoi (str);
caps_append (caps, new_s, 176, 144, mpi);
caps = caps_append (caps, new_s, 176, 144, mpi);
added = TRUE;
}
str = gst_structure_get_string (s, "sqcif");
if (str) {
int mpi = atoi (str);
caps_append (caps, new_s, 128, 96, mpi);
caps = caps_append (caps, new_s, 128, 96, mpi);
added = TRUE;
}
if (added)
gst_structure_free (new_s);
else
gst_caps_merge_structure (caps, new_s);
caps = gst_caps_merge_structure (caps, new_s);
}
}
......
......@@ -370,7 +370,7 @@ gst_rtp_h264_pay_getcaps (GstRTPBasePayload * payload, GstPad * pad,
"profile", G_TYPE_STRING, "constrained-baseline", NULL);
}
gst_caps_merge_structure (caps, new_s);
caps = gst_caps_merge_structure (caps, new_s);
}
icaps = gst_caps_intersect (caps, template_caps);
......
......@@ -256,7 +256,7 @@ gst_videomixer2_update_src_caps (GstVideoMixer2 * mix)
goto done;
}
gst_caps_truncate (caps);
caps = gst_caps_truncate (caps);
s = gst_caps_get_structure (caps, 0);
gst_structure_fixate_field_nearest_int (s, "width", best_width);
gst_structure_fixate_field_nearest_int (s, "height", best_height);
......
......@@ -122,7 +122,7 @@ static gboolean gst_v4l2src_query (GstBaseSrc * bsrc, GstQuery * query);
static gboolean gst_v4l2src_decide_allocation (GstBaseSrc * src,
GstQuery * query);
static GstFlowReturn gst_v4l2src_fill (GstPushSrc * src, GstBuffer * out);
static void gst_v4l2src_fixate (GstBaseSrc * basesrc, GstCaps * caps);
static GstCaps *gst_v4l2src_fixate (GstBaseSrc * basesrc, GstCaps * caps);
static gboolean gst_v4l2src_negotiate (GstBaseSrc * basesrc);
static void gst_v4l2src_set_property (GObject * object, guint prop_id,
......@@ -280,7 +280,7 @@ gst_v4l2src_get_property (GObject * object,
}
/* this function is a bit of a last resort */
static void
static GstCaps *
gst_v4l2src_fixate (GstBaseSrc * basesrc, GstCaps * caps)
{
GstStructure *structure;
......@@ -288,6 +288,8 @@ gst_v4l2src_fixate (GstBaseSrc * basesrc, GstCaps * caps)
GST_DEBUG_OBJECT (basesrc, "fixating caps %" GST_PTR_FORMAT, caps);
caps = gst_caps_make_writable (caps);
for (i = 0; i < gst_caps_get_size (caps); ++i) {
structure = gst_caps_get_structure (caps, i);
......@@ -302,7 +304,9 @@ gst_v4l2src_fixate (GstBaseSrc * basesrc, GstCaps * caps)
GST_DEBUG_OBJECT (basesrc, "fixated caps %" GST_PTR_FORMAT, caps);
GST_BASE_SRC_CLASS (parent_class)->fixate (basesrc, caps);
caps = GST_BASE_SRC_CLASS (parent_class)->fixate (basesrc, caps);
return caps;
}
......@@ -395,12 +399,11 @@ gst_v4l2src_negotiate (GstBaseSrc * basesrc)
if (peercaps)
gst_caps_unref (peercaps);
if (caps) {
caps = gst_caps_make_writable (caps);
gst_caps_truncate (caps);
caps = gst_caps_truncate (caps);
/* now fixate */
if (!gst_caps_is_empty (caps)) {
gst_v4l2src_fixate (basesrc, caps);
caps = gst_v4l2src_fixate (basesrc, caps);
GST_DEBUG_OBJECT (basesrc, "fixated to: %" GST_PTR_FORMAT, caps);
LOG_CAPS (basesrc, caps);
......
......@@ -81,7 +81,7 @@ enum
#define gst_ximage_src_parent_class parent_class
G_DEFINE_TYPE (GstXImageSrc, gst_ximage_src, GST_TYPE_PUSH_SRC);
static void gst_ximage_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
static GstCaps *gst_ximage_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
static void gst_ximage_src_clear_bufpool (GstXImageSrc * ximagesrc);
/* Called when a buffer is returned from the pipeline */
......@@ -1115,18 +1115,22 @@ gst_ximage_src_set_caps (GstBaseSrc * bs, GstCaps * caps)
return TRUE;
}
static void
static GstCaps *
gst_ximage_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
{
gint i;
GstStructure *structure;
caps = gst_caps_make_writable (caps);
for (i = 0; i < gst_caps_get_size (caps); ++i) {
structure = gst_caps_get_structure (caps, i);
gst_structure_fixate_field_nearest_fraction (structure, "framerate", 25, 1);
}
GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps);
caps = GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps);
return caps;
}
static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment