Exemplo n.º 1
0
	WMERESULT CExternalRendererImp::WriteVideoData(char *pData, int nLen)
	{
		WMERESULT ret = WME_S_OK;

		if(!m_pVideoFile)
		{
			ret = OpenVideoFile();
			if(!m_pVideoFile)
			{
				return WME_E_FAIL;
			}
		}

		if(!pData)
		{
			return WME_E_INVALIDARG;
		}
	
		m_WriteLock.Lock();
		int nWriteLen = fwrite(pData, 1, nLen, m_pVideoFile);
		fflush(m_pVideoFile);
		m_WriteLock.UnLock();

		if(nWriteLen != nLen)
		{
			CM_ERROR_TRACE_THIS("CExternalRendererImp::WriteVideoFrame(): failed to write data to video file!");
			return WME_E_FAIL;
		}

		return WME_S_OK;
	}
Exemplo n.º 2
0
BOOL OnCreate(HWND hwnd, LPCREATESTRUCT /*lpCreateStruct*/)
{
    // Initialize the DPI scalar.
    InitializeDPIScale(hwnd);


    LPWSTR lpCmdLineW = GetCommandLine();

    int argc = 0;
    LPWSTR *argv = CommandLineToArgvW(lpCmdLineW, &argc);

    if (argv == NULL)
    {
        return FALSE;
    }

    if (argc == 2)
    {
        OpenVideoFile(hwnd, argv[1]);
    }

    LocalFree(argv);

    return TRUE;
}
Exemplo n.º 3
0
void OnFileOpen(HWND hwnd)
{    
    HRESULT hr = S_OK;

    IFileDialog *pDialog = NULL;
    IShellItem *pItem = NULL;

    LPWSTR pwszFilePath = NULL;

    // Create the FileOpenDialog object.
    hr = CoCreateInstance(
        __uuidof(FileOpenDialog), 
        NULL, 
        CLSCTX_INPROC_SERVER, 
        IID_PPV_ARGS(&pDialog)
        );

    if (FAILED(hr)) { goto done; }

    hr = pDialog->SetTitle(L"Select a File to Play");
    if (FAILED(hr)) { goto done; }

    // Show the file-open dialog.
    hr = pDialog->Show(hwnd);

    if (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED))
    {
        // User cancelled.
        hr = S_OK;
        goto done;
    }

    if (FAILED(hr)) { goto done; }

    hr = pDialog->GetResult(&pItem);

    if (FAILED(hr)) { goto done; }

    hr = pItem->GetDisplayName(SIGDN_FILESYSPATH, &pwszFilePath);

    if (FAILED(hr)) { goto done; }

    // Open the file and create bitmaps.
    hr = OpenVideoFile(hwnd, pwszFilePath);

done:
    if (FAILED(hr))
    {
        ShowErrorMessage(L"Cannot open file.", hr);
    }

    CoTaskMemFree(pwszFilePath);
    SafeRelease(&pItem);
    SafeRelease(&pDialog);
}
Exemplo n.º 4
0
	WMERESULT CExternalRendererImp::SetVideoFile(const char *pFileName)
	{
		if(!pFileName)
		{
			CM_ERROR_TRACE_THIS("CFileCaptureEngineImp::SetVideoFile, invalid file name or video format ");
			return WME_E_INVALIDARG;
		}

		m_strFileName = pFileName;


		CloseVideoFile();

		OpenVideoFile();

		return WME_S_OK;
	}
Exemplo n.º 5
0
CMainWindow::CMainWindow(QWidget* parent): QMainWindow(parent), m_timer(nullptr), m_fps(nullptr)
{
    m_ui.setupUi(this);

    m_timer = new QTimer(this);
    m_timer->start(16);

    m_fps = new QLabel(m_ui.statusBar);
    m_ui.statusBar->addWidget(m_fps);

    connect(m_timer, SIGNAL(timeout()), this, SLOT(TimerUpdate()));
    connect(m_timer, SIGNAL(timeout()), m_ui.glwidget, SLOT(updateGL()));

    // Buffering mode
    connect(m_ui.noThreading, SIGNAL(toggled(bool)), this, SLOT(UseSingleBuffer(bool)));
    connect(m_ui.tripleBuffer, SIGNAL(toggled(bool)), this, SLOT(UseTripleBuffer(bool)));
    connect(m_ui.doubleBuffer, SIGNAL(toggled(bool)), this, SLOT(UseDoubleBuffer(bool)));

    // Effect enable/disable signal
    connect(m_ui.fractalEnabled, SIGNAL(toggled(bool)), this, SLOT(EnableFractalFX(bool)));
    connect(m_ui.fluidEnabled, SIGNAL(toggled(bool)), this, SLOT(EnableFluidFX(bool)));
    connect(m_ui.pageCurlEnabled, SIGNAL(toggled(bool)), this, SLOT(EnablePageCurlFX(bool)));

    // Fractal effect signal
    connect(m_ui.animate, SIGNAL(stateChanged(int)), m_ui.glwidget, SLOT(SetAnimated(int)));
    connect(m_ui.animatePageCurl, SIGNAL(stateChanged(int)), m_ui.glwidget, SLOT(SetPageCurlAnimated(int)));
    connect(m_ui.alphaSlider, SIGNAL(valueChanged(int)), m_ui.glwidget, SLOT(ChangeAlphaValue(int)));
    connect(m_ui.alphaSlider, SIGNAL(valueChanged(int)), this, SLOT(UpdateTransparencyLabel(int)));

    // fluid effect signal
    connect(m_ui.maxWidth, SIGNAL(valueChanged(int)), m_ui.glwidget, SLOT(ChangeFluidMaxWidth(int)));
    connect(m_ui.maxHeight, SIGNAL(valueChanged(int)), m_ui.glwidget, SLOT(ChangeFluidMaxHeight(int)));
    m_ui.alphaSlider->valueChanged(50);

    // file open. connect to CMainWindow to avoid "... must be top level ..." error
    connect(m_ui.actionOpen_Video, SIGNAL(triggered()), this, SLOT(OpenVideoFile()));

    AllocConsole();
    freopen("CONOUT$", "w", stdout);
    freopen("CONOUT$", "w", stderr);
}