Commit 52806d2c authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Added new way to access device's informations

parent 91cf8873
......@@ -31,6 +31,7 @@
#define DEVICE_HAS_CRAPPY_ANDROID_FASTTRACK (1<<4) /*set when the AUDIO_OUTPUT_FLAG_FAST flag of android AudioTrack doesn't work*/
#define DEVICE_HAS_CRAPPY_ANDROID_FASTRECORD (1<<5) /*set when the AUDIO_INPUT_FLAG_FAST flag of android AudioRecord doesn't work*/
#define DEVICE_HAS_UNSTANDARD_LIBMEDIA (1<<6) /*set when the libmedia backend shall not be used because of proprietary modifications made into it by the manufacturer*/
#define DEVICE_HAS_CRAPPY_OPENGL (1<<7) /*set when the opengl is crappy and our opengl surfaceview will crash */
struct SoundDeviceAudioHacks {
const char *equalizer;
......@@ -51,6 +52,11 @@ struct SoundDeviceDescription{
typedef struct SoundDeviceDescription SoundDeviceDescription;
struct MSDevicesInfo {
MSList *sound_devices_descriptions;
};
typedef struct MSDevicesInfo MSDevicesInfo;
#ifdef __cplusplus
extern "C"{
......@@ -61,6 +67,16 @@ SoundDeviceDescription * sound_device_description_get(void);
extern SoundDeviceDescription genericSoundDeviceDescriptor;
MSDevicesInfo *ms_devices_info_new(void);
void ms_devices_info_free(MSDevicesInfo *devices_info);
MS2_PUBLIC void ms_devices_info_add(MSDevicesInfo *devices_info, const char *manufacturer, const char *model, const char *platform, unsigned int flags, int delay, int recommended_rate);
MS2_PUBLIC SoundDeviceDescription* ms_devices_info_lookup_device(MSDevicesInfo *devices_info, const char *manufacturer, const char* model, const char *platform);
MS2_PUBLIC SoundDeviceDescription* ms_devices_info_get_sound_device_description(MSDevicesInfo *devices_info);
#ifdef __cplusplus
}
#endif
......
......@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mediastreamer2/msfilter.h"
#include "mediastreamer2/devices.h"
/*do not use these fields directly*/
struct _MSFactory{
......@@ -45,6 +45,7 @@ struct _MSFactory{
void (*voip_uninit_func)(struct _MSFactory*);
bool_t statistics_enabled;
bool_t voip_initd;
MSDevicesInfo *devices_info;
};
typedef struct _MSFactory MSFactory;
......@@ -372,6 +373,8 @@ MS2_PUBLIC MSOfferAnswerProvider * ms_factory_get_offer_answer_provider(MSFactor
**/
MS2_PUBLIC MSOfferAnswerContext * ms_factory_create_offer_answer_context(MSFactory *f, const char *mime_type);
MS2_PUBLIC MSDevicesInfo* ms_factory_get_devices_info(MSFactory *f);
#ifdef __cplusplus
}
#endif
......
This diff is collapsed.
......@@ -862,6 +862,10 @@ MSOfferAnswerContext * ms_factory_create_offer_answer_context(MSFactory *f, cons
return NULL;
}
MSDevicesInfo* ms_factory_get_devices_info(MSFactory *f) {
return f->devices_info;
}
#ifdef ANDROID
#include "sys/system_properties.h"
#include <jni.h>
......
......@@ -305,14 +305,18 @@ void ms_factory_init_voip(MSFactory *obj){
}
#endif
obj->devices_info = ms_devices_info_new();
#if defined(ANDROID) && defined (VIDEO_ENABLED)
if (1) {
libmsandroidopengldisplay_init(obj);
} else {
if (!libmsandroiddisplay_init(obj)) {
libmsandroiddisplaybad_init(obj);
{
MSDevicesInfo *devices = ms_factory_get_devices_info(obj);
SoundDeviceDescription *description = ms_devices_info_get_sound_device_description(devices);
if (description && description->flags & DEVICE_HAS_CRAPPY_OPENGL) {
if (!libmsandroiddisplay_init(obj)) {
libmsandroiddisplaybad_init(obj);
}
} else {
libmsandroidopengldisplay_init(obj);
}
}
#endif
......@@ -331,6 +335,7 @@ void ms_factory_uninit_voip(MSFactory *obj){
ms_video_presets_manager_destroy(obj->video_presets_manager);
#endif
ms_srtp_shutdown();
if (obj->devices_info) ms_devices_info_free(obj->devices_info);
obj->voip_initd = FALSE;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment