ribi::MultiAlphaFilter::MultiAlphaFilter(
  const std::vector<double> alphas,
  const double dt)
  : m_filters(CreateFilters(alphas,dt))
{

}
예제 #2
0
DiathekeFilterMgr::DiathekeFilterMgr (char mark, char enc)
		   : EncodingFilterMgr(enc) {

        markup = mark;

        CreateFilters(markup);
}
예제 #3
0
//===============================================================================
//		
//===============================================================================
HRESULT DetectionModule_touchLib::DetectionModuleInit(WCHAR* videoFilename, WCHAR* saveGraphFileName, WCHAR* loadGraphFilename)
{
	HRESULT hr = S_OK;

	GSGraphBase::CreateGraph();


	hr = AddSourceFilter(videoFilename);
	hr = CreateFilters(); //or using loading graph 
	//hr = LoadGraphFile(graphFilename);
	hr = GetFiltersAndInterfaces();
	hr = GetPins();
	hr = ConnectGraph();


	m_paramSet = GetDefaultParameters();

	// Set call back function in FindBlobFilter
	void* myDM[]={this};
	m_pIFindBlobFilter->SetCallbackFunction(DetectionModule_touchLib::FingerResultCallBack,1,myDM);

	//--- Save current graph ---
	if(saveGraphFileName != NULL)
	{
		hr = SaveGraphFile(saveGraphFileName);
	}


	return hr;
}
bool HDevice::SetupEncodedVideoCapture(IBaseFilter *filter,
			VideoConfig &config,
			const EncodedDevice &info)
{
	CComPtr<IBaseFilter> crossbar;
	CComPtr<IBaseFilter> encoder;
	CComPtr<IBaseFilter> demuxer;
	MediaType            mtVideo;
	MediaType            mtAudio;

	if (!CreateFilters(filter, &crossbar, &encoder, &demuxer))
		return false;

	if (!CreateDemuxVideoPin(demuxer, mtVideo, info.width, info.height,
				info.frameInterval, info.videoFormat))
		return false;

	if (!CreateDemuxAudioPin(demuxer, mtAudio, info.samplesPerSec,
				16, 2, info.audioFormat))
		return false;

	config.cx             = info.width;
	config.cy             = info.height;
	config.frameInterval  = info.frameInterval;
	config.format         = info.videoFormat;
	config.internalFormat = info.videoFormat;

	PinCaptureInfo pci;
	pci.callback          = [this] (IMediaSample *s) {Receive(true, s);};
	pci.expectedMajorType = mtVideo->majortype;
	pci.expectedSubType   = mtVideo->subtype;

	videoCapture = new CaptureFilter(pci);
	videoFilter  = demuxer;

	if (!!encoder && config.name.find(L"IT9910") != std::string::npos) {
		rocketEncoder = encoder;

		if (!SetRocketEnabled(rocketEncoder, true))
			return false;
	}

	graph->AddFilter(crossbar,     L"Crossbar");
	graph->AddFilter(filter,       L"Device");
	graph->AddFilter(demuxer,      L"Demuxer");
	graph->AddFilter(videoCapture, L"Capture Filter");

	if (!!encoder)
		graph->AddFilter(encoder, L"Encoder");

	bool success = ConnecEncodedtFilters(graph, filter, crossbar,
			encoder, demuxer);
	if (success)
		success = MapPacketIDs(demuxer, info.videoPacketID,
				info.audioPacketID);

	return success;
}
예제 #5
0
SWORD_NAMESPACE_START

/******************************************************************************
 * MarkupFilterMgr Constructor - initializes instance of MarkupFilterMgr
 *
 * ENT:
 *      enc - Encoding format to emit
 *      mark - Markup format to emit
 */

