mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-03 16:09:39 +00:00
faad: use an in struct segment rather than a separately allocated one
This commit is contained in:
parent
88af663e86
commit
b3e8ded46e
2 changed files with 7 additions and 25 deletions
|
@ -134,7 +134,6 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
static void gst_faad_base_init (GstFaadClass * klass);
|
static void gst_faad_base_init (GstFaadClass * klass);
|
||||||
static void gst_faad_class_init (GstFaadClass * klass);
|
static void gst_faad_class_init (GstFaadClass * klass);
|
||||||
static void gst_faad_init (GstFaad * faad);
|
static void gst_faad_init (GstFaad * faad);
|
||||||
static void gst_faad_dispose (GObject * object);
|
|
||||||
|
|
||||||
static gboolean gst_faad_setcaps (GstPad * pad, GstCaps * caps);
|
static gboolean gst_faad_setcaps (GstPad * pad, GstCaps * caps);
|
||||||
static GstCaps *gst_faad_srcgetcaps (GstPad * pad);
|
static GstCaps *gst_faad_srcgetcaps (GstPad * pad);
|
||||||
|
@ -194,13 +193,10 @@ gst_faad_base_init (GstFaadClass * klass)
|
||||||
static void
|
static void
|
||||||
gst_faad_class_init (GstFaadClass * klass)
|
gst_faad_class_init (GstFaadClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
||||||
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_faad_dispose);
|
|
||||||
|
|
||||||
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_faad_change_state);
|
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_faad_change_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +216,6 @@ gst_faad_init (GstFaad * faad)
|
||||||
faad->sum_dur_out = 0;
|
faad->sum_dur_out = 0;
|
||||||
faad->packetised = FALSE;
|
faad->packetised = FALSE;
|
||||||
faad->error_count = 0;
|
faad->error_count = 0;
|
||||||
faad->segment = gst_segment_new ();
|
|
||||||
|
|
||||||
faad->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
|
faad->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
|
||||||
gst_element_add_pad (GST_ELEMENT (faad), faad->sinkpad);
|
gst_element_add_pad (GST_ELEMENT (faad), faad->sinkpad);
|
||||||
|
@ -242,19 +237,6 @@ gst_faad_init (GstFaad * faad)
|
||||||
gst_element_add_pad (GST_ELEMENT (faad), faad->srcpad);
|
gst_element_add_pad (GST_ELEMENT (faad), faad->srcpad);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gst_faad_dispose (GObject * object)
|
|
||||||
{
|
|
||||||
GstFaad *faad = GST_FAAD (object);
|
|
||||||
|
|
||||||
if (faad->segment) {
|
|
||||||
gst_segment_free (faad->segment);
|
|
||||||
faad->segment = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_faad_send_tags (GstFaad * faad)
|
gst_faad_send_tags (GstFaad * faad)
|
||||||
{
|
{
|
||||||
|
@ -816,7 +798,7 @@ gst_faad_drain (GstFaad * faad)
|
||||||
{
|
{
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
|
||||||
if (faad->segment->rate < 0.0) {
|
if (faad->segment.rate < 0.0) {
|
||||||
/* if we have some queued frames for reverse playback, flush
|
/* if we have some queued frames for reverse playback, flush
|
||||||
* them now */
|
* them now */
|
||||||
ret = flush_queued (faad);
|
ret = flush_queued (faad);
|
||||||
|
@ -929,7 +911,7 @@ gst_faad_sink_event (GstPad * pad, GstEvent * event)
|
||||||
GST_DEBUG ("Got NEWSEGMENT event in GST_FORMAT_TIME, passing on (%"
|
GST_DEBUG ("Got NEWSEGMENT event in GST_FORMAT_TIME, passing on (%"
|
||||||
GST_TIME_FORMAT " - %" GST_TIME_FORMAT ")", GST_TIME_ARGS (start),
|
GST_TIME_FORMAT " - %" GST_TIME_FORMAT ")", GST_TIME_ARGS (start),
|
||||||
GST_TIME_ARGS (end));
|
GST_TIME_ARGS (end));
|
||||||
gst_segment_set_newsegment (faad->segment, is_update, rate, fmt, start,
|
gst_segment_set_newsegment (&faad->segment, is_update, rate, fmt, start,
|
||||||
end, base);
|
end, base);
|
||||||
} else if (fmt == GST_FORMAT_BYTES) {
|
} else if (fmt == GST_FORMAT_BYTES) {
|
||||||
gint64 new_start = 0;
|
gint64 new_start = 0;
|
||||||
|
@ -953,7 +935,7 @@ gst_faad_sink_event (GstPad * pad, GstEvent * event)
|
||||||
event = gst_event_new_new_segment (is_update, rate,
|
event = gst_event_new_new_segment (is_update, rate,
|
||||||
GST_FORMAT_TIME, new_start, new_end, new_start);
|
GST_FORMAT_TIME, new_start, new_end, new_start);
|
||||||
|
|
||||||
gst_segment_set_newsegment (faad->segment, is_update, rate,
|
gst_segment_set_newsegment (&faad->segment, is_update, rate,
|
||||||
GST_FORMAT_TIME, new_start, new_end, new_start);
|
GST_FORMAT_TIME, new_start, new_end, new_start);
|
||||||
|
|
||||||
GST_DEBUG ("Sending new NEWSEGMENT event, time %" GST_TIME_FORMAT
|
GST_DEBUG ("Sending new NEWSEGMENT event, time %" GST_TIME_FORMAT
|
||||||
|
@ -1429,7 +1411,7 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
faad->sum_dur_out += GST_BUFFER_DURATION (outbuf);
|
faad->sum_dur_out += GST_BUFFER_DURATION (outbuf);
|
||||||
GST_OBJECT_UNLOCK (faad);
|
GST_OBJECT_UNLOCK (faad);
|
||||||
|
|
||||||
if ((outbuf = gst_audio_buffer_clip (outbuf, faad->segment,
|
if ((outbuf = gst_audio_buffer_clip (outbuf, &faad->segment,
|
||||||
faad->samplerate, faad->bps * faad->channels))) {
|
faad->samplerate, faad->bps * faad->channels))) {
|
||||||
GST_LOG_OBJECT (faad,
|
GST_LOG_OBJECT (faad,
|
||||||
"pushing buffer, off=%" G_GUINT64_FORMAT ", ts=%" GST_TIME_FORMAT,
|
"pushing buffer, off=%" G_GUINT64_FORMAT ", ts=%" GST_TIME_FORMAT,
|
||||||
|
@ -1441,7 +1423,7 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
faad->discont = FALSE;
|
faad->discont = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (faad->segment->rate > 0.0) {
|
if (faad->segment.rate > 0.0) {
|
||||||
ret = gst_pad_push (faad->srcpad, outbuf);
|
ret = gst_pad_push (faad->srcpad, outbuf);
|
||||||
} else {
|
} else {
|
||||||
/* reverse playback, queue frame till later when we get a discont. */
|
/* reverse playback, queue frame till later when we get a discont. */
|
||||||
|
@ -1539,7 +1521,7 @@ gst_faad_change_state (GstElement * element, GstStateChange transition)
|
||||||
return GST_STATE_CHANGE_FAILURE;
|
return GST_STATE_CHANGE_FAILURE;
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
gst_segment_init (faad->segment, GST_FORMAT_TIME);
|
gst_segment_init (&faad->segment, GST_FORMAT_TIME);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -71,7 +71,7 @@ typedef struct _GstFaad {
|
||||||
gboolean discont;
|
gboolean discont;
|
||||||
|
|
||||||
/* segment handling */
|
/* segment handling */
|
||||||
GstSegment * segment;
|
GstSegment segment;
|
||||||
|
|
||||||
/* list of raw output buffers for reverse playback */
|
/* list of raw output buffers for reverse playback */
|
||||||
GList *queued;
|
GList *queued;
|
||||||
|
|
Loading…
Reference in a new issue