speexenc: Use new gst_audio_encoder_set_headers() API
This commit is contained in:
parent
b16f5637e8
commit
df946f603f
@ -139,8 +139,6 @@ static GstFlowReturn gst_speex_enc_handle_frame (GstAudioEncoder * enc,
|
|||||||
GstBuffer * in_buf);
|
GstBuffer * in_buf);
|
||||||
static gboolean gst_speex_enc_sink_event (GstAudioEncoder * enc,
|
static gboolean gst_speex_enc_sink_event (GstAudioEncoder * enc,
|
||||||
GstEvent * event);
|
GstEvent * event);
|
||||||
static GstFlowReturn
|
|
||||||
gst_speex_enc_pre_push (GstAudioEncoder * benc, GstBuffer ** buffer);
|
|
||||||
|
|
||||||
#define gst_speex_enc_parent_class parent_class
|
#define gst_speex_enc_parent_class parent_class
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstSpeexEnc, gst_speex_enc, GST_TYPE_AUDIO_ENCODER,
|
G_DEFINE_TYPE_WITH_CODE (GstSpeexEnc, gst_speex_enc, GST_TYPE_AUDIO_ENCODER,
|
||||||
@ -167,7 +165,6 @@ gst_speex_enc_class_init (GstSpeexEncClass * klass)
|
|||||||
base_class->set_format = GST_DEBUG_FUNCPTR (gst_speex_enc_set_format);
|
base_class->set_format = GST_DEBUG_FUNCPTR (gst_speex_enc_set_format);
|
||||||
base_class->handle_frame = GST_DEBUG_FUNCPTR (gst_speex_enc_handle_frame);
|
base_class->handle_frame = GST_DEBUG_FUNCPTR (gst_speex_enc_handle_frame);
|
||||||
base_class->sink_event = GST_DEBUG_FUNCPTR (gst_speex_enc_sink_event);
|
base_class->sink_event = GST_DEBUG_FUNCPTR (gst_speex_enc_sink_event);
|
||||||
base_class->pre_push = GST_DEBUG_FUNCPTR (gst_speex_enc_pre_push);
|
|
||||||
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_QUALITY,
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_QUALITY,
|
||||||
g_param_spec_float ("quality", "Quality", "Encoding quality",
|
g_param_spec_float ("quality", "Quality", "Encoding quality",
|
||||||
@ -274,8 +271,6 @@ gst_speex_enc_stop (GstAudioEncoder * benc)
|
|||||||
speex_bits_destroy (&enc->bits);
|
speex_bits_destroy (&enc->bits);
|
||||||
gst_tag_list_free (enc->tags);
|
gst_tag_list_free (enc->tags);
|
||||||
enc->tags = NULL;
|
enc->tags = NULL;
|
||||||
g_slist_foreach (enc->headers, (GFunc) gst_buffer_unref, NULL);
|
|
||||||
enc->headers = NULL;
|
|
||||||
|
|
||||||
gst_tag_setter_reset_tags (GST_TAG_SETTER (enc));
|
gst_tag_setter_reset_tags (GST_TAG_SETTER (enc));
|
||||||
|
|
||||||
@ -494,16 +489,6 @@ gst_speex_enc_setup (GstSpeexEnc * enc)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* push out the buffer */
|
|
||||||
static GstFlowReturn
|
|
||||||
gst_speex_enc_push_buffer (GstSpeexEnc * enc, GstBuffer * buffer)
|
|
||||||
{
|
|
||||||
GST_DEBUG_OBJECT (enc, "pushing output buffer of size %" G_GSIZE_FORMAT,
|
|
||||||
gst_buffer_get_size (buffer));
|
|
||||||
|
|
||||||
return gst_pad_push (GST_AUDIO_ENCODER_SRC_PAD (enc), buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_speex_enc_sink_event (GstAudioEncoder * benc, GstEvent * event)
|
gst_speex_enc_sink_event (GstAudioEncoder * benc, GstEvent * event)
|
||||||
{
|
{
|
||||||
@ -699,6 +684,7 @@ gst_speex_enc_handle_frame (GstAudioEncoder * benc, GstBuffer * buf)
|
|||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
guchar *data;
|
guchar *data;
|
||||||
gint data_len;
|
gint data_len;
|
||||||
|
GList *headers;
|
||||||
|
|
||||||
/* create header buffer */
|
/* create header buffer */
|
||||||
data = (guint8 *) speex_header_to_packet (&enc->header, &data_len);
|
data = (guint8 *) speex_header_to_packet (&enc->header, &data_len);
|
||||||
@ -722,11 +708,11 @@ gst_speex_enc_handle_frame (GstAudioEncoder * benc, GstBuffer * buf)
|
|||||||
|
|
||||||
/* push out buffers */
|
/* push out buffers */
|
||||||
/* store buffers for later pre_push sending */
|
/* store buffers for later pre_push sending */
|
||||||
g_slist_foreach (enc->headers, (GFunc) gst_buffer_unref, NULL);
|
headers = NULL;
|
||||||
enc->headers = NULL;
|
|
||||||
GST_DEBUG_OBJECT (enc, "storing header buffers");
|
GST_DEBUG_OBJECT (enc, "storing header buffers");
|
||||||
enc->headers = g_slist_prepend (enc->headers, buf2);
|
headers = g_list_prepend (headers, buf2);
|
||||||
enc->headers = g_slist_prepend (enc->headers, buf1);
|
headers = g_list_prepend (headers, buf1);
|
||||||
|
gst_audio_encoder_set_headers (benc, headers);
|
||||||
|
|
||||||
enc->header_sent = TRUE;
|
enc->header_sent = TRUE;
|
||||||
}
|
}
|
||||||
@ -739,36 +725,6 @@ gst_speex_enc_handle_frame (GstAudioEncoder * benc, GstBuffer * buf)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
|
||||||
gst_speex_enc_pre_push (GstAudioEncoder * benc, GstBuffer ** buffer)
|
|
||||||
{
|
|
||||||
GstSpeexEnc *enc;
|
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
|
||||||
|
|
||||||
enc = GST_SPEEX_ENC (benc);
|
|
||||||
|
|
||||||
/* FIXME 0.11 ? get rid of this special ogg stuff and have it
|
|
||||||
* put and use 'codec data' in caps like anything else,
|
|
||||||
* with all the usual out-of-band advantage etc */
|
|
||||||
if (G_UNLIKELY (enc->headers)) {
|
|
||||||
GSList *header = enc->headers;
|
|
||||||
|
|
||||||
/* try to push all of these, if we lose one, might as well lose all */
|
|
||||||
while (header) {
|
|
||||||
if (ret == GST_FLOW_OK)
|
|
||||||
ret = gst_speex_enc_push_buffer (enc, header->data);
|
|
||||||
else
|
|
||||||
gst_speex_enc_push_buffer (enc, header->data);
|
|
||||||
header = g_slist_next (header);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_slist_free (enc->headers);
|
|
||||||
enc->headers = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_speex_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
gst_speex_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
GParamSpec * pspec)
|
GParamSpec * pspec)
|
||||||
|
@ -80,7 +80,6 @@ struct _GstSpeexEnc {
|
|||||||
gint rate;
|
gint rate;
|
||||||
|
|
||||||
gboolean header_sent;
|
gboolean header_sent;
|
||||||
GSList *headers;
|
|
||||||
|
|
||||||
GstTagList *tags;
|
GstTagList *tags;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user