linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] problem with video output filter?


From: Vadim Lebedev
Subject: [Linphone-developers] problem with video output filter?
Date: Wed, 03 Dec 2008 16:22:16 +0100
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

Hello,

I've built mediastreamer2 (on linux) from latest linphone svn

And i'm testing video functionality with videodisplay.c test app (i'm attaching modfiied source)

It mostly works but there are couple of quirks:
When i start the app the it shows the camera feed in the window
After  "attaching tee filter message"  the window is black for 400 frames
Then for 4 periods of 400 frames i see the small ovrelay window in each of the 4 corners
then 400 more frames without corner overlay
after the message "detaching tee filter"  the window becomes black.

It seems something bad happens when attaching/detaching tee filter and which fixes itself when SET_CORNER is done


Thanks
Vadim



/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 2006  Simon MORLAT (address@hidden)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#include "mediastreamer2/mediastream.h"
#include "mediastreamer2/msvideoout.h"
#include "mediastreamer2/msv4l.h"

int main(int argc, char *argv[]){
        VideoStream *vs;
        MSWebCam *cam;
        MSVideoSize vsize;
        int i;

        vsize.width=MS_VIDEO_SIZE_CIF_W;
        vsize.height=MS_VIDEO_SIZE_CIF_H;

        ortp_init();
        
ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
        ms_init();
        cam=ms_web_cam_manager_get_default_cam(ms_web_cam_manager_get());
        /* this is to test the sequence start/stop */
        for(i=0;i<1;++i){
                int n;
                vs=video_preview_start(cam,vsize);

                for(n=0;n<3200;++n){
#ifdef WIN32
                        MSG msg;
                Sleep(100);
                        while (PeekMessage(&msg, NULL, 0, 0,1)){
                                TranslateMessage(&msg);
                                DispatchMessage(&msg);
                        }
#else
                        struct timespec ts;
                        ts.tv_sec=0;
                        ts.tv_nsec=10000000;
                        nanosleep(&ts,NULL);

                        if (vs) video_stream_iterate(vs);
#endif

/* test code */
                        if (n==400)
                          {
                            ortp_message("attaching tee filter\n");
                            ms_ticker_detach (vs->ticker, vs->source);

                            vs->tee = ms_filter_new(MS_TEE_ID);

                            ms_filter_unlink(vs->pixconv,0, vs->output,0);

                            ms_filter_link(vs->pixconv,0,vs->tee,0);
                            ms_filter_link(vs->tee,0,vs->output,0);
                            ms_filter_link(vs->tee,1,vs->output,1);
                            
                            //ms_filter_unlink(vs->tee,0,vs->output,0);
                            ms_ticker_attach (vs->ticker, vs->source);

                          }
                        if (n==800)
                          {
                            int corner=0;
                            ortp_message("setting corner to 0\n");
                            
ms_filter_call_method(vs->output,MS_VIDEO_OUT_SET_CORNER,&corner);
                          }
                        if (n==1200)
                          {
                            ortp_message("setting corner to 1\n");
                            int corner=1;
                            
ms_filter_call_method(vs->output,MS_VIDEO_OUT_SET_CORNER,&corner);
                          }
                        if (n==1600)
                          {
                            int corner=2;
                            ortp_message("setting corner to 2\n");
                            
ms_filter_call_method(vs->output,MS_VIDEO_OUT_SET_CORNER,&corner);
                          }
                        if (n==2000)
                          {
                            int corner=3;
                            ortp_message("setting corner to 3\n");
                            
ms_filter_call_method(vs->output,MS_VIDEO_OUT_SET_CORNER,&corner);
                          }

                        if (n==2400)
                          {
                            int corner=-1;
                            ortp_message("setting corner to -1\n");
                            
ms_filter_call_method(vs->output,MS_VIDEO_OUT_SET_CORNER,&corner);
                          }

                        if (n==2800)
                          {

                            ortp_message("detaching tee filter\n");
                            ms_ticker_detach (vs->ticker, vs->source);

                            ms_filter_unlink(vs->pixconv,0,vs->tee,0);
                            ms_filter_unlink(vs->tee,0,vs->output,0);
                            ms_filter_unlink(vs->tee,1,vs->output,1);
                            ms_filter_destroy(vs->tee);
                            vs->tee=NULL;

                            ms_filter_link(vs->pixconv,0, vs->output,0);

                            
                            ms_ticker_attach (vs->ticker, vs->source);
                          }
                }
                video_preview_stop(vs);
        }
        return 0;
}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]