mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-24 16:18:16 +00:00
wildmidi: set caps on pad
Set the caps on the pad and use those caps instead of keeping a separate caps pointer around. Fix some whitespace.
This commit is contained in:
parent
4ef773164a
commit
25caf9f743
2 changed files with 31 additions and 28 deletions
|
@ -652,6 +652,7 @@ gst_wildmidi_loop (GstPad * sinkpad)
|
|||
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)) {
|
||||
|
@ -724,6 +725,10 @@ gst_wildmidi_loop (GstPad * sinkpad)
|
|||
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);
|
||||
|
||||
|
@ -787,7 +792,7 @@ gst_wildmidi_loop (GstPad * sinkpad)
|
|||
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)
|
||||
|
@ -819,8 +824,6 @@ gst_wildmidi_change_state (GstElement * element, GstStateChange transition)
|
|||
|
||||
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:
|
||||
|
@ -846,7 +849,6 @@ gst_wildmidi_change_state (GstElement * element, GstStateChange transition)
|
|||
wildmidi->mididata = NULL;
|
||||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||
gst_caps_unref (wildmidi->out_caps);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* gstwildmidi - wildmidi plugin for gstreamer
|
||||
*
|
||||
*
|
||||
* Copyright 2007 Wouter Paesen <wouter@blue-gate.be>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -19,8 +19,8 @@
|
|||
* 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.
|
||||
*/
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
|||
#include <wildmidi_lib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_WILDMIDI \
|
||||
(gst_wildmidi_get_type())
|
||||
#define GST_WILDMIDI(obj) \
|
||||
|
@ -42,39 +43,38 @@ G_BEGIN_DECLS
|
|||
(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
|
||||
|
@ -85,4 +85,5 @@ struct _GstWildmidiClass
|
|||
GType gst_wildmidi_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_WILDMIDI_H__ */
|
||||
|
|
Loading…
Reference in a new issue