示例#1
0
STDMETHODIMP VLCVideo::get_height(long* height)
{
    if( NULL == height )
        return E_POINTER;

    libvlc_media_player_t *p_md;
    HRESULT hr = getMD(&p_md);
    if( SUCCEEDED(hr) )
    {
        *height = libvlc_video_get_height(p_md);
    }
    return hr;
};
示例#2
0
void *VideoDataOutput::lock(void *data, void **bufRet)
{
    Q_ASSERT(data);
    VideoDataOutput *cw = (VideoDataOutput *)data;
    cw->m_mutex.lock();

    const int width = libvlc_video_get_width(cw->p_vlc_player);
    const int height = libvlc_video_get_height(cw->p_vlc_player);
    cw->videoSizeChanged(width, height);

    *bufRet = cw->m_img->bits();

    return NULL; // Picture identifier, not needed here. - NULL because we are called by Mr. C.
}
示例#3
0
BOOL CReportCameraWorker::MakeCapturePhoto()
{
	TRACE(_T("CReportCameraWorker::MakeCapturePhoto\n"));

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

	USES_CONVERSION;
	CString strOutputFileName;
	strOutputFileName = GetCaptureFileName(_T("jpg"), TRUE);

	/* retrieve width of video */
	int width = libvlc_video_get_width (m_mp);
	
	/* retrieve height of video */
	int height = libvlc_video_get_height (m_mp);

	int iRet = 
	libvlc_video_take_snapshot(m_mp, 
		0, 
		T2A(strOutputFileName),
		width,
		height);

	TRACE(_T("CReportCameraWorker::MakeCapturePhoto iRet=%d\n"), iRet);
	
	if (iRet == 0)
	{
		LogCaptureFile(_T("jpg"));

		return TRUE;
	}

	return FALSE;
}
示例#4
0
文件: npolibvlc.cpp 项目: Kafay/vlc
RuntimeNPObject::InvokeResult
LibvlcVideoNPObject::getProperty(int index, NPVariant &result)
{
    /* is plugin still running */
    if( isPluginRunning() )
    {
        VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
        libvlc_exception_t ex;
        libvlc_exception_init(&ex);

        libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
        RETURN_ON_EXCEPTION(this,ex);

        switch( index )
        {
            case ID_video_fullscreen:
            {
                int val = p_plugin->get_fullscreen(&ex);
                RETURN_ON_EXCEPTION(this,ex);
                BOOLEAN_TO_NPVARIANT(val, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_video_height:
            {
                int val = libvlc_video_get_height(p_md, &ex);
                RETURN_ON_EXCEPTION(this,ex);
                INT32_TO_NPVARIANT(val, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_video_width:
            {
                int val = libvlc_video_get_width(p_md, &ex);
                RETURN_ON_EXCEPTION(this,ex);
                INT32_TO_NPVARIANT(val, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_video_aspectratio:
            {
                NPUTF8 *psz_aspect = libvlc_video_get_aspect_ratio(p_md, &ex);
                RETURN_ON_EXCEPTION(this,ex);
                if( !psz_aspect )
                    return INVOKERESULT_GENERIC_ERROR;

                STRINGZ_TO_NPVARIANT(psz_aspect, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_video_subtitle:
            {
                int i_spu = libvlc_video_get_spu(p_md, &ex);
                RETURN_ON_EXCEPTION(this,ex);
                INT32_TO_NPVARIANT(i_spu, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_video_crop:
            {
                NPUTF8 *psz_geometry = libvlc_video_get_crop_geometry(p_md, &ex);
                RETURN_ON_EXCEPTION(this,ex);
                if( !psz_geometry )
                    return INVOKERESULT_GENERIC_ERROR;

                STRINGZ_TO_NPVARIANT(psz_geometry, result);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_video_teletext:
            {
                int i_page = libvlc_video_get_teletext(p_md, &ex);
                RETURN_ON_EXCEPTION(this,ex);
                INT32_TO_NPVARIANT(i_page, result);
                return INVOKERESULT_NO_ERROR;
            }
        }
    }
    return INVOKERESULT_GENERIC_ERROR;
}