Changeset 1172:e577e30d6f73 in mediastreamer2


Ignore:
Timestamp:
Oct 12, 2010 9:43:01 PM (3 years ago)
Author:
Simon Morlat <simon.morlat@…>
Branch:
default
Children:
1173:6b4faa54125b, 1188:27fdd2536b36
Message:

use 2 windows, bugfixes

Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • include/mediastreamer2/mediastream.h

    r1171 r1172  
    238238void video_stream_send_only_stop(VideoStream *vs); 
    239239 
    240 VideoStream * video_preview_start(MSWebCam *device, MSVideoSize disp_size, const char *displaytype); 
    241 void video_preview_stop(VideoStream *stream); 
     240typedef VideoStream VideoPreview; 
     241 
     242VideoPreview * 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) 
     247void video_preview_start(VideoPreview *stream, MSWebCam *device); 
     248void video_preview_stop(VideoPreview *stream); 
    242249 
    243250bool_t ms_is_ipv6(const char *address); 
  • src/videostream.c

    r1171 r1172  
    514514 
    515515unsigned 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) 
    519519                        return id; 
    520520        } 
     
    526526} 
    527527 
    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; 
     528VideoPreview * 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 
     537void video_preview_start(VideoPreview *stream, MSWebCam *device){ 
    532538        MSPixFmt format; 
    533539        float fps=(float)29.97; 
    534540        int mirroring=1; 
    535541        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 
    542546        stream->source = ms_web_cam_create_reader(device); 
    543547 
    544         stream->output=ms_filter_new_from_name (stream->display_name); 
     548        stream->output2=ms_filter_new_from_name (displaytype); 
    545549 
    546550        /* configure the filters */ 
     
    559563 
    560564        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        } 
    565572        /* and then connect all */ 
    566573 
    567574        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); 
    569576 
    570577        /* create the ticker */ 
     
    572579        ms_ticker_set_name(stream->ticker,"Video MSTicker"); 
    573580        ms_ticker_attach (stream->ticker, stream->source); 
    574         return stream; 
    575581} 
    576582 
     
    578584        ms_ticker_detach(stream->ticker, stream->source); 
    579585        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); 
    581587         
    582588        video_stream_free(stream); 
  • src/x11video.c

    r1171 r1172  
    176176                if (s->window_id==0) return; 
    177177                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); 
    178181        } 
    179182        XGetWindowAttributes(s->display,s->window_id,&wa); 
     
    516519        unsigned long *id=(unsigned long*)arg; 
    517520        *id=s->window_id; 
    518         return -1; 
     521        return 0; 
    519522} 
    520523 
  • tests/Makefile.am

    r856 r1172  
    44 
    55if BUILD_VIDEO 
    6 noinst_PROGRAMS+=videodisplay 
     6noinst_PROGRAMS+=videodisplay test_x11window 
    77endif 
     8 
     9 
    810 
    911echo_SOURCES=echo.c 
     
    1214mtudiscover_SOURCES=mtudiscover.c 
    1315bench_SOURCES=bench.c 
     16test_x11window_SOURCES=test_x11window.c 
     17 
    1418 
    1519libexec_PROGRAMS=mediastream 
  • tests/videodisplay.c

    r1164 r1172  
    4848        for(i=0;i<1;++i){ 
    4949                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); 
    5153 
    5254        for(n=0;n<60000 && !stopped;++n){ 
Note: See TracChangeset for help on using the changeset viewer.