GstWildmidi *wildmidi = GST_WILDMIDI (GST_PAD_PARENT (sinkpad));
GstBuffer *out;
GstFlowReturn ret;
+ GstCaps *outcaps;
if (wildmidi->mididata_size == 0) {
if (!gst_wildmidi_get_upstream_size (wildmidi, &wildmidi->mididata_size)) {
info = WildMidi_GetInfo (wildmidi->song);
wildmidi->o_len = info->approx_total_samples;
+ outcaps = gst_caps_copy (gst_pad_get_pad_template_caps (wildmidi->srcpad));
+ gst_pad_set_caps (wildmidi->srcpad, outcaps);
+ gst_caps_unref (outcaps);
+
gst_segment_set_newsegment (wildmidi->o_segment, FALSE, 1.0,
GST_FORMAT_DEFAULT, 0, GST_CLOCK_TIME_NONE, 0);
wildmidi->o_seek = FALSE;
}
- gst_buffer_set_caps (out, wildmidi->out_caps);
+ gst_buffer_set_caps (out, GST_PAD_CAPS (wildmidi->srcpad));
ret = gst_pad_push (wildmidi->srcpad, out);
if (GST_FLOW_IS_FATAL (ret) || ret == GST_FLOW_NOT_LINKED)
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
- wildmidi->out_caps =
- gst_caps_copy (gst_pad_get_pad_template_caps (wildmidi->srcpad));
wildmidi->mididata = NULL;
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
wildmidi->mididata = NULL;
break;
case GST_STATE_CHANGE_READY_TO_NULL:
- gst_caps_unref (wildmidi->out_caps);
break;
default:
break;
/*
* gstwildmidi - wildmidi plugin for gstreamer
- *
+ *
* Copyright 2007 Wouter Paesen <wouter@blue-gate.be>
*
* This library is free software; you can redistribute it and/or
* Boston, MA 02111-1307, USA.
*
* Wrapper element for libtimidity. This element works in pull
- * based mode because that's essentially how libwildmidi works.
- * We create a libwildmidi stream that operates on the srcpad.
+ * based mode because that's essentially how libwildmidi works.
+ * We create a libwildmidi stream that operates on the srcpad.
* The sinkpad is in pull mode.
*/
#include <wildmidi_lib.h>
G_BEGIN_DECLS
+
#define GST_TYPE_WILDMIDI \
(gst_wildmidi_get_type())
#define GST_WILDMIDI(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WILDMIDI))
#define GST_IS_WILDMIDI_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_WILDMIDI))
+
typedef struct _GstWildmidi GstWildmidi;
typedef struct _GstWildmidiClass GstWildmidiClass;
struct _GstWildmidi
{
- GstElement element;
+ GstElement element;
- GstPad *sinkpad, *srcpad;
+ GstPad *sinkpad, *srcpad;
- /* input stream properties */
- gint64 mididata_size, mididata_offset;
- gchar *mididata;
- gboolean mididata_filled;
+ /* input stream properties */
+ gint64 mididata_size, mididata_offset;
+ gchar *mididata;
+ gboolean mididata_filled;
- midi *song;
+ midi *song;
- /* output data */
- gboolean o_new_segment, o_segment_changed, o_seek;
- GstSegment o_segment[1];
- gint64 o_len;
+ /* output data */
+ gboolean o_new_segment, o_segment_changed, o_seek;
+ GstSegment o_segment[1];
+ gint64 o_len;
- /* format of the stream */
- gint64 bytes_per_frame;
- GstClockTime time_per_frame;
+ /* format of the stream */
+ gint64 bytes_per_frame;
+ GstClockTime time_per_frame;
- /* options */
- gboolean accurate_seek;
+ /* options */
+ gboolean accurate_seek;
- /* wildmidi settings */
- gboolean high_quality;
- gboolean linear_volume;
-
- GstCaps *out_caps;
+ /* wildmidi settings */
+ gboolean high_quality;
+ gboolean linear_volume;
};
struct _GstWildmidiClass
GType gst_wildmidi_get_type (void);
G_END_DECLS
+
#endif /* __GST_WILDMIDI_H__ */