Commit f05af00e authored by Simon Morlat's avatar Simon Morlat

add new video external display filter

parent 648bfcf6
mediastreamer-2.5.1: ???
mediastreamer-2.5.0: June 3, 2010
* fix regression with speex decoder at 16 and 32khz.
* uses less memory for speex decoding.
......
dnl Process this file with autoconf to produce a configure script.
AC_INIT([mediastreamer],[2.5.0])
AC_INIT([mediastreamer],[2.5.0.1])
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)])
......
......@@ -28,7 +28,8 @@ mediastreamer2_include_HEADERS= ice.h \
msinterfaces.h \
mschanadapter.h \
msaudiomixer.h \
msitc.h
msitc.h \
msextdisplay.h
EXTRA_DIST=$(mediastreamer2_include_HEADERS)
......@@ -95,7 +95,8 @@ typedef enum MSFilterId{
MS_CHANNEL_ADAPTER_ID,
MS_AUDIO_MIXER_ID,
MS_ITC_SINK_ID,
MS_ITC_SOURCE_ID
MS_ITC_SOURCE_ID,
MS_EXT_DISPLAY_ID
} MSFilterId;
......
......@@ -161,6 +161,7 @@ void audio_stream_get_local_rtp_stats(AudioStream *stream, rtp_stats_t *stats);
Video Support
*****************/
typedef void (*VideoStreamRenderCallback)(void *user_pointer, const MSPicture *local_view, const MSPicture *remote_view);
struct _VideoStream
{
......@@ -178,6 +179,8 @@ struct _VideoStream
OrtpEvQueue *evq;
MSVideoSize sent_vsize;
int corner; /*for selfview*/
VideoStreamRenderCallback rendercb;
void *render_pointer;
bool_t adapt_bitrate;
};
......@@ -185,6 +188,7 @@ typedef struct _VideoStream VideoStream;
VideoStream *video_stream_new(int locport, bool_t use_ipv6);
void video_stream_enable_adaptive_bitrate_control(VideoStream *s, bool_t yesno);
void video_stream_set_render_callback(VideoStream *s, VideoStreamRenderCallback cb, void *user_pointer);
int video_stream_start(VideoStream * stream, RtpProfile *profile, const char *remip, int remport, int rem_rtcp_port,
int payload, int jitt_comp, MSWebCam *device);
void video_stream_set_relay_session_id(VideoStream *stream, const char *relay_session_id);
......
......@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef msaudiomixer_h
#define msaudiomixer_h
#include "msfilter.h"
#include "mediastreamer2/msfilter.h"
typedef struct MSAudioMixerCtl{
int pin;
......
/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 2010 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.
*/
#ifndef msextdisplay_h
#define msextdisplay_h
#include "mediastreamer2/msfilter.h"
#include "mediastreamer2/msvideo.h"
typedef struct _MSExtDisplayOutput{
MSPicture remote_view;
MSPicture local_view;
}MSExtDisplayOutput;
/* a synchronous event generated by the filter when a new picture is to be drawn */
#define MS_EXT_DISPLAY_ON_DRAW MS_FILTER_EVENT(MS_EXT_DISPLAY_ID,0,MSExtDisplayOutput)
#endif
......@@ -128,7 +128,8 @@ endif
libmediastreamer_la_SOURCES+= rfc2429.h \
msvideo.c \
rfc3984.c \
mire.c
mire.c \
extdisplay.c
libmediastreamer_la_SOURCES+=videostream.c
......
......@@ -558,11 +558,11 @@ static void dd_display_process(MSFilter *f){
/*else using direct blitting to screen*/
ReleaseDC(NULL,hdc);
if (main_im!=NULL)
ms_queue_flush(f->inputs[0]);
if (local_im!=NULL)
ms_queue_flush(f->inputs[1]);
}
if (f->inputs[0]!=NULL)
ms_queue_flush(f->inputs[0]);
if (f->inputs[1]!=NULL)
ms_queue_flush(f->inputs[1]);
}
static int get_native_window_id(MSFilter *f, void *data){
......
/*
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.
*/
#include "mediastreamer2/msextdisplay.h"
static void ext_display_init(MSFilter *f){
ms_filter_enable_synchronous_notifcations (f,TRUE);
}
static void ext_display_uninit(MSFilter *f){
}
static void ext_display_process(MSFilter *f){
MSExtDisplayOutput output;
mblk_t *main_im=NULL;
mblk_t *local_im=NULL;
memset(&output,0,sizeof(output));
/*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 (f->inputs[0]!=NULL && (main_im=ms_queue_peek_last(f->inputs[0]))!=NULL) {
if (yuv_buf_init_from_mblk(&output.remote_view,main_im)==0){
}
}
ms_filter_notify(f,MS_EXT_DISPLAY_ON_DRAW,&output);
if (f->inputs[0]!=NULL)
ms_queue_flush(f->inputs[0]);
if (f->inputs[1]!=NULL)
ms_queue_flush(f->inputs[1]);
}
#ifdef _MSC_VER
MSFilterDesc ms_ext_display_desc={
MS_EXT_DISPLAY_ID,
"MSExtDisplay",
N_("A display filter sending the buffers to draw to the upper layer"),
MS_FILTER_OTHER,
NULL,
2,
0,
ext_display_init,
NULL,
ext_display_process,
NULL,
ext_display_uninit,
};
#else
MSFilterDesc ms_ext_display_desc={
.id=MS_EXT_DISPLAY_ID,
.name="MSExtDisplay",
.text=N_("A display filter sending the buffers to draw to the upper layer"),
.category=MS_FILTER_OTHER,
.ninputs=2,
.noutputs=0,
.init=ext_display_init,
.process=ext_display_process,
.uninit=ext_display_uninit,
};
#endif
MS_FILTER_DESC_EXPORT(ms_ext_display_desc)
......@@ -151,6 +151,7 @@ int ms_filter_unlink(MSFilter *f1, int pin1, MSFilter *f2, int pin2){
}
#define MS_FILTER_METHOD_GET_FID(id) (((id)>>16) & 0xFFFF)
#define MS_FILTER_METHOD_GET_INDEX(id) ( ((id)>>8) & 0XFF)
static inline bool_t is_interface_method(unsigned int magic){
return magic==MS_FILTER_BASE_ID || magic>MSFilterInterfaceBegin;
......@@ -174,7 +175,8 @@ int ms_filter_call_method(MSFilter *f, unsigned int id, void *arg){
return methods[i].method(f,arg);
}
}
if (magic!=MS_FILTER_BASE_ID) ms_error("no such method on filter %s, fid=%i",f->desc->name,magic);
if (magic!=MS_FILTER_BASE_ID) ms_error("no such method on filter %s, fid=%i method index=%i",f->desc->name,magic,
MS_FILTER_METHOD_GET_INDEX(id) );
return -1;
}
......
......@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mediastreamer2/msvideo.h"
#include "mediastreamer2/msrtp.h"
#include "mediastreamer2/msvideoout.h"
#include "mediastreamer2/msextdisplay.h"
#ifdef HAVE_CONFIG_H
#include "mediastreamer-config.h"
......@@ -194,6 +194,21 @@ void video_stream_enable_adaptive_bitrate_control(VideoStream *s, bool_t yesno){
s->adapt_bitrate=yesno;
}
void video_stream_set_render_callback (VideoStream *s, VideoStreamRenderCallback cb, void *user_pointer){
s->rendercb=cb;
s->render_pointer=user_pointer;
}
static void ext_display_cb(void *ud, unsigned int event, void *eventdata){
MSExtDisplayOutput *output=(MSExtDisplayOutput*)eventdata;
VideoStream *st=(VideoStream*)ud;
if (st->rendercb!=NULL){
st->rendercb(st->render_pointer,
output->local_view.w!=0 ? &output->local_view : NULL,
output->remote_view.w!=0 ? &output->remote_view : NULL);
}
}
int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *remip, int remport,
int rem_rtcp_port, int payload, int jitt_comp, MSWebCam *cam){
PayloadType *pt;
......@@ -246,13 +261,20 @@ int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *re
/* creates the filters */
stream->source = ms_web_cam_create_reader(cam);
stream->tee = ms_filter_new(MS_TEE_ID);
if (stream->rendercb!=NULL){
stream->output=ms_filter_new(MS_EXT_DISPLAY_ID);
ms_filter_set_notify_callback (stream->output,ext_display_cb,stream);
}else{
#ifndef WIN32
stream->output=ms_filter_new(MS_VIDEO_OUT_ID);
stream->output=ms_filter_new(MS_VIDEO_OUT_ID);
#else
stream->output=ms_filter_new(MS_DRAWDIB_DISPLAY_ID);
stream->output=ms_filter_new(MS_DRAWDIB_DISPLAY_ID);
#endif
}
stream->sizeconv=ms_filter_new(MS_SIZE_CONV_ID);
if (pt->normal_bitrate>0){
ms_message("Limiting bitrate of video encoder to %i bits/s",pt->normal_bitrate);
ms_filter_call_method(stream->encoder,MS_FILTER_SET_BITRATE,&pt->normal_bitrate);
......@@ -376,6 +398,7 @@ VideoStream * video_preview_start(MSWebCam *device, MSVideoSize disp_size){
/* creates the filters */
stream->source = ms_web_cam_create_reader(device);
#ifndef WIN32
stream->output = ms_filter_new(MS_VIDEO_OUT_ID);
#else
......
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