Commit fb113617 authored by smorlat's avatar smorlat
Browse files

support for large video formats

bugfixing in SDL video output



git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@120 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 94f6bf42
......@@ -1460,7 +1460,7 @@ void linphone_core_stop_media_streams(LinphoneCore *lc){
}
if (linphone_core_video_preview_enabled(lc)){
if (lc->previewstream==NULL){
lc->previewstream=video_preview_start(lc->video_conf.device);
lc->previewstream=video_preview_start(lc->video_conf.device, lc->video_conf.vsize);
}
}
#endif
......@@ -1940,7 +1940,8 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val){
if (lc->videostream==NULL){
if (val){
if (lc->previewstream==NULL){
lc->previewstream=video_preview_start(lc->video_conf.device);
lc->previewstream=video_preview_start(lc->video_conf.device,
lc->video_conf.vsize);
}
}else{
if (lc->previewstream!=NULL){
......@@ -2045,8 +2046,14 @@ static bool_t video_size_supported(MSVideoSize vsize){
void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize){
if (video_size_supported(vsize))
if (video_size_supported(vsize)){
MSVideoSize oldvsize=lc->video_conf.vsize;
lc->video_conf.vsize=vsize;
if (!ms_video_size_equal(oldvsize,vsize) && lc->previewstream!=NULL){
toggle_video_preview(lc,FALSE);
toggle_video_preview(lc,TRUE);
}
}
}
void linphone_core_set_preferred_video_size_by_name(LinphoneCore *lc, const char *name){
......
This diff is collapsed.
......@@ -33,6 +33,23 @@ static void linphone_gtk_fill_combo_box(GtkWidget *combo, const char **devices,
gtk_combo_box_set_active(GTK_COMBO_BOX(combo),active);
}
void linphone_gtk_fill_video_sizes(GtkWidget *combo){
const MSVideoSizeDef *def=linphone_core_get_supported_video_sizes(linphone_gtk_get_core());;
int i,active=0;
char vsize_def[256];
MSVideoSize cur=linphone_core_get_preferred_video_size(linphone_gtk_get_core());
/* glade creates a combo box without list model and text renderer,
unless we fill it with a dummy text.
This dummy text needs to be removed first*/
gtk_combo_box_remove_text(GTK_COMBO_BOX(combo),0);
for(i=0;def->name!=NULL;++def,++i){
snprintf(vsize_def,sizeof(vsize_def),"%s (%ix%i)",def->name,def->vsize.width,def->vsize.height);
gtk_combo_box_append_text(GTK_COMBO_BOX(combo),vsize_def);
if (cur.width==def->vsize.width && cur.height==def->vsize.height) active=i;
}
gtk_combo_box_set_active(GTK_COMBO_BOX(combo),active);
}
void linphone_gtk_parameters_closed(GtkWidget *button){
GtkWidget *pb=gtk_widget_get_toplevel(button);
gtk_widget_destroy(pb);
......@@ -153,6 +170,14 @@ void linphone_gtk_cam_changed(GtkWidget *w){
g_free(sel);
}
void linphone_gtk_video_size_changed(GtkWidget *w){
int sel=gtk_combo_box_get_active(GTK_COMBO_BOX(w));
const MSVideoSizeDef *defs=linphone_core_get_supported_video_sizes(linphone_gtk_get_core());
if (defs<0) return;
linphone_core_set_preferred_video_size(linphone_gtk_get_core(),
defs[sel].vsize);
}
void linphone_gtk_ring_file_set(GtkWidget *w){
gchar *file=gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(w));
linphone_core_set_ring(linphone_gtk_get_core(),file);
......@@ -623,6 +648,7 @@ void linphone_gtk_show_parameters(void){
linphone_core_get_capture_device(lc));
linphone_gtk_fill_combo_box(linphone_gtk_get_widget(pb,"webcams"),linphone_core_get_video_devices(lc),
linphone_core_get_video_device(lc));
linphone_gtk_fill_video_sizes(linphone_gtk_get_widget(pb,"video_size"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"echo_cancelation")),
linphone_core_echo_cancelation_enabled(lc));
......
......@@ -101,17 +101,24 @@ AC_DEFUN([MS_CHECK_VIDEO],[
PKG_CHECK_MODULES(SWSCALE, [libswscale >= 0.5.0 ], [echo "We have libswscale"],
[echo "We don't have libswscale, let's hope its symbols are in libavcodec"] )
MS_CHECK_DEP([SDL],[SDL],[${libsdldir}/include],[${libsdldir}/lib],[SDL/SDL.h],[SDL],[SDL_Init])
if test "$SDL_found" = "no" ; then
AC_MSG_ERROR([Could not find libsdl headers and library. This is mandatory for video support])
if test "$libsdldir" != "none" ; then
MS_CHECK_DEP([SDL],[SDL],[${libsdldir}/include],[${libsdldir}/lib],[SDL/SDL.h],[SDL],[SDL_Init])
if test "$SDL_found" = "no" ; then
AC_MSG_ERROR([Could not find libsdl headers and library. This is mandatory for video support])
fi
fi
PKG_CHECK_MODULES(THEORA, [theora >= 1.0alpha7 ], [have_theora=yes],
[have_theora=no])
AC_CHECK_HEADERS(X11/Xlib.h)
VIDEO_CFLAGS=" $FFMPEG_CFLAGS $SDL_CFLAGS -DVIDEO_ENABLED "
VIDEO_LIBS=" $FFMPEG_LIBS $SWSCALE_LIBS $SDL_LIBS"
VIDEO_CFLAGS=" $FFMPEG_CFLAGS -DVIDEO_ENABLED"
VIDEO_LIBS=" $FFMPEG_LIBS $SWSCALE_LIBS"
if test "$SDL_found" = "yes" ; then
VIDEO_CFLAGS="$VIDEO_CFLAGS $SDL_CFLAGS -DHAVE_SDL"
VIDEO_LIBS="$VIDEO_LIBS $SDL_LIBS"
fi
if test "${ac_cv_header_X11_Xlib_h}" = "yes" ; then
VIDEO_LIBS="$VIDEO_LIBS -lX11"
......
......@@ -21,10 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef MEDIASTREAM_H
#define MEDIASTREAM_H
#include "msfilter.h"
#include "msticker.h"
#include "mssndcard.h"
#include "mswebcam.h"
#include "mediastreamer2/msfilter.h"
#include "mediastreamer2/msticker.h"
#include "mediastreamer2/mssndcard.h"
#include "mediastreamer2/mswebcam.h"
#include "mediastreamer2/msvideo.h"
#include "ortp/ortp.h"
#include "ortp/event.h"
......@@ -119,11 +120,12 @@ struct _VideoStream
MSFilter *rtprecv;
MSFilter *rtpsend;
OrtpEvQueue *evq;
MSVideoSize sent_vsize;
bool_t adapt_bitrate;
};
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);
int video_stream_start(VideoStream * stream, RtpProfile *profile, const char *remip, int remport, int rem_rtcp_port,
......@@ -133,9 +135,10 @@ void video_stream_set_rtcp_information(VideoStream *st, const char *cname, const
/*function to call periodically to handle various events */
void video_stream_iterate(VideoStream *stream);
void video_stream_send_vfu(VideoStream *stream);
void video_stream_stop (VideoStream * stream);
void video_stream_stop(VideoStream * stream);
void video_stream_set_sent_video_size(VideoStream *stream, MSVideoSize vsize);
VideoStream * video_preview_start(MSWebCam *device);
VideoStream * video_preview_start(MSWebCam *device, MSVideoSize vsize);
void video_preview_stop(VideoStream *stream);
int video_stream_recv_only_start(VideoStream * stream, RtpProfile *profile, const char *remip, int remport, int payload, int jitt_comp);
......
......@@ -48,11 +48,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MS_VIDEO_SIZE_1024_W 1024
#define MS_VIDEO_SIZE_1024_H 768
#define MS_VIDEO_SIZE_800X600_W 800
#define MS_VIDEO_SIZE_800X600_H 600
#define MS_VIDEO_SIZE_MAX_W MS_VIDEO_SIZE_1024_W
#define MS_VIDEO_SIZE_MAX_H MS_VIDEO_SIZE_1024_H
typedef struct MSVideoSize{
int width,height;
int16_t width,height;
} MSVideoSize;
typedef struct MSRect{
......@@ -73,6 +76,24 @@ typedef struct MSRect{
#define MS_VIDEO_SIZE_1024 (MSVideoSize){MS_VIDEO_SIZE_1024_W, MS_VIDEO_SIZE_1024_H}
#define MS_VIDEO_SIZE_800X600 (MSVideoSize){MS_VIDEO_SIZE_800X600_W, MS_VIDEO_SIZE_800X600_H}
static inline bool_t ms_video_size_greater_than(MSVideoSize vs1, MSVideoSize vs2){
return (vs1.width>=vs2.width) && (vs1.height>=vs2.height);
}
static inline MSVideoSize ms_video_size_max(MSVideoSize vs1, MSVideoSize vs2){
return ms_video_size_greater_than(vs1,vs2) ? vs1 : vs2;
}
static inline MSVideoSize ms_video_size_min(MSVideoSize vs1, MSVideoSize vs2){
return ms_video_size_greater_than(vs1,vs2) ? vs2 : vs1;
}
static inline bool_t ms_video_size_equal(MSVideoSize vs1, MSVideoSize vs2){
return vs1.width==vs2.width && vs1.height==vs2.height;
}
typedef enum{
MS_YUV420P,
MS_YUYV,
......
......@@ -45,6 +45,7 @@ typedef struct _MSDisplayDesc{
void (*update)(struct _MSDisplay *); /*display the picture to the screen*/
void (*uninit)(struct _MSDisplay *);
bool_t (*pollevent)(struct _MSDisplay *, MSDisplayEvent *ev);
long default_window_id;
}MSDisplayDesc;
typedef struct _MSDisplay{
......@@ -76,6 +77,12 @@ extern MSDisplayDesc ms_sdl_display_desc;
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);
......@@ -85,6 +92,7 @@ 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)
#ifdef __cplusplus
}
......
......@@ -177,7 +177,10 @@ static int enc_set_br(MSFilter *f, void *arg){
EncData *d=(EncData*)f->data;
d->bitrate=*(int*)arg;
if (d->bitrate>=1024000){
if (d->bitrate>=1024000){
d->vsize=MS_VIDEO_SIZE_VGA;
d->fps=25;
}else if (d->bitrate>=512000){
d->vsize=MS_VIDEO_SIZE_VGA;
d->fps=15;
}else if (d->bitrate>=384000){
......
......@@ -63,6 +63,9 @@ int yuv_buf_init_from_mblk(YuvBuf *buf, mblk_t *m){
}else if (size==(MS_VIDEO_SIZE_1024_W*MS_VIDEO_SIZE_1024_H*3)/2){
w=MS_VIDEO_SIZE_1024_W;
h=MS_VIDEO_SIZE_1024_H;
}else if (size==(MS_VIDEO_SIZE_800X600_W*MS_VIDEO_SIZE_800X600_H*3)/2){
w=MS_VIDEO_SIZE_800X600_W;
h=MS_VIDEO_SIZE_800X600_H;
}else if (size==(160*112*3)/2){/*format used by econf*/
w=160;
h=112;
......
......@@ -153,7 +153,7 @@ static void enc_init(MSFilter *f, enum CodecID codec)
f->data=s;
ms_ffmpeg_check_init();
s->profile=0;/*always default to profile 0*/
s->comp_buf=allocb(32000,0);
s->comp_buf=NULL;
s->fps=15;
s->mtu=ms_get_payload_max_size()-2;/*-2 for the H263 payload header*/
s->maxbr=500000;
......@@ -202,7 +202,7 @@ static void prepare(EncState *s){
c->time_base.den = (int)s->fps;
c->gop_size=(int)s->fps*5; /*emit I frame every 5 seconds*/
c->pix_fmt=PIX_FMT_YUV420P;
s->comp_buf=allocb(c->bit_rate*2,0);
if (s->codec==CODEC_ID_SNOW){
c->strict_std_compliance=-2;
}
......@@ -245,7 +245,6 @@ static void prepare_mpeg4(EncState *s){
static void enc_uninit(MSFilter *f){
EncState *s=(EncState*)f->data;
if (s->comp_buf!=NULL) freemsg(s->comp_buf);
ms_free(s);
}
#if 0
......@@ -292,6 +291,10 @@ static void enc_postprocess(MSFilter *f){
avcodec_close(&s->av_context);
s->av_context.codec=NULL;
}
if (s->comp_buf!=NULL) {
freemsg(s->comp_buf);
s->comp_buf=NULL;
}
}
static void add_rfc2190_header(mblk_t **packet, AVCodecContext *context){
......
......@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "ffmpeg-priv.h"
static int video_out_handle_resize(MSFilter *f, void *arg);
static int video_out_set_vsize(MSFilter *f,void *arg);
bool_t ms_display_poll_event(MSDisplay *d, MSDisplayEvent *ev){
if (d->desc->pollevent)
......@@ -35,7 +35,7 @@ bool_t ms_display_poll_event(MSDisplay *d, MSDisplayEvent *ev){
else return FALSE;
}
#ifndef WIN32
#ifdef HAVE_SDL
#include <SDL/SDL.h>
#include <SDL/SDL_video.h>
......@@ -78,6 +78,8 @@ static void sdl_show_window(bool_t show){
#endif
static void sdl_display_uninit(MSDisplay *obj);
static SDL_Overlay * sdl_create_window(int w, int h){
SDL_Overlay *lay;
sdl_screen = SDL_SetVideoMode(w,h, 0,SDL_SWSURFACE|SDL_RESIZABLE);
......@@ -89,13 +91,16 @@ static SDL_Overlay * sdl_create_window(int w, int h){
if (sdl_screen->flags & SDL_HWSURFACE) ms_message("SDL surface created in hardware");
SDL_WM_SetCaption("Linphone Video", NULL);
ms_message("Using yuv overlay.");
lay=SDL_CreateYUVOverlay(w,h,SDL_YV12_OVERLAY,sdl_screen);
lay=SDL_CreateYUVOverlay(w , h ,SDL_YV12_OVERLAY,sdl_screen);
if (lay==NULL){
ms_warning("Couldn't create yuv overlay: %s\n",
SDL_GetError());
return NULL;
}else{
if (lay->hw_overlay) ms_message("YUV overlay using hardware acceleration.");
ms_message("%i x %i YUV overlay created: hw_accel=%i, pitches=%i,%i,%i",lay->w,lay->h,lay->hw_overlay,
lay->pitches[0],lay->pitches[1],lay->pitches[2]);
ms_message("planes= %p %p %p %i %i",lay->pixels[0],lay->pixels[1],lay->pixels[2],
lay->pixels[1]-lay->pixels[0],lay->pixels[2]-lay->pixels[1]);
}
return lay;
}
......@@ -113,8 +118,9 @@ static bool_t sdl_display_init(MSDisplay *obj, MSPicture *fbuf){
sdl_initialized=TRUE;
ms_mutex_init(&sdl_mutex,NULL);
}
if (obj->data!=NULL)
if (obj->data!=NULL){
SDL_FreeYUVOverlay((SDL_Overlay*)obj->data);
}
lay=sdl_create_window(fbuf->w, fbuf->h);
if (lay){
......@@ -124,6 +130,8 @@ static bool_t sdl_display_init(MSDisplay *obj, MSPicture *fbuf){
fbuf->strides[0]=lay->pitches[0];
fbuf->strides[1]=lay->pitches[2];
fbuf->strides[2]=lay->pitches[1];
fbuf->w=lay->w;
fbuf->h=lay->h;
obj->data=lay;
sdl_show_window(TRUE);
return TRUE;
......@@ -158,36 +166,22 @@ static void sdl_display_update(MSDisplay *obj){
static bool_t sdl_poll_event(MSDisplay *obj, MSDisplayEvent *ev){
SDL_Event event;
static MSDisplayEvent last_ev;
static struct timeval tv;
static bool_t got_rs_ev=FALSE;
struct timeval cur;
int elapsed;
bool_t ret=FALSE;
if (sdl_screen==NULL) return FALSE;
ms_mutex_lock(&sdl_mutex);
if (SDL_PollEvent(&event)){
ms_mutex_unlock(&sdl_mutex);
switch(event.type){
case SDL_VIDEORESIZE:
last_ev.evtype=MS_DISPLAY_RESIZE_EVENT;
last_ev.w=event.resize.w;
last_ev.h=event.resize.h;
got_rs_ev=TRUE;
gettimeofday(&tv,NULL);
ev->evtype=MS_DISPLAY_RESIZE_EVENT;
ev->w=event.resize.w;
ev->h=event.resize.h;
return TRUE;
break;
default:
break;
}
}else ms_mutex_unlock(&sdl_mutex);
if (got_rs_ev){
gettimeofday(&cur,NULL);
elapsed=((cur.tv_sec-tv.tv_sec)*1000) + ((cur.tv_usec-tv.tv_usec)/1000);
if (elapsed>1000){
got_rs_ev=FALSE;
*ev=last_ev;
ret=TRUE;
}
}
return ret;
}
......@@ -213,7 +207,7 @@ MSDisplayDesc ms_sdl_display_desc={
.pollevent=sdl_poll_event
};
#else
#elif defined(WIN32)
#include <Vfw.h>
......@@ -386,25 +380,6 @@ static void yuv420p_to_rgb(MSPicture *src, uint8_t *rgb){
ms_error("Error in 420->rgb sws_scale().");
}
sws_freeContext(sws);
#if 0
/*revert colors*/
{
int i,j,stride;
rgb_t pix;
stride=src->w*3;
p=rgb;
for(i=0;i<src->h;++i){
for(j=0;j<stride;j+=3){
pix.r=p[j];
pix.g=p[j+1];
pix.b=p[j+2];
p[j]=pix.b;
p[j+2]=pix.r;
}
p+=stride;
}
}
#endif
}
static void win_display_update(MSDisplay *obj){
......@@ -465,12 +440,6 @@ static void win_display_uninit(MSDisplay *obj){
}
bool_t win_display_pollevent(MSDisplay *d, MSDisplayEvent *ev){
WinDisplay *wd=(WinDisplay*)d->data;
if (wd->new_ev){
wd->new_ev=FALSE;
*ev=wd->last_rsz;
return TRUE;
}
return FALSE;
}
......@@ -514,6 +483,24 @@ void ms_display_destroy(MSDisplay *obj){
ms_free(obj);
}
#ifdef HAVE_SDL
static MSDisplayDesc *default_display_desc=&ms_sdl_display_desc;
#elif defined(WIN32)
static MSDisplayDesc *default_display_desc=&ms_win_display_desc;
#endif
void ms_display_desc_set_default(MSDisplayDesc *desc){
default_display_desc=desc;
}
MSDisplayDesc * ms_display_desc_get_default(void){
return default_display_desc;
}
void ms_display_desc_set_default_window_id(MSDisplayDesc *desc, long id){
desc->default_window_id=id;
}
typedef struct VideoOut
{
AVRational ratio;
......@@ -527,6 +514,7 @@ typedef struct VideoOut
MSDisplay *display;
bool_t own_display;
bool_t ready;
bool_t autofit;
} VideoOut;
......@@ -535,8 +523,8 @@ typedef struct VideoOut
static void set_corner(VideoOut *s, int corner)
{
s->corner=corner;
s->local_pic.w=s->fbuf.w/SCALE_FACTOR;
s->local_pic.h=s->fbuf.h/SCALE_FACTOR;
s->local_pic.w=(s->fbuf.w/SCALE_FACTOR) & ~0x1;
s->local_pic.h=(s->fbuf.h/SCALE_FACTOR) & ~0x1;
if (corner==1)
{
/* top left corner */
......@@ -573,13 +561,10 @@ static void set_corner(VideoOut *s, int corner)
}
static void set_vsize(VideoOut *s, MSVideoSize *sz){
if (s->ratio.num!=0){
sz->width=sz->width & (~0x1);
sz->height=sz->width*s->ratio.den/s->ratio.num;
}
s->fbuf.w=sz->width;
s->fbuf.h=sz->height;
set_corner(s, s->corner);
s->fbuf.w=sz->width & ~0x1;
s->fbuf.h=sz->height & ~0x1;
set_corner(s,s->corner);
ms_message("Video size set to %ix%i",s->fbuf.w,s->fbuf.h);
}
static void video_out_init(MSFilter *f){
......@@ -596,6 +581,7 @@ static void video_out_init(MSFilter *f){
obj->display=NULL;
obj->own_display=FALSE;
obj->ready=FALSE;
obj->autofit=FALSE;
set_vsize(obj,&def_size);
f->data=obj;
}
......@@ -620,15 +606,10 @@ static void video_out_uninit(MSFilter *f){
ms_free(obj);
}
static void video_out_preprocess(MSFilter *f){
static void video_out_prepare(MSFilter *f){
VideoOut *obj=(VideoOut*)f->data;
if (obj->display==NULL){
#ifndef WIN32
obj->display=ms_display_new(&ms_sdl_display_desc);
#else
obj->display=ms_display_new(&ms_win_display_desc);
#endif
obj->display=ms_display_new(default_display_desc);
obj->own_display=TRUE;
}
if (!ms_display_init(obj->display,&obj->fbuf)){
......@@ -647,9 +628,30 @@ static void video_out_preprocess(MSFilter *f){
freemsg(obj->local_msg);
obj->local_msg=NULL;
}
set_corner(obj,obj->corner);
obj->ready=TRUE;
}
static int video_out_handle_resizing(MSFilter *f, void *data){
VideoOut *s=(VideoOut*)f->data;
MSDisplay *disp=s->display;
if (disp!=NULL){
MSDisplayEvent ev;
if (ms_display_poll_event(disp,&ev)){
if (ev.evtype==MS_DISPLAY_RESIZE_EVENT){
MSVideoSize sz;
sz.width=ev.w;
sz.height=ev.h;
ms_filter_lock(f);
set_vsize(s,&sz);
s->ready=FALSE;
ms_filter_unlock(f);
}
}
}
return 0;
}
static void video_out_postprocess(MSFilter *f){
}
......@@ -658,11 +660,8 @@ static void video_out_process(MSFilter *f){
VideoOut *obj=(VideoOut*)f->data;
mblk_t *inm;
#ifdef WIN32
video_out_handle_resize(f, NULL);
#endif
ms_filter_lock(f);
if (!obj->ready) video_out_prepare(f);
if (obj->display==NULL){
ms_filter_unlock(f);
if (f->inputs[0]!=NULL)
......@@ -705,6 +704,17 @@ static void video_out_process(MSFilter *f){
MSPicture src;
if (yuv_buf_init_from_mblk(&src,inm)==0){
if (obj->sws1==NULL){
MSVideoSize cur,newsize;
cur.width=obj->fbuf.w;
cur.height=obj->fbuf.h;
newsize.width=src.w;
newsize.height=src.h;
if (obj->autofit && (ms_video_size_greater_than(newsize,cur) &&
!ms_video_size_equal(newsize,cur) ) ){
set_vsize(obj,&newsize);
video_out_prepare(f);
obj->autofit=FALSE;
}
obj->sws1=sws_getContext(src.w,src.h,PIX_FMT_YUV420P,
obj->fbuf.w,obj->fbuf.h,PIX_FMT_YUV420P,
SWS_FAST_BILINEAR, NULL, NULL, NULL);
......@@ -734,18 +744,14 @@ static void video_out_process(MSFilter *f){
corner.planes,corner.strides,roi);
ms_display_unlock(obj->display);
}
ms_display_update(obj->display);
ms_filter_unlock(f);
}
static int video_out_set_vsize(MSFilter *f,void *arg){
VideoOut *s=(VideoOut*)f->data;
bool_t reconfigure;
ms_filter_lock(f);
reconfigure=s->ready;
set_vsize(s,(MSVideoSize*)arg);
if (reconfigure) video_out_preprocess(f);
ms_filter_unlock(f);
return 0;
}
......@@ -756,30 +762,16 @@ static int video_out_set_display(MSFilter *f,void *arg){
return 0;
}