mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-30 07:42:32 +00:00
audiosink: Keep baseclass extensible
Add a structure for future extension. Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/716 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/547>
This commit is contained in:
parent
e945b3706c
commit
4a774e878f
2 changed files with 24 additions and 9 deletions
|
@ -623,9 +623,9 @@ gst_audio_sink_ring_buffer_clear_all (GstAudioRingBuffer * buf)
|
||||||
sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
|
sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
|
||||||
csink = GST_AUDIO_SINK_GET_CLASS (sink);
|
csink = GST_AUDIO_SINK_GET_CLASS (sink);
|
||||||
|
|
||||||
if (csink->clear_all) {
|
if (csink->extension->clear_all) {
|
||||||
GST_DEBUG_OBJECT (sink, "clear all");
|
GST_DEBUG_OBJECT (sink, "clear all");
|
||||||
csink->clear_all (sink);
|
csink->extension->clear_all (sink);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* chain up to the parent implementation */
|
/* chain up to the parent implementation */
|
||||||
|
@ -645,7 +645,9 @@ enum
|
||||||
};
|
};
|
||||||
|
|
||||||
#define _do_init \
|
#define _do_init \
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_audio_sink_debug, "audiosink", 0, "audiosink element");
|
GST_DEBUG_CATEGORY_INIT (gst_audio_sink_debug, "audiosink", 0, "audiosink element"); \
|
||||||
|
g_type_add_class_private (g_define_type_id, \
|
||||||
|
sizeof (GstAudioSinkClassExtension));
|
||||||
#define gst_audio_sink_parent_class parent_class
|
#define gst_audio_sink_parent_class parent_class
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstAudioSink, gst_audio_sink,
|
G_DEFINE_TYPE_WITH_CODE (GstAudioSink, gst_audio_sink,
|
||||||
GST_TYPE_AUDIO_BASE_SINK, _do_init);
|
GST_TYPE_AUDIO_BASE_SINK, _do_init);
|
||||||
|
@ -664,6 +666,9 @@ gst_audio_sink_class_init (GstAudioSinkClass * klass)
|
||||||
GST_DEBUG_FUNCPTR (gst_audio_sink_create_ringbuffer);
|
GST_DEBUG_FUNCPTR (gst_audio_sink_create_ringbuffer);
|
||||||
|
|
||||||
g_type_class_ref (GST_TYPE_AUDIO_SINK_RING_BUFFER);
|
g_type_class_ref (GST_TYPE_AUDIO_SINK_RING_BUFFER);
|
||||||
|
|
||||||
|
klass->extension = G_TYPE_CLASS_GET_PRIVATE (klass,
|
||||||
|
GST_TYPE_AUDIO_SINK, GstAudioSinkClassExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -41,6 +41,7 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
typedef struct _GstAudioSink GstAudioSink;
|
typedef struct _GstAudioSink GstAudioSink;
|
||||||
typedef struct _GstAudioSinkClass GstAudioSinkClass;
|
typedef struct _GstAudioSinkClass GstAudioSinkClass;
|
||||||
|
typedef struct _GstAudioSinkClassExtension GstAudioSinkClassExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstAudioSink:
|
* GstAudioSink:
|
||||||
|
@ -76,13 +77,13 @@ struct _GstAudioSink {
|
||||||
* This vmethod is deprecated. Please provide pause and stop instead.
|
* This vmethod is deprecated. Please provide pause and stop instead.
|
||||||
* @pause: Pause the device and unblock write as fast as possible.
|
* @pause: Pause the device and unblock write as fast as possible.
|
||||||
* For retro compatibility, the audio sink will fallback
|
* For retro compatibility, the audio sink will fallback
|
||||||
* to calling reset if this vmethod is not provided.
|
* to calling reset if this vmethod is not provided. Since: 1.18
|
||||||
* @resume: Resume the device.
|
* @resume: Resume the device. Since: 1.18
|
||||||
* @stop: Stop the device and unblock write as fast as possible.
|
* @stop: Stop the device and unblock write as fast as possible.
|
||||||
* Pending samples are flushed from the device.
|
* Pending samples are flushed from the device.
|
||||||
* For retro compatibility, the audio sink will fallback
|
* For retro compatibility, the audio sink will fallback
|
||||||
* to calling reset if this vmethod is not provided.
|
* to calling reset if this vmethod is not provided. Since: 1.18
|
||||||
* @clear-all: Clear the device.
|
* @extension: class extension structure. Since: 1.18
|
||||||
*/
|
*/
|
||||||
struct _GstAudioSinkClass {
|
struct _GstAudioSinkClass {
|
||||||
GstAudioBaseSinkClass parent_class;
|
GstAudioBaseSinkClass parent_class;
|
||||||
|
@ -109,11 +110,20 @@ struct _GstAudioSinkClass {
|
||||||
void (*resume) (GstAudioSink *sink);
|
void (*resume) (GstAudioSink *sink);
|
||||||
/* stop the audio device, unblock from a write */
|
/* stop the audio device, unblock from a write */
|
||||||
void (*stop) (GstAudioSink *sink);
|
void (*stop) (GstAudioSink *sink);
|
||||||
|
|
||||||
|
GstAudioSinkClassExtension *extension;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstAudioSinkClassExtension:
|
||||||
|
* @clear-all: Clear the device. Since: 1.18
|
||||||
|
*/
|
||||||
|
struct _GstAudioSinkClassExtension
|
||||||
|
{
|
||||||
/* clear the audio device */
|
/* clear the audio device */
|
||||||
void (*clear_all) (GstAudioSink *sink);
|
void (*clear_all) (GstAudioSink *sink);
|
||||||
|
|
||||||
/*< private >*/
|
/* no padding needed */
|
||||||
gpointer _gst_reserved[GST_PADDING - 4];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GST_AUDIO_API
|
GST_AUDIO_API
|
||||||
|
|
Loading…
Reference in a new issue