diff --git a/include/mediastreamer2/mediastream.h b/include/mediastreamer2/mediastream.h index 47e9546..00ce4f2 100644 --- a/include/mediastreamer2/mediastream.h +++ b/include/mediastreamer2/mediastream.h @@ -226,7 +226,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 vsize); +VideoStream * video_preview_start(MSWebCam *device, MSVideoSize disp_size, const char *displaytype); void video_preview_stop(VideoStream *stream); bool_t ms_is_ipv6(const char *address); diff --git a/src/msv4l2.c b/src/msv4l2.c index 1df88e6..94d89c3 100644 --- a/src/msv4l2.c +++ b/src/msv4l2.c @@ -382,7 +382,7 @@ static void msv4l2_uninit(MSFilter *f){ V4l2State *s=(V4l2State*)f->data; ms_free(s->dev); #ifdef V4L2_THREADED - ms_mutex_destroy(&s->mutex); + ms_mutex_destroy(&s->mutex); #endif ms_free(s); } @@ -390,7 +390,6 @@ static void msv4l2_uninit(MSFilter *f){ #ifdef V4L2_THREADED static void *msv4l2_thread(void *ptr){ V4l2State *s=(V4l2State*)ptr; - int err=-1; ms_message("msv4l2_thread starting"); if (s->fd!=-1) { @@ -407,13 +406,12 @@ static void *msv4l2_thread(void *ptr){ } if (msv4l2_do_mmap(s)!=0) { - ms_warning("msv4l2 do mmap"); + ms_warning("msv4l2 could not do mmap"); goto close; } ms_message("V4L2 video capture started."); while(s->thread_run) { - mblk_t *m; if (s->fd!=-1){ mblk_t *m; m=v4lv2_grab_image(s); @@ -425,9 +423,7 @@ static void *msv4l2_thread(void *ptr){ ms_mutex_unlock(&s->mutex); } } - } - ms_message("thread:%d",s->thread_run); -munmap: + } msv4l2_do_munmap(s); close: msv4l2_close(s); @@ -471,12 +467,12 @@ static void msv4l2_process(MSFilter *f){ if (cur_frame>=s->frame_count){ mblk_t *om=NULL; - ms_mutex_lock(&s->mutex); /*keep the most recent frame if several frames have been captured */ if (s->fd!=-1){ + ms_mutex_lock(&s->mutex); om=getq(&s->rq); + ms_mutex_unlock(&s->mutex); } - ms_mutex_unlock(&s->mutex); if (om!=NULL){ timestamp=f->ticker->time*90;/* rtp uses a 90000 Hz clockrate for video*/ mblk_set_timestamp_info(om,timestamp); diff --git a/src/videostream.c b/src/videostream.c index 47b44aa..44e9381 100644 --- a/src/videostream.c +++ b/src/videostream.c @@ -432,7 +432,7 @@ unsigned long video_stream_get_native_window_id(VideoStream *stream){ } -VideoStream * video_preview_start(MSWebCam *device, MSVideoSize disp_size){ +VideoStream * video_preview_start(MSWebCam *device, MSVideoSize disp_size, const char *displaytype){ VideoStream *stream = (VideoStream *)ms_new0 (VideoStream, 1); MSVideoSize vsize=disp_size; MSPixFmt format; @@ -441,7 +441,10 @@ VideoStream * video_preview_start(MSWebCam *device, MSVideoSize disp_size){ int corner=-1; /* creates the filters */ - choose_display_name(stream); + if(!displaytype) + choose_display_name(stream); + else + video_stream_set_display_filter_name(stream,displaytype); stream->source = ms_web_cam_create_reader(device); stream->output=ms_filter_new_from_name (stream->display_name); diff --git a/tests/videodisplay.c b/tests/videodisplay.c index 4c69372..b42530a 100644 --- a/tests/videodisplay.c +++ b/tests/videodisplay.c @@ -37,7 +37,7 @@ int main(int argc, char *argv[]){ /* this is to test the sequence start/stop */ for(i=0;i<1;++i){ int n; - vs=video_preview_start(cam,vsize); + vs=video_preview_start(cam,vsize,NULL); for(n=0;n<1000;++n){ #ifdef WIN32