static GstFlowReturn gst_test_reverse_negotiation_sink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf) { GstTestReverseNegotiationSink *sink = GST_TEST_REVERSE_NEGOTIATION_SINK (bsink); GstVideoFormat fmt; gint width, height; fail_unless (gst_video_format_parse_caps (caps, &fmt, &width, &height)); if (sink->nbuffers < 2) { *buf = gst_buffer_new_and_alloc (gst_video_format_get_size (fmt, width, height)); gst_buffer_set_caps (*buf, caps); } else { gint fps_n, fps_d; fail_unless (gst_video_parse_caps_framerate (caps, &fps_n, &fps_d)); width = 512; height = 128; *buf = gst_buffer_new_and_alloc (gst_video_format_get_size (fmt, width, height)); caps = gst_video_format_new_caps (fmt, width, height, fps_n, fps_d, 1, 1); gst_buffer_set_caps (*buf, caps); gst_caps_unref (caps); } return GST_FLOW_OK; }
static GstFlowReturn gst_test_reverse_negotiation_sink_render (GstBaseSink * bsink, GstBuffer * buffer) { GstTestReverseNegotiationSink *sink = GST_TEST_REVERSE_NEGOTIATION_SINK (bsink); GstCaps *caps; GstVideoInfo info; caps = gst_pad_get_current_caps (GST_BASE_SINK_PAD (bsink)); fail_unless (caps != NULL); fail_unless (gst_video_info_from_caps (&info, caps)); sink->nbuffers++; /* The third buffer is still in the old size * because the videoconverts can't convert * the frame sizes */ if (sink->nbuffers > 3) { fail_unless_equals_int (GST_VIDEO_INFO_WIDTH (&info), 512); fail_unless_equals_int (GST_VIDEO_INFO_HEIGHT (&info), 128); } gst_caps_unref (caps); return GST_FLOW_OK; }
static GstFlowReturn gst_test_reverse_negotiation_sink_render (GstBaseSink * bsink, GstBuffer * buffer) { GstTestReverseNegotiationSink *sink = GST_TEST_REVERSE_NEGOTIATION_SINK (bsink); GstCaps *caps = gst_buffer_get_caps (buffer); GstVideoFormat fmt; gint width, height; fail_unless (caps != NULL); fail_unless (gst_video_format_parse_caps (caps, &fmt, &width, &height)); sink->nbuffers++; /* The third buffer is still in the old size * because the ffmpegcolorspaces can't convert * the frame sizes */ if (sink->nbuffers > 3) { fail_unless_equals_int (width, 512); fail_unless_equals_int (height, 128); } gst_caps_unref (caps); return GST_FLOW_OK; }