summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@mad.scientist.com>2005-04-12 05:10:37 +0000
committerJan Schmidt <thaytan@mad.scientist.com>2005-04-12 05:10:37 +0000
commitf39449ebd2cd43aee7a669d440c0bb303863951a (patch)
treec81d38123a36f03e06ddcace0f0a360b0284b5e0 /ext
parent06b6d5a288b4536585188aefb956da4932da9c18 (diff)
downloadgst-plugins-bad-f39449ebd2cd43aee7a669d440c0bb303863951a.tar.gz
gst-plugins-bad-f39449ebd2cd43aee7a669d440c0bb303863951a.tar.bz2
gst-plugins-bad-f39449ebd2cd43aee7a669d440c0bb303863951a.zip
ext/dts/gstdtsdec.c: Handle filler events.
Original commit message from CVS: * ext/dts/gstdtsdec.c: (gst_dtsdec_handle_event), (gst_dtsdec_chain): Handle filler events. * ext/a52dec/gsta52dec.c: (gst_a52dec_handle_event), (gst_a52dec_chain): Handle filler events. * ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_init), (dvdnavsrc_print_event), (dvdnavsrc_structure_set_uint64), (dvdnavsrc_make_dvd_nav_packet_event), (dvdnavsrc_loop), (dvdnavsrc_change_state), (dvdnav_handle_navigation_event), (dvdnavsrc_event), (dvdnavsrc_get_formats), (dvdnavsrc_query): Lots of changes for DVD playback * ext/ladspa/gstladspa.c: (gst_ladspa_base_init), (gst_ladspa_init), (gst_ladspa_link), (gst_ladspa_loop), (gst_ladspa_chain), (gst_ladspa_get): * ext/ladspa/gstladspa.h: Memory allocation and timestamping fixes. * ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_negotiate_format): Handle filler events * gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init), (gst_dvd_demux_class_init), (gst_dvd_demux_init), (gst_dvd_demux_send_data), (gst_dvd_demux_handle_dvd_event), (gst_dvd_demux_send_event), (gst_dvd_demux_handle_discont), (gst_dvd_demux_get_video_stream), (gst_dvd_demux_get_audio_stream), (gst_dvd_demux_get_subpicture_stream), (gst_dvd_demux_reset), (gst_dvd_demux_synchronise_pads), (gst_dvd_demux_sync_stream_to_time): * gst/mpegstream/gstdvddemux.h: * gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init), (gst_mpeg_demux_init), (gst_mpeg_demux_send_data), (gst_mpeg_demux_send_discont), (gst_mpeg_demux_send_event), (gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_init_stream), (gst_mpeg_demux_get_audio_stream), (gst_mpeg_demux_parse_packet), (gst_mpeg_demux_parse_pes), (gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_synchronise_pads), (gst_mpeg_demux_sync_stream_to_time), (gst_mpeg_demux_handle_src_event), (gst_mpeg_demux_handle_src_query), (gst_mpeg_demux_reset): * gst/mpegstream/gstmpegdemux.h: * gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_class_init), (gst_mpeg_parse_reset), (gst_mpeg_parse_handle_discont), (gst_mpeg_parse_send_discont), (gst_mpeg_parse_send_event), (gst_mpeg_parse_parse_packhead), (gst_mpeg_parse_handle_src_query), (gst_mpeg_parse_handle_src_event): * gst/mpegstream/gstmpegparse.h: Lots of changes for DVD playback. Still troublesome in playbin, not sure why yet. * gst/wavparse/gstwavparse.c: (gst_wavparse_create_sourcepad), (gst_wavparse_fmt): Some error checks
Diffstat (limited to 'ext')
-rw-r--r--ext/dts/gstdtsdec.c22
-rw-r--r--ext/ladspa/gstladspa.c67
-rw-r--r--ext/ladspa/gstladspa.h7
3 files changed, 65 insertions, 31 deletions
diff --git a/ext/dts/gstdtsdec.c b/ext/dts/gstdtsdec.c
index fa7fd5d9..b6e526e5 100644
--- a/ext/dts/gstdtsdec.c
+++ b/ext/dts/gstdtsdec.c
@@ -333,6 +333,28 @@ gst_dtsdec_handle_event (GstDtsDec * dts, GstEvent * event)
dts->cache = NULL;
}
break;
+ case GST_EVENT_FILLER:{
+ /* Transform filler to always have timestamp + duration */
+ GstClockTime end_ts = GST_EVENT_TIMESTAMP (event);
+ GstClockTime dur = gst_event_filler_get_duration (event);
+
+ if (!GST_CLOCK_TIME_IS_VALID (end_ts))
+ end_ts = dts->current_ts;
+
+ if (GST_CLOCK_TIME_IS_VALID (dur))
+ end_ts += dur;
+
+ dur = GST_CLOCK_DIFF (end_ts, dts->current_ts);
+
+ gst_event_unref (event);
+
+ if (dur <= 0)
+ return;
+
+ event = gst_event_new_filler_stamped (dts->current_ts, dur);
+ dts->current_ts = end_ts;
+ }
+
default:
break;
}
diff --git a/ext/ladspa/gstladspa.c b/ext/ladspa/gstladspa.c
index 0f1982f8..56986b2e 100644
--- a/ext/ladspa/gstladspa.c
+++ b/ext/ladspa/gstladspa.c
@@ -113,6 +113,7 @@ gst_ladspa_base_init (GstLADSPAClass * klass)
klass->numsrcpads++;
}
+ g_free (name);
gst_element_class_add_pad_template (element_class, templ);
}
}
@@ -416,6 +417,22 @@ gst_ladspa_init (GstLADSPA * ladspa)
ladspa->controls = g_new (gfloat, oclass->numcontrols);
ladspa->dpman = gst_dpman_new ("ladspa_dpman", GST_ELEMENT (ladspa));
+ if (oclass->numsinkpads > 0) {
+ ladspa->data_in = g_new0 (LADSPA_Data *, oclass->numsinkpads);
+ ladspa->buffers_in = g_new0 (GstBuffer *, oclass->numsinkpads);
+ } else {
+ ladspa->data_in = NULL;
+ ladspa->buffers_in = NULL;
+ }
+
+ if (oclass->numsrcpads > 0) {
+ ladspa->buffers_out = g_new0 (GstBuffer *, oclass->numsrcpads);
+ ladspa->data_out = g_new0 (LADSPA_Data *, oclass->numsrcpads);
+ } else {
+ ladspa->buffers_out = NULL;
+ ladspa->data_out = NULL;
+ }
+
/* set up pads */
sinkcount = 0;
srccount = 0;
@@ -524,7 +541,8 @@ gst_ladspa_link (GstPad * pad, const GstCaps * caps)
/* if this fails in some other plugin, the graph is left in an inconsistent
state */
for (l = gst_element_get_pad_list (element); l; l = l->next)
- if (pad != (GstPad *) l->data)
+ if ((pad != (GstPad *) l->data)
+ && !GST_PAD_IS_NEGOTIATING ((GstPad *) l->data))
if (gst_pad_try_set_caps ((GstPad *) l->data, caps) <= 0)
return GST_PAD_LINK_REFUSED;
@@ -740,12 +758,10 @@ gst_ladspa_loop (GstElement * element)
numsinkpads = oclass->numsinkpads;
numsrcpads = oclass->numsrcpads;
-
- /* fixme: these mallocs need to die */
- data_in = g_new0 (LADSPA_Data *, numsinkpads);
- data_out = g_new0 (LADSPA_Data *, numsrcpads);
- buffers_in = g_new0 (GstBuffer *, numsinkpads);
- buffers_out = g_new0 (GstBuffer *, numsrcpads);
+ data_in = ladspa->data_in;
+ data_out = ladspa->data_out;
+ buffers_in = ladspa->buffers_in;
+ buffers_out = ladspa->buffers_out;
largest_buffer = -1;
@@ -775,7 +791,8 @@ gst_ladspa_loop (GstElement * element)
MIN (GST_BUFFER_SIZE (buffers_in[i]) / sizeof (gfloat),
largest_buffer);
data_in[i] = (LADSPA_Data *) GST_BUFFER_DATA (buffers_in[i]);
- GST_BUFFER_TIMESTAMP (buffers_in[i]) = ladspa->timestamp;
+ if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffers_in[i])))
+ ladspa->timestamp = GST_BUFFER_TIMESTAMP (buffers_in[i]);
}
i = 0;
@@ -837,18 +854,12 @@ gst_ladspa_loop (GstElement * element)
ladspa->timestamp += ladspa->buffer_frames * GST_SECOND / ladspa->samplerate;
- /* FIXME: move these mallocs and frees to the state-change handler */
-
- g_free (buffers_out);
- g_free (buffers_in);
- g_free (data_out);
- g_free (data_in);
}
static void
gst_ladspa_chain (GstPad * pad, GstData * _data)
{
- GstBuffer *buffer_in = GST_BUFFER (_data);
+ GstBuffer *buffer_in;
LADSPA_Descriptor *desc;
LADSPA_Data *data_in, **data_out = NULL;
GstBuffer **buffers_out = NULL;
@@ -857,6 +868,10 @@ gst_ladspa_chain (GstPad * pad, GstData * _data)
GstLADSPA *ladspa;
GstLADSPAClass *oclass;
+ /* we shouldn't get events here... */
+ g_return_if_fail (GST_IS_BUFFER (_data));
+ buffer_in = GST_BUFFER (_data);
+
ladspa = (GstLADSPA *) GST_OBJECT_PARENT (pad);
oclass = (GstLADSPAClass *) (G_OBJECT_GET_CLASS (ladspa));
data_in = (LADSPA_Data *) GST_BUFFER_DATA (buffer_in);
@@ -864,19 +879,15 @@ gst_ladspa_chain (GstPad * pad, GstData * _data)
numsrcpads = oclass->numsrcpads;
desc = ladspa->descriptor;
- /* we shouldn't get events here... */
- g_return_if_fail (GST_IS_BUFFER (buffer_in));
-
- /* FIXME: this function shouldn't need to malloc() anything */
- if (numsrcpads > 0) {
- buffers_out = g_new (GstBuffer *, numsrcpads);
- data_out = g_new (LADSPA_Data *, numsrcpads);
- }
+ buffers_out = ladspa->buffers_out;
+ data_out = ladspa->data_out;
+ if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer_in)))
+ ladspa->timestamp = GST_BUFFER_TIMESTAMP (buffer_in);
i = 0;
if (!ladspa->inplace_broken && numsrcpads) {
/* reuse the first (chained) buffer */
- buffers_out[i] = buffer_in;
+ buffers_out[i] = gst_buffer_copy_on_write (buffer_in);
GST_DEBUG ("reuse: %d", GST_BUFFER_SIZE (buffer_in));
data_out[i] = data_in;
i++;
@@ -888,8 +899,7 @@ gst_ladspa_chain (GstPad * pad, GstData * _data)
data_out[i] = (LADSPA_Data *) GST_BUFFER_DATA (buffers_out[i]);
}
- GST_DPMAN_PREPROCESS (ladspa->dpman, num_samples,
- GST_BUFFER_TIMESTAMP (buffer_in));
+ GST_DPMAN_PREPROCESS (ladspa->dpman, num_samples, ladspa->timestamp);
num_processed = 0;
/* split up processing of the buffer into chunks so that dparams can
@@ -923,9 +933,6 @@ gst_ladspa_chain (GstPad * pad, GstData * _data)
GST_BUFFER_SIZE (buffers_out[i]), i);
gst_pad_push (ladspa->srcpads[i], GST_DATA (buffers_out[i]));
}
-
- g_free (buffers_out);
- g_free (data_out);
}
}
@@ -945,8 +952,8 @@ gst_ladspa_get (GstPad * pad)
/* 4096 is arbitrary */
buf = gst_buffer_new_and_alloc (4096);
- GST_BUFFER_TIMESTAMP (buf) = ladspa->timestamp;
data = (LADSPA_Data *) GST_BUFFER_DATA (buf);
+ GST_BUFFER_TIMESTAMP (buf) = ladspa->timestamp;
GST_DPMAN_PREPROCESS (ladspa->dpman, ladspa->buffer_frames,
ladspa->timestamp);
diff --git a/ext/ladspa/gstladspa.h b/ext/ladspa/gstladspa.h
index f3556f74..231871cd 100644
--- a/ext/ladspa/gstladspa.h
+++ b/ext/ladspa/gstladspa.h
@@ -59,10 +59,15 @@ struct _GstLADSPA {
GstPad **sinkpads,
**srcpads;
+ LADSPA_Data **data_in;
+ LADSPA_Data **data_out;
+ GstBuffer **buffers_in;
+ GstBuffer **buffers_out;
+
gboolean activated;
gint samplerate, buffer_frames;
- gint64 timestamp;
+ GstClockTime timestamp;
gboolean inplace_broken;
};