1 /* 2 * Copyright (C) 2019 Collabora Ltd. 3 * Author: Xavier Claessens <xavier.claessens@collabora.com> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation 8 * version 2.1 of the License. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 * 19 */ 20 21 #pragma once 22 23 #include <gst/gst.h> 24 #include <gst/audio/gstaudiosink.h> 25 26 #include <ml_audio.h> 27 28 G_BEGIN_DECLS 29 30 typedef struct _GstMLAudioWrapper GstMLAudioWrapper; 31 32 GstMLAudioWrapper * gst_ml_audio_wrapper_new (gpointer app); 33 void gst_ml_audio_wrapper_free (GstMLAudioWrapper *self); 34 35 MLResult gst_ml_audio_wrapper_create_sound (GstMLAudioWrapper *self, 36 const MLAudioBufferFormat *format, 37 uint32_t buffer_size, 38 MLAudioBufferCallback callback, 39 gpointer user_data); 40 MLResult gst_ml_audio_wrapper_pause_sound (GstMLAudioWrapper *self); 41 MLResult gst_ml_audio_wrapper_resume_sound (GstMLAudioWrapper *self); 42 MLResult gst_ml_audio_wrapper_stop_sound (GstMLAudioWrapper *self); 43 MLResult gst_ml_audio_wrapper_get_latency (GstMLAudioWrapper *self, 44 float *out_latency_in_msec); 45 MLResult gst_ml_audio_wrapper_get_buffer (GstMLAudioWrapper *self, 46 MLAudioBuffer *out_buffer); 47 MLResult gst_ml_audio_wrapper_release_buffer (GstMLAudioWrapper *self); 48 49 void gst_ml_audio_wrapper_set_handle (GstMLAudioWrapper *self, MLHandle handle); 50 void gst_ml_audio_wrapper_set_node (GstMLAudioWrapper *self, gpointer 51 audio_node); 52 53 typedef gboolean (*GstMLAudioWrapperCallback) (GstMLAudioWrapper *self, 54 gpointer user_data); 55 gboolean gst_ml_audio_wrapper_invoke_sync (GstMLAudioWrapper *self, 56 GstMLAudioWrapperCallback callback, gpointer user_data); 57 58 G_END_DECLS 59