MarkupFilterMgr::MarkupFilterMgr (char mark, char enc)
		   : EncodingFilterMgr(enc) {

        markup = mark;

        CreateFilters(markup);
}
예제 #6
0
/////////////////////////////////////////////////////////////////////////////////////////
// DirectShowフィルタの初期化処理
/////////////////////////////////////////////////////////////////////////////////////////
BOOL InitializeDirectDraw(HWND hWnd){
	
	HRESULT		hResult;

	// フィルタグラフ作成
	hResult = CoCreateInstance(CLSID_FilterGraph, NULL, 
		CLSCTX_INPROC, IID_IGraphBuilder, (void **)&g_pGraph);
	if (hResult != S_OK)return FALSE;

	// キャプチャデバイス取得
	hResult = GetCaptureDevice(&g_pSrc);
	if (hResult != TRUE)return FALSE;

	// キャプチャビルダの作成
	hResult = CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL, 
		CLSCTX_INPROC, IID_ICaptureGraphBuilder2, (void **)&g_pBuilder);
	if (hResult != S_OK)return FALSE;

	// グラフにキャプチャビルダをセット
	hResult = g_pBuilder->SetFiltergraph(g_pGraph);
	if (hResult != S_OK)return FALSE;

	// メディアコントロールを取得
	g_pGraph->QueryInterface(IID_IMediaControl, (void **)&g_pMediaCtrl);

	// フィルタの作成
	if( !CreateFilters() )return FALSE;
	// フィルタの接続
	if( !ConectFilters() )return FALSE;
	// ウィンドウのセット
	if( !SetWindow(hWnd) )return FALSE;
	
	// 処理開始
	hResult = g_pMediaCtrl->Run();

	return TRUE;
}
HRESULT 
CVideoCaptureTerminal::AddFiltersToGraph(
    )
{
    LOG((MSP_TRACE, "CVideoCaptureTerminal::AddFiltersToGraph called"));
    
    if (m_pGraph == NULL)
    {
        LOG((MSP_ERROR, "CVideoCaptureTerminal::AddFiltersToGraph - "
            "no graph - exit E_UNEXPECTED"));

        return E_UNEXPECTED;
    }

    HRESULT hr;

    hr = CreateFilters();

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CVideoCaptureTerminal::AddFiltersToGraph - "
            "CreateFilters failed - exit 0x%08x", hr));

        return hr;
    }

    //
    // Add the filter to the graph.
    //
    // A word about names:
    // If a filter has already been added with the same name (which will
    // happen if we have more than one video capture terminal in the same
    // graph) then that will return VFW_S_DUPLICATE_NAME, which is not
    // a failure.
    //

    try 
    {
        USES_CONVERSION;
        hr = m_pGraph->AddFilter(m_pIFilter, T2CW(m_szName));
    }
    catch (...)
    {
        LOG((MSP_ERROR, "CVideoCaptureTerminal::AddFiltersToGraph - T2CW threw an exception - "
            "return E_OUTOFMEMORY"));

        return E_OUTOFMEMORY;
    }

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CVideoCaptureTerminal::AddFiltersToGraph - "
            "AddFilter failed - exit 0x%08x", hr));

        return hr;
    }

    //
    // set the terminal's capture pin (output pin)
    //

    hr = FindCapturePin();

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CVideoCaptureTerminal::AddFiltersToGraph - "
            "FindCapturePin failed - exit 0x%08x", hr));

        return hr;
    }

    LOG((MSP_TRACE, "CVideoCaptureTerminal::AddFiltersToGraph succeeded"));
    return S_OK;
}
예제 #8
0
char DiathekeFilterMgr::Markup(char mark) {
        if (mark && mark != markup) {
                markup = mark;
                ModMap::const_iterator module;

                SWFilter * oldplain = fromplain;
                SWFilter * oldthml = fromthml;
                SWFilter * oldgbf = fromgbf;
                SWFilter * oldosis = fromosis;

                CreateFilters(markup);

                for (module = getParentMgr()->Modules.begin(); module != getParentMgr()->Modules.end(); module++)
                        switch (module->second->getMarkup()) {
                        case FMT_THML:
                                if (oldthml != fromthml) {
                                        if (oldthml) {
                                                if (!fromthml) {
                                                        module->second->removeRenderFilter(oldthml);
                                                }
                                                else {
                                                        module->second->replaceRenderFilter(oldthml, fromthml);
                                                }
                                        }
                                        else if (fromthml) {
                                                module->second->addRenderFilter(fromthml);
                                        }
                                }
                                break;
                        case FMT_GBF:
                                if (oldgbf != fromgbf) {
                                        if (oldgbf) {
                                                if (!fromgbf) {
                                                        module->second->removeRenderFilter(oldgbf);
                                                }
                                                else {
                                                        module->second->replaceRenderFilter(oldgbf, fromgbf);
                                                }
                                        }
                                        else if (fromgbf) {
                                                module->second->addRenderFilter(fromgbf);
                                        }
                                        break;
                                }
                        case FMT_PLAIN:
                                if (oldplain != fromplain) {
                                        if (oldplain) {
                                                if (!fromplain) {
                                                        module->second->removeRenderFilter(oldplain);
                                                }
                                                else {
                                                        module->second->replaceRenderFilter(oldplain, fromplain);
                                                }
                                        }
                                        else if (fromplain) {
                                                module->second->addRenderFilter(fromplain);
                                        }
                                        break;
                                }
                        case FMT_OSIS:
                                if (oldosis != fromosis) {
                                        if (oldosis) {
                                                if (!fromosis) {
                                                        module->second->removeRenderFilter(oldosis);
                                                }
                                                else {
                                                        module->second->replaceRenderFilter(oldosis, fromosis);
                                                }
                                        }
                                        else if (fromosis) {
                                                module->second->addRenderFilter(fromosis);
                                        }
                                        break;
                                }
                        }

                if (oldthml)
                        delete oldthml;
                if (oldgbf)
                        delete oldgbf;
                if (oldplain)
                        delete oldplain;
                if (oldosis)
                        delete oldosis;
        }
        return markup;
}
예제 #9
0
파일: main.c 프로젝트: gale320/cc3200
//*****************************************************************************
//
//! NwpFilter - Function which Creates and Enables the Filter
//!
//! \param  pvParameters
//!
//! \return 0
//!
//*****************************************************************************
static int NwpFilter(void *pvParameters)
{
    long lRetVal = 0;
    InitializeAppVariables();

    //
    // Following function configure the device to default state by cleaning
    // the persistent settings stored in NVMEM (viz. connection profiles &
    // policies, power policy etc)
    //
    // Applications may choose to skip this step if the developer is sure
    // that the device is in its default state at start of applicaton
    //
    // Note that all profiles and persistent settings that were done on the
    // device will be lost
    //
    lRetVal = ConfigureSimpleLinkToDefaultState();
    if(lRetVal < 0)
    {
        if (DEVICE_NOT_IN_STATION_MODE == lRetVal)
        {
            UART_PRINT("Failed to configure the device in its default state\n\r");
        }

        LOOP_FOREVER();
    }

    UART_PRINT("Device is configured in default state \n\r");

    //
    // Assumption is that the device is configured in station mode already
    // and it is in its default state
    //
    lRetVal = sl_Start(0, 0, 0);
    if (lRetVal < 0 || ROLE_STA != lRetVal)
    {
        UART_PRINT("Failed to start the device \n\r");
        LOOP_FOREVER();
    }

    UART_PRINT("Device started as STATION \n\r");

    //
    // Reset policy settings
    //
    lRetVal = sl_WlanPolicySet(SL_POLICY_CONNECTION, \
                                SL_CONNECTION_POLICY(0,0,0,0,0), 0, 0);

    //
    // This function creates two different filters:
    // (1) Filter packets according to remote MAC
    // (2) Filter packets according to remote IP address
    //
    lRetVal=CreateFilters();
    if (lRetVal < 0)
    {
        UART_PRINT("Filter creation failed\n\r");
        LOOP_FOREVER();
    }

    //
    // Activate pre-defined filters  - The filters will be deleted upon reset
    //
    if(EnableAllFilters() < 0)
    {
        UART_PRINT("Unable to enable filter \n\r");
        LOOP_FOREVER();
    }
    
    //
    //Connecting to WLAN AP
    //
    lRetVal = WlanConnect();
    if(lRetVal < 0)
    {
        UART_PRINT("Failed to establish connection w/ an AP \n\r");
        LOOP_FOREVER();
    }

    UART_PRINT("Connection established w/ AP and IP is aquired \n\r");

    //
    // After calling this function, you can start sending data to CC3200 IP 
    // address on PORT_NUM TCP connection will be refused if remote MAC/IP is of 
    // the filtered. It's also possible to enable the filters after TCP 
    // connection, resulting in TCP packets to not being received 
    //
    lRetVal = BsdTcpServer(PORT_NUM);
    if(lRetVal < 0)
    {
        UART_PRINT("Failure in TCP server\n\r");
        LOOP_FOREVER();
    }

    //
    // Power off Network processor
    //
    lRetVal = sl_Stop(SL_STOP_TIMEOUT);

    return 0;
}