HRESULT CLAVAudio::UpdateBitstreamContext() { if (!m_pInput || !m_pInput->IsConnected()) return E_UNEXPECTED; BOOL bBitstream = IsBitstreaming(m_nCodecId); if ((bBitstream && !m_avBSContext) || (!bBitstream && m_avBSContext)) { CMediaType mt = m_pInput->CurrentMediaType(); const void *format = mt.Format(); GUID format_type = mt.formattype; DWORD formatlen = mt.cbFormat; // Override the format type if (mt.subtype == MEDIASUBTYPE_FFMPEG_AUDIO && format_type == FORMAT_WaveFormatExFFMPEG) { WAVEFORMATEXFFMPEG *wfexff = (WAVEFORMATEXFFMPEG *)mt.Format(); format = &wfexff->wfex; format_type = FORMAT_WaveFormatEx; formatlen -= sizeof(WAVEFORMATEXFFMPEG) - sizeof(WAVEFORMATEX); } ffmpeg_init(m_nCodecId, format, format_type, formatlen); m_bQueueResync = TRUE; } // Configure DTS-HD setting if(m_avBSContext) { if (m_settings.bBitstream[Bitstream_DTSHD] && m_settings.DTSHDFraming && !m_bForceDTSCore) { m_bDTSHD = TRUE; av_opt_set_int(m_avBSContext->priv_data, "dtshd_rate", LAV_BITSTREAM_DTS_HD_RATE, 0); } else { m_bDTSHD = FALSE; // Force auto-detection av_opt_set_int(m_avBSContext->priv_data, "dtshd_rate", 0, 0); } } return S_OK; }
HRESULT __stdcall vcInitialize() { GetTempPath(MAX_PATH, g_szTempPath); PathRemoveBackslash(g_szTempPath); GetModuleFileName(NULL, g_szModulePath, MAX_PATH); PathRemoveFileSpec(g_szModulePath); CreateLogFile(); GetOSDisplayString(); GetSystemInformations(); InitGdiplus(); InitCommonResource(); InitHSBControlWindow(); ffmpeg_init(); LoadProfiles(); InitMediaMananger(); InitVideoPlayer(); InitVideoRender(); StringCchCopy(g_merge_info.m_Name, 256, L"merged"); if (LoadOptions() != S_OK) { SHGetFolderPath(NULL, CSIDL_MYVIDEO | CSIDL_FLAG_CREATE, NULL, 0, g_opt.m_OutputPath); g_opt.m_Parallel = g_cpu_count; g_opt.m_FillColor2 = 0xFFFFFFFF; } if (LoadProfileSettings() != S_OK) { ZeroMemory(&g_ProfileSettings, sizeof(g_ProfileSettings)); GetDefaultProfileSetting1(g_ProfileSettings, GROUP_VIDEO); } CopyProfileSettings(); return S_OK; }
CFFmpeg_Glue::CFFmpeg_Glue() { ffmpeg_init(); }