Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
mediastreamer2
Commits
dc277cd9
Commit
dc277cd9
authored
Mar 22, 2013
by
Simon Morlat
Browse files
improve glx display filter for linux.
Make it the default choice.
parent
5c71ff21
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
18 deletions
+65
-18
acinclude.m4
acinclude.m4
+15
-11
configure.ac
configure.ac
+1
-1
src/videofilters/glxvideo.c
src/videofilters/glxvideo.c
+49
-6
No files found.
acinclude.m4
View file @
dc277cd9
...
...
@@ -122,6 +122,7 @@ AC_DEFUN([MS_CHECK_VIDEO],[
dnl we use quartz+opengl directly on mac os for video display.
enable_sdl_default=false
enable_x11_default=false
enable_glx_default=false
OBJCFLAGS="$OBJCFLAGS -framework QTKit"
LIBS="$LIBS -framework QTKit -framework CoreVideo "
dnl the following check is necessary but due to automake bug it forces every platform to have an objC compiler !
...
...
@@ -131,12 +132,15 @@ AC_DEFUN([MS_CHECK_VIDEO],[
elif test "$ios_found" = "yes" ; then
enable_sdl_default=false
enable_x11_default=false
enable_glx_default=false
elif test "$ms_check_dep_mingw_found" = "yes" ; then
enable_sdl_default=false
enable_x11_default=false
enable_glx_default=false
else
enable_sdl_default=false
enable_x11_default=true
enable_glx_default=true
fi
AC_ARG_ENABLE(sdl,
...
...
@@ -183,20 +187,20 @@ AC_DEFUN([MS_CHECK_VIDEO],[
AC_MSG_ERROR([No X video output API found. Please install X11+Xv headers.])
fi
fi
AC_ARG_ENABLE(gl,
[AS_HELP_STRING([--enable-gl], [Enable GL rendering support (require glx and glew)])],
AC_ARG_ENABLE(gl
x
,
[AS_HELP_STRING([--enable-gl
x
], [Enable
X11+Open
GL rendering support (require
s
glx and glew)])],
[case "${enableval}" in
yes) enable_gl=true ;;
no) enable_gl=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-gl) ;;
esac],[enable_gl
=false
])
yes) enable_gl
x
=true ;;
no) enable_gl
x
=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-gl
x
) ;;
esac],[enable_gl
x=$enable_glx_default
])
if test "$enable_gl" = "true"; then
AC_CHECK_HEADERS(GL/gl.h,[] ,[enable_gl=false])
AC_CHECK_HEADERS(GL/glx.h,[] ,[enable_gl=false],[
if test "$enable_gl
x
" = "true"; then
AC_CHECK_HEADERS(GL/gl.h,[] ,[enable_gl
x
=false])
AC_CHECK_HEADERS(GL/glx.h,[] ,[enable_gl
x
=false],[
#include <GL/glx.h>
])
if test "$enable_gl" = "false" ; then
if test "$enable_gl
x
" = "false" ; then
AC_MSG_ERROR([No GL/GLX API found. Please install GL and GLX headers.])
fi
PKG_CHECK_MODULES(GLEW,[glew >= 1.6])
...
...
@@ -260,7 +264,7 @@ AC_DEFUN([MS_CHECK_VIDEO],[
if test "$ios_found" = "yes" ; then
LIBS="$LIBS -framework AVFoundation -framework CoreVideo -framework CoreMedia"
fi
if test "$enable_gl" = "true"; then
if test "$enable_gl
x
" = "true"; then
VIDEO_LIBS="$VIDEO_LIBS -lGL -lGLEW"
VIDEO_CFLAGS="$VIDEO_CFLAGS -DHAVE_GL"
fi
...
...
configure.ac
View file @
dc277cd9
...
...
@@ -605,7 +605,7 @@ AM_CONDITIONAL(BUILD_WIN32_WCE, test "$mingw32ce_found" = "yes")
AM_CONDITIONAL(BUILD_FFMPEG, test "$ffmpeg" = "true")
AM_CONDITIONAL(BUILD_SDL,test "$sdl_found" = "true" )
AM_CONDITIONAL(BUILD_X11_XV, test "$enable_xv" = "true" )
AM_CONDITIONAL(BUILD_X11_GL, test "$enable_gl" = "true" )
AM_CONDITIONAL(BUILD_X11_GL, test "$enable_gl
x
" = "true" )
AM_CONDITIONAL(BUILD_UPNP, test "$build_upnp" = "true" )
dnl *********************************************
...
...
src/videofilters/glxvideo.c
View file @
dc277cd9
...
...
@@ -51,6 +51,8 @@ typedef struct GLXVideo
bool_t
show
;
bool_t
own_window
;
bool_t
ready
;
bool_t
mirror
;
bool_t
autofit
;
}
GLXVideo
;
...
...
@@ -78,6 +80,7 @@ static void glxvideo_init(MSFilter *f){
obj
->
vsize
=
def_size
;
/* the size of the main video*/
obj
->
wsize
=
def_size
;
/* the size of the window*/
obj
->
show
=
TRUE
;
obj
->
autofit
=
TRUE
;
f
->
data
=
obj
;
}
...
...
@@ -155,6 +158,7 @@ static void glxvideo_process(MSFilter *f){
GLXVideo
*
obj
=
(
GLXVideo
*
)
f
->
data
;
mblk_t
*
inm
;
MSPicture
src
=
{
0
};
bool_t
precious
=
FALSE
;
XWindowAttributes
wa
;
XGetWindowAttributes
(
obj
->
display
,
obj
->
window_id
,
&
wa
);
...
...
@@ -177,12 +181,37 @@ static void glxvideo_process(MSFilter *f){
glXMakeCurrent
(
obj
->
display
,
obj
->
window_id
,
obj
->
glContext
);
if
(
f
->
inputs
[
0
]
!=
NULL
&&
(
inm
=
ms_queue_peek_last
(
f
->
inputs
[
0
]))
!=
0
)
{
if
(
ms_yuv_buf_init_from_mblk
(
&
src
,
inm
)
==
0
){
ogl_display_set_yuv_to_display
(
obj
->
glhelper
,
inm
);
MSVideoSize
newsize
;
newsize
.
width
=
src
.
w
;
newsize
.
height
=
src
.
h
;
precious
=
mblk_get_precious_flag
(
inm
);
if
(
!
ms_video_size_equal
(
newsize
,
obj
->
vsize
)
)
{
ms_message
(
"received size is %ix%i"
,
newsize
.
width
,
newsize
.
height
);
obj
->
vsize
=
newsize
;
if
(
obj
->
autofit
){
MSVideoSize
new_window_size
;
static
const
MSVideoSize
min_size
=
MS_VIDEO_SIZE_QVGA
;
/*don't resize less than QVGA, it is too small*/
if
(
min_size
.
width
*
min_size
.
height
>
newsize
.
width
*
newsize
.
height
){
new_window_size
.
width
=
newsize
.
width
*
2
;
new_window_size
.
height
=
newsize
.
height
*
2
;
}
else
new_window_size
=
newsize
;
obj
->
wsize
=
new_window_size
;
ms_message
(
"autofit: new window size should be %ix%i"
,
new_window_size
.
width
,
new_window_size
.
height
);
XResizeWindow
(
obj
->
display
,
obj
->
window_id
,
new_window_size
.
width
,
new_window_size
.
height
);
XSync
(
obj
->
display
,
FALSE
);
}
glxvideo_unprepare
(
f
);
glxvideo_prepare
(
f
);
if
(
!
obj
->
ready
)
goto
end
;
}
if
(
obj
->
mirror
&&
!
precious
)
ms_yuv_buf_mirror
(
&
src
);
ogl_display_set_yuv_to_display
(
obj
->
glhelper
,
inm
);
}
}
if
(
f
->
inputs
[
1
]
!=
NULL
&&
(
inm
=
ms_queue_peek_last
(
f
->
inputs
[
1
]))
!=
0
)
{
if
(
ms_yuv_buf_init_from_mblk
(
&
src
,
inm
)
==
0
){
ogl_display_set_preview_yuv_to_display
(
obj
->
glhelper
,
inm
);
ogl_display_set_preview_yuv_to_display
(
obj
->
glhelper
,
inm
);
}
}
ogl_display_render
(
obj
->
glhelper
,
0
);
...
...
@@ -343,12 +372,26 @@ static bool_t createX11GLWindow(Display* display, MSVideoSize size, GLXContext*
return
TRUE
;
}
static
int
glxvideo_enable_mirroring
(
MSFilter
*
f
,
void
*
arg
){
GLXVideo
*
s
=
(
GLXVideo
*
)
f
->
data
;
s
->
mirror
=
(
bool_t
)
*
(
int
*
)
arg
;
return
0
;
}
static
int
glxvideo_enable_autofit
(
MSFilter
*
f
,
void
*
arg
){
GLXVideo
*
s
=
(
GLXVideo
*
)
f
->
data
;
s
->
autofit
=
(
bool_t
)
*
(
int
*
)
arg
;
return
0
;
}
static
MSFilterMethod
methods
[]
=
{
{
MS_FILTER_SET_VIDEO_SIZE
,
glxvideo_set_vsize
},
{
MS_VIDEO_DISPLAY_GET_NATIVE_WINDOW_ID
,
glxvideo_get_native_window_id
},
{
MS_FILTER_SET_VIDEO_SIZE
,
glxvideo_set_vsize
},
{
MS_VIDEO_DISPLAY_GET_NATIVE_WINDOW_ID
,
glxvideo_get_native_window_id
},
{
MS_VIDEO_DISPLAY_SET_NATIVE_WINDOW_ID
,
glxvideo_set_native_window_id
},
{
MS_VIDEO_DISPLAY_SHOW_VIDEO
,
glxvideo_show_video
},
{
MS_VIDEO_DISPLAY_ZOOM
,
glxvideo_zoom
},
{
MS_VIDEO_DISPLAY_SHOW_VIDEO
,
glxvideo_show_video
},
{
MS_VIDEO_DISPLAY_ZOOM
,
glxvideo_zoom
},
{
MS_VIDEO_DISPLAY_ENABLE_MIRRORING
,
glxvideo_enable_mirroring
},
{
MS_VIDEO_DISPLAY_ENABLE_AUTOFIT
,
glxvideo_enable_autofit
},
{
0
,
NULL
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment