当前位置: 首页>>代码示例>>C++>>正文


C++ MediaInfo::Close方法代码示例

本文整理汇总了C++中MediaInfo::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaInfo::Close方法的具体用法?C++ MediaInfo::Close怎么用?C++ MediaInfo::Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MediaInfo的用法示例。


在下文中一共展示了MediaInfo::Close方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetVideoRotation

int CMediaInfo::GetVideoRotation(const wxString &filename)
{
	MediaInfo MI;
	wstring To_Display;
	MI.Open(CConvertUtility::ConvertToStdWstring(filename));
	To_Display = MI.Get(Stream_Video, 0, __T("Rotation"), Info_Text, Info_Name).c_str();
	MI.Close();
	if (To_Display != "")
		return std::stoi(To_Display);
	return 0;
}
开发者ID:jfiguinha,项目名称:Regards,代码行数:11,代码来源:MediaInfo.cpp

示例2: main

int main (int argc, char *argv[])
{
    //Information about MediaInfo
    MediaInfo MI;
    ZenLib::Ztring To_Display=MI.Option(__T("Info_Version"), __T("0.7.0.0;MediaInfoDLL_Example_MSVC;0.7.0.0")).c_str();

    To_Display += __T("\r\n\r\nInfo_Parameters\r\n");
    To_Display += MI.Option(__T("Info_Parameters")).c_str();

    To_Display += __T("\r\n\r\nInfo_Capacities\r\n");
    To_Display += MI.Option(__T("Info_Capacities")).c_str();

    To_Display += __T("\r\n\r\nInfo_Codecs\r\n");
    To_Display += MI.Option(__T("Info_Codecs")).c_str();

    //An example of how to use the library
    To_Display += __T("\r\n\r\nOpen\r\n");
    MI.Open(__T("Example.ogg"));

    To_Display += __T("\r\n\r\nInform with Complete=false\r\n");
    MI.Option(__T("Complete"));
    To_Display += MI.Inform().c_str();

    To_Display += __T("\r\n\r\nInform with Complete=true\r\n");
    MI.Option(__T("Complete"), __T("1"));
    To_Display += MI.Inform().c_str();

    To_Display += __T("\r\n\r\nCustom Inform\r\n");
    MI.Option(__T("Inform"), __T("General;Example : FileSize=%FileSize%"));
    To_Display += MI.Inform().c_str();

    To_Display += __T("\r\n\r\nGet with Stream=General and Parameter=\"FileSize\"\r\n");
    To_Display += MI.Get(Stream_General, 0, __T("FileSize"), Info_Text, Info_Name).c_str();

    To_Display += __T("\r\n\r\nGetI with Stream=General and Parameter=46\r\n");
    To_Display += MI.Get(Stream_General, 0, 46, Info_Text).c_str();

    To_Display += __T("\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n");
    To_Display += ZenLib::Ztring::ToZtring(MI.Count_Get(Stream_Audio, -1)); //Warning : this is an integer

    To_Display += __T("\r\n\r\nGet with Stream=General and Parameter=\"AudioCount\"\r\n");
    To_Display += MI.Get(Stream_General, 0, __T("AudioCount"), Info_Text, Info_Name).c_str();

    To_Display += __T("\r\n\r\nGet with Stream=Audio and Parameter=\"StreamCount\"\r\n");
    To_Display += MI.Get(Stream_Audio, 0, __T("StreamCount"), Info_Text, Info_Name).c_str();

    To_Display += __T("\r\n\r\nClose\r\n");
    MI.Close();

    std::cout<<To_Display.To_Local().c_str()<<std::endl;

    return 0;
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:53,代码来源:HowToUse.cpp

示例3: SplitByLine

vector<CMetadata> CMediaInfo::ReadMetadata(const wxString &filename)
{
    vector<CMetadata> metadata;
    //Information about MediaInfo
    MediaInfo MI;
    String To_Display=MI.Option(__T("Info_Version"), __T("0.7.13;MediaInfoDLL_Example_MSVC;0.7.13")).c_str();
    MI.Open(CConvertUtility::ConvertToStdWstring(filename));
    std:wstring value = MI.Inform();
    metadata = SplitByLine(value);
    MI.Close();
    return metadata;
}
开发者ID:jfiguinha,项目名称:Regards,代码行数:12,代码来源:MediaInfo.cpp

示例4: OnInitDialog

BOOL CPPageFileMediaInfo::OnInitDialog()
{
	__super::OnInitDialog();

	if (!m_pCFont) {
		m_pCFont = DNew CFont;
	}

	if (!m_pCFont) {
		return TRUE;
	}

	MediaInfo MI;

	MI.Option(_T("ParseSpeed"), _T("0"));
	MI.Option(_T("Language"), mi_get_lang_file());
	MI.Option(_T("Complete"));
	MI.Open(m_fn.GetString());
	MI_Text = MI.Inform().c_str();
	MI.Close();

	if (!MI_Text.Find(_T("Unable to load"))) {
		MI_Text.Empty();
	}

	LOGFONT lf;
	memset(&lf, 0, sizeof(lf));
	lf.lfPitchAndFamily = DEFAULT_PITCH | FF_MODERN;

	LPCTSTR fonts[] = {_T("Consolas"), _T("Lucida Console"), _T("Courier New"), _T("") };

	UINT i = 0;
	BOOL success;

	PAINTSTRUCT ps;
	CDC* cDC = m_mediainfo.BeginPaint(&ps);

	do {
		wcscpy_s(lf.lfFaceName, LF_FACESIZE, fonts[i]);
		lf.lfHeight = -MulDiv(8, cDC->GetDeviceCaps(LOGPIXELSY), 72);
		success = IsFontInstalled(fonts[i]) && m_pCFont->CreateFontIndirect(&lf);
		i++;
	} while (!success && i < _countof(fonts));

	m_mediainfo.SetFont(m_pCFont);
	m_mediainfo.SetWindowText(MI_Text);

	m_mediainfo.EndPaint(&ps);

	OldControlProc = (WNDPROC)SetWindowLongPtr(m_mediainfo.m_hWnd, GWLP_WNDPROC, (LONG_PTR)ControlProc);

	return TRUE;
}
开发者ID:WinnerSoftLab,项目名称:WinnerMediaPlayer,代码行数:53,代码来源:PPageFileMediaInfo.cpp

示例5: OnInitDialog

// CDLGMediaInfo message handlers
BOOL CDLGMediaInfo::OnInitDialog()
{
	CDialog::OnInitDialog();

	MediaInfo MI;

	MI.Open(path);
	MI.Option("Complete", "1");
	m_edit = MI.Inform().c_str();
	MI.Close();

	UpdateData(FALSE);


	return TRUE;  // return TRUE  unless you set the focus to a control
}
开发者ID:a1324yn,项目名称:zogvm,代码行数:17,代码来源:DLGMediaInfo.cpp

示例6: main

int main (int argc, MediaInfoLib::Char *argv[])
{
    //Information about MediaInfo
    MediaInfo MI;
    String To_Display=MI.Option(_T("Info_Version"), _T("0.7.0.0;MediaInfoDLL_Example_MSVC;0.7.0.0")).c_str();

    To_Display += _T("\r\n\r\nInfo_Parameters\r\n");
    To_Display += MI.Option(_T("Info_Parameters")).c_str();

    To_Display += _T("\r\n\r\nInfo_Capacities\r\n");
    To_Display += MI.Option(_T("Info_Capacities")).c_str();

    To_Display += _T("\r\n\r\nInfo_Codecs\r\n");
    To_Display += MI.Option(_T("Info_Codecs")).c_str();

    //An example of how to use the library
    To_Display += _T("\r\n\r\nOpen\r\n");
    MI.Open(_T("Example.ogg"));

    To_Display += _T("\r\n\r\nInform with Complete=false\r\n");
    MI.Option(_T("Complete"));
    To_Display += MI.Inform().c_str();

    To_Display += _T("\r\n\r\nInform with Complete=true\r\n");
    MI.Option(_T("Complete"), _T("1"));
    To_Display += MI.Inform().c_str();

    To_Display += _T("\r\n\r\nCustom Inform\r\n");
    MI.Option(_T("Inform"), _T("General;Example : FileSize=%FileSize%"));
    To_Display += MI.Inform().c_str();

    To_Display += _T("\r\n\r\nGet with Stream=General and Parameter=\"FileSize\"\r\n");
    To_Display += MI.Get(Stream_General, 0, _T("FileSize"), Info_Text, Info_Name).c_str();

    To_Display += _T("\r\n\r\nGetI with Stream=General and Parameter=46\r\n");
    To_Display += MI.Get(Stream_General, 0, 46, Info_Text).c_str();

    To_Display += _T("\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n");
    #ifdef __MINGW32__
        Char* C1=new Char[33];
        _itot (MI.Count_Get(Stream_Audio), C1, 10);
        To_Display +=C1;
        delete[] C1;
    #else
        toStringStream SS;
        SS << std::setbase(10) << MI.Count_Get(Stream_Audio);
        To_Display += SS.str();
    #endif

    To_Display += _T("\r\n\r\nGet with Stream=General and Parameter=\"AudioCount\"\r\n");
    To_Display += MI.Get(Stream_General, 0, _T("AudioCount"), Info_Text, Info_Name).c_str();

    To_Display += _T("\r\n\r\nGet with Stream=Audio and Parameter=\"StreamCount\"\r\n");
    To_Display += MI.Get(Stream_Audio, 0, _T("StreamCount"), Info_Text, Info_Name).c_str();

    To_Display += _T("\r\n\r\nClose\r\n");
    MI.Close();

    #ifdef _UNICODE
        std::wcout << To_Display;
    #else
        std::cout  << To_Display;
    #endif

    return 1;
}
开发者ID:thespooler,项目名称:mediainfo-code,代码行数:66,代码来源:HowToUse_Dll.cpp

示例7: get_mediainfo

HRESULT get_mediainfo(const wchar_t *filename, media_info_entry **out, bool use_localization /* = false */)
{
	if (!out)
		return E_POINTER;

	MediaInfo MI;

	dwindow_log_line(L"Gettting MediaInfo for %s", filename);

	// localization
	if (use_localization)
	{
		wchar_t path[MAX_PATH];
		wcscpy(path, g_apppath);
		wcscat(path, C(L"MediaInfoLanguageFile"));

		FILE *f = _wfopen(path, L"rb");
		if (f)
		{
			wchar_t lang[102400] = L"";
			char tmp[1024];
			wchar_t tmp2[1024];
			USES_CONVERSION;
			while (fscanf(f, "%s", tmp, 1024, f) != EOF)
			{
				MultiByteToWideChar(CP_UTF8, 0, tmp, 1024, tmp2, 1024);

				if (wcsstr(tmp2, L";"))
				{
					wcscat(lang, tmp2);
					wcscat(lang, L"\n");
				}
			}
			fclose(f);
			MI.Option(_T("Language"), W2T(lang));
		}
		else
		{
			MI.Option(_T("Language"));
		}
	}
	else
	{
		MI.Option(_T("Language"));
	}

	MI.Open(filename);
	MI.Option(_T("Complete"));
	MI.Option(_T("Inform"));
	String str = MI.Inform().c_str();
	MI.Close();
	wchar_t *p = (wchar_t*)str.c_str();
	wchar_t *p2 = wcsstr(p, L"\n");
	wchar_t tmp[20480];
	bool next_is_a_header = true;

	media_info_entry *pm = *out = NULL;

	while (true)
	{
		if (p2)
		{
			p2[0] = NULL;
			p2 ++;
		}

		wcscpy(tmp, p);
		wcstrim(tmp);
		wcstrim(tmp, L'\n');
		wcstrim(tmp, L'\r');
		wcs_replace(tmp, L"  ", L" ");

		if (tmp[0] == NULL || tmp[0] == L'\n' || tmp[0] == L'\r')
		{
			next_is_a_header = true;
		}		
		else if (next_is_a_header)
		{
			next_is_a_header = false;

			if (NULL == pm)
				pm = *out = (media_info_entry*)calloc(1, sizeof(media_info_entry));
			else
				pm = pm->next = (media_info_entry*)calloc(1, sizeof(media_info_entry));



			wcscpy(pm->key, tmp);
			if (wcschr(pm->key, L':'))
			{
				*((wchar_t*)wcsrchr(pm->key, L':')) = NULL;

				wcscpy(pm->value, wcsrchr(tmp, L':')+1);
			}
			wcstrim(pm->key);
			wcstrim(pm->value);
			pm->level_depth = 0;
		}
		else
		{
//.........这里部分代码省略.........
开发者ID:334151798,项目名称:dwindow,代码行数:101,代码来源:MediaInfo.cpp

示例8: FillTree

HRESULT MediaInfoWindow::FillTree(HWND root, const wchar_t *filename)
{
	HTREEITEM file = InsertTreeviewItem(root, filename, TVI_ROOT);
	InsertTreeviewItem(root, C(L"Reading Infomation ...."), file);
	SendMessage(root, TVM_EXPAND, TVE_EXPAND, (LPARAM)file);
	DoEvents();

	MediaInfo MI;

	// language

	wchar_t path[MAX_PATH];
	wcscpy(path, g_apppath);
	wcscat(path, C(L"MediaInfoLanguageFile"));

	FILE *f = _wfopen(path, L"rb");
	if (f)
	{
		wchar_t lang[102400] = L"";
		char tmp[1024];
		wchar_t tmp2[1024];
		USES_CONVERSION;
		while (fscanf(f, "%s", tmp, 1024, f) != EOF)
		{
			MultiByteToWideChar(CP_UTF8, 0, tmp, 1024, tmp2, 1024);

			if (wcsstr(tmp2, L";"))
			{
				wcscat(lang, tmp2);
				wcscat(lang, L"\n");
			}
		}
		fclose(f);
		MI.Option(_T("Language"), W2T(lang));
	}
	else
	{
		MI.Option(_T("Language"));
	}

	HANDLE h_file = CreateFileW (filename, GENERIC_READ, FILE_SHARE_DELETE|FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
	String str = L"";
	if (h_file != INVALID_HANDLE_VALUE)
	{
		__int64 filesize = 0;
		GetFileSizeEx(h_file, (LARGE_INTEGER*)&filesize);

		DWORD From_Buffer_Size = 0;
		unsigned char From_Buffer[1316];
		MI.Open_Buffer_Init(filesize);

		__int64 last_seek_target, seek_target = -5;

		do
		{
			if (seek_target >= 0)
				last_seek_target = seek_target;

			if (!ReadFile(h_file, From_Buffer, 1316, &From_Buffer_Size, NULL) || From_Buffer_Size <= 0)
				break;

			size_t result = MI.Open_Buffer_Continue(From_Buffer, From_Buffer_Size);
			if ((result&0x08)==0x08) // 8 = all done
				break;

			seek_target = MI.Open_Buffer_Continue_GoTo_Get();
			if (seek_target>=0)
				SetFilePointerEx(h_file, *(LARGE_INTEGER*)&seek_target, NULL, SEEK_SET);
			else if (seek_target >= filesize)
				break;
		}
		while (From_Buffer_Size>0 && last_seek_target != seek_target);
		MI.Open_Buffer_Finalize();

		MI.Option(_T("Complete"));
		MI.Option(_T("Inform"));
		str = MI.Inform().c_str();
		MI.Close();

		CloseHandle(h_file);
	}
	wchar_t *p = (wchar_t*)str.c_str();
	wchar_t *p2 = wcsstr(p, L"\n");
	wchar_t tmp[1024];
	bool next_is_a_header = true;
	
	//TreeView_DeleteAllItems (root);
	TreeView_DeleteItem(root, file);
	file = InsertTreeviewItem(root, filename, TVI_ROOT);
	wcscat(m_msg, filename);
	wcscat(m_msg, L"\r\n");
	HTREEITEM insert_position = file;
	HTREEITEM headers[4096] = {0};
	int headers_count = 0;

	wchar_t tbl[3][20]={L"\t", L"\t\t", L"\t\t\t"};

	while (true)
	{
		if (p2)
//.........这里部分代码省略.........
开发者ID:334151798,项目名称:dwindow,代码行数:101,代码来源:MediaInfo.cpp


注:本文中的MediaInfo::Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。