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
5db6533a
Commit
5db6533a
authored
Oct 08, 2010
by
Simon Morlat
Browse files
Merge branch 'master' of
git://git.linphone.org/mediastreamer2
Conflicts: src/layouts.c
parents
43c7c54a
ab14e9c7
Changes
31
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
333 additions
and
285 deletions
+333
-285
acinclude.m4
acinclude.m4
+12
-10
build/android/Android.mk
build/android/Android.mk
+21
-35
build/android/alldescs.h
build/android/alldescs.h
+16
-0
build/android/libmediastreamer2_AndroidConfig.h
build/android/libmediastreamer2_AndroidConfig.h
+2
-2
configure.ac
configure.ac
+5
-3
include/mediastreamer2/Makefile.am
include/mediastreamer2/Makefile.am
+2
-1
include/mediastreamer2/allfilters.h
include/mediastreamer2/allfilters.h
+3
-1
include/mediastreamer2/mediastream.h
include/mediastreamer2/mediastream.h
+3
-1
include/mediastreamer2/msinterfaces.h
include/mediastreamer2/msinterfaces.h
+1
-9
include/mediastreamer2/msjpegwriter.h
include/mediastreamer2/msjpegwriter.h
+27
-0
include/mediastreamer2/msvideo.h
include/mediastreamer2/msvideo.h
+5
-4
include/mediastreamer2/msvideoout.h
include/mediastreamer2/msvideoout.h
+0
-84
include/mediastreamer2/mswebcam.h
include/mediastreamer2/mswebcam.h
+4
-0
src/Makefile.am
src/Makefile.am
+12
-3
src/drawdib-display.c
src/drawdib-display.c
+2
-129
src/extdisplay.c
src/extdisplay.c
+2
-2
src/h264dec.c
src/h264dec.c
+1
-1
src/jpegwriter.c
src/jpegwriter.c
+175
-0
src/layouts.c
src/layouts.c
+4
-0
src/layouts.h
src/layouts.h
+36
-0
No files found.
acinclude.m4
View file @
5db6533a
...
...
@@ -128,11 +128,7 @@ AC_DEFUN([MS_CHECK_VIDEO],[
sdl_found=no
if test "$enable_sdl" = "true"; then
PKG_CHECK_MODULES(SDL, [sdl >= 1.2.0 ],sdl_found=yes,sdl_found=no)
if test "$sdl_found" = "no" && test "$mingw_found" != "yes"; then
AC_MSG_ERROR([Could not find libsdl headers and library. This is mandatory for video support])
fi
PKG_CHECK_MODULES(SDL, [sdl >= 1.2.0 ],sdl_found=true,sdl_found=false)
fi
AC_ARG_ENABLE(x11,
...
...
@@ -148,17 +144,23 @@ AC_DEFUN([MS_CHECK_VIDEO],[
fi
AC_ARG_ENABLE(xv,
[ --enable-xv Enable xv support
- experimenta
l],
[ --enable-xv Enable xv supportl],
[case "${enableval}" in
yes) enable_xv=true ;;
no) enable_xv=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-xv) ;;
esac],[enable_xv=
fals
e])
esac],[enable_xv=
tru
e])
if test "$enable_xv" = "true"; then
AC_CHECK_HEADERS(X11/extensions/Xv.h)
AC_CHECK_HEADERS(X11/extensions/Xv.h
,[] ,[enable_xv=false]
)
AC_CHECK_LIB(Xv,XvCreateImage,[LIBS="$LIBS -lXv"])
fi
fi
fi
if ! test "$mingw_found" = "yes" ; then
if test "$enable_xv$sdl_found" == "nono" ; then
AC_MSG_ERROR([No video output API found. Install either X11+Xv headers or SDL library.])
fi
fi
AC_ARG_ENABLE(theora,
...
...
@@ -181,7 +183,7 @@ AC_DEFUN([MS_CHECK_VIDEO],[
VIDEO_CFLAGS=" $FFMPEG_CFLAGS -DVIDEO_ENABLED"
VIDEO_LIBS=" $FFMPEG_LIBS $SWSCALE_LIBS"
if test "$sdl_found" = "
yes
" ; then
if test "$sdl_found" = "
true
" ; then
VIDEO_CFLAGS="$VIDEO_CFLAGS $SDL_CFLAGS -DHAVE_SDL"
VIDEO_LIBS="$VIDEO_LIBS $SDL_LIBS"
fi
...
...
build/android/Android.mk
View file @
5db6533a
...
...
@@ -81,31 +81,23 @@ endif
##if BUILD_MACAQSND
#LOCAL_SRC_FILES += aqsnd.c
##if BUILD_VIDEO
#
##if BUILD_MACOSX
#LOCAL_SRC_FILES += msv4m.c
#
## else (Linux)
#LOCAL_SRC_FILES += \
# msv4l.c \
# msv4l2.c
#
ifeq
($(LINPHONE_VIDEO),1)
#LOCAL_SRC_FILES += \
# videoenc.c \
# videodec.c \
# pixconv.c \
# sizeconv.c \
# rfc2429.h \
# nowebcam.c \
# nowebcam.h \
# videoout.c \
# msvideo.c \
# rfc3984.c \
# mire.c \
# swscale.h \
# ffmpeg-priv.h
LOCAL_CFLAGS
+=
-DVIDEO_ENABLED
LOCAL_SRC_FILES
+=
\
videoenc.c
\
videodec.c
\
pixconv.c
\
sizeconv.c
\
nowebcam.c
\
msvideo.c
\
h264dec.c
\
rfc3984.c
\
mire.c
\
videostream.c
endif
#LOCAL_SRC_FILES += videostream.c
#
...
...
@@ -125,10 +117,6 @@ LOCAL_CFLAGS += \
-include
$(LOCAL_PATH)
/../build/android/libmediastreamer2_AndroidConfig.h
\
-D_POSIX_SOURCE
ifeq
($(TARGET_ARCH),arm)
#this is for ffmpeg
LOCAL_CFLAGS
+=
-DANDROID_CONFIG_X86
=
1
endif
#LOCAL_CFLAGS += -DDEBUG
...
...
@@ -140,22 +128,20 @@ LOCAL_C_INCLUDES += \
$(LOCAL_PATH)
/../../../externals/speex/include
\
$(LOCAL_PATH)
/../../../externals/build/speex
\
$(LOCAL_PATH)
/../../../externals/gsm/inc
\
$(LOCAL_PATH)
/../../../externals/ffmpeg
$(LOCAL_PATH)
/../../../externals/ffmpeg
\
$(LOCAL_PATH)
/../../../externals/
\
$(LOCAL_PATH)
/../../../externals/build/ffmpeg
LOCAL_STATIC_LIBRARIES
:=
\
libortp
\
libspeex
\
libspeex
ifeq
($(strip $(BOARD_USES_ALSA_AUDIO)),true)
LOCAL_SHARED_LIBRARIES
+=
libasound
endif
#LOCAL_SHARED_LIBRARIES += libavcodec \
# libswscale \
# libavutil
include
$(BUILD_STATIC_LIBRARY)
build/android/alldescs.h
View file @
5db6533a
...
...
@@ -25,6 +25,13 @@ extern MSFilterDesc aq_write_desc;
extern
MSFilterDesc
ms_equalizer_desc
;
extern
MSFilterDesc
ms_gsm_dec_desc
;
extern
MSFilterDesc
ms_gsm_enc_desc
;
extern
MSFilterDesc
ms_mpeg4_enc_desc
;
extern
MSFilterDesc
ms_mpeg4_dec_desc
;
extern
MSFilterDesc
ms_h263_enc_desc
;
extern
MSFilterDesc
ms_h263_dec_desc
;
extern
MSFilterDesc
ms_h264_dec_desc
;
extern
MSFilterDesc
ms_pix_conv_desc
;
extern
MSFilterDesc
ms_size_conv_desc
;
MSFilterDesc
*
ms_filter_descs
[]
=
{
&
ms_alaw_dec_desc
,
...
...
@@ -49,6 +56,15 @@ MSFilterDesc * ms_filter_descs[]={
&
ms_equalizer_desc
,
&
ms_gsm_enc_desc
,
&
ms_gsm_dec_desc
,
#ifdef VIDEO_ENABLED
&
ms_mpeg4_enc_desc
,
&
ms_mpeg4_dec_desc
,
&
ms_h263_enc_desc
,
&
ms_h263_dec_desc
,
&
ms_h264_dec_desc
,
&
ms_pix_conv_desc
,
&
ms_size_conv_desc
,
#endif
NULL
};
build/android/libmediastreamer2_AndroidConfig.h
View file @
5db6533a
...
...
@@ -38,10 +38,10 @@
#define HAVE_LIBSWSCALE_SWSCALE_H 1
/* Define to 1 if you have the <linux/videodev2.h> header file. */
#define HAVE_LINUX_VIDEODEV2_H 1
/*
#define HAVE_LINUX_VIDEODEV2_H 1
*/
/* Define to 1 if you have the <linux/videodev.h> header file. */
#define HAVE_LINUX_VIDEODEV_H 1
/*
#define HAVE_LINUX_VIDEODEV_H 1
*/
/* Define to 1 if you have the <machine/soundcard.h> header file. */
/* #undef HAVE_MACHINE_SOUNDCARD_H */
...
...
configure.ac
View file @
5db6533a
dnl Process this file with autoconf to produce a configure script.
AC_INIT([mediastreamer],[2.
6
.0])
AC_INIT([mediastreamer],[2.
7
.0])
AC_MSG_NOTICE([$PACKAGE_NAME-$PACKAGE_VERSION A mediastreaming library for telephony application.])
AC_MSG_NOTICE([licensed under the terms of the General Public License (GPL)])
...
...
@@ -12,8 +12,8 @@ MEDIASTREAMER_MINOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f2)
MEDIASTREAMER_MICRO_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f3)
MEDIASTREAMER_EXTRA_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f4)
LIBMEDIASTREAMER_SO_CURRENT=
0
dnl increment this number when you add/change/remove an interface
LIBMEDIASTREAMER_SO_REVISION=
1
dnl increment this number when you change source code, without changing interfaces; set to 0 when incrementing CURRENT
LIBMEDIASTREAMER_SO_CURRENT=
1
dnl increment this number when you add/change/remove an interface
LIBMEDIASTREAMER_SO_REVISION=
0
dnl increment this number when you change source code, without changing interfaces; set to 0 when incrementing CURRENT
LIBMEDIASTREAMER_SO_AGE=0 dnl increment this number when you add an interface, set to 0 if you remove an interface
LIBMEDIASTREAMER_SO_VERSION=$LIBMEDIASTREAMER_SO_CURRENT:$LIBMEDIASTREAMER_SO_REVISION:$LIBMEDIASTREAMER_SO_AGE
...
...
@@ -519,6 +519,8 @@ AM_CONDITIONAL(BUILD_THEORA, test "$have_theora" = "yes")
AM_CONDITIONAL(BUILD_WIN32, test "$mingw_found" = "yes")
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" )
dnl *********************************************
dnl setup oRTP dependency
...
...
include/mediastreamer2/Makefile.am
View file @
5db6533a
...
...
@@ -28,7 +28,8 @@ mediastreamer2_include_HEADERS= ice.h \
mschanadapter.h
\
msaudiomixer.h
\
msitc.h
\
msextdisplay.h
msextdisplay.h
\
msjpegwriter.h
EXTRA_DIST
=
$(mediastreamer2_include_HEADERS)
include/mediastreamer2/allfilters.h
View file @
5db6533a
...
...
@@ -101,7 +101,9 @@ typedef enum MSFilterId{
MS_IOUNIT_READ_ID
,
MS_IOUNIT_WRITE_ID
,
MS_ANDROID_SOUND_READ_ID
,
MS_ANDROID_SOUND_WRITE_ID
MS_ANDROID_SOUND_WRITE_ID
,
MS_JPEG_WRITER_ID
,
MS_X11VIDEO_ID
}
MSFilterId
;
...
...
include/mediastreamer2/mediastream.h
View file @
5db6533a
...
...
@@ -185,6 +185,8 @@ struct _VideoStream
MSFilter
*
decoder
;
MSFilter
*
rtprecv
;
MSFilter
*
rtpsend
;
MSFilter
*
tee2
;
MSFilter
*
jpegwriter
;
OrtpEvQueue
*
evq
;
MSVideoSize
sent_vsize
;
int
corner
;
/*for selfview*/
...
...
@@ -227,7 +229,7 @@ int video_stream_send_only_start(VideoStream *videostream,
void
video_stream_recv_only_stop
(
VideoStream
*
vs
);
void
video_stream_send_only_stop
(
VideoStream
*
vs
);
VideoStream
*
video_preview_start
(
MSWebCam
*
device
,
MSVideoSize
vsiz
e
);
VideoStream
*
video_preview_start
(
MSWebCam
*
device
,
MSVideoSize
disp_size
,
const
char
*
displaytyp
e
);
void
video_preview_stop
(
VideoStream
*
stream
);
bool_t
ms_is_ipv6
(
const
char
*
address
);
...
...
include/mediastreamer2/msinterfaces.h
View file @
5db6533a
...
...
@@ -50,15 +50,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MS_VIDEO_DISPLAY_SET_LOCAL_VIEW_SCALEFACTOR \
MS_FILTER_METHOD(MSFilterVideoDisplayInterface,5,float)
/**scale factor of the local view */
#define MS_VIDEO_DISPLAY_SET_SELFVIEW_POS \
MS_FILTER_METHOD(MSFilterVideoDisplayInterface,6,float[3])
/**scale factor of the local view */
#define MS_VIDEO_DISPLAY_GET_SELFVIEW_POS \
MS_FILTER_METHOD(MSFilterVideoDisplayInterface,7,float[3])
/**scale factor of the local view */
/**Set the background colour for video window */
#define MS_VIDEO_DISPLAY_SET_BACKGROUND_COLOR \
MS_FILTER_METHOD(MSFilterVideoDisplayInterface,8,int[3])
...
...
include/mediastreamer2/msjpegwriter.h
0 → 100644
View file @
5db6533a
/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 2010 Belledonne Communications SARL (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.
*/
#ifndef msjpegwriter_h
#define msjpegwriter_h
#include "mediastreamer2/msfilter.h"
#define MS_JPEG_WRITER_TAKE_SNAPSHOT MS_FILTER_METHOD(MS_JPEG_WRITER_ID,0,const char)
#endif
include/mediastreamer2/msvideo.h
View file @
5db6533a
...
...
@@ -185,9 +185,9 @@ int ms_pix_fmt_to_ffmpeg(MSPixFmt fmt);
MSPixFmt
ffmpeg_pix_fmt_to_ms
(
int
fmt
);
MSPixFmt
ms_fourcc_to_pix_fmt
(
uint32_t
fourcc
);
void
ms_ffmpeg_check_init
(
void
);
int
yuv_buf_init_from_mblk
(
MSPicture
*
buf
,
mblk_t
*
m
);
void
yuv_buf_init_from_mblk_with_size
(
MSPicture
*
buf
,
mblk_t
*
m
,
int
w
,
int
h
);
mblk_t
*
yuv_buf_alloc
(
MSPicture
*
buf
,
int
w
,
int
h
);
int
ms_
yuv_buf_init_from_mblk
(
MSPicture
*
buf
,
mblk_t
*
m
);
void
ms_
yuv_buf_init_from_mblk_with_size
(
MSPicture
*
buf
,
mblk_t
*
m
,
int
w
,
int
h
);
mblk_t
*
ms_
yuv_buf_alloc
(
MSPicture
*
buf
,
int
w
,
int
h
);
void
ms_yuv_buf_copy
(
uint8_t
*
src_planes
[],
const
int
src_strides
[],
uint8_t
*
dst_planes
[],
const
int
dst_strides
[
3
],
MSVideoSize
roi
);
void
ms_yuv_buf_mirror
(
YuvBuf
*
buf
);
...
...
@@ -196,6 +196,8 @@ void rgb24_revert(uint8_t *buf, int w, int h, int linesize);
void
rgb24_copy_revert
(
uint8_t
*
dstbuf
,
int
dstlsz
,
const
uint8_t
*
srcbuf
,
int
srclsz
,
MSVideoSize
roi
);
void
ms_rgb_to_yuv
(
const
uint8_t
rgb
[
3
],
uint8_t
yuv
[
3
]);
static
inline
bool_t
ms_video_size_greater_than
(
MSVideoSize
vs1
,
MSVideoSize
vs2
){
return
(
vs1
.
width
>=
vs2
.
width
)
&&
(
vs1
.
height
>=
vs2
.
height
);
}
...
...
@@ -262,6 +264,5 @@ void ms_video_set_video_func(struct ms_swscaleDesc *_ms_swscale_desc);
/* request a video-fast-update (=I frame for H263,MP4V-ES) to a video encoder*/
#define MS_FILTER_REQ_VFU MS_FILTER_BASE_METHOD_NO_ARG(106)
#define MS_FILTER_SET_IMAGE MS_FILTER_BASE_METHOD(107,char)
#endif
include/mediastreamer2/msvideoout.h
View file @
5db6533a
...
...
@@ -24,89 +24,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <mediastreamer2/msvideo.h>
struct
_MSDisplay
;
typedef
enum
_MSDisplayEventType
{
MS_DISPLAY_RESIZE_EVENT
}
MSDisplayEventType
;
typedef
struct
_MSDisplayEvent
{
MSDisplayEventType
evtype
;
int
w
,
h
;
}
MSDisplayEvent
;
typedef
struct
_MSDisplayDesc
{
/*init requests setup of the display window at the proper size, given
in frame_buffer argument. Memory buffer (data,strides) must be fulfilled
at return. init() might be called several times upon screen resize*/
bool_t
(
*
init
)(
struct
_MSDisplay
*
,
struct
_MSFilter
*
f
,
MSPicture
*
frame_buffer
,
MSPicture
*
selfview_buffer
);
void
(
*
lock
)(
struct
_MSDisplay
*
);
/*lock before writing to the framebuffer*/
void
(
*
unlock
)(
struct
_MSDisplay
*
);
/*unlock after writing to the framebuffer*/
void
(
*
update
)(
struct
_MSDisplay
*
,
int
new_image
,
int
new_selfview
);
/*display the picture to the screen*/
void
(
*
uninit
)(
struct
_MSDisplay
*
);
int
(
*
pollevent
)(
struct
_MSDisplay
*
,
MSDisplayEvent
*
ev
);
long
default_window_id
;
}
MSDisplayDesc
;
typedef
struct
_MSDisplay
{
MSDisplayDesc
*
desc
;
long
window_id
;
/*window id if the display should use an existing window*/
void
*
data
;
bool_t
use_external_window
;
}
MSDisplay
;
#define ms_display_init(d,f,fbuf,fbuf_selfview) (d)->desc->init(d,f,fbuf,fbuf_selfview)
#define ms_display_lock(d) if ((d)->desc->lock) (d)->desc->lock(d)
#define ms_display_unlock(d) if ((d)->desc->unlock) (d)->desc->unlock(d)
#define ms_display_update(d, A, B) if ((d)->desc->update) (d)->desc->update(d, A, B)
int
ms_display_poll_event
(
MSDisplay
*
d
,
MSDisplayEvent
*
ev
);
extern
MSDisplayDesc
ms_sdl_display_desc
;
#if (defined(WIN32) || defined(_WIN32_WCE)) && !defined(MEDIASTREAMER_STATIC)
#if defined(MEDIASTREAMER2_EXPORTS) && defined(INVIDEOUT_C)
#define MSVAR_DECLSPEC __declspec(dllexport)
#else
#define MSVAR_DECLSPEC __declspec(dllimport)
#endif
#else
#define MSVAR_DECLSPEC extern
#endif
#ifdef __cplusplus
extern
"C"
{
#endif
/*plugins can set their own display using this method:*/
void
ms_display_desc_set_default
(
MSDisplayDesc
*
desc
);
MSDisplayDesc
*
ms_display_desc_get_default
(
void
);
void
ms_display_desc_set_default_window_id
(
MSDisplayDesc
*
desc
,
long
id
);
MSVAR_DECLSPEC
MSDisplayDesc
ms_win_display_desc
;
MSDisplay
*
ms_display_new
(
MSDisplayDesc
*
desc
);
void
ms_display_set_window_id
(
MSDisplay
*
d
,
long
window_id
);
void
ms_display_destroy
(
MSDisplay
*
d
);
#define MS_VIDEO_OUT_SET_DISPLAY MS_FILTER_METHOD(MS_VIDEO_OUT_ID,0,MSDisplay*)
#define MS_VIDEO_OUT_HANDLE_RESIZING MS_FILTER_METHOD_NO_ARG(MS_VIDEO_OUT_ID,1)
#define MS_VIDEO_OUT_SET_CORNER MS_FILTER_METHOD(MS_VIDEO_OUT_ID,2,int)
#define MS_VIDEO_OUT_AUTO_FIT MS_FILTER_METHOD(MS_VIDEO_OUT_ID,3,int)
#define MS_VIDEO_OUT_ENABLE_MIRRORING MS_FILTER_METHOD(MS_VIDEO_OUT_ID,4,int)
#define MS_VIDEO_OUT_GET_NATIVE_WINDOW_ID MS_FILTER_METHOD(MS_VIDEO_OUT_ID,5,unsigned long)
#define MS_VIDEO_OUT_GET_CORNER MS_FILTER_METHOD(MS_VIDEO_OUT_ID,6,int)
#define MS_VIDEO_OUT_SET_SCALE_FACTOR MS_FILTER_METHOD(MS_VIDEO_OUT_ID,7,float)
#define MS_VIDEO_OUT_GET_SCALE_FACTOR MS_FILTER_METHOD(MS_VIDEO_OUT_ID,8,float)
#define MS_VIDEO_OUT_SET_SELFVIEW_POS MS_FILTER_METHOD(MS_VIDEO_OUT_ID,9,float[3])
#define MS_VIDEO_OUT_GET_SELFVIEW_POS MS_FILTER_METHOD(MS_VIDEO_OUT_ID,10,float[3])
#define MS_VIDEO_OUT_SET_BACKGROUND_COLOR MS_FILTER_METHOD(MS_VIDEO_OUT_ID,11,int[3])
#define MS_VIDEO_OUT_GET_BACKGROUND_COLOR MS_FILTER_METHOD(MS_VIDEO_OUT_ID,12,int[3])
#ifdef __cplusplus
}
#endif
#endif
include/mediastreamer2/mswebcam.h
View file @
5db6533a
...
...
@@ -224,6 +224,10 @@ const char *ms_web_cam_get_string_id(MSWebCam *obj);
void
ms_static_image_set_default_image
(
const
char
*
path
);
/** method for the "nowebcam" filter */
#define MS_STATIC_IMAGE_SET_IMAGE \
MS_FILTER_METHOD(MS_STATIC_IMAGE_ID,0,const char)
#ifdef __cplusplus
}
#endif
...
...
src/Makefile.am
View file @
5db6533a
...
...
@@ -125,16 +125,25 @@ libmediastreamer_la_SOURCES+= videoenc.c \
pixconv.c
\
sizeconv.c
\
nowebcam.c nowebcam.h
\
videoout.c
\
swscale.h ffmpeg-priv.h
\
h264dec.c
h264dec.c
\
jpegwriter.c
endif
if
BUILD_SDL
libmediastreamer_la_SOURCES
+=
videoout.c
endif
if
BUILD_X11_XV
libmediastreamer_la_SOURCES
+=
x11video.c
endif
libmediastreamer_la_SOURCES
+=
rfc2429.h
\
msvideo.c
\
rfc3984.c
\
mire.c
\
extdisplay.c
extdisplay.c
\
layouts.c layouts.h
libmediastreamer_la_SOURCES
+=
videostream.c
...
...
src/drawdib-display.c
View file @
5db6533a
/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 20
06 Simon MORLAT (simon.morlat@linphone.org)
Copyright (C) 20
10 Belledonne Communications SARL, Grenoble France.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
...
...
@@ -274,133 +274,6 @@ static void dd_display_preprocess(MSFilter *f){
}
/* compute the ideal placement of the video within a window of size wsize,
given that the original video has size vsize. Put the result in rect*/
static
void
center_with_ratio
(
MSVideoSize
wsize
,
MSVideoSize
vsize
,
MSRect
*
rect
){
int
w
,
h
;
w
=
wsize
.
width
&
~
0x3
;
h
=
((
w
*
vsize
.
height
)
/
vsize
.
width
)
&
~
0x1
;
if
(
h
>
wsize
.
height
){
/*the height doesn't fit, so compute the width*/
h
=
wsize
.
height
&
~
0x1
;
w
=
((
h
*
vsize
.
width
)
/
vsize
.
height
)
&
~
0x3
;
}
rect
->
x
=
(
wsize
.
width
-
w
)
/
2
;
rect
->
y
=
(
wsize
.
height
-
h
)
/
2
;
rect
->
w
=
w
;
rect
->
h
=
h
;
}
#define LOCAL_BORDER_SIZE 2
#define LOCAL_POS_OFFSET 10
static
void
compute_layout
(
MSVideoSize
wsize
,
MSVideoSize
vsize
,
MSVideoSize
orig_psize
,
MSRect
*
mainrect
,
MSRect
*
localrect
,
int
localrect_pos
,
float
scalefactor
){
MSVideoSize
psize
;
center_with_ratio
(
wsize
,
vsize
,
mainrect
);
if
(
localrect_pos
!=-
1
){
psize
.
width
=
(
int
)(
wsize
.
width
/
scalefactor
);
psize
.
height
=
(
int
)(
wsize
.
height
/
scalefactor
);
center_with_ratio
(
psize
,
orig_psize
,
localrect
);
if
((
wsize
.
height
-
mainrect
->
h
<
mainrect
->
h
/
scalefactor
&&
wsize
.
width
-
mainrect
->
w
<
mainrect
->
w
/
scalefactor
)
||
localrect_pos
<=
3
)
{
int
x_sv
;
int
y_sv
;
if
(
localrect_pos
%
4
==
1
)
{
/* top left corner */
x_sv
=
LOCAL_POS_OFFSET
;
y_sv
=
LOCAL_POS_OFFSET
;
}
else
if
(
localrect_pos
%
4
==
2
)
{
/* top right corner */
x_sv
=
(
wsize
.
width
-
localrect
->
w
-
LOCAL_POS_OFFSET
);
y_sv
=
LOCAL_POS_OFFSET
;
}
else
if
(
localrect_pos
%
4
==
3
)
{
/* bottom left corner */
x_sv
=
LOCAL_POS_OFFSET
;
y_sv
=
(
wsize
.
height
-
localrect
->
h
-
LOCAL_POS_OFFSET
);
}
else
/* corner = 0: default */
{
/* bottom right corner */
x_sv
=
(
wsize
.
width
-
localrect
->
w
-
LOCAL_POS_OFFSET
);
y_sv
=
(
wsize
.
height
-
localrect
->
h
-
LOCAL_POS_OFFSET
);
}
localrect
->
x
=
x_sv
;
//wsize.width-localrect->w-LOCAL_POS_OFFSET;
localrect
->
y
=
y_sv
;
//wsize.height-localrect->h-LOCAL_POS_OFFSET;
}
else
{
int
x_sv
;
int
y_sv
;
if
(
wsize
.
width
-
mainrect
->
w
<
mainrect
->
w
/
scalefactor
)
{
// recalculate so we have a selfview taking as
// much available space as possible
psize
.
width
=
wsize
.
width
;
psize
.
height
=
wsize
.
height
-
mainrect
->
h
;
center_with_ratio
(
psize
,
orig_psize
,
localrect
);
if
(
localrect_pos
%
4
==
1
||
localrect_pos
%
4
==
2
)
{
//Self View on Top
x_sv
=
(
wsize
.
width
-
localrect
->
w
)
/
2
;
y_sv
=
LOCAL_POS_OFFSET
;
mainrect
->
y
=
wsize
.
height
-
mainrect
->
h
-
LOCAL_POS_OFFSET
;
}
else
{
//Self View on Bottom
x_sv
=
(
wsize
.
width
-
localrect
->
w
)
/
2
;
y_sv
=
(
wsize
.
height
-
localrect
->
h
-
LOCAL_POS_OFFSET
);
mainrect
->
y
=
LOCAL_POS_OFFSET
;
}
}
else
{
// recalculate so we have a selfview taking as
// much available space as possible
psize
.
width
=
wsize
.
width
-
mainrect
->
w
;
psize
.
height
=
wsize
.
height
;
center_with_ratio
(
psize
,
orig_psize
,
localrect
);
if
(
localrect_pos
%
4
==
1
||
localrect_pos
%
4
==
3
)
{
//Self View on left
x_sv
=
LOCAL_POS_OFFSET
;
y_sv
=
(
wsize
.
height
-
localrect
->
h
)
/
2
;
mainrect
->
x
=
wsize
.
width
-
mainrect
->
w
-
LOCAL_POS_OFFSET
;
}
else
{
//Self View on right
x_sv
=
(
wsize
.
width
-
localrect
->
w
-
LOCAL_POS_OFFSET
);
y_sv
=
(
wsize
.
height
-
localrect
->
h
)
/
2
;
mainrect
->
x
=
LOCAL_POS_OFFSET
;
}
}
localrect
->
x
=
x_sv
;
//wsize.width-localrect->w-LOCAL_POS_OFFSET;
localrect
->
y
=
y_sv
;
//wsize.height-localrect->h-LOCAL_POS_OFFSET;
}
}
/*
ms_message("Compute layout result for\nwindow size=%ix%i\nvideo orig size=%ix%i\nlocal size=%ix%i\nlocal orig size=%ix%i\n"
"mainrect=%i,%i,%i,%i\tlocalrect=%i,%i,%i,%i",
wsize.width,wsize.height,vsize.width,vsize.height,psize.width,psize.height,orig_psize.width,orig_psize.height,
mainrect->x,mainrect->y,mainrect->w,mainrect->h,
localrect->x,localrect->y,localrect->w,localrect->h);
*/
}
static
void
draw_local_view_frame
(
HDC
hdc
,
MSVideoSize
wsize
,
MSRect
localrect
){
Rectangle
(
hdc
,
localrect
.
x
-
LOCAL_BORDER_SIZE
,
localrect
.
y
-
LOCAL_BORDER_SIZE
,
...
...
@@ -506,7 +379,7 @@ static void dd_display_process(MSFilter *f){
}
if
(
main_im
!=
NULL
||
local_im
!=
NULL
||
obj
->
need_repaint
){
compute
_layout
(
wsize
,
obj
->
vsize
,
obj
->
lsize
,
&
mainrect
,
&
localrect
,
corner
,
scalefactor
);
ms_layout_
compute
(
wsize
,
obj
->
vsize
,
obj
->
lsize
,
corner
,
scalefactor
,
&
mainrect
,
&
localrect
);
vsize
.
width
=
mainrect
.
w
;
vsize
.
height
=
mainrect
.
h
;
lsize
.
width
=
localrect
.
w
;
...
...
src/extdisplay.c
View file @
5db6533a
...
...
@@ -36,12 +36,12 @@ static void ext_display_process(MSFilter *f){
/*get most recent message and draw it*/
if
(
f
->
inputs
[
1
]
!=
NULL
&&
(
local_im
=
ms_queue_peek_last
(
f
->
inputs
[
1
]))
!=
NULL
)
{
if
(
yuv_buf_init_from_mblk
(
&
output
.
local_view
,
local_im
)
==
0
){
if
(
ms_
yuv_buf_init_from_mblk
(
&
output
.
local_view
,
local_im
)
==
0
){
}
}