git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@152 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
smorlat 2008-11-03 13:42:53 +00:00
parent 9c6e605818
commit e7680ddaa6
3 changed files with 26 additions and 25 deletions

View file

@ -129,6 +129,8 @@ static int v4l2_configure(V4l2State *s){
return -1;
}
ms_message("Driver is %s",cap.driver);
if (v4lv2_try_format(s,V4L2_PIX_FMT_YUV420)){
s->pix_fmt=MS_YUV420P;
s->int_pix_fmt=V4L2_PIX_FMT_YUV420;

View file

@ -125,7 +125,7 @@ void static_image_init(MSFilter *f){
SIData *d=(SIData*)ms_new(SIData,1);
d->vsize.width=MS_VIDEO_SIZE_CIF_W;
d->vsize.height=MS_VIDEO_SIZE_CIF_H;
memset(d->nowebcamimage, 0, sizeof(d->nowebcamimage));
memset(d->nowebcamimage, 0, sizeof(d->nowebcamimage));
d->index=-1;
d->lasttime=0;
d->pic=NULL;
@ -138,27 +138,26 @@ void static_image_uninit(MSFilter *f){
void static_image_preprocess(MSFilter *f){
SIData *d=(SIData*)f->data;
if (d->pic==NULL)
{
if (d->nowebcamimage[0] != '\0')
d->pic=ms_load_jpeg_as_yuv(d->nowebcamimage,&d->vsize);
else
d->pic=ms_load_nowebcam(&d->vsize,d->index);
}
if (d->pic==NULL){
if (d->nowebcamimage[0] != '\0')
d->pic=ms_load_jpeg_as_yuv(d->nowebcamimage,&d->vsize);
else
d->pic=ms_load_nowebcam(&d->vsize,d->index);
}
}
void static_image_process(MSFilter *f){
SIData *d=(SIData*)f->data;
/*output a frame every second*/
if ((f->ticker->time - d->lasttime>1000) || d->lasttime==0){
ms_mutex_lock(&f->lock);
ms_mutex_lock(&f->lock);
if (d->pic) {
mblk_t *o=dupb(d->pic);
/*prevent mirroring at the output*/
mblk_set_precious_flag(o,1);
ms_queue_put(f->outputs[0],o);
}
ms_mutex_unlock(&f->lock);
ms_mutex_unlock(&f->lock);
d->lasttime=f->ticker->time;
}
}
@ -190,24 +189,24 @@ int static_image_get_pix_fmt(MSFilter *f, void *data){
return 0;
}
static int static_image_set_image(MSFilter *f, void *arg){
SIData *d=(SIData*)f->data;
char *image = (char *)arg;
ms_mutex_lock(&f->lock);
if (image!=NULL && image[0]!='\0')
snprintf(d->nowebcamimage, sizeof(d->nowebcamimage), "%s", image);
else
d->nowebcamimage[0] = '\0';
if (d->pic!=NULL)
freemsg(d->pic);
static int static_image_set_image(MSFilter *f, void *arg){
SIData *d=(SIData*)f->data;
char *image = (char *)arg;
ms_mutex_lock(&f->lock);
if (image!=NULL && image[0]!='\0')
snprintf(d->nowebcamimage, sizeof(d->nowebcamimage), "%s", image);
else
d->nowebcamimage[0] = '\0';
if (d->pic!=NULL)
freemsg(d->pic);
//if (d->nowebcamimage[0] != '\0')
// d->pic=ms_load_jpeg_as_yuv(d->nowebcamimage,&d->vsize);
//else
// d->pic=ms_load_nowebcam(&d->vsize,d->index);
ms_mutex_unlock(&f->lock);
return 0;
ms_mutex_unlock(&f->lock);
return 0;
}
MSFilterMethod static_image_methods[]={

View file

@ -22,7 +22,7 @@ LDADD= $(top_builddir)/src/libmediastreamer.la \
$(SPEEX_LIBS) \
$(GSM_LIBS) \
$(THEORA_LIBS) \
$(FFMPEG_LIBS)
$(VIDEO_LIBS)