#include <mm_types.h>
#include <mm_message.h>
-
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
-#include "mm_radio_sound_focus.h"
-#endif
+#include <media/mm_resource_manager.h>
#include "mm_radio.h"
#include "mm_radio_utils.h"
#include <gst/gst.h>
#include <gst/gstbuffer.h>
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
MM_RADIO_FREQ_NONE = 0,
/* min band types */
- MM_RADIO_FREQ_MIN_76100_KHZ = 76100,
- MM_RADIO_FREQ_MIN_87500_KHZ = 87500,
- MM_RADIO_FREQ_MIN_88100_KHZ = 88100,
+ MM_RADIO_FREQ_MIN_76100_KHZ = 76100,
+ MM_RADIO_FREQ_MIN_87500_KHZ = 87500,
+ MM_RADIO_FREQ_MIN_88100_KHZ = 88100,
/* max band types */
MM_RADIO_FREQ_MAX_89900_KHZ = 89900,
MM_RADIO_FREQ_MAX_108000_KHZ = 108000,
int channel_spacing; // TBD
} MMRadioRegion_t;
+typedef struct {
+ pthread_t thread;
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ int thread_id;
+ bool is_running;
+ bool stop;
+ bool thread_exit;
+} MMRadioThread_t;
+
+typedef enum {
+ MM_RADIO_MSG_DESTROY = 0,
+ MM_RADIO_MSG_SCAN_INFO,
+ MM_RADIO_MSG_SCAN_STOPPED,
+ MM_RADIO_MSG_SCAN_FINISHED,
+ MM_RADIO_MSG_SEEK_FINISHED,
+ MM_RADIO_MSG_STATE_INTERRUPTED,
+ MM_RADIO_MSG_NUM
+} MMRadioMsgTypes;
+
+typedef struct {
+ bool destroy;
+ MMRadioMsgTypes msg_type;
+ int data;
+} mm_radio_msg_t;
+
+typedef enum {
+ MM_RADIO_THREAD_MSG = 0,
+ MM_RADIO_THREAD_SEEK,
+ MM_RADIO_THREAD_SCAN,
+ MM_RADIO_THREAD_NUM
+} MMRadioThreadTypes;
+
/*---------------------------------------------------------------------------
GLOBAL DATA TYPE DEFINITIONS:
---------------------------------------------------------------------------*/
GstElement *pipeline;
GstElement *audiosrc;
GstElement *queue2;
- GstElement *volume;
GstElement *audiosink;
GstBuffer *output_buffer;
} mm_radio_gstreamer_s;
/* radio attributes */
MMHandleType* attrs;
+ MMRadioThread_t thread[MM_RADIO_THREAD_NUM];
+
/* message callback */
+ GAsyncQueue *msg_queue;
MMMessageCallback msg_cb;
void* msg_cb_param;
/* hw debug */
struct v4l2_dbg_register reg;
- /* scan */
- pthread_t scan_thread;
- bool stop_scan;
-
/* seek */
- pthread_t seek_thread;
int prev_seek_freq;
MMRadioSeekDirectionType seek_direction;
-#ifdef TIZEN_FEATURE_SOUND_FOCUS
- mm_radio_sound_focus sound_focus;
-#endif
-
int freq;
#ifdef USE_GST_PIPELINE
mm_radio_gstreamer_s* pGstreamer_s;
#endif
- unsigned int subs_id;
+ mm_resource_manager_h resource_manager;
+ mm_resource_manager_res_h radio_resource;
+ int interrupted_by_resource_conflict;
+
float local_volume;
/* region settings */
int _mmradio_stop_scan(mm_radio_t *radio);
int _mm_radio_get_signal_strength(mm_radio_t *radio, int *strength);
#ifdef USE_GST_PIPELINE
-int _mmradio_realize_pipeline( mm_radio_t *radio);
+int _mmradio_realize_pipeline(mm_radio_t *radio);
int _mmradio_start_pipeline(mm_radio_t *radio);
-int _mmradio_stop_pipeline( mm_radio_t *radio);
+int _mmradio_stop_pipeline(mm_radio_t *radio);
int _mmradio_destroy_pipeline(mm_radio_t *radio);
#endif
int _mmradio_apply_region(mm_radio_t *radio, MMRadioRegionType region, bool update);