Changeset 1172:e577e30d6f73 in mediastreamer2
- Timestamp:
- Oct 12, 2010 9:43:01 PM (3 years ago)
- Branch:
- default
- Children:
- 1173:6b4faa54125b, 1188:27fdd2536b36
- Files:
-
- 1 added
- 5 edited
-
include/mediastreamer2/mediastream.h (modified) (1 diff)
-
src/videostream.c (modified) (5 diffs)
-
src/x11video.c (modified) (2 diffs)
-
tests/Makefile.am (modified) (2 diffs)
-
tests/test_x11window.c (added)
-
tests/videodisplay.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
include/mediastreamer2/mediastream.h
r1171 r1172 238 238 void video_stream_send_only_stop(VideoStream *vs); 239 239 240 VideoStream * video_preview_start(MSWebCam *device, MSVideoSize disp_size, const char *displaytype); 241 void video_preview_stop(VideoStream *stream); 240 typedef VideoStream VideoPreview; 241 242 VideoPreview * video_preview_new(); 243 #define video_preview_set_size(p,s) video_stream_set_sent_video_size(p,s) 244 #define video_preview_set_display_filter_name(p,dt) video_stream_set_display_filter_name(p,dt) 245 #define video_preview_set_native_window_id(p,id) video_stream_set_native_preview_window_id (p,id) 246 #define video_preview_get_native_window_id(p) video_stream_get_native_preview_window_id (p) 247 void video_preview_start(VideoPreview *stream, MSWebCam *device); 248 void video_preview_stop(VideoPreview *stream); 242 249 243 250 bool_t ms_is_ipv6(const char *address); -
src/videostream.c
r1171 r1172 514 514 515 515 unsigned long video_stream_get_native_preview_window_id(VideoStream *stream){ 516 unsigned long id ;517 if (stream->output ){518 if (ms_filter_call_method(stream->output ,MS_VIDEO_DISPLAY_GET_NATIVE_WINDOW_ID,&id)==0)516 unsigned long id=0; 517 if (stream->output2){ 518 if (ms_filter_call_method(stream->output2,MS_VIDEO_DISPLAY_GET_NATIVE_WINDOW_ID,&id)==0) 519 519 return id; 520 520 } … … 526 526 } 527 527 528 529 VideoStream * video_preview_start(MSWebCam *device, MSVideoSize disp_size, const char *displaytype){ 530 VideoStream *stream = (VideoStream *)ms_new0 (VideoStream, 1); 531 MSVideoSize vsize=disp_size; 528 VideoPreview * video_preview_new(void){ 529 VideoPreview *stream = (VideoPreview *)ms_new0 (VideoPreview, 1); 530 stream->sent_vsize.width=MS_VIDEO_SIZE_CIF_W; 531 stream->sent_vsize.height=MS_VIDEO_SIZE_CIF_H; 532 choose_display_name(stream); 533 return stream; 534 } 535 536 537 void video_preview_start(VideoPreview *stream, MSWebCam *device){ 532 538 MSPixFmt format; 533 539 float fps=(float)29.97; 534 540 int mirroring=1; 535 541 int corner=-1; 536 537 /* creates the filters */ 538 if(!displaytype) 539 choose_display_name(stream); 540 else 541 video_stream_set_display_filter_name(stream,displaytype); 542 MSVideoSize disp_size=stream->sent_vsize; 543 MSVideoSize vsize=disp_size; 544 const char *displaytype=stream->display_name; 545 542 546 stream->source = ms_web_cam_create_reader(device); 543 547 544 stream->output =ms_filter_new_from_name (stream->display_name);548 stream->output2=ms_filter_new_from_name (displaytype); 545 549 546 550 /* configure the filters */ … … 559 563 560 564 format=MS_YUV420P; 561 ms_filter_call_method(stream->output,MS_FILTER_SET_PIX_FMT,&format); 562 ms_filter_call_method(stream->output,MS_FILTER_SET_VIDEO_SIZE,&disp_size); 563 ms_filter_call_method(stream->output,MS_VIDEO_DISPLAY_ENABLE_MIRRORING,&mirroring); 564 ms_filter_call_method(stream->output,MS_VIDEO_DISPLAY_SET_LOCAL_VIEW_MODE,&corner); 565 ms_filter_call_method(stream->output2,MS_FILTER_SET_PIX_FMT,&format); 566 ms_filter_call_method(stream->output2,MS_FILTER_SET_VIDEO_SIZE,&disp_size); 567 ms_filter_call_method(stream->output2,MS_VIDEO_DISPLAY_ENABLE_MIRRORING,&mirroring); 568 ms_filter_call_method(stream->output2,MS_VIDEO_DISPLAY_SET_LOCAL_VIEW_MODE,&corner); 569 if (stream->preview_window_id!=0){ 570 ms_filter_call_method(stream->output2, MS_VIDEO_DISPLAY_SET_NATIVE_WINDOW_ID,&stream->preview_window_id); 571 } 565 572 /* and then connect all */ 566 573 567 574 ms_filter_link(stream->source,0, stream->pixconv,0); 568 ms_filter_link(stream->pixconv, 0, stream->output , 0);575 ms_filter_link(stream->pixconv, 0, stream->output2, 0); 569 576 570 577 /* create the ticker */ … … 572 579 ms_ticker_set_name(stream->ticker,"Video MSTicker"); 573 580 ms_ticker_attach (stream->ticker, stream->source); 574 return stream;575 581 } 576 582 … … 578 584 ms_ticker_detach(stream->ticker, stream->source); 579 585 ms_filter_unlink(stream->source,0,stream->pixconv,0); 580 ms_filter_unlink(stream->pixconv,0,stream->output ,0);586 ms_filter_unlink(stream->pixconv,0,stream->output2,0); 581 587 582 588 video_stream_free(stream); -
src/x11video.c
r1171 r1172 176 176 if (s->window_id==0) return; 177 177 s->own_window=TRUE; 178 }else if (s->own_window==FALSE){ 179 /*we need to register for resize events*/ 180 XSelectInput(s->display,s->window_id,StructureNotifyMask); 178 181 } 179 182 XGetWindowAttributes(s->display,s->window_id,&wa); … … 516 519 unsigned long *id=(unsigned long*)arg; 517 520 *id=s->window_id; 518 return -1;521 return 0; 519 522 } 520 523 -
tests/Makefile.am
r856 r1172 4 4 5 5 if BUILD_VIDEO 6 noinst_PROGRAMS+=videodisplay 6 noinst_PROGRAMS+=videodisplay test_x11window 7 7 endif 8 9 8 10 9 11 echo_SOURCES=echo.c … … 12 14 mtudiscover_SOURCES=mtudiscover.c 13 15 bench_SOURCES=bench.c 16 test_x11window_SOURCES=test_x11window.c 17 14 18 15 19 libexec_PROGRAMS=mediastream -
tests/videodisplay.c
r1164 r1172 48 48 for(i=0;i<1;++i){ 49 49 int n; 50 vs=video_preview_start(cam,vsize,NULL); 50 vs=video_preview_new(); 51 video_preview_set_size(vs,vsize); 52 video_preview_start(vs, cam); 51 53 52 54 for(n=0;n<60000 && !stopped;++n){
Note: See TracChangeset
for help on using the changeset viewer.
