Commit cdaff87a authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Renamed Android's openGL display filter to be able to choose which one to use

parent 65946f22
......@@ -164,6 +164,11 @@ public class AndroidVideoWindowImpl {
Log.e("View class does not match Video display filter used (you must use a non-GL View)");
return mVideoRenderingView.getHolder().getSurface();
}
public SurfaceView getPreviewSurfaceView(){
if (useGLrendering)
Log.e("View class does not match Video display filter used (you must use a non-GL View)");
return mVideoPreviewView;
}
public Bitmap getBitmap(){
if (useGLrendering)
Log.e( "View class does not match Video display filter used (you must use a non-GL View)");
......
......@@ -22,6 +22,7 @@ import java.util.List;
import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version;
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration.AndroidCamera;
......@@ -121,10 +122,16 @@ public class AndroidVideoApi5JniWrapper {
public static void setPreviewDisplaySurface(Object cam, Object surf) {
Log.d("mediastreamer", "setPreviewDisplaySurface(" + cam + ", " + surf + ")");
Camera camera = (Camera) cam;
SurfaceView surface = (SurfaceView) surf;
try {
camera.setPreviewDisplay(surface.getHolder());
if (surf instanceof SurfaceView) {
SurfaceView surface = (SurfaceView) surf;
camera.setPreviewDisplay(surface.getHolder());
} else {
AndroidVideoWindowImpl avw = (AndroidVideoWindowImpl) surf;
camera.setPreviewDisplay(avw.getPreviewSurfaceView().getHolder());
}
} catch (Exception exc) {
Log.e(exc);
exc.printStackTrace();
}
}
......
......@@ -157,7 +157,8 @@ static void android_display_process(MSFilter *f){
ms_filter_unlock(f);
ms_queue_flush(f->inputs[0]);
ms_queue_flush(f->inputs[1]);
if (f->inputs[1] != NULL)
ms_queue_flush(f->inputs[1]);
}
static int android_display_set_window(MSFilter *f, void *arg){
......
......@@ -163,7 +163,7 @@ static MSFilterMethod methods[]={
MSFilterDesc ms_android_opengl_display_desc={
.id=MS_ANDROID_DISPLAY_ID,
.name="MSAndroidDisplay",
.name="MSAndroidOpenGLDisplay",
.text="OpenGL-ES2 video display filter for Android.",
.category=MS_FILTER_OTHER,
.ninputs=2, /*number of inputs*/
......
......@@ -310,15 +310,10 @@ void ms_factory_init_voip(MSFactory *obj){
#if defined(__ANDROID__) && defined (VIDEO_ENABLED)
{
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);
if (!libmsandroiddisplay_init(obj)) {
libmsandroiddisplaybad_init(obj);
}
libmsandroidopengldisplay_init(obj);
}
#endif
obj->voip_initd=TRUE;
......
......@@ -245,7 +245,7 @@ const char *video_stream_get_default_video_renderer(void){
#elif defined(MS2_WINDOWS_DESKTOP)
return "MSDrawDibDisplay";
#elif defined(__ANDROID__)
return "MSAndroidDisplay";
return "MSAndroidOpenGLDisplay";
#elif __APPLE__ && !TARGET_OS_IPHONE
return "MSOSXGLDisplay";
#elif defined (HAVE_XV)
......@@ -262,7 +262,16 @@ const char *video_stream_get_default_video_renderer(void){
}
static void choose_display_name(VideoStream *stream){
stream->display_name=ms_strdup(video_stream_get_default_video_renderer());
#if defined(__ANDROID__)
MSDevicesInfo *devices = ms_factory_get_devices_info(ms_factory_get_fallback());
SoundDeviceDescription *description = ms_devices_info_get_sound_device_description(devices);
if (description->flags & DEVICE_HAS_CRAPPY_OPENGL)
stream->display_name = ms_strdup("MSAndroidDisplay");
else
stream->display_name = ms_strdup(video_stream_get_default_video_renderer());
#else
stream->display_name = ms_strdup(video_stream_get_default_video_renderer());
#endif
}
static float video_stream_get_rtcp_xr_average_quality_rating(void *userdata) {
......@@ -423,7 +432,6 @@ void video_stream_set_display_filter_name(VideoStream *s, const char *fname){
s->display_name=ms_strdup(fname);
}
static void ext_display_cb(void *ud, MSFilter* f, unsigned int event, void *eventdata){
MSExtDisplayOutput *output=(MSExtDisplayOutput*)eventdata;
VideoStream *st=(VideoStream*)ud;
......
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