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
7e44142c
Commit
7e44142c
authored
May 07, 2014
by
Pierre-Eric Pelloux-Prayer
Browse files
Add MSX11Helper struct to ease X11 interaction
parent
a0350a26
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
137 additions
and
1 deletion
+137
-1
include/mediastreamer2/Makefile.am
include/mediastreamer2/Makefile.am
+2
-1
include/mediastreamer2/x11_helper.h
include/mediastreamer2/x11_helper.h
+41
-0
src/Makefile.am
src/Makefile.am
+1
-0
src/utils/x11_helper.c
src/utils/x11_helper.c
+93
-0
No files found.
include/mediastreamer2/Makefile.am
View file @
7e44142c
...
...
@@ -37,7 +37,8 @@ mediastreamer2_include_HEADERS= ice.h \
qualityindicator.h
\
msconference.h
\
videostarter.h
\
bits_rw.h
bits_rw.h
\
x11_helper.h
EXTRA_DIST
=
$(mediastreamer2_include_HEADERS)
include/mediastreamer2/x11_helper.h
0 → 100644
View file @
7e44142c
/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 2010 Belledonne Communications SARL
Author: Simon Morlat <simon.morlat@linphone.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#if !defined(_X11_HELPER_H_)
#define _X11_HELPER_H_
#include <X11/Xlib.h>
typedef
struct
_x11_helper
{
Display
*
display
;
Window
window
;
}
MSX11Helper
;
/* One time init */
int
ms_x11_helper_init
(
MSX11Helper
*
x11
);
int
ms_x11_helper_create_window
(
MSX11Helper
*
x11
,
int
width
,
int
height
);
int
ms_x11_helper_get_window_size
(
MSX11Helper
*
x11
,
int
*
width
,
int
*
height
);
int
ms_x11_helper_destroy_window
(
MSX11Helper
*
x11
);
int
ms_x11_helper_uninit
(
MSX11Helper
*
x11
);
#endif
src/Makefile.am
View file @
7e44142c
...
...
@@ -252,6 +252,7 @@ libmediastreamer_voip_la_SOURCES+= voip/rfc2429.h \
videofilters/mire.c
\
videofilters/extdisplay.c
\
utils/bits_rw.c
\
utils/x11_helper.c
\
voip/layouts.c voip/layouts.h
if
ORTP_ENABLED
...
...
src/utils/x11_helper.c
0 → 100644
View file @
7e44142c
/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 2010 Belledonne Communications SARL
Author: Simon Morlat <simon.morlat@linphone.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "mediastreamer2/x11_helper.h"
#include "mediastreamer2/mscommon.h"
#include <ortp/port.h>
int
ms_x11_helper_init
(
MSX11Helper
*
x11
)
{
const
char
*
display
;
display
=
getenv
(
"DISPLAY"
);
if
(
display
==
NULL
)
display
=
":0"
;
x11
->
display
=
XOpenDisplay
(
display
);
if
(
x11
->
display
==
NULL
)
{
ms_error
(
"Could not open display %s"
,
display
);
return
-
1
;
}
return
0
;
}
int
ms_x11_helper_create_window
(
MSX11Helper
*
x11
,
int
width
,
int
height
)
{
XSetWindowAttributes
wa
;
memset
(
&
wa
,
0
,
sizeof
(
wa
));
wa
.
event_mask
=
StructureNotifyMask
;
x11
->
window
=
XCreateWindow
(
x11
->
display
,
DefaultRootWindow
(
x11
->
display
),
200
,
200
,
width
,
height
,
0
,
CopyFromParent
,
CopyFromParent
,
CopyFromParent
,
CWEventMask
|
CWBackPixel
,
&
wa
);
if
(
x11
->
window
==
0
){
ms_error
(
"Could not create X11 window."
);
return
-
1
;
}
XMapWindow
(
x11
->
display
,
x11
->
window
);
XClearWindow
(
x11
->
display
,
x11
->
window
);
XCreateGC
(
x11
->
display
,
x11
->
window
,
0
,
NULL
);
return
0
;
}
int
ms_x11_helper_get_window_size
(
MSX11Helper
*
x11
,
int
*
width
,
int
*
height
)
{
XWindowAttributes
wa
;
XGetWindowAttributes
(
x11
->
display
,
x11
->
window
,
&
wa
);
*
width
=
wa
.
width
;
*
height
=
wa
.
height
;
return
0
;
}
int
ms_x11_helper_destroy_window
(
MSX11Helper
*
x11
)
{
XDestroyWindow
(
x11
->
display
,
x11
->
window
);
return
0
;
}
int
ms_x11_helper_uninit
(
MSX11Helper
*
x11
)
{
if
(
x11
->
display
)
{
XCloseDisplay
(
x11
->
display
);
x11
->
display
=
NULL
;
}
return
0
;
}
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