Beispiel #1
0
STDMETHODIMP CArchiveFolderManager::GetIconPath(const wchar_t *ext, BSTR *iconPath, Int32 *iconIndex)
{
  LoadFormats();
  *iconPath = 0;
  *iconIndex = 0;
  for (int i = 0; i < _codecs->Libs.Size(); i++)
  {
    const CCodecLib &lib = _codecs->Libs[i];
    int ii;
    if (lib.FindIconIndex(ext, ii))
    {
      *iconIndex = ii;
      return StringToBstr(fs2us(lib.Path), iconPath);
    }
  }
  int ii;
  if (_codecs->InternalIcons.FindIconIndex(ext, ii))
  {
    FString path;
    if (NWindows::NDLL::MyGetModuleFileName(path))
    {
      *iconIndex = ii;
      return StringToBstr(fs2us(path), iconPath);
    }
  }
  return S_OK;
}
STDMETHODIMP CArchiveFolderManager::GetIconPath(const wchar_t *ext, BSTR *iconPath, Int32 *iconIndex)
{
  LoadFormats();
  *iconPath = 0;
  *iconIndex = 0;
  for (int i = 0; i < _codecs->Libs.Size(); i++)
  {
    const CCodecLib &lib = _codecs->Libs[i];
    int ii;
    if (lib.FindIconIndex(ext, ii))
    {
      *iconIndex = ii;
      return StringToBstr(GetUnicodeString(lib.Path, GetCurrentFileCodePage()), iconPath);
    }
  }
  int ii;
  if (_codecs->InternalIcons.FindIconIndex(ext, ii))
  {
    *iconIndex = ii;
    UString path;
    NWindows::NDLL::MyGetModuleFileName(g_hInstance, path);
    return StringToBstr(path, iconPath);
  }
  return S_OK;
}
Beispiel #3
0
STDMETHODIMP CArchiveFolderManager::GetExtensions(BSTR *extensions)
{
  LoadFormats();
  *extensions = 0;
  UString res;
  for (int i = 0; i < _codecs->Libs.Size(); i++)
    AddIconExt(_codecs->Libs[i], res);
  AddIconExt(_codecs->InternalIcons, res);
  return StringToBstr(res, extensions);
}
bool
SipccSdpMediaSection::Load(sdp_t* sdp, uint16_t level,
                           SdpErrorHolder& errorHolder)
{
  switch (sdp_get_media_type(sdp, level)) {
    case SDP_MEDIA_AUDIO:
      mMediaType = kAudio;
      break;
    case SDP_MEDIA_VIDEO:
      mMediaType = kVideo;
      break;
    case SDP_MEDIA_APPLICATION:
      mMediaType = kApplication;
      break;
    case SDP_MEDIA_TEXT:
      mMediaType = kText;
      break;

    default:
      errorHolder.AddParseError(sdp_get_media_line_number(sdp, level),
                                "Unsupported media section type");
      return false;
  }

  mPort = sdp_get_media_portnum(sdp, level);
  int32_t pc = sdp_get_media_portcount(sdp, level);
  if (pc == SDP_INVALID_VALUE) {
    // SDP_INVALID_VALUE (ie; -2) is used when there is no port count. :(
    mPortCount = 0;
  } else if (pc > static_cast<int32_t>(UINT16_MAX) || pc < 0) {
    errorHolder.AddParseError(sdp_get_media_line_number(sdp, level),
                              "Invalid port count");
    return false;
  } else {
    mPortCount = pc;
  }

  if (!LoadProtocol(sdp, level, errorHolder)) {
    return false;
  }

  if (!LoadFormats(sdp, level, errorHolder)) {
    return false;
  }

  if (!mAttributeList.Load(sdp, level, errorHolder)) {
    return false;
  }

  if (!mBandwidths.Load(sdp, level, errorHolder)) {
    return false;
  }

  return LoadConnection(sdp, level, errorHolder);
}
STDMETHODIMP CArchiveFolderManager::GetIconPath(const wchar_t *ext, BSTR *iconPath, Int32 *iconIndex)
{
  LoadFormats();
  *iconPath = 0;
  *iconIndex = 0;
  for (int i = 0; i < _codecs->Libs.Size(); i++)
  {
    const CCodecLib &lib = _codecs->Libs[i];
    int ii = lib.FindIconIndex(ext);
    if (ii >= 0)
    {
      *iconIndex = ii;
      return StringToBstr(GetUnicodeString(lib.Path, GetCurrentFileCodePage()), iconPath);
    }
  }
  return S_OK;
}
/*
STDMETHODIMP CArchiveFolderManager::GetExtensions(const wchar_t *type, BSTR *extensions)
{
  *extensions = 0;
  int formatIndex = FindFormat(type);
  if (formatIndex <  0)
    return E_INVALIDARG;
  // Exts[0].Ext;
  return StringToBstr(_codecs.Formats[formatIndex].GetAllExtensions(), extensions);
}
*/
STDMETHODIMP CArchiveFolderManager::GetExtensions(BSTR *extensions)
{
  LoadFormats();
  *extensions = 0;
  UString res;
  for (int i = 0; i < _codecs->Libs.Size(); i++)
  {
    const CCodecLib &lib = _codecs->Libs[i];
    for (int j = 0; j < lib.IconPairs.Size(); j++)
    {
      if (!res.IsEmpty())
        res += L' ';
      res += lib.IconPairs[j].Ext;
    }
  }
  return StringToBstr(res, extensions);
}
Beispiel #7
0
/*
STDMETHODIMP CArchiveFolderManager::GetExtensions(const wchar_t *type, BSTR *extensions)
{
  *extensions = 0;
  int formatIndex = FindFormat(type);
  if (formatIndex <  0)
    return E_INVALIDARG;
  CMyComBSTR valueTemp = _codecs.Formats[formatIndex].GetAllExtensions(); // Exts[0].Ext;
  *extensions = valueTemp.Detach();
  return S_OK;
}
*/
STDMETHODIMP CArchiveFolderManager::GetExtensions(BSTR *extensions)
{
  LoadFormats();
  *extensions = 0;
  UString res;
  for (int i = 0; i < _codecs->Libs.Size(); i++)
  {
    const CCodecLib &lib = _codecs->Libs[i];
    for (int j = 0; j < lib.IconPairs.Size(); j++)
    {
      if (!res.IsEmpty())
        res += L' ';
      res += lib.IconPairs[j].Ext;
    }
  }
  CMyComBSTR valueTemp = res;
  *extensions = valueTemp.Detach();
  return S_OK;
}
Beispiel #8
0
FbExportDlg::FbExportDlg( wxWindow* parent, const wxString & selections, int author) :
	FbDialog( parent, wxID_ANY, _("Export to external storage"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
	m_selections(selections),
	m_author(author),
	m_struct(NULL),
	m_checkAuthor(NULL)
{
	SetSizeHints( wxDefaultSize, wxDefaultSize );

	wxBoxSizer * bSizerMain = new wxBoxSizer( wxVERTICAL );

	wxFlexGridSizer * fgSizerTop = new wxFlexGridSizer( 2, 2, 0, 0 );
	fgSizerTop->AddGrowableCol( 1 );
	fgSizerTop->SetFlexibleDirection( wxBOTH );
	fgSizerTop->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	wxStaticText * folder_info = new wxStaticText( this, wxID_ANY, _("Destination folder:"));
	folder_info->Wrap( -1 );
	fgSizerTop->Add( folder_info, 0, wxTOP|wxLEFT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );

	m_folder = new FbCustomCombo(this, ID_DIR_TXT);
	m_folder->SetMinSize( wxSize( 300,-1 ) );
	fgSizerTop->Add( m_folder, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );

	wxStaticText * format_info = new wxStaticText( this, wxID_ANY, _("Exported structure:"));
	format_info->Wrap( -1 );
	fgSizerTop->Add( format_info, 0, wxTOP|wxLEFT|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );

	wxString structure = FbParams(FB_FOLDER_FORMAT).Str();

	m_struct = new wxComboBox( this, ID_STRUCT, structure, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
	m_folder->SetMinSize( wxSize( 300,-1 ) );
	m_struct->Append( wxT("%a/%f/%s/%n %t") );
	m_struct->Append( wxT("%a/%f/%t") );
	m_struct->Append( wxT("%f/%s/%n %t") );
	m_struct->Append( wxT("%f/%s/%t") );
	m_struct->Append( wxT("%f/%m") );
	fgSizerTop->Add( m_struct, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );

	bSizerMain->Add( fgSizerTop, 0, wxEXPAND, 5 );

	wxBoxSizer * bSizerTrans = new wxBoxSizer( wxHORIZONTAL );

	m_transDir = new wxCheckBox( this, ID_DIR, _("Transliterate folder name"));
	bSizerTrans->Add( m_transDir, 1, wxALL|wxEXPAND, 5 );

	m_transFile = new wxCheckBox( this, ID_FILE, _("Transliterate filename"));
	bSizerTrans->Add( m_transFile, 1, wxALL|wxEXPAND, 5 );

	bSizerMain->Add( bSizerTrans, 0, wxEXPAND, 5 );

	if (author) {
		m_checkAuthor = new wxCheckBox( this, ID_AUTHOR, _("Use Author (without co-Authors)"));
		bSizerMain->Add( m_checkAuthor, 0, wxALL, 5 );
		m_checkAuthor->SetValue(1);
	}

	m_books = new FbTreeViewCtrl( this, ID_BOOKS, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN | fbTR_VRULES);
	m_books->SetMinSize( wxSize( -1,250 ) );
	m_books->AddColumn (0, _("File name"), -10, wxALIGN_LEFT);
	m_books->AddColumn (1, _("Size, Kb"), 6, wxALIGN_RIGHT);

	bSizerMain->Add( m_books, 1, wxALL|wxEXPAND, 5 );

	wxBoxSizer* bSizerFormat;
	bSizerFormat = new wxBoxSizer( wxHORIZONTAL );

	wxStaticText * m_staticTextFormat = new wxStaticText( this, wxID_ANY, _("Export As..."));
	m_staticTextFormat->Wrap( -1 );
	bSizerFormat->Add( m_staticTextFormat, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	m_format = new FbChoiceInt( this, ID_FORMAT, wxDefaultPosition, wxDefaultSize);
	bSizerFormat->Add( m_format, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	bSizerMain->Add( bSizerFormat, 0, wxEXPAND, 5 );

	m_folder->SetValue( FbParamItem::GetPath(FB_EXTERNAL_DIR) );
	m_transDir->SetValue( FbParams(FB_TRANSLIT_FOLDER) );
	m_transFile->SetValue( FbParams(FB_TRANSLIT_FILE) );

	wxStdDialogButtonSizer * sdbSizerBtn = CreateStdDialogButtonSizer( wxOK | wxCANCEL );
	bSizerMain->Add( sdbSizerBtn, 0, wxEXPAND|wxBOTTOM|wxLEFT|wxRIGHT, 5 );

	this->SetSizer( bSizerMain );
	this->Layout();
	bSizerMain->Fit( this );

	SetAffirmativeId(wxID_OK);
	SetEscapeId(wxID_CANCEL);

	LoadFormats();

	m_books->AssignModel(CreateModel(author, structure));
}
Beispiel #9
0
HRESULT CCodec::Load(IWMCodecInfo2* pICodecInfo, GUID guidType, int nIndex)
{
	m_nIndex = nIndex;

	// Get codec name
    DWORD dwCount = 0;
    HRESULT hr = pICodecInfo->GetCodecName(guidType, nIndex, NULL, &dwCount);
	if (SUCCEEDED(hr) && dwCount > 0) 
	{
		WCHAR *wszCodecName = new WCHAR[ dwCount + 1 ];
		if (wszCodecName == NULL) return E_POINTER;
		pICodecInfo->GetCodecName(guidType, nIndex, wszCodecName, &dwCount);
		m_strCodecName = wszCodecName;
		delete [] wszCodecName;
	}
	
	m_majorType = guidType;

	// Get props interface of code	
	CComPtr<IWMStreamConfig> pStreamConfigCodec;
    hr = pICodecInfo->GetCodecFormat(guidType, nIndex, 0, &pStreamConfigCodec);
	if (SUCCEEDED(hr) && pStreamConfigCodec)
		LoadMediaProps(pStreamConfigCodec);

	LoadFormats(pICodecInfo, guidType, nIndex);

	/*
	CComQIPtr<IWMCodecInfo3> pICodecInfo3(pICodecInfo);

	m_nComplexityLive = GetDWordProperty(pICodecInfo3, guidType, nIndex, g_wszComplexityLive);
	m_nComplexityMax = GetDWordProperty(pICodecInfo3, guidType, nIndex, g_wszComplexityMax);
	m_nComplexityOffline = GetDWordProperty(pICodecInfo3, guidType, nIndex, g_wszComplexityOffline);
	_ASSERT(m_nComplexityMax == 0);

	LoadPassAndVBRSettings(pICodecInfo3, guidType, nIndex);

	// We have to do a bit of trickery here. Because we limit the format enum
	// settings above, only the first codec lists all format settings. So we cheat
	// and load them individually for each

	// 1-pass cbr
	QueryPropertySupported(pICodecInfo3, guidType, nIndex, WMT_TYPE_DWORD, g_wszNumPasses, 1);
	QueryPropertySupported(pICodecInfo3, guidType, nIndex, WMT_TYPE_BOOL, g_wszVBREnabled, FALSE);
	LoadFormats(pICodecInfo, guidType, nIndex);

	// 1-pass vbr
	QueryPropertySupported(pICodecInfo3, guidType, nIndex, WMT_TYPE_DWORD, g_wszNumPasses, 1);
	QueryPropertySupported(pICodecInfo3, guidType, nIndex, WMT_TYPE_BOOL, g_wszVBREnabled, TRUE);
	LoadFormats(pICodecInfo, guidType, nIndex);

	// 2-pass cbr
	QueryPropertySupported(pICodecInfo3, guidType, nIndex, WMT_TYPE_DWORD, g_wszNumPasses, 2);
	QueryPropertySupported(pICodecInfo3, guidType, nIndex, WMT_TYPE_BOOL, g_wszVBREnabled, FALSE);
	LoadFormats(pICodecInfo, guidType, nIndex);

	// 2-pass vbr
	QueryPropertySupported(pICodecInfo3, guidType, nIndex, WMT_TYPE_DWORD, g_wszNumPasses, 2);
	QueryPropertySupported(pICodecInfo3, guidType, nIndex, WMT_TYPE_BOOL, g_wszVBREnabled, TRUE);
	LoadFormats(pICodecInfo, guidType, nIndex);
*/
	return S_OK;
}