GST_DEBUG_OBJECT (enc, "start");
enc->tags = gst_tag_list_new_empty ();
- enc->header_sent = FALSE;
enc->encoded_samples = 0;
return TRUE;
GstOpusEnc *enc = GST_OPUS_ENC (benc);
GST_DEBUG_OBJECT (enc, "stop");
- enc->header_sent = FALSE;
if (enc->state) {
opus_multistream_encoder_destroy (enc->state);
enc->state = NULL;
}
gst_tag_list_unref (enc->tags);
enc->tags = NULL;
- g_slist_foreach (enc->headers, (GFunc) gst_buffer_unref, NULL);
- g_slist_free (enc->headers);
- enc->headers = NULL;
gst_tag_setter_reset_tags (GST_TAG_SETTER (enc));
return TRUE;
enc = GST_OPUS_ENC (benc);
GST_DEBUG_OBJECT (enc, "handle_frame");
- if (!enc->header_sent) {
+ if (!gst_pad_has_current_caps (GST_AUDIO_ENCODER_SRC_PAD (benc))) {
GstCaps *caps;
- g_slist_foreach (enc->headers, (GFunc) gst_buffer_unref, NULL);
- g_slist_free (enc->headers);
- enc->headers = NULL;
-
- gst_opus_header_create_caps (&caps, &enc->headers, enc->n_channels,
+ gst_opus_header_create_caps (&caps, NULL, enc->n_channels,
enc->n_stereo_streams, enc->sample_rate, enc->channel_mapping_family,
enc->decoding_channel_mapping,
gst_tag_setter_get_tag_list (GST_TAG_SETTER (enc)));
-
/* negotiate with these caps */
GST_DEBUG_OBJECT (enc, "here are the caps: %" GST_PTR_FORMAT, caps);
gst_audio_encoder_set_output_format (benc, caps);
gst_caps_unref (caps);
-
- enc->header_sent = TRUE;
}
GST_DEBUG_OBJECT (enc, "received buffer %p of %" G_GSIZE_FORMAT " bytes", buf,
guint8 *data;
g_return_if_fail (caps);
- g_return_if_fail (headers && !*headers);
+ g_return_if_fail (!headers || !*headers);
g_return_if_fail (gst_buffer_get_size (buf1) >= 19);
gst_buffer_map (buf1, &map, GST_MAP_READ);
"channels", G_TYPE_INT, channels, "rate", G_TYPE_INT, rate, NULL);
*caps = _gst_caps_set_buffer_array (*caps, "streamheader", buf1, buf2, NULL);
- *headers = g_slist_prepend (*headers, gst_buffer_ref (buf2));
- *headers = g_slist_prepend (*headers, gst_buffer_ref (buf1));
+ if (headers) {
+ *headers = g_slist_prepend (*headers, gst_buffer_ref (buf2));
+ *headers = g_slist_prepend (*headers, gst_buffer_ref (buf1));
+ }
}
void
GstBuffer *buf1, *buf2;
g_return_if_fail (caps);
- g_return_if_fail (headers && !*headers);
+ g_return_if_fail (!headers || !*headers);
g_return_if_fail (nchannels > 0);
g_return_if_fail (sample_rate >= 0); /* 0 -> unset */
g_return_if_fail (channel_mapping_family == 0 || channel_mapping);