#include "gstvideoencoder.h"
#include "gstvideoutils.h"
+#include <gst/video/gstvideometa.h>
+
#include <string.h>
GST_DEBUG_CATEGORY (videoencoder_debug);
GstEvent * event);
static gboolean gst_video_encoder_src_event_default (GstVideoEncoder * encoder,
GstEvent * event);
+static gboolean gst_video_encoder_propose_allocation_default (GstVideoEncoder *
+ encoder, GstQuery * query);
/* we can't use G_DEFINE_ABSTRACT_TYPE because we need the klass in the _init
* method to get to the padtemplates */
klass->sink_event = gst_video_encoder_sink_event_default;
klass->src_event = gst_video_encoder_src_event_default;
+ klass->propose_allocation = gst_video_encoder_propose_allocation_default;
}
static void
return caps;
}
+static gboolean
+gst_video_encoder_propose_allocation_default (GstVideoEncoder * encoder,
+ GstQuery * query)
+{
+ gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
+
+ return TRUE;
+}
static gboolean
gst_video_encoder_sink_query (GstPad * pad, GstObject * parent,
res = TRUE;
break;
}
+ case GST_QUERY_ALLOCATION:
+ {
+ GstVideoEncoderClass *klass = GST_VIDEO_ENCODER_GET_CLASS (encoder);
+
+ if (klass->propose_allocation)
+ res = klass->propose_allocation (encoder, query);
+ break;
+ }
default:
res = gst_pad_query_default (pad, parent, query);
break;
* Event handler on the source pad. This function should return
* TRUE if the event was handled and should be discarded
* (i.e. not unref'ed).
+ * @propose_allocation: Optional.
+ * Propose buffer allocation parameters for upstream elements.
+ * The default implementation proposes the VIDEO_META.
*
* Subclasses can override any of the available virtual methods or not, as
* needed. At minimum @handle_frame needs to be overridden, and @set_format
gboolean (*src_event) (GstVideoEncoder *encoder,
GstEvent *event);
+ gboolean (*propose_allocation) (GstVideoEncoder * encoder,
+ GstQuery * query);
+
/*< private >*/
/* FIXME before moving to base */
gpointer _gst_reserved[GST_PADDING_LARGE];