Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8232589: Remove CoreAudio Utility Classes
Reviewed-by: kcr, jvos
  • Loading branch information
Alexander Matveev committed Jan 7, 2020
1 parent df8b3c5 commit c9519b6
Show file tree
Hide file tree
Showing 64 changed files with 599 additions and 14,323 deletions.
Expand Up @@ -158,6 +158,21 @@ static GstFlowReturn gst_spectrum_transform_ip (GstBaseTransform * trans,
static gboolean gst_spectrum_setup (GstAudioFilter * base,
const GstAudioInfo * info);

#if defined (GSTREAMER_LITE) && defined (OSX)
gboolean gst_spectrum_setup_api (GstAudioFilter * base, const GstAudioInfo * info,
guint bps_user, guint bpf_user) {
GstSpectrum *spectrum = GST_SPECTRUM (base);
spectrum->bps_user = bps_user;
spectrum->bpf_user = bpf_user;
return gst_spectrum_setup(base, info);
}

GstFlowReturn
gst_spectrum_transform_ip_api (GstBaseTransform * trans, GstBuffer * buffer) {
return gst_spectrum_transform_ip(trans, buffer);
}
#endif // GSTREAMER_LITE and OSX

static void
gst_spectrum_class_init (GstSpectrumClass * klass)
{
Expand Down Expand Up @@ -251,6 +266,12 @@ gst_spectrum_init (GstSpectrum * spectrum)
spectrum->bands = DEFAULT_BANDS;
spectrum->threshold = DEFAULT_THRESHOLD;

#if defined (GSTREAMER_LITE) && defined (OSX)
spectrum->bps_user = 0;
spectrum->bpf_user = 0;
spectrum->user_data = NULL;
#endif // GSTREAMER_LITE and OSX

g_mutex_init (&spectrum->lock);
}

Expand Down Expand Up @@ -714,10 +735,24 @@ gst_spectrum_message_new (GstSpectrum * spectrum, GstClockTime timestamp,

GST_DEBUG_OBJECT (spectrum, "preparing message, bands =%d ", spectrum->bands);

#if defined (GSTREAMER_LITE) && defined (OSX)
// When running spectrum directly we cannot figure out time stamps, since we do not
// have full pipeline. Caller will be responsible to handle time stamps.
if (spectrum->user_data != NULL) {
running_time = 0;
stream_time = 0;
} else {
running_time = gst_segment_to_running_time (&trans->segment, GST_FORMAT_TIME,
timestamp);
stream_time = gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME,
timestamp);
}
#else // GSTREAMER_LITE and OSX
running_time = gst_segment_to_running_time (&trans->segment, GST_FORMAT_TIME,
timestamp);
stream_time = gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME,
timestamp);
#endif // GSTREAMER_LITE and OSX
/* endtime is for backwards compatibility */
endtime = stream_time + duration;

Expand Down Expand Up @@ -877,6 +912,12 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * buffer)
channels = GST_AUDIO_FILTER_CHANNELS (spectrum);
bps = GST_AUDIO_FILTER_BPS (spectrum);
bpf = GST_AUDIO_FILTER_BPF (spectrum);
#ifdef OSX
if (spectrum->bps_user != 0 && spectrum->bpf_user != 0) {
bps = spectrum->bps_user;
bpf = spectrum->bpf_user;
}
#endif // OSX
output_channels = spectrum->multi_channel ? channels : 1;
max_value = (1UL << ((bps << 3) - 1)) - 1;
bands = spectrum->bands;
Expand Down
Expand Up @@ -81,6 +81,12 @@ struct _GstSpectrum
GMutex lock;

GstSpectrumInputData input_data;

#if defined (GSTREAMER_LITE) && defined (OSX)
guint bps_user; // User provided values to avoid more complex spectrum initialization
guint bpf_user;
void *user_data;
#endif // GSTREAMER_LITE and OSX
};

struct _GstSpectrumClass
Expand All @@ -90,6 +96,14 @@ struct _GstSpectrumClass

GType gst_spectrum_get_type (void);

#if defined (GSTREAMER_LITE) && defined (OSX)
GST_EXPORT gboolean gst_spectrum_setup_api (GstAudioFilter * base,
const GstAudioInfo * info, guint bps_user, guint bpf_user);

GST_EXPORT GstFlowReturn
gst_spectrum_transform_ip_api (GstBaseTransform * trans, GstBuffer * buffer);
#endif // GSTREAMER_LITE and OSX

G_END_DECLS

#endif /* __GST_SPECTRUM_H__ */

0 comments on commit c9519b6

Please sign in to comment.