Commit bc6c0ed4 authored by Simon Morlat's avatar Simon Morlat

make new interface working

parent 70e50386
......@@ -509,6 +509,8 @@ void ms_filter_unregister_all(void);
}
#endif
#include "msinterfaces.h"
/* used by awk script in Makefile.am to generate alldescs.c */
#define MS_FILTER_DESC_EXPORT(desc)
......
/*
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 msinterfaces_h
#define msinterfaces_h
/**
* Interface definition for video display filters.
**/
/** whether the video window should be resized to the stream's resolution*/
#define MS_VIDEO_DISPLAY_ENABLE_AUTOFIT \
MS_FILTER_METHOD(MSFilterVideoDisplayInterface,0,bool_t)
/**position of the local view */
#define MS_VIDEO_DISPLAY_SET_LOCAL_VIEW_CORNER \
MS_FILTER_METHOD(MSFilterVideoDisplayInterface,1,int)
/**whether the video should be reversed as in mirror */
#define MS_VIDEO_DISPLAY_ENABLE_MIRRORING \
MS_FILTER_METHOD(MSFilterVideoDisplayInterface,2,int)
/**returns a platform dependant window id where the video is drawn */
#define MS_VIDEO_DISPLAY_GET_NATIVE_WINDOW_ID \
MS_FILTER_METHOD(MSFilterVideoDisplayInterface,3,long)
#endif
......@@ -152,17 +152,21 @@ int ms_filter_unlink(MSFilter *f1, int pin1, MSFilter *f2, int pin2){
#define MS_FILTER_METHOD_GET_FID(id) (((id)>>16) & 0xFFFF)
static inline bool_t is_interface_method(unsigned int magic){
return magic==MS_FILTER_BASE_ID || magic>MSFilterInterfaceBegin;
}
int ms_filter_call_method(MSFilter *f, unsigned int id, void *arg){
MSFilterMethod *methods=f->desc->methods;
int i;
unsigned int magic=MS_FILTER_METHOD_GET_FID(id);
if (magic!=MS_FILTER_BASE_ID && magic!=f->desc->id) {
if (!is_interface_method(magic) && magic!=f->desc->id) {
ms_fatal("Method type checking failed when calling %u on filter %s",id,f->desc->name);
return -1;
}
for(i=0;methods!=NULL && methods[i].method!=NULL; i++){
unsigned int mm=MS_FILTER_METHOD_GET_FID(methods[i].id);
if (mm!=f->desc->id && mm!=MS_FILTER_BASE_ID) {
if (mm!=f->desc->id && !is_interface_method(mm)) {
ms_fatal("Bad method definition on filter %s. fid=%u , mm=%u",f->desc->name,f->desc->id,mm);
return -1;
}
......
......@@ -1800,6 +1800,11 @@ static MSFilterMethod methods[]={
{ MS_VIDEO_OUT_GET_SELFVIEW_POS , video_out_get_selfview_pos},
{ MS_VIDEO_OUT_SET_BACKGROUND_COLOR , video_out_set_background_color},
{ MS_VIDEO_OUT_GET_BACKGROUND_COLOR , video_out_get_background_color},
/* methods for compatibility with the MSVideoDisplay interface*/
{ MS_VIDEO_DISPLAY_SET_LOCAL_VIEW_CORNER , video_out_set_corner },
{ MS_VIDEO_DISPLAY_ENABLE_AUTOFIT , video_out_auto_fit },
{ MS_VIDEO_DISPLAY_ENABLE_MIRRORING , video_out_enable_mirroring },
{ MS_VIDEO_DISPLAY_GET_NATIVE_WINDOW_ID , video_out_get_native_window_id },
{ 0 ,NULL}
};
......
......@@ -398,8 +398,8 @@ VideoStream * video_preview_start(MSWebCam *device, MSVideoSize disp_size){
format=MS_YUV420P;
ms_filter_call_method(stream->output,MS_FILTER_SET_PIX_FMT,&format);
ms_filter_call_method(stream->output,MS_FILTER_SET_VIDEO_SIZE,&disp_size);
//ms_filter_call_method(stream->output,MS_VIDEO_OUT_ENABLE_MIRRORING,&mirroring);
//ms_filter_call_method(stream->output,MS_VIDEO_OUT_SET_CORNER,&corner);
ms_filter_call_method(stream->output,MS_VIDEO_DISPLAY_ENABLE_MIRRORING,&mirroring);
ms_filter_call_method(stream->output,MS_VIDEO_DISPLAY_SET_LOCAL_VIEW_CORNER,&corner);
/* and then connect all */
ms_filter_link(stream->source,0, stream->pixconv,0);
......
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