mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
flacenc: implement proper accept-caps
Should just compare with what can be immediatelly accepted by the element. flacenc can't renegotiate so if it has a caps already it should only accept if it is that caps otherwise just use the template caps
This commit is contained in:
parent
3553493d96
commit
a00546e078
1 changed files with 37 additions and 0 deletions
|
@ -141,6 +141,8 @@ static GstFlowReturn gst_flac_enc_handle_frame (GstAudioEncoder * enc,
|
||||||
static GstCaps *gst_flac_enc_getcaps (GstAudioEncoder * enc, GstCaps * filter);
|
static GstCaps *gst_flac_enc_getcaps (GstAudioEncoder * enc, GstCaps * filter);
|
||||||
static gboolean gst_flac_enc_sink_event (GstAudioEncoder * enc,
|
static gboolean gst_flac_enc_sink_event (GstAudioEncoder * enc,
|
||||||
GstEvent * event);
|
GstEvent * event);
|
||||||
|
static gboolean gst_flac_enc_sink_query (GstAudioEncoder * enc,
|
||||||
|
GstQuery * query);
|
||||||
|
|
||||||
static void gst_flac_enc_finalize (GObject * object);
|
static void gst_flac_enc_finalize (GObject * object);
|
||||||
|
|
||||||
|
@ -359,6 +361,7 @@ gst_flac_enc_class_init (GstFlacEncClass * klass)
|
||||||
base_class->handle_frame = GST_DEBUG_FUNCPTR (gst_flac_enc_handle_frame);
|
base_class->handle_frame = GST_DEBUG_FUNCPTR (gst_flac_enc_handle_frame);
|
||||||
base_class->getcaps = GST_DEBUG_FUNCPTR (gst_flac_enc_getcaps);
|
base_class->getcaps = GST_DEBUG_FUNCPTR (gst_flac_enc_getcaps);
|
||||||
base_class->sink_event = GST_DEBUG_FUNCPTR (gst_flac_enc_sink_event);
|
base_class->sink_event = GST_DEBUG_FUNCPTR (gst_flac_enc_sink_event);
|
||||||
|
base_class->sink_query = GST_DEBUG_FUNCPTR (gst_flac_enc_sink_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1267,6 +1270,40 @@ gst_flac_enc_sink_event (GstAudioEncoder * enc, GstEvent * event)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_flac_enc_sink_query (GstAudioEncoder * enc, GstQuery * query)
|
||||||
|
{
|
||||||
|
GstPad *pad = GST_AUDIO_ENCODER_SINK_PAD (enc);
|
||||||
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
|
GST_DEBUG ("Received %s query on sinkpad, %" GST_PTR_FORMAT,
|
||||||
|
GST_QUERY_TYPE_NAME (query), query);
|
||||||
|
|
||||||
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
|
case GST_QUERY_ACCEPT_CAPS:{
|
||||||
|
GstCaps *acceptable, *caps;
|
||||||
|
|
||||||
|
if (gst_pad_has_current_caps (pad)) {
|
||||||
|
acceptable = gst_pad_get_current_caps (pad);
|
||||||
|
} else {
|
||||||
|
acceptable = gst_pad_get_pad_template_caps (pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_query_parse_accept_caps (query, &caps);
|
||||||
|
|
||||||
|
gst_query_set_accept_caps_result (query,
|
||||||
|
gst_caps_is_subset (caps, acceptable));
|
||||||
|
gst_caps_unref (acceptable);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ret = GST_AUDIO_ENCODER_CLASS (parent_class)->sink_query (enc, query);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||||
#define READ_INT24 GST_READ_UINT24_LE
|
#define READ_INT24 GST_READ_UINT24_LE
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue