[MOVED FROM BAD 090/134] vp8enc: Update for basevideoencoder ::get_caps() removal

This commit is contained in:
Sebastian Dröge 2011-08-12 12:08:08 +02:00
parent 73a6edbfe2
commit c58dd70675

View file

@ -220,7 +220,6 @@ static GstFlowReturn gst_vp8_enc_shape_output (GstBaseVideoEncoder * encoder,
GstVideoFrame * frame); GstVideoFrame * frame);
static gboolean gst_vp8_enc_sink_event (GstBaseVideoEncoder * static gboolean gst_vp8_enc_sink_event (GstBaseVideoEncoder *
base_video_encoder, GstEvent * event); base_video_encoder, GstEvent * event);
static GstCaps *gst_vp8_enc_get_caps (GstBaseVideoEncoder * base_video_encoder);
static GstStaticPadTemplate gst_vp8_enc_sink_template = static GstStaticPadTemplate gst_vp8_enc_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_PAD_TEMPLATE ("sink",
@ -291,7 +290,6 @@ gst_vp8_enc_class_init (GstVP8EncClass * klass)
base_video_encoder_class->finish = gst_vp8_enc_finish; base_video_encoder_class->finish = gst_vp8_enc_finish;
base_video_encoder_class->shape_output = gst_vp8_enc_shape_output; base_video_encoder_class->shape_output = gst_vp8_enc_shape_output;
base_video_encoder_class->event = gst_vp8_enc_sink_event; base_video_encoder_class->event = gst_vp8_enc_sink_event;
base_video_encoder_class->get_caps = gst_vp8_enc_get_caps;
g_object_class_install_property (gobject_class, PROP_BITRATE, g_object_class_install_property (gobject_class, PROP_BITRATE,
g_param_spec_int ("bitrate", "Bit rate", g_param_spec_int ("bitrate", "Bit rate",
@ -695,6 +693,8 @@ gst_vp8_enc_set_format (GstBaseVideoEncoder * base_video_encoder,
vpx_codec_err_t status; vpx_codec_err_t status;
vpx_image_t *image; vpx_image_t *image;
guint8 *data = NULL; guint8 *data = NULL;
GstCaps *caps;
gboolean ret;
encoder = GST_VP8_ENC (base_video_encoder); encoder = GST_VP8_ENC (base_video_encoder);
GST_DEBUG_OBJECT (base_video_encoder, "set_format"); GST_DEBUG_OBJECT (base_video_encoder, "set_format");
@ -845,23 +845,6 @@ gst_vp8_enc_set_format (GstBaseVideoEncoder * base_video_encoder,
data + gst_video_format_get_component_offset (state->format, 2, data + gst_video_format_get_component_offset (state->format, 2,
state->width, state->height); state->width, state->height);
return TRUE;
}
static GstCaps *
gst_vp8_enc_get_caps (GstBaseVideoEncoder * base_video_encoder)
{
GstCaps *caps;
const GstVideoState *state;
GstTagList *tags = NULL;
const GstTagList *iface_tags;
GstBuffer *stream_hdr, *vorbiscomment;
guint8 *data;
GstStructure *s;
GValue array = { 0 };
GValue value = { 0 };
state = gst_base_video_encoder_get_state (base_video_encoder);
caps = gst_caps_new_simple ("video/x-vp8", caps = gst_caps_new_simple ("video/x-vp8",
"width", G_TYPE_INT, state->width, "width", G_TYPE_INT, state->width,
@ -870,7 +853,13 @@ gst_vp8_enc_get_caps (GstBaseVideoEncoder * base_video_encoder)
state->fps_d, state->fps_d,
"pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n, "pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n,
state->par_d, NULL); state->par_d, NULL);
{
GstStructure *s;
GstBuffer *stream_hdr, *vorbiscomment;
const GstTagList *iface_tags;
GstTagList *tags;
GValue array = { 0, };
GValue value = { 0, };
s = gst_caps_get_structure (caps, 0); s = gst_caps_get_structure (caps, 0);
/* put buffers in a fixed list */ /* put buffers in a fixed list */
@ -903,8 +892,8 @@ gst_vp8_enc_get_caps (GstBaseVideoEncoder * base_video_encoder)
gst_tag_setter_get_tag_list (GST_TAG_SETTER (base_video_encoder)); gst_tag_setter_get_tag_list (GST_TAG_SETTER (base_video_encoder));
if (iface_tags) { if (iface_tags) {
vorbiscomment = vorbiscomment =
gst_tag_list_to_vorbiscomment_buffer ((iface_tags) ? iface_tags : tags, gst_tag_list_to_vorbiscomment_buffer ((iface_tags) ? iface_tags :
(const guint8 *) "OVP80\2 ", 7, tags, (const guint8 *) "OVP80\2 ", 7,
"Encoded with GStreamer vp8enc " PACKAGE_VERSION); "Encoded with GStreamer vp8enc " PACKAGE_VERSION);
GST_BUFFER_FLAG_SET (vorbiscomment, GST_BUFFER_FLAG_IN_CAPS); GST_BUFFER_FLAG_SET (vorbiscomment, GST_BUFFER_FLAG_IN_CAPS);
@ -918,8 +907,12 @@ gst_vp8_enc_get_caps (GstBaseVideoEncoder * base_video_encoder)
gst_structure_set_value (s, "streamheader", &array); gst_structure_set_value (s, "streamheader", &array);
g_value_unset (&array); g_value_unset (&array);
}
return caps; ret = gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (encoder), caps);
gst_caps_unref (caps);
return ret;
} }
static GstFlowReturn static GstFlowReturn