Ejemplo n.º 1
0
void CPPageInternalFiltersListBox::OnContextMenu(CWnd* pWnd, CPoint point)
{
    if (point.x == -1 && point.y == -1) {
        // The context menu was triggered using the keyboard,
        // get the coordinates of the currently selected item.
        POSITION pos = GetFirstSelectedItemPosition();
        if (pos) {
            CRect r;
            if (GetItemRect(GetNextSelectedItem(pos), &r, LVIR_BOUNDS)) {
                point.SetPoint(r.left, r.bottom);
            } else {
                point.SetPoint(0, 0);
            }
        }
    } else {
        ScreenToClient(&point);
    }

    CMenu m;
    m.CreatePopupMenu();

    enum {
        ENABLE_ALL = 1,
        DISABLE_ALL,
        ENABLE_VIDEO,
        DISABLE_VIDEO,
        ENABLE_AUDIO,
        DISABLE_AUDIO
    };

    int totalFilters = 0, totalChecked = 0;
    for (int i = 0; i < FILTER_TYPE_NB; i++) {
        totalFilters += m_nbFiltersPerType[i];
        totalChecked += m_nbChecked[i];
    }

    UINT state = (totalChecked != totalFilters) ? MF_ENABLED : MF_GRAYED;
    m.AppendMenu(MF_STRING | state, ENABLE_ALL, ResStr(IDS_ENABLE_ALL_FILTERS));
    state = (totalChecked != 0) ? MF_ENABLED : MF_GRAYED;
    m.AppendMenu(MF_STRING | state, DISABLE_ALL, ResStr(IDS_DISABLE_ALL_FILTERS));

    if (m_n == 1) {
        m.AppendMenu(MF_SEPARATOR);
        state = (m_nbChecked[AUDIO_DECODER] != m_nbFiltersPerType[AUDIO_DECODER]) ? MF_ENABLED : MF_GRAYED;
        m.AppendMenu(MF_STRING | state, ENABLE_AUDIO, ResStr(IDS_ENABLE_AUDIO_FILTERS));
        state = (m_nbChecked[AUDIO_DECODER] != 0) ? MF_ENABLED : MF_GRAYED;
        m.AppendMenu(MF_STRING | state, DISABLE_AUDIO, ResStr(IDS_DISABLE_AUDIO_FILTERS));

        m.AppendMenu(MF_SEPARATOR);
        state = (m_nbChecked[VIDEO_DECODER] != m_nbFiltersPerType[VIDEO_DECODER]) ? MF_ENABLED : MF_GRAYED;
        m.AppendMenu(MF_STRING | state, ENABLE_VIDEO, ResStr(IDS_ENABLE_VIDEO_FILTERS));
        state = (m_nbChecked[VIDEO_DECODER] != 0) ? MF_ENABLED : MF_GRAYED;
        m.AppendMenu(MF_STRING | state, DISABLE_VIDEO, ResStr(IDS_DISABLE_VIDEO_FILTERS));
    }

    ClientToScreen(&point);
    UINT id = m.TrackPopupMenu(TPM_LEFTBUTTON | TPM_RETURNCMD, point.x, point.y, this);

    if (id == 0) {
        return;
    }

    int index = 0;
    for (int i = 0; i < m_filters.GetCount(); i++) {
        switch (m_filters[i].type) {
            case SOURCE_FILTER:
                if (m_n == 1) {
                    continue;
                }
                break;
            case AUDIO_DECODER:
            case VIDEO_DECODER:
                if (m_n == 0) {
                    continue;
                }
                break;
            default:
                continue;
        }

        switch (id) {
            case ENABLE_ALL:
                SetCheck(index, TRUE);
                break;
            case DISABLE_ALL:
                SetCheck(index, FALSE);
                break;
            case ENABLE_AUDIO:
                if (m_filters[i].type == AUDIO_DECODER) {
                    SetCheck(index, TRUE);
                }
                break;
            case DISABLE_AUDIO:
                if (m_filters[i].type == AUDIO_DECODER) {
                    SetCheck(index, FALSE);
                }
                break;
            case ENABLE_VIDEO:
                if (m_filters[i].type == VIDEO_DECODER) {
                    SetCheck(index, TRUE);
                }
                break;
            case DISABLE_VIDEO:
                if (m_filters[i].type == VIDEO_DECODER) {
                    SetCheck(index, FALSE);
                }
                break;
        }
        index++;
    }

    GetParent()->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), CLBN_CHKCHANGE), (LPARAM)m_hWnd);
}
Ejemplo n.º 2
0
void CMediaFormats::UpdateData(bool fSave)
{
    if (fSave) {
        AfxGetApp()->WriteProfileString(_T("FileFormats"), NULL, NULL);

        AfxGetApp()->WriteProfileInt(_T("FileFormats"), _T("RtspHandler"), m_iRtspHandler);
        AfxGetApp()->WriteProfileInt(_T("FileFormats"), _T("RtspFileExtFirst"), m_fRtspFileExtFirst);
    } else {
        RemoveAll();

#define ADDFMT(f) Add(CMediaFormatCategory##f)

        ADDFMT((_T("avi"),         ResStr(IDS_MFMT_AVI),         _T("avi")));
        ADDFMT((_T("mpeg"),        ResStr(IDS_MFMT_MPEG),        _T("mpg mpeg mpe m1v m2v mpv2 mp2v pva evo m2p")));
        ADDFMT((_T("mpegts"),      ResStr(IDS_MFMT_MPEGTS),      _T("ts tp trp m2t m2ts mts rec")));
        ADDFMT((_T("dvdvideo"),    ResStr(IDS_MFMT_DVDVIDEO),    _T("vob ifo")));
        ADDFMT((_T("mkv"),         ResStr(IDS_MFMT_MKV),         _T("mkv")));
        ADDFMT((_T("webm"),        ResStr(IDS_MFMT_WEBM),        _T("webm")));
        ADDFMT((_T("mp4"),         ResStr(IDS_MFMT_MP4),         _T("mp4 m4v mp4v mpv4 hdmov")));
        ADDFMT((_T("mov"),         ResStr(IDS_MFMT_MOV),         _T("mov"), false, _T("QuickTime or QT Lite")));
        ADDFMT((_T("3gp"),         ResStr(IDS_MFMT_3GP),         _T("3gp 3gpp")));
#ifdef _WIN64
        ADDFMT((_T("3g2"),         ResStr(IDS_MFMT_3G2),         _T("3g2 3gp2")));
#else
        ADDFMT((_T("3g2"),         ResStr(IDS_MFMT_3G2),         _T("3g2 3gp2"), false, _T("QuickTime or QT Lite"), QuickTime));
#endif
        ADDFMT((_T("flv"),         ResStr(IDS_MFMT_FLV),         _T("flv f4v")));
        ADDFMT((_T("ogm"),         ResStr(IDS_MFMT_OGM),         _T("ogm ogv")));
#ifdef _WIN64
        ADDFMT((_T("rm"),          ResStr(IDS_MFMT_RM),          _T("rm ram rpm rmm")));
        ADDFMT((_T("rt"),          ResStr(IDS_MFMT_RT),          _T("rt rp smi smil")));
#else
        ADDFMT((_T("rm"),          ResStr(IDS_MFMT_RM),          _T("rm ram rmm"), false, _T("RealPlayer or Real Alternative"), RealMedia));
        ADDFMT((_T("rt"),          ResStr(IDS_MFMT_RT),          _T("rt rp smi smil"), false, _T("RealPlayer or Real Alternative"), RealMedia));
#endif
        ADDFMT((_T("wmv"),         ResStr(IDS_MFMT_WMV),         _T("wmv wmp wm asf")));
        ADDFMT((_T("bink"),        ResStr(IDS_MFMT_BINK),        _T("smk bik"), false, _T("smackw32/binkw32.dll in dll path")));
        ADDFMT((_T("flic"),        ResStr(IDS_MFMT_FLIC),        _T("fli flc flic")));
        ADDFMT((_T("dsm"),         ResStr(IDS_MFMT_DSM),         _T("dsm dsv dsa dss")));
        ADDFMT((_T("ivf"),         ResStr(IDS_MFMT_IVF),         _T("ivf")));
        ADDFMT((_T("dvd2avi"),     ResStr(IDS_MFMT_D2V),         _T("d2v")));
        ADDFMT((_T("swf"),         ResStr(IDS_MFMT_SWF),         _T("swf"), false, _T("ShockWave ActiveX control"), ShockWave));
        ADDFMT((_T("other"),       ResStr(IDS_MFMT_OTHER),       _T("divx rmvb amv")));
        ADDFMT((_T("ac3dts"),      ResStr(IDS_MFMT_AC3),         _T("ac3 dts"), true));
        ADDFMT((_T("aiff"),        ResStr(IDS_MFMT_AIFF),        _T("aif aifc aiff"), true));
        ADDFMT((_T("alac"),        ResStr(IDS_MFMT_ALAC),        _T("alac"), true));
        ADDFMT((_T("amr"),         ResStr(IDS_MFMT_AMR),         _T("amr"), true));
        ADDFMT((_T("ape"),         ResStr(IDS_MFMT_APE),         _T("ape apl"), true));
        ADDFMT((_T("au"),          ResStr(IDS_MFMT_AU),          _T("au snd"), true));
        ADDFMT((_T("audiocd"),     ResStr(IDS_MFMT_CDA),         _T("cda"), true));
        ADDFMT((_T("flac"),        ResStr(IDS_MFMT_FLAC),        _T("flac"), true));
#ifdef _WIN64
        ADDFMT((_T("m4a"),         ResStr(IDS_MFMT_M4A),         _T("m4a m4b m4r aac"), true));
#else
        ADDFMT((_T("m4a"),         ResStr(IDS_MFMT_M4A),         _T("m4a m4b m4r aac"), true, _T(""), QuickTime));
#endif
        ADDFMT((_T("midi"),        ResStr(IDS_MFMT_MIDI),        _T("mid midi rmi"), true));
        ADDFMT((_T("mka"),         ResStr(IDS_MFMT_MKA),         _T("mka"), true));
        ADDFMT((_T("mp3"),         ResStr(IDS_MFMT_MP3),         _T("mp3"), true));
        ADDFMT((_T("mpa"),         ResStr(IDS_MFMT_MPA),         _T("mpa mp2 m1a m2a"), true));
        ADDFMT((_T("mpc"),         ResStr(IDS_MFMT_MPC),         _T("mpc"), true));
        ADDFMT((_T("ofr"),         ResStr(IDS_MFMT_OFR),         _T("ofr ofs"), true));
        ADDFMT((_T("ogg"),         ResStr(IDS_MFMT_OGG),         _T("ogg oga"), true));
        ADDFMT((_T("opus"),        ResStr(IDS_MFMT_OPUS),        _T("opus"), true));
#ifdef _WIN64
        ADDFMT((_T("ra"),          ResStr(IDS_MFMT_RA),          _T("ra"), true));
#else
        ADDFMT((_T("ra"),          ResStr(IDS_MFMT_RA),          _T("ra"), true, _T("RealPlayer or Real Alternative"), RealMedia));
#endif
        ADDFMT((_T("tak"),         ResStr(IDS_MFMT_TAK),         _T("tak"), true));
        ADDFMT((_T("tta"),         ResStr(IDS_MFMT_TTA),         _T("tta"), true));
        ADDFMT((_T("wav"),         ResStr(IDS_MFMT_WAV),         _T("wav"), true));
        ADDFMT((_T("wma"),         ResStr(IDS_MFMT_WMA),         _T("wma"), true));
        ADDFMT((_T("wavpack"),     ResStr(IDS_MFMT_WV),          _T("wv"), true));
        ADDFMT((_T("other_audio"), ResStr(IDS_MFMT_OTHER_AUDIO), _T("aob mlp"), true));
        ADDFMT((_T("pls"),         ResStr(IDS_MFMT_PLS),         _T("asx m3u m3u8 pls wvx wax wmx mpcpl")));
        ADDFMT((_T("bdpls"),       ResStr(IDS_MFMT_BDPLS),       _T("mpls bdmv")));
#undef ADDFMT

        m_iRtspHandler = (engine_t)AfxGetApp()->GetProfileInt(_T("FileFormats"), _T("RtspHandler"), (int)RealMedia);
        m_fRtspFileExtFirst = !!AfxGetApp()->GetProfileInt(_T("FileFormats"), _T("RtspFileExtFirst"), 1);
    }

    for (size_t i = 0; i < GetCount(); i++) {
        GetAt(i).UpdateData(fSave);
    }
}
bool CMPCDXVAVideoDecSettingsWnd::OnActivate()
{
    ASSERT(IPP_FONTSIZE == 13);
    const int h20 = IPP_SCALE(20);
    const int h25 = IPP_SCALE(25);
    DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP;
    CPoint p(10, 10);
    GUID* DxvaGui = nullptr;

    //m_grpFFMpeg.Create(ResStr(IDS_VDF_FFSETTINGS), WS_VISIBLE | WS_CHILD | BS_GROUPBOX, CRect(p + CPoint(-5, 0), CSize(IPP_SCALE(350), h20 + h25 * 3 + h20)), this, (UINT)IDC_STATIC);
    //p.y += h20;

    // Read AR from stream
    m_cbARMode.Create(ResStr(IDS_VDF_AR_MODE), dwStyle | BS_AUTOCHECKBOX | BS_LEFTTEXT, CRect(p, CSize(IPP_SCALE(340), m_fontheight)), this, IDC_PP_AR);
    m_cbARMode.SetCheck(FALSE);
    p.y += h25;

    // Interlaced flag
    m_txtInterlacedFlag.Create(ResStr(IDS_VDF_INTERLACED_FLAG), WS_VISIBLE | WS_CHILD, CRect(p, CSize(IPP_SCALE(220), m_fontheight)), this, (UINT)IDC_STATIC);
    m_cbInterlacedFlag.Create(dwStyle | CBS_DROPDOWNLIST | WS_VSCROLL, CRect(p + CPoint(IPP_SCALE(230), -6), CSize(IPP_SCALE(110), 200)), this, IDC_PP_INTERLACED_FLAG);
    m_cbInterlacedFlag.AddString(ResStr(IDS_VDF_AUTO));
    m_cbInterlacedFlag.AddString(ResStr(IDS_VDF_IF_PROGRESSIVE));
    m_cbInterlacedFlag.AddString(ResStr(IDS_VDF_IF_TOP_FIELD_FIRST));
    m_cbInterlacedFlag.AddString(ResStr(IDS_VDF_IF_BOTTOM_FIELD_FIRST));
    p.y += h25;

    //m_grpDXVA.Create(ResStr(IDS_VDF_DXVA_SETTING), WS_VISIBLE | WS_CHILD | BS_GROUPBOX, CRect(p + CPoint(-5, 0), CSize(IPP_SCALE(350), h20 + h25 + h20 * 3 + m_fontheight)), this, (UINT)IDC_STATIC);
    //p.y += h20;

    // DXVA Compatibility check
    m_txtDXVACompatibilityCheck.Create(ResStr(IDS_VDF_DXVACOMPATIBILITY), WS_VISIBLE | WS_CHILD, CRect(p, CSize(IPP_SCALE(225), m_fontheight)), this, (UINT)IDC_STATIC);
    m_cbDXVACompatibilityCheck.Create(dwStyle | CBS_DROPDOWNLIST | WS_VSCROLL, CRect(p + CPoint(IPP_SCALE(230), -4), CSize(IPP_SCALE(110), 200)), this, IDC_PP_DXVA_CHECK);
    m_cbDXVACompatibilityCheck.AddString(ResStr(IDS_VDF_DXVA_FULLCHECK));
    m_cbDXVACompatibilityCheck.AddString(ResStr(IDS_VDF_DXVA_SKIP_LEVELCHECK));
    m_cbDXVACompatibilityCheck.AddString(ResStr(IDS_VDF_DXVA_SKIP_REFCHECK));
    m_cbDXVACompatibilityCheck.AddString(ResStr(IDS_VDF_DXVA_SKIP_ALLCHECK));
    p.y += h25;

    // Set DXVA for SD (H.264)
    m_cbDXVA_SD.Create(ResStr(IDS_VDF_DXVA_SD), dwStyle | BS_AUTOCHECKBOX | BS_LEFTTEXT, CRect(p, CSize(IPP_SCALE(340), m_fontheight)), this, IDC_PP_DXVA_SD);
    m_cbDXVA_SD.SetCheck(FALSE);
    p.y += h25;

    // DXVA mode
    m_txtDXVAMode.Create(ResStr(IDS_VDF_DXVA_MODE), WS_VISIBLE | WS_CHILD, CRect(p, CSize(IPP_SCALE(120), m_fontheight)), this, (UINT)IDC_STATIC);
    m_edtDXVAMode.Create(WS_CHILD | WS_VISIBLE | WS_DISABLED, CRect(p + CPoint(IPP_SCALE(120), 0), CSize(IPP_SCALE(220), m_fontheight)), this, 0);
    p.y += h20;

    // Video card description
    m_txtVideoCardDescription.Create(ResStr(IDS_VDF_VIDEOCARD), WS_VISIBLE | WS_CHILD, CRect(p, CSize(IPP_SCALE(120), m_fontheight)), this, (UINT)IDC_STATIC);
    m_edtVideoCardDescription.Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_DISABLED, CRect(p + CPoint(IPP_SCALE(120), 0), CSize(IPP_SCALE(220), m_fontheight * 2)), this, 0);
    m_edtVideoCardDescription.SetWindowText(m_pMDF->GetVideoCardDescription());

    DxvaGui = m_pMDF->GetDXVADecoderGuid();
    if (DxvaGui != nullptr) {
        CString DXVAMode = GetDXVAMode(DxvaGui);
        m_edtDXVAMode.SetWindowText(DXVAMode);
    } else {
        m_txtDXVAMode.ShowWindow(SW_HIDE);
        m_edtDXVAMode.ShowWindow(SW_HIDE);
    }

    for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
        pWnd->SetFont(&m_font, FALSE);
    }

    CorrectComboListWidth(m_cbDXVACompatibilityCheck);

    if (m_pMDF) {
 
        m_cbARMode.SetCheck(m_pMDF->GetARMode());
    	 
        m_cbDXVACompatibilityCheck.SetCurSel(m_pMDF->GetDXVACheckCompatibility());
        m_cbDXVA_SD.SetCheck(m_pMDF->GetDXVA_SD());

        m_cbInterlacedFlag.SetCurSel(m_pMDF->GetInterlacedFlag());
    }

    return true;
void CMediaFormats::UpdateData(bool fSave)
{
	if (fSave) {
		AfxGetApp()->WriteProfileString(_T("FileFormats"), NULL, NULL);
	} else {
		RemoveAll();

#define ADDFMT(f) Add(CMediaFormatCategory##f)
		// video files
		ADDFMT((_T("avi"),         ResStr(IDS_MFMT_AVI),         _T("avi")));
		ADDFMT((_T("mpeg"),        ResStr(IDS_MFMT_MPEG),        _T("mpg mpeg mpe m1v m2v mpv2 mp2v pva evo m2p")));
		ADDFMT((_T("mpegts"),      ResStr(IDS_MFMT_MPEGTS),      _T("ts tp trp m2t m2ts mts rec ssif")));
		ADDFMT((_T("dvdvideo"),    ResStr(IDS_MFMT_DVDVIDEO),    _T("vob ifo")));
		ADDFMT((_T("mkv"),         ResStr(IDS_MFMT_MKV),         _T("mkv")));
		ADDFMT((_T("webm"),        ResStr(IDS_MFMT_WEBM),        _T("webm")));
		ADDFMT((_T("mp4"),         ResStr(IDS_MFMT_MP4),         _T("mp4 m4v mp4v mpv4 hdmov")));
		ADDFMT((_T("mov"),         ResStr(IDS_MFMT_MOV),         _T("mov")));
		ADDFMT((_T("3gp"),         ResStr(IDS_MFMT_3GP),         _T("3gp 3gpp 3ga")));
		ADDFMT((_T("3g2"),         ResStr(IDS_MFMT_3G2),         _T("3g2 3gp2")));
		ADDFMT((_T("flv"),         ResStr(IDS_MFMT_FLV),         _T("flv f4v")));
		ADDFMT((_T("ogm"),         ResStr(IDS_MFMT_OGM),         _T("ogm ogv")));
		ADDFMT((_T("rm"),          ResStr(IDS_MFMT_RM),          _T("rm ram rmm")));
		ADDFMT((_T("roq"),         ResStr(IDS_MFMT_ROQ),         _T("roq")));
		ADDFMT((_T("rt"),          ResStr(IDS_MFMT_RT),          _T("rt rp smil")));
		ADDFMT((_T("wmv"),         ResStr(IDS_MFMT_WMV),         _T("wmv wmp wm asf")));
//		ADDFMT((_T("videocd"),     ResStr(IDS_MFMT_VIDEOCD),     _T("dat")));
		ADDFMT((_T("ratdvd"),      ResStr(IDS_MFMT_RATDVD),      _T("ratdvd"), TVideo, _T("ratdvd media file")));
		ADDFMT((_T("bink"),        ResStr(IDS_MFMT_BINK),        _T("smk bik"), TVideo, _T("smackw32/binkw32.dll in dll path")));
		ADDFMT((_T("flic"),        ResStr(IDS_MFMT_FLIC),        _T("fli flc flic")));
		ADDFMT((_T("dsm"),         ResStr(IDS_MFMT_DSM),         _T("dsm dsv dsa dss")));
		ADDFMT((_T("ivf"),         ResStr(IDS_MFMT_IVF),         _T("ivf")));
		ADDFMT((_T("swf"),         ResStr(IDS_MFMT_SWF),         _T("swf"), TVideo, _T("ShockWave ActiveX control"), ShockWave));
		ADDFMT((_T("other"),       ResStr(IDS_MFMT_OTHER),       _T("divx rmvb amv wtv dvr-ms")));
		ADDFMT((_T("raw video"),   ResStr(IDS_MFMT_RAW_VIDEO),   _T("h264 264 vc1 h265 265 hm10 hevc")));
		// audio files
		ADDFMT((_T("ac3dts"),      ResStr(IDS_MFMT_AC3),         _T("ac3 dts dtshd"), TAudio));
		ADDFMT((_T("aiff"),        ResStr(IDS_MFMT_AIFF),        _T("aif aifc aiff"), TAudio));
		ADDFMT((_T("alac"),        ResStr(IDS_MFMT_ALAC),        _T("alac"), TAudio));
		ADDFMT((_T("amr"),         ResStr(IDS_MFMT_AMR),         _T("amr"), TAudio));
		ADDFMT((_T("ape"),         ResStr(IDS_MFMT_APE),         _T("ape apl"), TAudio));
		ADDFMT((_T("au"),          ResStr(IDS_MFMT_AU),          _T("au snd"), TAudio));
		ADDFMT((_T("audiocd"),     ResStr(IDS_MFMT_CDA),         _T("cda"), TAudio));
		ADDFMT((_T("dvdaudio"),    ResStr(IDS_MFMT_DVDAUDIO),    _T("aob"), TAudio));
		ADDFMT((_T("flac"),        ResStr(IDS_MFMT_FLAC),        _T("flac"), TAudio));
		ADDFMT((_T("m4a"),         ResStr(IDS_MFMT_M4A),         _T("m4a m4b aac"), TAudio));
		ADDFMT((_T("midi"),        ResStr(IDS_MFMT_MIDI),        _T("mid midi rmi"), TAudio));
		ADDFMT((_T("mka"),         ResStr(IDS_MFMT_MKA),         _T("mka"), TAudio));
		ADDFMT((_T("mlp"),         ResStr(IDS_MFMT_MLP),         _T("mlp"), TAudio));
		ADDFMT((_T("mp3"),         ResStr(IDS_MFMT_MP3),         _T("mp3"), TAudio));
		ADDFMT((_T("mpa"),         ResStr(IDS_MFMT_MPA),         _T("mpa mp2 m1a m2a"), TAudio));
		ADDFMT((_T("mpc"),         ResStr(IDS_MFMT_MPC),         _T("mpc"), TAudio));
		ADDFMT((_T("ofr"),         ResStr(IDS_MFMT_OFR),         _T("ofr ofs"), TAudio));
		ADDFMT((_T("ogg"),         ResStr(IDS_MFMT_OGG),         _T("ogg oga"), TAudio));
		ADDFMT((_T("ra"),          ResStr(IDS_MFMT_RA),          _T("ra"), TAudio));
		ADDFMT((_T("tak"),         ResStr(IDS_MFMT_TAK),         _T("tak"), TAudio));
		ADDFMT((_T("tta"),         ResStr(IDS_MFMT_TTA),         _T("tta"), TAudio));
		ADDFMT((_T("wav"),         ResStr(IDS_MFMT_WAV),         _T("wav w64"), TAudio));
		ADDFMT((_T("wma"),         ResStr(IDS_MFMT_WMA),         _T("wma"), TAudio));
		ADDFMT((_T("wavpack"),     ResStr(IDS_MFMT_WAVPACK),     _T("wv"), TAudio));
		ADDFMT((_T("opus"),        ResStr(IDS_MFMT_OPUS),        _T("opus"), TAudio));
		ADDFMT((_T("speex"),       ResStr(IDS_MFMT_SPEEX),       _T("spx"), TAudio));
		// playlists
		ADDFMT((_T("pls"),         ResStr(IDS_MFMT_PLS),         _T("asx m3u m3u8 pls wvx wax wmx mpcpl xspf"), TPlaylist));
		ADDFMT((_T("bdpls"),       ResStr(IDS_MFMT_BDPLS),       _T("mpls bdmv"), TVideo)); // opens as a video file
		ADDFMT((_T("cue"),         ResStr(IDS_MFMT_CUE),         _T("cue"), TPlaylist));
#undef ADDFMT
	}

	for (size_t i = 0; i < GetCount(); i++) {
		GetAt(i).UpdateData(fSave);
	}
}
Ejemplo n.º 5
0
void CMediaFormats::UpdateData(bool fSave)
{
	if(fSave)
	{
		AfxGetApp()->WriteProfileString(_T("FileFormats"), NULL, NULL);

		AfxGetApp()->WriteProfileInt(_T("FileFormats"), _T("RtspHandler"), m_iRtspHandler);
		AfxGetApp()->WriteProfileInt(_T("FileFormats"), _T("RtspFileExtFirst"), m_fRtspFileExtFirst);
	}
	else
	{
		RemoveAll();

#define ADDFMT(f) Add(CMediaFormatCategory##f)

		ADDFMT((ResStr(IDS_AG_VIDEO_FILE),    _T("avi")));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_17),  _T("mkv")));
		ADDFMT((_T("WebM video file"),        _T("webm")));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_0),	  _T("wmv wmp wm asf")));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_4),   _T("mpg mpeg mpe m1v m2v mpv2 mp2v ts tp tpr pva m2ts m2t mts evo m2p")));
		ADDFMT((_T("VCD file"),               _T("dat")));
		ADDFMT((ResStr(IDS_AG_DVD_FILE),      _T("vob ifo")));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_10),  _T("ogm ogv")));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_14),  _T("d2v")));
		ADDFMT((ResStr(IDS_AG_MPEG4_FILE),    _T("mp4 m4v mp4v mpv4 hdmov 3gp 3gpp")));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_28),  _T("flv iflv f4v")));
		ADDFMT((ResStr(IDS_AG_FLIC_FILE),     _T("fli flc flic")));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_9),   _T("ivf")));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_19),  _T("smk bik"), false, _T("smackw32/binkw32.dll in dll path")));
		ADDFMT((ResStr(IDS_AG_RATDVD_FILE),   _T("ratdvd"), false, _T("ratdvd media file")));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_21),  _T("roq")));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_25),  _T("drc")));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_26),  _T("dsm dsv dsa dss")));
		ADDFMT((_T("MP3 audio file"),         _T("mp3"), true));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_1),   _T("wma"), true));
		ADDFMT((ResStr(IDS_AG_AUDIO_FILE),    _T("wav"), true));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_5),   _T("mpa mp2 m1a m2a"), true));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_7),   _T("ac3 dts"), true));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_11),  _T("ogg oga"), true));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_18),  _T("mka"), true));
		ADDFMT((_T("CD audio track"),         _T("cda"), true, ResStr(IDS_MEDIAFORMATS_12)));
#ifdef _WIN64
		ADDFMT((ResStr(IDS_MEDIAFORMATS_16),  _T("m4a m4b aac"), true, _T(""), QuickTime));
#else
		ADDFMT((ResStr(IDS_MEDIAFORMATS_16),  _T("m4a m4b aac"), true));
#endif
		ADDFMT((ResStr(IDS_AG_MUSEPACK_FILE), _T("mpc"), true));
		ADDFMT((_T("FLAC audio file"),        _T("flac"), true));
		ADDFMT((_T("WavPack audio file"),     _T("wv"), true));
		ADDFMT((_T("ALAC audio file"),        _T("alac"), true));
		ADDFMT((_T("OptimFrog audio file"),   _T("ofr ofs"), true));
		ADDFMT((_T("Monkey's Audio file"),    _T("ape apl"), true));
		ADDFMT((_T("True audio file"),        _T("tta"), true));
		ADDFMT((_T("AMR audio file"),         _T("amr"), true));
		ADDFMT((_T("AIFF audio file"),        _T("aif aifc aiff"), true));
		ADDFMT((_T("AU audio file"),          _T("au snd"), true));
		ADDFMT((ResStr(IDS_AG_MIDI_FILE),     _T("mid midi rmi"), true));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_29),  _T("swf"), false, _T("ShockWave ActiveX control"), ShockWave));
#ifdef _WIN64
		ADDFMT((ResStr(IDS_MEDIAFORMATS_22),  _T("rm ram rpm rmm")));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_23),  _T("ra"), true));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_24),  _T("rt rp smi smil")));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_30),  _T("mov 3g2 3gp2")));
#else
		ADDFMT((ResStr(IDS_MEDIAFORMATS_22),  _T("rm ram rpm rmm"), false, _T("RealPlayer or Real Alternative"), RealMedia));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_23),  _T("ra"), true, _T("RealPlayer or Real Alternative"), RealMedia));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_24),  _T("rt rp smi smil"), false, _T("RealPlayer or Real Alternative"), RealMedia));
		ADDFMT((ResStr(IDS_MEDIAFORMATS_30),  _T("mov 3g2 3gp2"), false, _T("QuickTime (Alternative)"), QuickTime));
#endif
		ADDFMT((ResStr(IDS_AG_PLAYLIST_FILE), _T("asx m3u pls wvx wax wmx mpcpl")));
		ADDFMT((_T("Blu-ray playlist file"),  _T("mpls bdmv")));
		ADDFMT((ResStr(IDS_AG_OTHER),         _T("divx rmvb amv")));

#undef ADDFMT

		m_iRtspHandler = (engine_t)AfxGetApp()->GetProfileInt(_T("FileFormats"), _T("RtspHandler"), (int)RealMedia);
		m_fRtspFileExtFirst = !!AfxGetApp()->GetProfileInt(_T("FileFormats"), _T("RtspFileExtFirst"), 1);
	}

	for(int i = 0; i < GetCount(); i++)
		GetAt(i).UpdateData(fSave);
}
void CDVSColorPPage::UpdateControlData(bool fSave)
{
	int nCountFmts = _countof(VSFilterDefaultFormats);

	if (fSave) {
		if ((UINT)m_preflist.GetCount() == nCountFmts) {
			BYTE* pData = DNew BYTE[nCountFmts];

			for (ptrdiff_t i = 0; i < m_preflist.GetCount(); i++) {
				pData[i] = (BYTE)m_preflist.GetItemData(i);
			}

			theApp.WriteProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_COLORFORMATS), pData, nCountFmts);

			delete [] pData;
		} else {
			ASSERT(0);
		}

		theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FORCERGB), !!m_forcergb.GetCheck());
	} else {
		m_preflist.ResetContent();
		m_dynchglist.ResetContent();

		BYTE* pData	= NULL;
		UINT nSize	= 0;

		if (!theApp.GetProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_COLORFORMATS), &pData, &nSize)
				|| !pData || nSize != nCountFmts) {
			if (pData) {
				delete [] pData, pData = NULL;
			}

			nSize = nCountFmts;
			pData = DNew BYTE[nCountFmts];
			for (UINT i = 0; i < nSize; i++) {
				pData[i] = i;
			}
		}

		if (pData) {
			for (UINT i = 0; i < nSize; i++) {
				CString guid = GetGUIDString(*VSFilterDefaultFormats[i].subtype);
				if (!guid.Left(13).CompareNoCase(_T("MEDIASUBTYPE_"))) {
					guid = guid.Mid(13);
				}

				m_dynchglist.AddString(guid);
				m_dynchglist.SetItemData(i, pData[i]);
				m_preflist.AddString(guid);
				m_preflist.SetItemData(i, pData[i]);
			}

			int iPosition = -1;
			m_pDirectVobSub->get_ColorFormat(&iPosition);
			m_dynchglist.SetCurSel(iPosition);

			delete [] pData;
		}

		m_forcergb.SetCheck(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FORCERGB), 0)?BST_CHECKED:BST_UNCHECKED);
	}
}
Ejemplo n.º 7
0
void CDVSMainPPage::UpdateControlData(bool fSave)
{
    if (fSave) {
        CString fn;
        m_fnedit.GetWindowText(fn);
        wcscpy_s(m_fn, fn);

        m_iSelectedLanguage = m_langs.GetCurSel();
        m_fOverridePlacement = !!m_oplacement.GetCheck();
        m_PlacementXperc = m_subposx.GetPos32();
        m_PlacementYperc = m_subposy.GetPos32();
        m_fOnlyShowForcedVobSubs = !!m_forcedsubs.GetCheck();
        if (m_PARCombo.GetCurSel() != CB_ERR) {
            m_ePARCompensationType = static_cast<CSimpleTextSubtitle::EPARCompensationType>(m_PARCombo.GetItemData(m_PARCombo.GetCurSel()));
        } else {
            m_ePARCompensationType = CSimpleTextSubtitle::EPCTDisabled;
        }
    } else {
        m_fnedit.SetWindowText(CString(m_fn));
        m_oplacement.SetCheck(m_fOverridePlacement);
        m_subposx.SetRange32(-20, 120);
        m_subposx.SetPos32(m_PlacementXperc);
        m_subposx.EnableWindow(m_fOverridePlacement);
        m_subposy.SetRange32(-20, 120);
        m_subposy.SetPos32(m_PlacementYperc);
        m_subposy.EnableWindow(m_fOverridePlacement);
        m_font.SetWindowText(m_defStyle.fontName);
        m_forcedsubs.SetCheck(m_fOnlyShowForcedVobSubs);
        m_langs.ResetContent();
        m_langs.EnableWindow(m_nLangs > 0);
        for (ptrdiff_t i = 0; i < m_nLangs; i++) {
            m_langs.AddString(CString(m_ppLangs[i]));
        }
        CorrectComboListWidth(m_langs);
        m_langs.SetCurSel(m_iSelectedLanguage);

        m_PARCombo.ResetContent();
        m_PARCombo.InsertString(0, ResStr(IDS_RT_PAR_DISABLED));
        m_PARCombo.SetItemData(0, CSimpleTextSubtitle::EPCTDisabled);
        if (m_ePARCompensationType == CSimpleTextSubtitle::EPCTDisabled) {
            m_PARCombo.SetCurSel(0);
        }

        m_PARCombo.InsertString(1, ResStr(IDS_RT_PAR_DOWNSCALE));
        m_PARCombo.SetItemData(1, CSimpleTextSubtitle::EPCTDownscale);
        if (m_ePARCompensationType == CSimpleTextSubtitle::EPCTDownscale) {
            m_PARCombo.SetCurSel(1);
        }

        m_PARCombo.InsertString(2, ResStr(IDS_RT_PAR_UPSCALE));
        m_PARCombo.SetItemData(2, CSimpleTextSubtitle::EPCTUpscale);
        if (m_ePARCompensationType == CSimpleTextSubtitle::EPCTUpscale) {
            m_PARCombo.SetCurSel(2);
        }

        m_PARCombo.InsertString(3, ResStr(IDS_RT_PAR_ACCURATE_SIZE));
        m_PARCombo.SetItemData(3, CSimpleTextSubtitle::EPCTAccurateSize);
        if (m_ePARCompensationType == CSimpleTextSubtitle::EPCTAccurateSize) {
            m_PARCombo.SetCurSel(3);
        }
    }
}
Ejemplo n.º 8
0
CDirectVobSub::CDirectVobSub()
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());

    BYTE* pData;
    UINT nSize;

    m_iSelectedLanguage = 0;
    m_bHideSubtitles = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE), 0);
    m_uSubPictToBuffer = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SUBPICTTOBUFFER), 10);
    m_bAnimWhenBuffering = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ANIMWHENBUFFERING), 1);
    m_bAllowDropSubPic = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ALLOW_DROPPING_SUBPIC), 1);
    m_bOverridePlacement = !!theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_OVERRIDEPLACEMENT), 0);
    m_PlacementXperc = theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_XPERC), 50);
    m_PlacementYperc = theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_YPERC), 90);
    m_bBufferVobSub = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_BUFFER), 1);
    m_bOnlyShowForcedVobSubs = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS), 0);
    m_bPolygonize = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_POLYGONIZE), 0);
    m_defStyle <<= theApp.GetProfileString(ResStr(IDS_R_TEXT), ResStr(IDS_RT_STYLE), _T(""));
    m_bFlipPicture = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPPICTURE), 0);
    m_bFlipSubtitles = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPSUBTITLES), 0);
    m_bOSD = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SHOWOSDSTATS), 0);
    m_bSaveFullPath = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SAVEFULLPATH), 0);
    m_nReloaderDisableCount = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), 0) ? 1 : 0;
    m_SubtitleDelay = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLEDELAY), 0);
    m_SubtitleSpeedMul = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDMUL), 1000);
    m_SubtitleSpeedDiv = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDDIV), 1000);
    m_bMediaFPSEnabled = !!theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPSENABLED), 0);
    m_ePARCompensationType = static_cast<CSimpleTextSubtitle::EPARCompensationType>(theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_AUTOPARCOMPENSATION), 0));
    pData = NULL;
    if (theApp.GetProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), &pData, &nSize) && pData) {
        if (nSize != sizeof(m_MediaFPS)) {
            m_MediaFPS = 25.0;
        } else {
            memcpy(&m_MediaFPS, pData, sizeof(m_MediaFPS));
        }
        delete [] pData;
    }
    m_ZoomRect.left = m_ZoomRect.top = 0;
    m_ZoomRect.right = m_ZoomRect.bottom = 1;

    m_bForced = false;
}
Ejemplo n.º 9
0
STDMETHODIMP CDirectVobSub::UpdateRegistry()
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());

    CAutoLock cAutoLock(&m_propsLock);

    theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE), m_bHideSubtitles);
    theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SUBPICTTOBUFFER), m_uSubPictToBuffer);
    theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ANIMWHENBUFFERING), m_bAnimWhenBuffering);
    theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ALLOW_DROPPING_SUBPIC), m_bAllowDropSubPic);
    theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_OVERRIDEPLACEMENT), m_bOverridePlacement);
    theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_XPERC), m_PlacementXperc);
    theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_YPERC), m_PlacementYperc);
    theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_BUFFER), m_bBufferVobSub);
    theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS), m_bOnlyShowForcedVobSubs);
    theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_POLYGONIZE), m_bPolygonize);
    CString style;
    theApp.WriteProfileString(ResStr(IDS_R_TEXT), ResStr(IDS_RT_STYLE), style <<= m_defStyle);
    theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPPICTURE), m_bFlipPicture);
    theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPSUBTITLES), m_bFlipSubtitles);
    theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SHOWOSDSTATS), m_bOSD);
    theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SAVEFULLPATH), m_bSaveFullPath);
    theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLEDELAY), m_SubtitleDelay);
    theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDMUL), m_SubtitleSpeedMul);
    theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDDIV), m_SubtitleSpeedDiv);
    theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPSENABLED), m_bMediaFPSEnabled);
    theApp.WriteProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), (BYTE*)&m_MediaFPS, sizeof(m_MediaFPS));
    theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_AUTOPARCOMPENSATION), m_ePARCompensationType);

    return S_OK;
}
Ejemplo n.º 10
0
void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
{
    LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;

    if (lpnmlv->iItem >= 0 && lpnmlv->iSubItem >= 0) {
        enum {
            TOGSEP = 1,
            DUPITEM, DELITEM,
            RESETS, SETOS, SETCS, RESETE, SETOE, SETCE,
            STYLEFIRST, STYLELAST = STYLEFIRST + 1000, STYLEEDIT,
            UNICODEYES, UNICODENO,
            LAYERDEC, LAYERINC,
            ACTORFIRST, ACTORLAST = ACTORFIRST + 1000,
            EFFECTFIRST, EFFECTLAST = EFFECTFIRST + 1000
        };

        CStringArray styles;
        CStringArray actors;
        CStringArray effects;

        CMenu m;
        m.CreatePopupMenu();

        if (m_mode == VOBSUB || m_mode == TEXTSUB) {
            m.AppendMenu(MF_STRING | MF_ENABLED, TOGSEP, ResStr(IDS_SUBRESYNC_SEPARATOR));
            m.AppendMenu(MF_SEPARATOR);
            if (m_mode == TEXTSUB) {
                m.AppendMenu(MF_STRING | MF_ENABLED, DUPITEM, ResStr(IDS_SUBRESYNC_DUPLICATE));
            }
            m.AppendMenu(MF_STRING | MF_ENABLED, DELITEM, ResStr(IDS_SUBRESYNC_DELETE));
        }

        switch (lpnmlv->iSubItem) {
            case COL_START:
                if (m_mode == VOBSUB || m_mode == TEXTSUB) {
                    m.AppendMenu(MF_SEPARATOR);
                    m.AppendMenu(MF_STRING | MF_ENABLED, RESETS, ResStr(IDS_SUBRESYNC_RESET) + _T("\tF1"));
                    m.AppendMenu(MF_STRING | MF_ENABLED, SETOS, ResStr(IDS_SUBRESYNC_ORIGINAL) + _T("\tF3"));
                    m.AppendMenu(MF_STRING | MF_ENABLED, SETCS, ResStr(IDS_SUBRESYNC_CURRENT) + _T("\tF5"));
                }
                break;
            case COL_END:
                if (m_mode == TEXTSUB) {
                    m.AppendMenu(MF_SEPARATOR);
                    m.AppendMenu(MF_STRING | MF_ENABLED, RESETE, ResStr(IDS_SUBRESYNC_RESET) + _T("\tF2"));
                    m.AppendMenu(MF_STRING | MF_ENABLED, SETOE, ResStr(IDS_SUBRESYNC_ORIGINAL) + _T("\tF4"));
                    m.AppendMenu(MF_STRING | MF_ENABLED, SETCE, ResStr(IDS_SUBRESYNC_CURRENT) + _T("\tF6"));
                }
                break;
            case COL_STYLE:
                if (m_mode == TEXTSUB) {
                    m.AppendMenu(MF_SEPARATOR);

                    int id = STYLEFIRST;

                    POSITION pos = m_sts.m_styles.GetStartPosition();
                    while (pos && id <= STYLELAST) {
                        CString key;
                        STSStyle* val;
                        m_sts.m_styles.GetNextAssoc(pos, key, val);
                        styles.Add(key);
                        m.AppendMenu(MF_STRING | MF_ENABLED, id++, key);
                    }

                    if (id > STYLEFIRST && m_list.GetSelectedCount() == 1) {
                        m.AppendMenu(MF_SEPARATOR);
                        m.AppendMenu(MF_STRING | MF_ENABLED, STYLEEDIT, ResStr(IDS_SUBRESYNC_EDIT));
                    }
                }
                break;
            case COL_UNICODE:
                if (m_mode == TEXTSUB) {
                    m.AppendMenu(MF_SEPARATOR);
                    m.AppendMenu(MF_STRING | MF_ENABLED, UNICODEYES, m_strYesMenu);
                    m.AppendMenu(MF_STRING | MF_ENABLED, UNICODENO, m_strNoMenu);
                }
                break;
            case COL_LAYER:
                if (m_mode == TEXTSUB) {
                    m.AppendMenu(MF_SEPARATOR);
                    m.AppendMenu(MF_STRING | MF_ENABLED, LAYERDEC, ResStr(IDS_SUBRESYNC_DECREASE));
                    m.AppendMenu(MF_STRING | MF_ENABLED, LAYERINC, ResStr(IDS_SUBRESYNC_INCREASE));
                }
                break;
            case COL_ACTOR:
                if (m_mode == TEXTSUB) {
                    CMapStringToPtr actormap;

                    for (size_t i = 0, j = m_sts.GetCount(); i < j; i++) {
                        actormap[m_sts[i].actor] = nullptr;
                    }

                    actormap.RemoveKey(_T(""));

                    if (!actormap.IsEmpty()) {
                        m.AppendMenu(MF_SEPARATOR);

                        int id = ACTORFIRST;

                        POSITION pos = actormap.GetStartPosition();
                        while (pos && id <= ACTORLAST) {
                            CString key;
                            void* val;
                            actormap.GetNextAssoc(pos, key, val);

                            actors.Add(key);

                            m.AppendMenu(MF_STRING | MF_ENABLED, id++, key);
                        }
                    }
                }
                break;
            case COL_EFFECT:
                if (m_mode == TEXTSUB) {
                    CMapStringToPtr effectmap;

                    for (size_t i = 0, j = m_sts.GetCount(); i < j; i++) {
                        effectmap[m_sts[i].effect] = nullptr;
                    }

                    effectmap.RemoveKey(_T(""));

                    if (!effectmap.IsEmpty()) {
                        m.AppendMenu(MF_SEPARATOR);

                        int id = EFFECTFIRST;

                        POSITION pos = effectmap.GetStartPosition();
                        while (pos && id <= EFFECTLAST) {
                            CString key;
                            void* val;
                            effectmap.GetNextAssoc(pos, key, val);

                            effects.Add(key);

                            m.AppendMenu(MF_STRING | MF_ENABLED, id++, key);
                        }
                    }
                }
                break;
        }

        CPoint p = lpnmlv->ptAction;
        ::MapWindowPoints(pNMHDR->hwndFrom, HWND_DESKTOP, &p, 1);

        UINT id = m.TrackPopupMenu(TPM_LEFTBUTTON | TPM_RETURNCMD, p.x, p.y, this);

        bool bNeedsUpdate = false;

        POSITION pos = m_list.GetFirstSelectedItemPosition();
        while (pos) {
            int iItem = m_list.GetNextSelectedItem(pos);

            SubTime& st = m_subtimes[iItem];

            switch (id) {
                case TOGSEP:
                    m_displayData[iItem].flags ^= TSEP;
                    m_list.Invalidate();
                    bNeedsUpdate = true;
                    break;
                case DUPITEM: {
                    CUIntArray items;
                    pos = m_list.GetFirstSelectedItemPosition();
                    while (pos) {
                        items.Add(m_list.GetNextSelectedItem(pos));
                    }

                    qsort(items.GetData(), items.GetCount(), sizeof(UINT), uintcomp);

                    for (INT_PTR i = 0, l = items.GetCount(); i < l; i++) {
                        iItem = items[i];

                        STSEntry entry = m_sts[iItem];
                        m_sts.InsertAt(iItem + 1, entry);
                        SubTime subtime = m_subtimes[iItem];
                        m_subtimes.InsertAt(iItem + 1, subtime);
                        DisplayData displayData = m_displayData[iItem];
                        m_displayData.InsertAt(iItem + 1, displayData);
                    }

                    m_list.SetItemCount((int)m_sts.GetCount());

                    bNeedsUpdate = true;
                    break;
                }
                case DELITEM: {
                    CUIntArray items;
                    pos = m_list.GetFirstSelectedItemPosition();
                    while (pos) {
                        items.Add(m_list.GetNextSelectedItem(pos));
                    }

                    qsort(items.GetData(), items.GetCount(), sizeof(UINT), uintcomp);

                    for (INT_PTR i = 0, l = items.GetCount(); i < l; i++) {
                        iItem = items[i];
                        m_sts.RemoveAt(iItem);
                        m_subtimes.RemoveAt(iItem);
                        m_displayData.RemoveAt(iItem);
                    }

                    m_list.SetItemCount((int)m_sts.GetCount());

                    iItem = items[items.GetCount() - 1];
                    if (iItem >= m_list.GetItemCount()) {
                        iItem = m_list.GetItemCount() - 1;
                    }
                    m_list.SetSelectionMark(iItem);

                    bNeedsUpdate = true;
                    break;
                }
                case RESETS:
                    ModStart(iItem, st.orgStart, true);
                    bNeedsUpdate = true;
                    break;
                case SETOS:
                    ModStart(iItem, st.orgStart);
                    bNeedsUpdate = true;
                    break;
                case SETCS:
                    ModStart(iItem, (int)(m_rt / 10000));
                    bNeedsUpdate = true;
                    break;
                case RESETE:
                    ModEnd(iItem, st.orgEnd, true);
                    bNeedsUpdate = true;
                    break;
                case SETOE:
                    ModEnd(iItem, st.orgEnd);
                    bNeedsUpdate = true;
                    break;
                case SETCE:
                    ModEnd(iItem, (int)(m_rt / 10000));
                    bNeedsUpdate = true;
                    break;
                default:
                    if (STYLEFIRST <= id && id <= STYLELAST) {
                        CString s = styles[id - STYLEFIRST];
                        if (m_sts[iItem].style != s) {
                            m_sts[iItem].style = s;
                            bNeedsUpdate = true;
                        }
                    } else if (id == STYLEEDIT) {
                        CAutoPtrArray<CPPageSubStyle> pages;
                        CAtlArray<STSStyle*> styles;

                        STSStyle* stss = m_sts.GetStyle(iItem);
                        int iSelPage = 0;

                        POSITION pos = m_sts.m_styles.GetStartPosition();
                        for (int i = 0; pos; i++) {
                            CString key;
                            STSStyle* val;
                            m_sts.m_styles.GetNextAssoc(pos, key, val);

                            CAutoPtr<CPPageSubStyle> page(DEBUG_NEW CPPageSubStyle());
                            page->InitStyle(key, *val);
                            pages.Add(page);
                            styles.Add(val);

                            if (stss == val) {
                                iSelPage = i;
                            }
                        }

                        CPropertySheet dlg(ResStr(IDS_SUBTITLES_STYLES_CAPTION), this, iSelPage);
                        for (size_t i = 0, l = pages.GetCount(); i < l; i++) {
                            dlg.AddPage(pages[i]);
                        }

                        if (dlg.DoModal() == IDOK) {
                            for (size_t j = 0, l = pages.GetCount(); j < l; j++) {
                                pages[j]->GetStyle(*styles[j]);
                            }
                            bNeedsUpdate = true;
                        }
                    } else if (id == UNICODEYES || id == UNICODENO) {
                        m_sts.ConvertUnicode(iItem, id == UNICODEYES);
                        bNeedsUpdate = true;
                    } else if (id == LAYERDEC || id == LAYERINC) {
                        int d = (id == LAYERDEC) ? -1 : 1;
                        m_sts[iItem].layer += d;
                        bNeedsUpdate = true;
                    } else if (ACTORFIRST <= id && id <= ACTORLAST) {
                        CString s = actors[id - ACTORFIRST];
                        if (m_sts[iItem].actor != s) {
                            m_sts[iItem].actor = s;
                            bNeedsUpdate = true;
                        }
                    } else if (EFFECTFIRST <= id && id <= EFFECTLAST) {
                        CString s = effects[id - EFFECTFIRST];
                        if (m_sts[iItem].effect != s) {
                            m_sts[iItem].effect = s;
                            bNeedsUpdate = true;
                        }
                    }
                    break;
            }

            if (bNeedsUpdate) {
                m_list.Update(iItem);
            }
        }

        if (bNeedsUpdate) {
            UpdatePreview();
        }
    }

    *pResult = 0;
}
Ejemplo n.º 11
0
void CPlayerSubresyncBar::ReloadTranslatableResources()
{
    SetWindowText(ResStr(IDS_SUBRESYNC_CAPTION));

    m_strYes = m_strYesMenu = ResStr(IDS_SUBRESYNC_YES);
    m_strNo = m_strNoMenu = ResStr(IDS_SUBRESYNC_NO);
    m_strYes.Remove(_T('&'));
    m_strNo.Remove(_T('&'));

    CHeaderCtrl* pHeaderCtrl = m_list.GetHeaderCtrl();
    if (pHeaderCtrl && pHeaderCtrl->GetItemCount() > 4) {
        auto setColumnHeaderText = [pHeaderCtrl](int nPos, CString str) {
            HDITEM item;
            item.mask = HDI_TEXT;
            item.pszText = (LPTSTR)(LPCTSTR)str;
            item.cchTextMax = str.GetLength() + 1;
            VERIFY(pHeaderCtrl->SetItem(nPos, &item));
        };

        setColumnHeaderText(COL_START, ResStr(IDS_SUBRESYNC_CLN_TIME));
        setColumnHeaderText(COL_END, ResStr(IDS_SUBRESYNC_CLN_END));
        setColumnHeaderText(COL_PREVSTART, ResStr(IDS_SUBRESYNC_CLN_PREVIEW));
        setColumnHeaderText(COL_PREVEND, ResStr(IDS_SUBRESYNC_CLN_END));
        if (m_mode == VOBSUB) {
            ASSERT(pHeaderCtrl->GetItemCount() == COL_COUNT_VOBSUB);
            setColumnHeaderText(COL_VOBID, ResStr(IDS_SUBRESYNC_CLN_VOB_ID));
            setColumnHeaderText(COL_CELLID, ResStr(IDS_SUBRESYNC_CLN_CELL_ID));
            setColumnHeaderText(COL_FORCED, ResStr(IDS_SUBRESYNC_CLN_FORCED));
        } else if (m_mode == TEXTSUB) {
            ASSERT(pHeaderCtrl->GetItemCount() == COL_COUNT_TEXTSUB);
            setColumnHeaderText(COL_TEXT, ResStr(IDS_SUBRESYNC_CLN_TEXT));
            setColumnHeaderText(COL_STYLE, ResStr(IDS_SUBRESYNC_CLN_STYLE));
            setColumnHeaderText(COL_FONT, ResStr(IDS_SUBRESYNC_CLN_FONT));
            setColumnHeaderText(COL_CHARSET, ResStr(IDS_SUBRESYNC_CLN_CHARSET));
            setColumnHeaderText(COL_UNICODE, ResStr(IDS_SUBRESYNC_CLN_UNICODE));
            setColumnHeaderText(COL_LAYER, ResStr(IDS_SUBRESYNC_CLN_LAYER));
            setColumnHeaderText(COL_ACTOR, ResStr(IDS_SUBRESYNC_CLN_ACTOR));
            setColumnHeaderText(COL_EFFECT, ResStr(IDS_SUBRESYNC_CLN_EFFECT));
        }
    }
}
Ejemplo n.º 12
0
void CSubtitleDlDlg::OnFailedConnection()
{
	SetStatus(ResStr(IDS_SUBDL_DLG_CONNECT_ERROR));
}
Ejemplo n.º 13
0
bool CMPCVideoDecSettingsWnd::OnActivate()
{
	int		nPosY	= 10;
	GUID*	DxvaGui = NULL;

#if HAS_FFMPEG_VIDEO_DECODERS
	m_grpFFMpeg.Create (ResStr (IDS_VDF_FFSETTINGS), WS_VISIBLE|WS_CHILD | BS_GROUPBOX, CRect (5,  nPosY, 350, nPosY+150), this, (UINT)IDC_STATIC);

	// Decoding threads
	nPosY += VERTICAL_SPACING;
	m_txtThreadNumber.Create (ResStr (IDS_VDF_THREADNUMBER), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING,  nPosY, 220, nPosY+15), this, (UINT)IDC_STATIC);
	m_cbThreadNumber.Create  (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (230,  nPosY-4, 345, nPosY+90), this, IDC_PP_THREAD_NUMBER);
	m_cbThreadNumber.AddString(ResStr(IDS_VDF_IDCT_AUTO));
	CString ThreadNumberStr;
	for (int i=0; i<16; i++) {
		ThreadNumberStr.Format(_T("%d"), i+1);
		m_cbThreadNumber.AddString(ThreadNumberStr);
	}

#if INTERNAL_DECODER_H264
	// H264 deblocking mode
	nPosY += VERTICAL_SPACING;
	m_txtDiscardMode.Create (ResStr (IDS_VDF_SKIPDEBLOCK), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING,  nPosY, 220, nPosY+15), this, (UINT)IDC_STATIC);
	m_cbDiscardMode.Create  (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (230,  nPosY-4, 345, nPosY+90), this, IDC_PP_DISCARD_MODE);
	m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_NONE));
	m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_DEFAULT));
	m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_NONREF));
	m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_BIDIR));
	m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_NONKFRM));
	m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_ALL));
#endif /* INTERNAL_DECODER_H264 */

	// Error recognition
	nPosY += VERTICAL_SPACING;
	m_txtErrorRecognition.Create (ResStr (IDS_VDF_ERROR_RECOGNITION), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING,  nPosY, 220, nPosY+15), this, (UINT)IDC_STATIC);
	m_cbErrorRecognition.Create  (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (230,  nPosY-4, 345, nPosY+90), this, IDC_PP_DISCARD_MODE);
	m_cbErrorRecognition.AddString (ResStr (IDS_VDF_ERR_CAREFUL));
	m_cbErrorRecognition.AddString (ResStr (IDS_VDF_ERR_COMPLIANT));
	m_cbErrorRecognition.AddString (ResStr (IDS_VDF_ERR_AGGRESSIVE));

	// IDCT Algo
	nPosY += VERTICAL_SPACING;
	m_txtIDCTAlgo.Create (ResStr (IDS_VDF_IDCT_ALGO), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING,  nPosY, 220, nPosY+15), this, (UINT)IDC_STATIC);
	m_cbIDCTAlgo.Create  (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (230,  nPosY-4, 345, nPosY+90), this, IDC_PP_DISCARD_MODE);
	m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_AUTO));
	m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_LIBMPEG2));
	m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_SIMPLE_MMX));
	m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_XVID));
	m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_SIMPLE));

	nPosY += VERTICAL_SPACING;
	m_cbARMode.Create (ResStr (IDS_VDF_AR_MODE), WS_VISIBLE|WS_CHILD|BS_AUTOCHECKBOX|BS_LEFTTEXT, CRect (LEFT_SPACING,  nPosY, 345, nPosY+15), this, IDC_PP_AR);
	m_cbARMode.SetCheck(FALSE);

	nPosY = 170;
#endif /* HAS_FFMPEG_VIDEO_DECODERS */

	m_grpDXVA.Create   (ResStr (IDS_VDF_DXVA_SETTING),   WS_VISIBLE|WS_CHILD | BS_GROUPBOX, CRect (5, nPosY, 350, nPosY+135), this, (UINT)IDC_STATIC);

	// DXVA Compatibility check
	nPosY += VERTICAL_SPACING;
	m_txtDXVACompatibilityCheck.Create (ResStr (IDS_VDF_DXVACOMPATIBILITY), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING,  nPosY, 225, nPosY+15), this, (UINT)IDC_STATIC);
	m_cbDXVACompatibilityCheck.Create  (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (230,  nPosY-4, 345, nPosY+90), this, IDC_PP_DXVA_CHECK);
	m_cbDXVACompatibilityCheck.AddString(ResStr(IDS_VDF_DXVA_FULLCHECK));
	m_cbDXVACompatibilityCheck.AddString(ResStr(IDS_VDF_DXVA_SKIP_LEVELCHECK));
	m_cbDXVACompatibilityCheck.AddString(ResStr(IDS_VDF_DXVA_SKIP_REFCHECK));
	m_cbDXVACompatibilityCheck.AddString(ResStr(IDS_VDF_DXVA_SKIP_ALLCHECK));

	nPosY += VERTICAL_SPACING;
	m_cbDXVA_SD.Create (ResStr (IDS_VDF_DXVA_SD), WS_VISIBLE|WS_CHILD|BS_AUTOCHECKBOX|BS_LEFTTEXT, CRect (LEFT_SPACING,  nPosY, 345, nPosY+15), this, IDC_PP_DXVA_SD);
	m_cbDXVA_SD.SetCheck(FALSE);

	// DXVA mode
	nPosY += VERTICAL_SPACING;
	m_txtDXVAMode.Create (ResStr (IDS_VDF_DXVA_MODE), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING,  nPosY, 120, nPosY+15), this, (UINT)IDC_STATIC);
	m_edtDXVAMode.Create (WS_CHILD|WS_VISIBLE|WS_DISABLED, CRect (120,  nPosY, 345, nPosY+20), this, 0);

	// Video card description
	nPosY += VERTICAL_SPACING;
	m_txtVideoCardDescription.Create (ResStr (IDS_VDF_VIDEOCARD), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING,  nPosY, 120, nPosY+15), this, (UINT)IDC_STATIC);
	m_edtVideoCardDescription.Create (ES_MULTILINE|WS_CHILD|WS_VISIBLE|WS_DISABLED, CRect (120,  nPosY, 345, nPosY+30), this, 0);
	m_edtVideoCardDescription.SetWindowText (m_pMDF->GetVideoCardDescription());


	DxvaGui = m_pMDF->GetDXVADecoderGuid();
	if (DxvaGui != NULL) {
		CString DXVAMode = GetDXVAMode (DxvaGui);
		m_edtDXVAMode.SetWindowText (DXVAMode);
	} else {
		m_txtDXVAMode.ShowWindow (SW_HIDE);
		m_edtDXVAMode.ShowWindow (SW_HIDE);
	}

	for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
		pWnd->SetFont(&m_font, FALSE);
	}

	CorrectComboListWidth(m_cbDXVACompatibilityCheck);
#if INTERNAL_DECODER_H264
	CorrectComboListWidth(m_cbDiscardMode);
#endif

	if (m_pMDF) {
#if HAS_FFMPEG_VIDEO_DECODERS
#if INTERNAL_DECODER_H264
		m_cbThreadNumber.SetCurSel		(m_pMDF->GetThreadNumber());
		m_cbDiscardMode.SetCurSel		(FindDiscardIndex (m_pMDF->GetDiscardMode()));
#endif
		m_cbErrorRecognition.SetCurSel	(FindErrRecognitionIndex (m_pMDF->GetErrorRecognition()));
		m_cbIDCTAlgo.SetCurSel			(m_pMDF->GetIDCTAlgo());

		m_cbARMode.SetCheck(m_pMDF->GetARMode());
#endif /* HAS_FFMPEG_VIDEO_DECODERS */

		m_cbDXVACompatibilityCheck.SetCurSel(m_pMDF->GetDXVACheckCompatibility());
		m_cbDXVA_SD.SetCheck(m_pMDF->GetDXVA_SD());
	}

	return true;
}
Ejemplo n.º 14
0
bool CMPCVideoDecSettingsWnd::OnActivate()
{
	DWORD	dwStyle = WS_VISIBLE|WS_CHILD|WS_BORDER;
	int		nPosY	= 10;
	GUID*	DxvaGui = NULL;

#if defined(REGISTER_FILTER) | INCLUDE_MPC_VIDEO_DECODER
	m_grpFFMpeg.Create (ResStr (IDS_VDF_FFSETTINGS), WS_VISIBLE|WS_CHILD | BS_GROUPBOX, CRect (10,  nPosY, 330, nPosY+150), this, IDC_STATIC);

	#if defined(REGISTER_FILTER) | INTERNAL_DECODER_H264
	// Decoding threads
	nPosY += VERTICAL_SPACING;
	m_txtThreadNumber.Create (ResStr (IDS_VDF_THREADNUMBER), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING,  nPosY, 190, nPosY+15), this, IDC_STATIC);
	m_cbThreadNumber.Create  (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (200,  nPosY-4, 260, nPosY+90), this, IDC_PP_THREAD_NUMBER);
	m_cbThreadNumber.AddString (_T("1"));
	m_cbThreadNumber.AddString (_T("2"));
	m_cbThreadNumber.AddString (_T("3"));
	m_cbThreadNumber.AddString (_T("4"));
	m_cbThreadNumber.AddString (_T("5"));
	m_cbThreadNumber.AddString (_T("6"));
	m_cbThreadNumber.AddString (_T("7"));
	m_cbThreadNumber.AddString (_T("8"));

	// H264 deblocking mode
	nPosY += VERTICAL_SPACING;
	m_txtDiscardMode.Create (ResStr (IDS_VDF_SKIPDEBLOCK), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING,  nPosY, 190, nPosY+15), this, IDC_STATIC);
	m_cbDiscardMode.Create  (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (200,  nPosY-4, 315, nPosY+90), this, IDC_PP_DISCARD_MODE);
	m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_NONE));
	m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_DEFAULT));
	m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_NONREF));
	m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_BIDIR));
	m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_NONKFRM));
	m_cbDiscardMode.AddString (ResStr (IDS_VDF_DBLK_ALL));
	#endif
	
	// Error recognition
	nPosY += VERTICAL_SPACING;
	m_txtErrorRecognition.Create (ResStr (IDS_VDF_ERROR_RECOGNITION), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING,  nPosY, 190, nPosY+15), this, IDC_STATIC);
	m_cbErrorRecognition.Create  (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (200,  nPosY-4, 315, nPosY+90), this, IDC_PP_DISCARD_MODE);
	m_cbErrorRecognition.AddString (ResStr (IDS_VDF_ERR_CAREFUL));
	m_cbErrorRecognition.AddString (ResStr (IDS_VDF_ERR_COMPLIANT));
	m_cbErrorRecognition.AddString (ResStr (IDS_VDF_ERR_AGGRESSIVE));
	m_cbErrorRecognition.AddString (ResStr (IDS_VDF_ERR_VERYAGGRESSIVE));

	// IDCT Algo
	nPosY += VERTICAL_SPACING;
	m_txtIDCTAlgo.Create (ResStr (IDS_VDF_IDCT_ALGO), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING,  nPosY, 190, nPosY+15), this, IDC_STATIC);
	m_cbIDCTAlgo.Create  (WS_VISIBLE|WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL, CRect (200,  nPosY-4, 315, nPosY+90), this, IDC_PP_DISCARD_MODE);
	m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_AUTO));
	m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_LIBMPG2));
	m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_SIMPLE_MMX));
	m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_XVID));
	m_cbIDCTAlgo.AddString (ResStr (IDS_VDF_IDCT_SIMPLE));

	nPosY += VERTICAL_SPACING;
	m_cbARMode.Create (ResStr (IDS_VDF_AR_MODE), WS_VISIBLE|WS_CHILD|BS_AUTOCHECKBOX|BS_LEFTTEXT, CRect (LEFT_SPACING,  nPosY, 315, nPosY+15), this, IDC_PP_AR);
	m_cbARMode.SetCheck(FALSE);

	nPosY = 170;
#endif

	m_grpDXVA.Create   (ResStr (IDS_VDF_DXVA_SETTING),   WS_VISIBLE|WS_CHILD | BS_GROUPBOX, CRect (10, nPosY, 330, nPosY+110), this, IDC_STATIC);

	// DXVA mode
	nPosY += VERTICAL_SPACING;
	m_txtDXVAMode.Create (ResStr (IDS_VDF_DXVA_MODE), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING,  nPosY, 120, nPosY+15), this, IDC_STATIC);
	m_edtDXVAMode.Create (WS_CHILD|WS_VISIBLE|WS_DISABLED, CRect (120,  nPosY, 315, nPosY+20), this, 0);

	// Video card description
	nPosY += VERTICAL_SPACING;
	m_txtVideoCardDescription.Create (ResStr (IDS_VDF_VIDEOCARD), WS_VISIBLE|WS_CHILD, CRect (LEFT_SPACING,  nPosY, 120, nPosY+15), this, IDC_STATIC);
	m_edtVideoCardDescription.Create (WS_CHILD|WS_VISIBLE|WS_DISABLED, CRect (120,  nPosY, 315, nPosY+20), this, 0);
	m_edtVideoCardDescription.SetWindowText (m_pMDF->GetVideoCardDescription());
	
	
	DxvaGui = m_pMDF->GetDXVADecoderGuid();
	if (DxvaGui != NULL)
	{
		CString DXVAMode = GetDXVAMode (DxvaGui);
		m_edtDXVAMode.SetWindowText (/*GetDXVAMode (DxvaGui)*/DXVAMode);
	}
	else
	{
		m_txtDXVAMode.ShowWindow (SW_HIDE);
		m_edtDXVAMode.ShowWindow (SW_HIDE);
	}

	for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
		pWnd->SetFont(&m_font, FALSE);

	#if defined(REGISTER_FILTER) | INCLUDE_MPC_VIDEO_DECODER
	if (m_pMDF)
	{
		#if defined(REGISTER_FILTER) | INTERNAL_DECODER_H264
		m_cbThreadNumber.SetCurSel		(m_pMDF->GetThreadNumber() - 1);
		m_cbDiscardMode.SetCurSel		(FindDiscardIndex (m_pMDF->GetDiscardMode()));
		#endif
		m_cbErrorRecognition.SetCurSel	(m_pMDF->GetErrorRecognition()-1);
		m_cbIDCTAlgo.SetCurSel			(m_pMDF->GetIDCTAlgo());

		m_cbARMode.SetCheck(m_pMDF->GetARMode());
	}
	#endif

	return true;
}
Ejemplo n.º 15
0
bool CMpegSplitterSettingsWnd::OnActivate()
{
    ASSERT(IPP_FONTSIZE == 13);
    const int h20 = IPP_SCALE(20);
    const int h25 = IPP_SCALE(25);
    const int h30 = IPP_SCALE(30);
    DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP;
    CPoint p(10, 10);

    m_cbFastStreamChange.Create(ResStr(IDS_MPEGSPLITTER_FSTREAM_CHANGE), dwStyle | BS_AUTOCHECKBOX | BS_LEFTTEXT, CRect(p, CSize(IPP_SCALE(305), m_fontheight)), this, IDC_PP_FAST_STREAM_SELECT);
    p.y += h20;

    m_cbForcedSub.Create(ResStr(IDS_MPEGSPLITTER_SUB_FORCING), dwStyle | BS_AUTOCHECKBOX | BS_LEFTTEXT, CRect(p, CSize(IPP_SCALE(305), m_fontheight)), this, IDC_PP_SUBTITLE_FORCED);
    p.y += h20;

    m_cbAlternativeDuration.Create(ResStr(IDS_MPEGSPLITTER_ALT_DUR_CALC), dwStyle | BS_AUTOCHECKBOX | BS_LEFTTEXT, CRect(p, CSize(IPP_SCALE(305), m_fontheight)), this, IDC_PP_ALTERNATIVE_DURATION);
    p.y += h20;

    m_txtAudioLanguageOrder.Create(ResStr(IDS_MPEGSPLITTER_LANG_ORDER), WS_VISIBLE | WS_CHILD, CRect(p, CSize(IPP_SCALE(200), m_fontheight)), this, (UINT)IDC_STATIC);
    p.y += h20;
    m_edtAudioLanguageOrder.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, CRect(p, CSize(IPP_SCALE(305), m_fontheight + 6)), this, IDC_PP_AUDIO_LANGUAGE_ORDER);
    p.y += h25;

    m_txtSubtitlesLanguageOrder.Create(ResStr(IDS_MPEGSPLITTER_SUB_ORDER), WS_VISIBLE | WS_CHILD, CRect(p, CSize(IPP_SCALE(200), m_fontheight)), this, (UINT)IDC_STATIC);
    p.y += h20;
    m_edtSubtitlesLanguageOrder.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, CRect(p, CSize(IPP_SCALE(305), m_fontheight + 6)), this, IDC_PP_SUBTITLES_LANGUAGE_ORDER);
    p.y += h25;

    m_txtVC1_GuidFlag.Create(ResStr(IDS_MPEGSPLITTER_VC1_GUIDFLAG), WS_VISIBLE | WS_CHILD, CRect(p, CSize(IPP_SCALE(200), m_fontheight)), this, (UINT)IDC_STATIC);
    p.y += h20;
    m_cbVC1_GuidFlag.Create(dwStyle | CBS_DROPDOWNLIST | WS_VSCROLL, CRect(p, CSize(IPP_SCALE(305), 200)), this, IDC_PP_VC1_GUIDFLAG);
    m_cbVC1_GuidFlag.AddString(_T("Default"));
    m_cbVC1_GuidFlag.AddString(_T("Cyberlink VC-1 Decoder"));
    m_cbVC1_GuidFlag.AddString(_T("ArcSoft VC-1 Decoder"));
    SetClassLongPtr(GetDlgItem(IDC_PP_VC1_GUIDFLAG)->m_hWnd, GCLP_HCURSOR, (LONG_PTR)AfxGetApp()->LoadStandardCursor(IDC_HAND));
    p.y += h30;

    m_grpTrueHD.Create(ResStr(IDS_MPEGSPLITTER_TRUEHD_OUTPUT), WS_VISIBLE | WS_CHILD | BS_GROUPBOX, CRect(p + CPoint(-5, 0), CSize(IPP_SCALE(305), h20 + h20)), this, (UINT)IDC_STATIC);
    p.y += h20;
    m_cbTrueHD.Create(_T("TrueHD"), dwStyle | BS_AUTORADIOBUTTON | BS_TOP | BS_MULTILINE | WS_GROUP, CRect(p, CSize(IPP_SCALE(95), m_fontheight + 2)), this, IDC_PP_TRUEHD);
    m_cbAC3Core.Create(_T("AC-3"), dwStyle | BS_AUTORADIOBUTTON | BS_TOP | BS_MULTILINE, CRect(p + CPoint(IPP_SCALE(100), 0), CSize(IPP_SCALE(95), m_fontheight + 2)), this, IDC_PP_AC3CORE);
    m_cbAsIs.Create(ResStr(IDS_MPEGSPLITTER_THD_NOSPLIT), dwStyle | BS_AUTORADIOBUTTON | BS_TOP | BS_MULTILINE, CRect(p + CPoint(IPP_SCALE(200), 0), CSize(IPP_SCALE(95), m_fontheight + 2)), this, IDC_PP_ASIS);

    if (m_pMSF) {
        m_cbFastStreamChange.SetCheck(m_pMSF->GetFastStreamChange());
        m_cbForcedSub.SetCheck(m_pMSF->GetForcedSub());
        m_edtAudioLanguageOrder.SetWindowText(m_pMSF->GetAudioLanguageOrder());
        m_edtSubtitlesLanguageOrder.SetWindowText(m_pMSF->GetSubtitlesLanguageOrder());
        m_cbVC1_GuidFlag.SetCurSel(m_pMSF->GetVC1_GuidFlag() - 1);
        m_cbTrueHD.SetCheck(m_pMSF->GetTrueHD() == 0);
        m_cbAC3Core.SetCheck(m_pMSF->GetTrueHD() == 1);
        m_cbAsIs.SetCheck(!m_cbTrueHD.GetCheck() && !m_cbAC3Core.GetCheck());
        m_cbAlternativeDuration.SetCheck(m_pMSF->GetAlternativeDuration());
    }

#ifndef STANDALONE_FILTER
    m_edtAudioLanguageOrder.EnableWindow(FALSE);
    m_edtSubtitlesLanguageOrder.EnableWindow(FALSE);
#endif


    for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
        pWnd->SetFont(&m_font, FALSE);
    }

    return true;
}
CString CPPageAccelTbl::MakeMouseButtonLabel(UINT mouse)
{
	CString ret;
	switch (mouse) {
		case wmcmd::NONE:
		default:
			ret = ResStr(IDS_AG_NONE);
			break;
		case wmcmd::LDOWN:
			ret = _T("Left Down");
			break;
		case wmcmd::LUP:
			ret = _T("Left Up");
			break;
		case wmcmd::LDBLCLK:
			ret = _T("Left DblClk");
			break;
		case wmcmd::MDOWN:
			ret = _T("Middle Down");
			break;
		case wmcmd::MUP:
			ret = _T("Middle Up");
			break;
		case wmcmd::MDBLCLK:
			ret = _T("Middle DblClk");
			break;
		case wmcmd::RDOWN:
			ret = _T("Right Down");
			break;
		case wmcmd::RUP:
			ret = _T("Right Up");
			break;
		case wmcmd::RDBLCLK:
			ret = _T("Right DblClk");
			break;
		case wmcmd::X1DOWN:
			ret = _T("X1 Down");
			break;
		case wmcmd::X1UP:
			ret = _T("X1 Up");
			break;
		case wmcmd::X1DBLCLK:
			ret = _T("X1 DblClk");
			break;
		case wmcmd::X2DOWN:
			ret = _T("X2 Down");
			break;
		case wmcmd::X2UP:
			ret = _T("X2 Up");
			break;
		case wmcmd::X2DBLCLK:
			ret = _T("X2 DblClk");
			break;
		case wmcmd::WUP:
			ret = _T("Wheel Up");
			break;
		case wmcmd::WDOWN:
			ret = _T("Wheel Down");
			break;
	}
	return ret;
}
bool CDVSMainPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg) {
		case WM_COMMAND: {
			switch (HIWORD(wParam)) {
				case BN_CLICKED: {
					if (LOWORD(wParam) == IDC_OPEN) {
						AFX_MANAGE_STATE(AfxGetStaticModuleState());

						CFileDialog fd(TRUE, NULL, NULL,
									   OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST,
									   _T(".idx .smi .sub .srt .psb .ssa .ass .usf .sup|*.idx;*.smi;*.sub;*.srt;*.psb;*.ssa;*.ass;*.usf;*.sup|")
									   _T("All files (*.*)|*.*||"),
									   CDialog::FromHandle(m_Dlg), 0);

						if (fd.DoModal() == IDOK) {
							m_fnedit.SetWindowText(fd.GetPathName());
						}

						return true;
					} else if (LOWORD(wParam) == IDC_FONT) {
						AFX_MANAGE_STATE(AfxGetStaticModuleState());

						CStyleEditorDialog dlg(_T("Default"), &m_defStyle, CWnd::FromHandle(m_hwnd));

						if (dlg.DoModal() == IDOK) {
							BOOL bStyleChanged = FALSE;
							if (dlg.m_stss != m_defStyle) {
								bStyleChanged = TRUE;
							}
							m_defStyle = dlg.m_stss;
							CString str = m_defStyle.fontName;
							if (str.GetLength() > 18) {
								str = str.Left(16).TrimRight() + _T("...");
							}
							m_font.SetWindowText(str);

							if (bStyleChanged) {
								m_bDirty = TRUE;
								if (m_pPageSite) {
									m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
								}

								if (!m_fDisableInstantUpdate
										&& !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INSTANTUPDATE), 1)) {
									OnApplyChanges();
								}
							}
						}

						return true;
					}
				}
				break;
			}
		}
		break;
	}

	return false;
}
Ejemplo n.º 18
0
BOOL CPPageFullscreen::OnInitDialog()
{
    __super::OnInitDialog();

    SetHandCursor(m_hWnd, IDC_COMBO1);

    const CAppSettings& s = AfxGetAppSettings();

    m_fullScreenMonitor = s.strFullScreenMonitor;
    m_bLaunchFullscreen = s.fLaunchfullscreen;
    m_fExitFullScreenAtTheEnd = s.fExitFullScreenAtTheEnd;

    m_autoChangeFSModes = s.autoChangeFSMode.modes;
    m_bAutoChangeFSModeEnabled = s.autoChangeFSMode.bEnabled;
    m_bAutoChangeFSModeApplyDefModeAtFSExist = s.autoChangeFSMode.bApplyDefaultModeAtFSExit;
    m_bAutoChangeFSModeRestoreResAfterProgExit = s.autoChangeFSMode.bRestoreResAfterProgExit;
    m_uAutoChangeFullscrResDelay = s.autoChangeFSMode.uDelay;

    CMonitors monitors;

    CString currentMonitorName;
    monitors.GetNearestMonitor(AfxGetMainWnd()).GetName(currentMonitorName);

    m_fullScreenMonitorCtrl.AddString(ResStr(IDS_FULLSCREENMONITOR_CURRENT));
    m_monitorDisplayNames.emplace_back(_T("Current"));
    m_iFullScreenMonitor = 0;

    for (int i = 0; i < monitors.GetCount(); i++) {
        CMonitor monitor = monitors.GetMonitor(i);

        if (monitor.IsMonitor()) {
            CString monitorName;
            monitor.GetName(monitorName);

            CString str = monitorName;
            if (monitorName == currentMonitorName) {
                str.AppendFormat(_T(" - [%s]"), ResStr(IDS_FULLSCREENMONITOR_CURRENT));
            }

            DISPLAY_DEVICE displayDevice = { sizeof(displayDevice) };
            if (EnumDisplayDevices(monitorName, 0, &displayDevice, 0)) {
                str.AppendFormat(_T(" - %s"), displayDevice.DeviceString);
            }

            m_fullScreenMonitorCtrl.AddString(str);
            m_monitorDisplayNames.emplace_back(monitorName);

            if (m_fullScreenMonitor == monitorName && m_iFullScreenMonitor == 0) {
                m_iFullScreenMonitor = m_fullScreenMonitorCtrl.GetCount() - 1;
            }
        }
    }

    if (m_fullScreenMonitorCtrl.GetCount() > 2) {
        GetDlgItem(IDC_COMBO1)->EnableWindow(TRUE);
    } else {
        m_iFullScreenMonitor = 0;
        GetDlgItem(IDC_COMBO1)->EnableWindow(FALSE);
    }

    m_list.SetExtendedStyle(m_list.GetExtendedStyle() | LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER
                            | LVS_EX_GRIDLINES | LVS_EX_BORDERSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_CHECKBOXES | LVS_EX_FLATSB);
    m_list.InsertColumn(COL_N, ResStr(IDS_PPAGE_FS_CLN_ON_OFF), LVCFMT_LEFT, 60);
    m_list.InsertColumn(COL_FRAMERATE_START, ResStr(IDS_PPAGE_FS_CLN_FROM_FPS), LVCFMT_RIGHT, 60);
    m_list.InsertColumn(COL_FRAMERATE_STOP, ResStr(IDS_PPAGE_FS_CLN_TO_FPS), LVCFMT_RIGHT, 60);
    m_list.InsertColumn(COL_DISPLAY_MODE, ResStr(IDS_PPAGE_FS_CLN_DISPLAY_MODE), LVCFMT_LEFT, 135);


    m_bHideFullscreenControls = s.bHideFullscreenControls;
    m_uHideFullscreenControlsDelay = s.uHideFullscreenControlsDelay;
    m_bHideFullscreenDockedPanels = s.bHideFullscreenDockedPanels;

    auto addHidePolicy = [&](LPCTSTR lpszName, CAppSettings::HideFullscreenControlsPolicy ePolicy) {
        int n = m_hidePolicy.InsertString(-1, lpszName);
        if (n >= 0) {
            VERIFY(m_hidePolicy.SetItemData(n, static_cast<DWORD_PTR>(ePolicy)) != CB_ERR);
            if (ePolicy == s.eHideFullscreenControlsPolicy) {
                VERIFY(m_hidePolicy.SetCurSel(n) == n);
            }
        } else {
            ASSERT(FALSE);
        }
    };
    auto loadString = [&](UINT nID) {
        CString ret;
        VERIFY(ret.LoadString(nID));
        return ret;
    };
    addHidePolicy(loadString(IDS_PPAGEFULLSCREEN_SHOWNEVER), CAppSettings::HideFullscreenControlsPolicy::SHOW_NEVER);
    addHidePolicy(loadString(IDS_PPAGEFULLSCREEN_SHOWMOVED), CAppSettings::HideFullscreenControlsPolicy::SHOW_WHEN_CURSOR_MOVED);
    addHidePolicy(loadString(IDS_PPAGEFULLSCREEN_SHOHHOVERED), CAppSettings::HideFullscreenControlsPolicy::SHOW_WHEN_HOVERED);

    m_delaySpinner.SetRange32(0, 9);

    CorrectComboListWidth(m_fullScreenMonitorCtrl);
    CorrectComboListWidth(m_hidePolicy);
    CorrectComboBoxHeaderWidth(GetDlgItem(IDC_CHECK2));
    CorrectComboBoxHeaderWidth(GetDlgItem(IDC_CHECK4));

    ModesUpdate();

    EnableToolTips(TRUE);

    UpdateData(FALSE);

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 19
0
bool CMpeg2DecSettingsWnd::OnActivate()
{
	ASSERT(IPP_FONTSIZE == 13);
	const int h20 = IPP_SCALE(20);
	const int h25 = IPP_SCALE(25);
	DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_TABSTOP;
	CPoint p(10, 10);

	m_planaryuv_check.Create(ResStr(IDS_MPEG2_ENABLE_PLANAR), dwStyle | BS_AUTOCHECKBOX, CRect(p, CSize(IPP_SCALE(335), m_fontheight)), this, IDC_PP_CHECK1);
	m_planaryuv_check.SetCheck(m_planaryuv ? BST_CHECKED : BST_UNCHECKED);
	p.y += h20;

	m_interlaced_check.Create(ResStr(IDS_MPEG2_INTERLACE_FLAG), dwStyle | BS_AUTOCHECKBOX, CRect(p, CSize(IPP_SCALE(300), m_fontheight)), this, IDC_PP_CHECK2);
	m_interlaced_check.SetCheck(m_interlaced ? BST_CHECKED : BST_UNCHECKED);
	p.y += h20;

	m_forcedsubs_check.Create(ResStr(IDS_MPEG2_FORCED_SUBS), dwStyle | BS_AUTOCHECKBOX, CRect(p, CSize(IPP_SCALE(300), m_fontheight)), this, IDC_PP_CHECK3);
	m_forcedsubs_check.SetCheck(m_forcedsubs ? BST_CHECKED : BST_UNCHECKED);
	p.y += h20;

	m_readARFromStream_check.Create(ResStr(IDS_MPEG2_READ_AR), dwStyle | BS_AUTOCHECKBOX, CRect(p, CSize(IPP_SCALE(300), m_fontheight)), this, IDC_PP_CHECK4);
	m_readARFromStream_check.SetCheck(m_readARFromStream ? BST_CHECKED : BST_UNCHECKED);
	p.y += h25;

	m_ditype_static.Create(ResStr(IDS_MPEG2_DEINTERLACING), WS_VISIBLE | WS_CHILD, CRect(p, CSize(IPP_SCALE(100), m_fontheight)), this);
	m_ditype_combo.Create(dwStyle | CBS_DROPDOWNLIST, CRect(p + CSize(IPP_SCALE(110), -4), CSize(IPP_SCALE(100), 200)), this, IDC_PP_COMBO1);
	m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Auto")), (DWORD)DIAuto);
	m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Weave")), (DWORD)DIWeave);
	m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Blend")), (DWORD)DIBlend);
	m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Bob")), (DWORD)DIBob);
	m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Field Shift")), (DWORD)DIFieldShift);
	m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("ELA")), (DWORD)DIELA);
	m_ditype_combo.SetCurSel(0);
	for (int i = 0; i < m_ditype_combo.GetCount(); i++)
		if ((int)m_ditype_combo.GetItemData(i) == m_ditype) {
			m_ditype_combo.SetCurSel(i);
		}
	m_ditype_combo.EnableWindow(!IsDlgButtonChecked(m_interlaced_check.GetDlgCtrlID()));
	p.y += h25;

	{
		int h = max(21, m_fontheight); // special size for sliders
		static const TCHAR* labels[] = {m_strBrightness, m_strContrast,	m_strHue, m_strSaturation};
		for (int i = 0; i < _countof(m_procamp_slider); i++) {
			m_procamp_static[i].Create(labels[i], WS_VISIBLE | WS_CHILD, CRect(p, CSize(IPP_SCALE(80), m_fontheight)), this);
			m_procamp_slider[i].Create(dwStyle, CRect(p + CPoint(IPP_SCALE(85), 0), CSize(201, h)), this, IDC_PP_SLIDER1 + i);
			m_procamp_value[i].Create(_T(""), WS_VISIBLE | WS_CHILD, CRect(p + CPoint(IPP_SCALE(85) + 201, 0), CSize(IPP_SCALE(30), m_fontheight)), this);
			p.y += h;
		}
		m_procamp_slider[0].SetRange(0, 2*128);
		m_procamp_slider[0].SetTic(128);
		m_procamp_slider[0].SetPos((int)(m_procamp[0] + (m_procamp[0] >= 0 ? 0.5f : -0.5f)) + 128);
		m_procamp_slider[1].SetRange(0, 200);
		m_procamp_slider[1].SetTic(100);
		m_procamp_slider[1].SetPos((int)(100*m_procamp[1] + 0.5f));
		m_procamp_slider[2].SetRange(0, 2*180);
		m_procamp_slider[2].SetTic(180);
		m_procamp_slider[2].SetPos((int)(m_procamp[2] + (m_procamp[2] >= 0 ? 0.5f : -0.5f)) + 180);
		m_procamp_slider[3].SetRange(0, 200);
		m_procamp_slider[3].SetTic(100);
		m_procamp_slider[3].SetPos((int)(100*m_procamp[3] + 0.5f));
		p.y += 5;
	
		m_procamp_tv2pc.Create(_T("TV->PC"), dwStyle, CRect(p + CPoint(IPP_SCALE(85) + 200 / 2 - 80 -5, 0), CSize(80, m_fontheight + 6)), this, IDC_PP_BUTTON1);
		m_procamp_reset.Create(ResStr(IDS_MPEG2_RESET), dwStyle, CRect(p + CPoint(IPP_SCALE(85) + 200 / 2 + 6, 0), CSize(80, m_fontheight + 6)), this, IDC_PP_BUTTON2);
		p.y += h25;
	
		UpdateProcampValues();
	}

	m_note_static.Create(
		ResStr(IDS_MPEG2_NOTE1), WS_VISIBLE | WS_CHILD, CRect(p, CSize(IPP_SCALE(320), m_fontheight * 4)), this);

	for (CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) {
		pWnd->SetFont(&m_font, FALSE);
	}

	SetClassLongPtr(m_hWnd, GCLP_HCURSOR, (long) AfxGetApp()->LoadStandardCursor(IDC_ARROW));
	SetClassLongPtr(GetDlgItem(IDC_PP_CHECK1)->m_hWnd, GCLP_HCURSOR, (long) AfxGetApp()->LoadStandardCursor(IDC_HAND));

	return true;
}
Ejemplo n.º 20
0
void CPPageFullscreen::ModesUpdate()
{
    DisplayMode currentDisplayMode;
    if (!CMainFrame::GetCurDispMode(m_fullScreenMonitor, currentDisplayMode)) {
        ASSERT(FALSE);
        return;
    }

    m_list.SetRedraw(FALSE);
    m_list.DeleteAllItems();
    m_displayModes.clear();
    m_displayModesString.RemoveAll();
    m_nCurrentDisplayModeIndex = 0;

    // Get the full list of available display modes
    for (int i = 0;; i++) {
        DisplayMode dm;
        if (!CMainFrame::GetDispMode(m_fullScreenMonitor, i, dm)) {
            break;
        }
        if (dm.bpp != 32 || dm.size.cx < 640) {
            continue; // skip low resolution and non 32bpp mode
        }

        m_displayModes.emplace_back(dm);
    }
    ASSERT(!m_displayModes.empty());

    // Sort the available display modes
    std::sort(m_displayModes.begin(), m_displayModes.end());
    // Then deduplicate them
    m_displayModes.erase(std::unique(m_displayModes.begin(), m_displayModes.end()), m_displayModes.end());

    // Generate the corresponding string representation
    auto formatStringFromDisplayMode = [](const DisplayMode & dm) {
        CString strDisplayMode;
        strDisplayMode.Format(_T("[ %d ] @ %ldx%ld %c"),
                              dm.freq, dm.size.cx, dm.size.cy,
                              (dm.dwDisplayFlags & DM_INTERLACED) ? _T('i') : _T('p'));
        return strDisplayMode;
    };
    m_CurrentDisplayModeString = formatStringFromDisplayMode(currentDisplayMode);
    for (const auto& dm : m_displayModes) {
        m_displayModesString.AddTail(formatStringFromDisplayMode(dm));

        if (currentDisplayMode == dm) {
            m_nCurrentDisplayModeIndex = m_displayModes.size() - 1;
        }
    }

    // Populate the vector with default modes on first initialization
    if (m_autoChangeFSModes.empty()) {
        auto addMode = [this, &currentDisplayMode](double dFRStart, double dFRStop) {
            m_autoChangeFSModes.emplace_back(true, dFRStart, dFRStop, currentDisplayMode);
        };
        addMode(0.0, 0.0); // Default mode
        addMode(23.500, 23.981);
        addMode(23.982, 24.499);
        addMode(24.500, 25.499);
        addMode(29.500, 29.981);
        addMode(29.982, 30.499);
        addMode(49.500, 50.499);
        addMode(59.500, 59.945);
        addMode(59.946, 60.499);
    }

    auto findDisplayMode = [this](const DisplayMode & dm) {
        auto it = std::lower_bound(m_displayModes.cbegin(), m_displayModes.cend(), dm);

        if (it != m_displayModes.cend() && !(dm < *it)) {
            return int(it - m_displayModes.cbegin());
        } else {
            return -1;
        }
    };

    int nItem = 0;
    for (const auto& mode : m_autoChangeFSModes) {
        CString strItemPos;
        strItemPos.Format(_T("%02d"), nItem);
        VERIFY(m_list.InsertItem(nItem, strItemPos) == nItem);

        m_list.SetCheck(nItem, mode.bChecked);

        // Find the corresponding display mode index
        int iDisplayMode = findDisplayMode(mode.dm);
        if (iDisplayMode < 0) {
            iDisplayMode = (int)m_nCurrentDisplayModeIndex;
        }
        m_list.SetItemData(nItem, (DWORD_PTR)iDisplayMode);

        m_list.SetItemText(nItem, COL_DISPLAY_MODE, formatStringFromDisplayMode(mode.dm));

        if (nItem == 0) { // Special case for default mode
            VERIFY(m_list.SetItemText(nItem, COL_N, ResStr(IDS_PPAGE_FS_DEFAULT)));
            VERIFY(m_list.SetItemText(nItem, COL_FRAMERATE_START, ResStr(IDS_PPAGE_FS_OTHER)));
            VERIFY(m_list.SetItemText(nItem, COL_FRAMERATE_STOP, ResStr(IDS_PPAGE_FS_OTHER)));
        } else {
            CString strFrameRate;
            strFrameRate.Format(_T("%.3f"), mode.dFrameRateStart);
            VERIFY(m_list.SetItemText(nItem, COL_FRAMERATE_START, strFrameRate));
            strFrameRate.Format(_T("%.3f"), mode.dFrameRateStop);
            VERIFY(m_list.SetItemText(nItem, COL_FRAMERATE_STOP, strFrameRate));
        }

        nItem++;
    }

    for (int i = 0; i <= COL_DISPLAY_MODE; i++) {
        m_list.SetColumnWidth(i, LVSCW_AUTOSIZE);
        int nColumnWidth = m_list.GetColumnWidth(i);
        m_list.SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER);
        int nHeaderWidth = m_list.GetColumnWidth(i);
        m_list.SetColumnWidth(i, std::max(nColumnWidth, nHeaderWidth));
    }

    m_list.SetRedraw(TRUE);
}
Ejemplo n.º 21
0
void CDVSGeneralPPage::UpdateControlData(bool fSave)
{
    if (fSave) {
        if (m_verext.GetCurSel() >= 0) {
            m_VerExt = (int)m_verext.GetItemData(m_verext.GetCurSel());
        }
        m_HorExt = !!m_mod32fix.GetCheck();
        if (m_resx2.GetCurSel() >= 0) {
            m_ResX2 = (int)m_resx2.GetItemData(m_resx2.GetCurSel());
        }
        m_ResX2minw = m_resx2w.GetPos32();
        m_ResX2minh = m_resx2h.GetPos32();
        if (m_load.GetCurSel() >= 0) {
            m_LoadLevel = (int)m_load.GetItemData(m_load.GetCurSel());
        }
        m_fExternalLoad = !!m_extload.GetCheck();
        m_fWebLoad = !!m_webload.GetCheck();
        m_fEmbeddedLoad = !!m_embload.GetCheck();
    } else {
        m_verext.ResetContent();
        m_verext.AddString(ResStr(IDS_ORGHEIGHT));
        m_verext.SetItemData(0, 0);
        m_verext.AddString(ResStr(IDS_EXTTO169));
        m_verext.SetItemData(1, 1);
        m_verext.AddString(ResStr(IDS_EXTTO43));
        m_verext.SetItemData(2, 2);
        m_verext.AddString(ResStr(IDS_EXTTO480));
        m_verext.SetItemData(3, 3);
        m_verext.AddString(ResStr(IDS_EXTTO576));
        m_verext.SetItemData(4, 4);
        m_verext.AddString(ResStr(IDS_CROPTO169));
        m_verext.SetItemData(5, 0x81);
        m_verext.AddString(ResStr(IDS_CROPTO43));
        m_verext.SetItemData(6, 0x82);
        m_verext.SetCurSel((m_VerExt & 0x7f) + ((m_VerExt & 0x80) ? 4 : 0));
        m_mod32fix.SetCheck(m_HorExt & 1);
        m_resx2.ResetContent();
        m_resx2.AddString(ResStr(IDS_ORGRES));
        m_resx2.SetItemData(0, 0);
        m_resx2.AddString(ResStr(IDS_DBLRES));
        m_resx2.SetItemData(1, 1);
        m_resx2.AddString(ResStr(IDS_DBLRESIF));
        m_resx2.SetItemData(2, 2);
        m_resx2.SetCurSel(m_ResX2);
        m_resx2w.SetRange32(0, 2048);
        m_resx2w.SetPos32(m_ResX2minw);
        m_resx2w.EnableWindow(m_ResX2 == 2);
        m_resx2h.SetRange32(0, 2048);
        m_resx2h.SetPos32(m_ResX2minh);
        m_resx2h.EnableWindow(m_ResX2 == 2);
        m_load.ResetContent();
        m_load.AddString(ResStr(IDS_DONOTLOAD));
        m_load.SetItemData(0, 2);
        m_load.AddString(ResStr(IDS_LOADWHENNEEDED));
        m_load.SetItemData(1, 0);
        m_load.AddString(ResStr(IDS_ALWAYSLOAD));
        m_load.SetItemData(2, 1);
        m_load.SetCurSel(!m_LoadLevel ? 1 : m_LoadLevel == 1 ? 2 : 0);
        m_extload.SetCheck(m_fExternalLoad);
        m_webload.SetCheck(m_fWebLoad);
        m_embload.SetCheck(m_fEmbeddedLoad);
        m_extload.EnableWindow(m_load.GetCurSel() == 1);
        m_webload.EnableWindow(m_load.GetCurSel() == 1);
        m_embload.EnableWindow(m_load.GetCurSel() == 1);
    }
}
Ejemplo n.º 22
0
void CPlayerSubresyncBar::ReloadSubtitle()
{
	m_mode = NONE;
	m_lastSegment = -1;
	m_sts.Empty();

	ResetSubtitle();

	if (!m_pSubStream) {
		return;
	}

	CLSID clsid;
	m_pSubStream->GetClassID(&clsid);

	if (clsid == __uuidof(CVobSubFile)) {
		CVobSubFile* pVSF = (CVobSubFile*)(ISubStream*)m_pSubStream;

		m_mode = VOBSUB;

		ASSERT(pVSF->m_iLang >= 0);
		CAtlArray<CVobSubFile::SubPos>& sp = pVSF->m_langs[pVSF->m_iLang].subpos;

		for (size_t i = 0, j = sp.GetCount(); i < j; i++) {
			CString str;
			str.Format(_T("%d,%d,%d,%Iu"), sp[i].vobid, sp[i].cellid, sp[i].fForced, i);
			m_sts.Add(TToW(str), false, (int)sp[i].start, (int)sp[i].stop);
		}

		m_sts.CreateDefaultStyle(DEFAULT_CHARSET);

		pVSF->m_fOnlyShowForcedSubs = false;

		for (int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++) {
			m_list.DeleteColumn(0);
		}
		m_list.InsertColumn(COL_START, ResStr(IDS_SUBRESYNC_CLN_TIME), LVCFMT_LEFT, 80);
		m_list.InsertColumn(COL_END, ResStr(IDS_SUBRESYNC_CLN_END), LVCFMT_LEFT, 80);
		m_list.InsertColumn(COL_PREVSTART, ResStr(IDS_SUBRESYNC_CLN_PREVIEW), LVCFMT_LEFT, 80);
		m_list.InsertColumn(COL_PREVEND, ResStr(IDS_SUBRESYNC_CLN_END), LVCFMT_LEFT, 80);
		m_list.InsertColumn(COL_VOBID, ResStr(IDS_SUBRESYNC_CLN_VOB_ID), LVCFMT_CENTER, 60);
		m_list.InsertColumn(COL_CELLID, ResStr(IDS_SUBRESYNC_CLN_CELL_ID), LVCFMT_CENTER, 60);
		m_list.InsertColumn(COL_FORCED, ResStr(IDS_SUBRESYNC_CLN_FORCED), LVCFMT_CENTER, 60);
	} else if (clsid == __uuidof(CRenderedTextSubtitle)) {
		CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;

		m_mode = TEXTSUB;

		m_sts.Copy(*pRTS);
		m_sts.ConvertToTimeBased(m_fps);
		m_sts.Sort(true); /*!!m_fUnlink*/

		for (int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++) {
			m_list.DeleteColumn(0);
		}
		m_list.InsertColumn(COL_START, ResStr(IDS_SUBRESYNC_CLN_TIME), LVCFMT_LEFT, 90);
		m_list.InsertColumn(COL_END, ResStr(IDS_SUBRESYNC_CLN_END), LVCFMT_LEFT, 4);
		m_list.InsertColumn(COL_PREVSTART, ResStr(IDS_SUBRESYNC_CLN_PREVIEW), LVCFMT_LEFT, 80);
		m_list.InsertColumn(COL_PREVEND, ResStr(IDS_SUBRESYNC_CLN_END), LVCFMT_LEFT, 4);
		m_list.InsertColumn(COL_TEXT, ResStr(IDS_SUBRESYNC_CLN_TEXT), LVCFMT_LEFT, 275);
		m_list.InsertColumn(COL_STYLE, ResStr(IDS_SUBRESYNC_CLN_STYLE), LVCFMT_LEFT, 80);
		m_list.InsertColumn(COL_FONT, ResStr(IDS_SUBRESYNC_CLN_FONT), LVCFMT_LEFT, 60);
		m_list.InsertColumn(COL_CHARSET, ResStr(IDS_SUBRESYNC_CLN_CHARSET), LVCFMT_CENTER, 20);
		m_list.InsertColumn(COL_UNICODE, ResStr(IDS_SUBRESYNC_CLN_UNICODE), LVCFMT_CENTER, 40);
		m_list.InsertColumn(COL_LAYER, ResStr(IDS_SUBRESYNC_CLN_LAYER), LVCFMT_CENTER, 50);
		m_list.InsertColumn(COL_ACTOR, ResStr(IDS_SUBRESYNC_CLN_ACTOR), LVCFMT_LEFT, 80);
		m_list.InsertColumn(COL_EFFECT, ResStr(IDS_SUBRESYNC_CLN_EFFECT), LVCFMT_LEFT, 80);
	}

	m_subtimes.SetCount(m_sts.GetCount());

	for (size_t i = 0, j = m_sts.GetCount(); i < j; i++) {
		m_subtimes[i].orgstart = m_sts[i].start;
		m_subtimes[i].orgend = m_sts[i].end;
	}

	ResetSubtitle();
}
Ejemplo n.º 23
0
CMDecodePage::CMDecodePage(CWnd* pParent /*=NULL*/)
	: CDialog(CMDecodePage::IDD, pParent)
	, m_auto_threads(TRUE)
	, m_dshow(FALSE)
{
	//{{AFX_DATA_INIT(CMDecodePage)
	//}}AFX_DATA_INIT
	m_vdecode.RemoveAll();
	m_adecode.RemoveAll();
	m_vdecode.Add(_T("coreavcwindows"));
	m_vdecode.Add(_T("lavcuvidwin"));
	m_vdecode.Add(_T("lavcuvid"));
	m_vdecode.Add(_T("coreavc"));
	m_vdecode.Add(_T("divxh264"));
	m_vdecode.Add(_T("diavc"));
	m_vdecode.Add(_T("ffdshow"));
	m_vdecode.Add(_T("cineformhd"));
	m_vdecode.Add(_T("cineformhddshow"));
	m_vdecode.Add(_T("ffdshowdxva"));
	m_vdecode.Add(_T("mpegpes"));
	m_vdecode.Add(_T("mpeg12"));
	m_vdecode.Add(_T("ffmpeg1"));
	m_vdecode.Add(_T("ffmpeg2"));
	m_vdecode.Add(_T("ffmpeg12"));
	m_vdecode.Add(_T("ffwmv1"));
	m_vdecode.Add(_T("ffwmv2"));
	m_vdecode.Add(_T("ffwmv3"));
	m_vdecode.Add(_T("ffvc1"));
	m_vdecode.Add(_T("ffh264"));
	m_vdecode.Add(_T("ffodivx"));
	m_vdecode.Add(_T("ffwv1f"));
	m_vdecode.Add(_T("fflibvpx"));
	m_vdecode.Add(_T("camtasia"));
	m_vdecode.Add(_T("xvid"));
	m_vdecode.Add(_T("divx4vfw"));
	m_vdecode.Add(_T("divxds"));
	m_vdecode.Add(_T("divx"));
	m_vdecode.Add(_T("mpeg4ds"));
	m_vdecode.Add(_T("mpeg4"));
	m_vdecode.Add(_T("wmv11dmo"));
	m_vdecode.Add(_T("wmv9dmo"));
	m_vdecode.Add(_T("wmvdmo"));
	m_vdecode.Add(_T("wmv8"));
	m_vdecode.Add(_T("wmv7"));
	m_vdecode.Add(_T("wmvvc1dmo"));
	m_vdecode.Add(_T("wms10dmod"));
	m_vdecode.Add(_T("wmsdmod"));
	m_vdecode.Add(_T("wmvadmo"));
	m_vdecode.Add(_T("rv3040win"));
	m_vdecode.Add(_T("rv20winrp10"));
	m_vdecode.Add(_T("rv10winrp10"));
	m_vdecode.Add(_T("ffrv40"));
	m_vdecode.Add(_T("ffrv30"));
	m_vdecode.Add(_T("ffrv20"));
	m_vdecode.Add(_T("ffrv10"));
	m_vdecode.Add(_T("ffvp3"));
	m_vdecode.Add(_T("ffvp5"));
	m_vdecode.Add(_T("ffvp6"));
	m_vdecode.Add(_T("ffvp6f"));
	m_vdecode.Add(_T("ffvp8"));
	m_vdecode.Add(_T("fflibvpx"));
	m_vdecode.Add(_T("vp3"));
	m_vdecode.Add(_T("vp4"));
	m_vdecode.Add(_T("vp5"));
	m_vdecode.Add(_T("vp6"));
	m_vdecode.Add(_T("vp7"));
	m_vdecode.Add(_T("null"));

	m_adecode.Add(_T("wmadmo"));
	m_adecode.Add(_T("wma9dmo"));
	m_adecode.Add(_T("wma9spdmo"));
	m_adecode.Add(_T("wma9spdshow"));
	m_adecode.Add(_T("ffcook"));
	m_adecode.Add(_T("ffatrc"));
	m_adecode.Add(_T("ra10cookwin"));
	m_adecode.Add(_T("racookwin"));
	m_adecode.Add(_T("ra10siprwin"));
	m_adecode.Add(_T("rasiprwin"));
	m_adecode.Add(_T("ra10atrcwin"));
	m_adecode.Add(_T("raatrcwin"));
	m_adecode.Add(_T("faad"));
	m_adecode.Add(_T("ffaac"));
	m_adecode.Add(_T("ffflac"));
	m_adecode.Add(_T("fftta"));
	m_adecode.Add(_T("ffwavpack"));
	m_adecode.Add(_T("ffape"));
	m_adecode.Add(_T("pcm"));
	m_adecode.Add(_T("divx"));
	m_adecode.Add(_T("mp3"));
	m_adecode.Add(_T("ffpcmdaud"));
	m_adecode.Add(_T("ffwmav1"));
	m_adecode.Add(_T("ffwmav2"));
	m_adecode.Add(_T("ffwmapro"));
	m_adecode.Add(_T("ffmp3"));
	m_adecode.Add(_T("ffmp3adu"));
	m_adecode.Add(_T("ffmp2"));
	m_adecode.Add(_T("mad"));
	m_adecode.Add(_T("mp3acm"));
	m_adecode.Add(_T("a52"));
	m_adecode.Add(_T("ffac3"));
	m_adecode.Add(_T("ffeac3"));
	m_adecode.Add(_T("dts"));
	m_adecode.Add(_T("ffdca"));
	m_adecode.Add(_T("ffamrnb"));
	m_adecode.Add(_T("ffamrwb"));
	m_adecode.Add(_T("hwac3"));
	m_adecode.Add(_T("hwdts"));
	m_adecode.Add(_T("ffvorbis"));
	m_adecode.Add(_T("vorbis"));

	TCHAR szFilePath[MAX_PATH + 1];
	GetModuleFileName(NULL, szFilePath, MAX_PATH);
	(_tcsrchr(szFilePath, _T('\\')))[1] = 0;
	m_program_dir.Format(_T("%s"),szFilePath);
	m_last_extract = inner;
    	
	m_str_skip1 = ResStr(IDS_DECODE_SKIP1);
	m_str_skip2 = ResStr(IDS_DECODE_SKIP2);
	m_str_skip3 = ResStr(IDS_DECODE_SKIP3);
	m_str_skip4 = ResStr(IDS_DECODE_SKIP4);
	m_str_skip5 = ResStr(IDS_DECODE_SKIP5);

	use1 = ResStr(IDS_PLAYER_USE);
	pr1 = ResStr(IDS_DECODE_PR);
	use = ResStr(IDS_PLAYER_USE);
	name = ResStr(IDS_DECODE_NAME);
	op = ResStr(IDS_PLAYER_OPTION);
	inf = ResStr(IDS_DECODE_INF);

	m_str_avlist.Add(ResStr(IDS_DECODE_SKIPLOOP));
	m_str_avlist.Add(ResStr(IDS_DECODE_SKIPLOOP_INFO));
	m_str_avlist.Add(ResStr(IDS_DECODE_SKIPFRAME));
	m_str_avlist.Add(ResStr(IDS_DECODE_SKIPFRAME_INFO));
	m_str_avlist.Add(ResStr(IDS_DECODE_XY));
	m_str_avlist.Add(ResStr(IDS_DECODE_XY_INFO));
	m_str_avlist.Add(ResStr(IDS_DECODE_LOW));
	m_str_avlist.Add(ResStr(IDS_DECODE_LOW_INFO));
	m_str_avlist.Add(ResStr(IDS_DECODE_THREADS));
	m_str_avlist.Add(ResStr(IDS_DECODE_THREADS_INFO));

	m_str_codecs.Add(ResStr(IDS_DECODE_CODEFILE1));
	m_str_codecs.Add(ResStr(IDS_DECODE_CODEFILE2));
	m_str_codecs.Add(ResStr(IDS_DECODE_CODEFILE3));
	m_str_codecs.Add(_T("LAV CUVID Decoder (Testing)"));
}
Ejemplo n.º 24
0
void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
{
	LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;

	if (lpnmlv->iItem >= 0 && lpnmlv->iSubItem >= 0) {
		enum {
			TOGSEP = 1,
			DUPITEM, DELITEM,
			RESETS, SETOS, SETCS, RESETE, SETOE, SETCE,
			STYLEFIRST, STYLELAST = STYLEFIRST + 1000, STYLEEDIT,
			UNICODEYES, UNICODENO,
			LAYERDEC, LAYERINC,
			ACTORFIRST, ACTORLAST = ACTORFIRST + 1000,
			EFFECTFIRST, EFFECTLAST = EFFECTFIRST + 1000
		};

		CStringArray styles;
		CStringArray actors;
		CStringArray effects;

		CMenu m;
		m.CreatePopupMenu();

		if (m_mode == VOBSUB || m_mode == TEXTSUB) {
			m.AppendMenu(MF_STRING | MF_ENABLED, TOGSEP, ResStr(IDS_SUBRESYNC_SEPARATOR));
			m.AppendMenu(MF_SEPARATOR);
			if (m_mode == TEXTSUB) {
				m.AppendMenu(MF_STRING | MF_ENABLED, DUPITEM, ResStr(IDS_SUBRESYNC_DUPLICATE));
			}
			m.AppendMenu(MF_STRING | MF_ENABLED, DELITEM, ResStr(IDS_SUBRESYNC_DELETE));
		}

		switch (lpnmlv->iSubItem) {
			case COL_START:
				if (m_mode == VOBSUB || m_mode == TEXTSUB) {
					m.AppendMenu(MF_SEPARATOR);
					m.AppendMenu(MF_STRING | MF_ENABLED, RESETS, ResStr(IDS_SUBRESYNC_RESET) + _T("\tF1"));
					m.AppendMenu(MF_STRING | MF_ENABLED, SETOS, ResStr(IDS_SUBRESYNC_ORIGINAL) + _T("\tF3"));
					m.AppendMenu(MF_STRING | MF_ENABLED, SETCS, ResStr(IDS_SUBRESYNC_CURRENT) + _T("\tF5"));
				}
				break;
			case COL_END:
				if (m_mode == TEXTSUB) {
					m.AppendMenu(MF_SEPARATOR);
					m.AppendMenu(MF_STRING | MF_ENABLED, RESETE, ResStr(IDS_SUBRESYNC_RESET) + _T("\tF2"));
					m.AppendMenu(MF_STRING | MF_ENABLED, SETOE, ResStr(IDS_SUBRESYNC_ORIGINAL) + _T("\tF4"));
					m.AppendMenu(MF_STRING | MF_ENABLED, SETCE, ResStr(IDS_SUBRESYNC_CURRENT) + _T("\tF6"));
				}
				break;
			case COL_STYLE:
				if (m_mode == TEXTSUB) {
					m.AppendMenu(MF_SEPARATOR);

					int id = STYLEFIRST;

					POSITION pos = m_sts.m_styles.GetStartPosition();
					while (pos && id <= STYLELAST) {
						CString key;
						STSStyle* val;
						m_sts.m_styles.GetNextAssoc(pos, key, val);
						styles.Add(key);
						m.AppendMenu(MF_STRING | MF_ENABLED, id++, key);
					}

					if (id > STYLEFIRST && m_list.GetSelectedCount() == 1) {
						m.AppendMenu(MF_SEPARATOR);
						m.AppendMenu(MF_STRING | MF_ENABLED, STYLEEDIT, ResStr(IDS_SUBRESYNC_EDIT));
					}
				}
				break;
			case COL_UNICODE:
				if (m_mode == TEXTSUB) {
					m.AppendMenu(MF_SEPARATOR);
					m.AppendMenu(MF_STRING | MF_ENABLED, UNICODEYES, ResStr(IDS_SUBRESYNC_YES));
					m.AppendMenu(MF_STRING | MF_ENABLED, UNICODENO, ResStr(IDS_SUBRESYNC_NO));
				}
				break;
			case COL_LAYER:
				if (m_mode == TEXTSUB) {
					m.AppendMenu(MF_SEPARATOR);
					m.AppendMenu(MF_STRING | MF_ENABLED, LAYERDEC, ResStr(IDS_SUBRESYNC_DECREASE));
					m.AppendMenu(MF_STRING | MF_ENABLED, LAYERINC, ResStr(IDS_SUBRESYNC_INCREASE));
				}
				break;
			case COL_ACTOR:
				if (m_mode == TEXTSUB) {
					CMapStringToPtr actormap;

					for (size_t i = 0, j = m_sts.GetCount(); i < j; i++) {
						actormap[m_sts[i].actor] = NULL;
					}

					actormap.RemoveKey(_T(""));

					if (!actormap.IsEmpty()) {
						m.AppendMenu(MF_SEPARATOR);

						int id = ACTORFIRST;

						POSITION pos = actormap.GetStartPosition();
						while (pos && id <= ACTORLAST) {
							CString key;
							void* val;
							actormap.GetNextAssoc(pos, key, val);

							actors.Add(key);

							m.AppendMenu(MF_STRING | MF_ENABLED, id++, key);
						}
					}
				}
				break;
			case COL_EFFECT:
				if (m_mode == TEXTSUB) {
					CMapStringToPtr effectmap;

					for (size_t i = 0, j = m_sts.GetCount(); i < j; i++) {
						effectmap[m_sts[i].effect] = NULL;
					}

					effectmap.RemoveKey(_T(""));

					if (!effectmap.IsEmpty()) {
						m.AppendMenu(MF_SEPARATOR);

						int id = EFFECTFIRST;

						POSITION pos = effectmap.GetStartPosition();
						while (pos && id <= EFFECTLAST) {
							CString key;
							void* val;
							effectmap.GetNextAssoc(pos, key, val);

							effects.Add(key);

							m.AppendMenu(MF_STRING | MF_ENABLED, id++, key);
						}
					}
				}
				break;
		}

		CPoint p = lpnmlv->ptAction;
		::MapWindowPoints(pNMHDR->hwndFrom, HWND_DESKTOP, &p, 1);

		UINT id = m.TrackPopupMenu(TPM_LEFTBUTTON | TPM_RETURNCMD, p.x, p.y, this);

		bool fNeedsUpdate = false;

		POSITION pos = m_list.GetFirstSelectedItemPosition();
		while (pos) {
			int iItem = m_list.GetNextSelectedItem(pos);

			SubTime& st = m_subtimes[iItem];

			switch (id) {
				case TOGSEP:
					m_list.SetItemData(iItem, m_list.GetItemData(iItem) ^ TSEP);
					m_list.Invalidate();
					fNeedsUpdate = true;
					break;
				case DUPITEM: {
					CUIntArray items;
					pos = m_list.GetFirstSelectedItemPosition();
					while (pos) {
						items.Add(m_list.GetNextSelectedItem(pos));
					}

					qsort(items.GetData(), items.GetCount(), sizeof(UINT), uintcomp);

					for (INT_PTR i = 0, l = items.GetCount(); i < l; i++) {
						iItem = items[i];

						STSEntry stse = m_sts[iItem];
						m_sts.InsertAt(iItem + 1, stse);

						SubTime st = m_subtimes[iItem];
						m_subtimes.InsertAt(iItem + 1, st);

						CHeaderCtrl* pHeader = (CHeaderCtrl*)m_list.GetDlgItem(0);
						int nColumnCount = pHeader->GetItemCount();

						CStringArray sa;
						sa.SetSize(nColumnCount);
						for (int col = 0; col < nColumnCount; col++) {
							sa[col] = m_list.GetItemText(iItem, col);
						}

						DWORD_PTR data = m_list.GetItemData(iItem);
						m_list.InsertItem(iItem + 1, sa[0]);
						m_list.SetItemData(iItem + 1, data);
						for (int col = 1; col < nColumnCount; col++) {
							m_list.SetItemText(iItem + 1, col, sa[col]);
						}
					}
				}

				fNeedsUpdate = true;
				break;
				case DELITEM: {
					CUIntArray items;
					pos = m_list.GetFirstSelectedItemPosition();
					while (pos) {
						items.Add(m_list.GetNextSelectedItem(pos));
					}

					qsort(items.GetData(), items.GetCount(), sizeof(UINT), uintcomp);

					for (INT_PTR i = 0, l = items.GetCount(); i < l; i++) {
						iItem = items[i];
						m_sts.RemoveAt(iItem);
						m_subtimes.RemoveAt(iItem);
						m_list.DeleteItem(iItem);
					}

					iItem = items[items.GetCount() - 1];
					if (iItem >= m_list.GetItemCount()) {
						iItem = m_list.GetItemCount() - 1;
					}

					m_list.SetSelectionMark(iItem);
				}
				fNeedsUpdate = true;
				break;
				case RESETS: /*if (*/
					ModStart(iItem, st.orgstart, true);/*)*/
					fNeedsUpdate = true;
					break;
				case SETOS: /*if (*/
					ModStart(iItem, st.orgstart);/*)*/
					fNeedsUpdate = true;
					break;
				case SETCS: /*if (*/
					ModStart(iItem, (int)(m_rt / 10000)); /*)*/
					fNeedsUpdate = true;
					break;
				case RESETE: /*if (*/
					ModEnd(iItem, st.orgend, true);/*)*/
					fNeedsUpdate = true;
					break;
				case SETOE: /*if (*/
					ModEnd(iItem, st.orgend);/*)*/
					fNeedsUpdate = true;
					break;
				case SETCE: /*if (*/
					ModEnd(iItem, (int)(m_rt / 10000)); /*)*/
					fNeedsUpdate = true;
					break;
				default:
					if (STYLEFIRST <= id && id <= STYLELAST) {
						CString s = styles[id - STYLEFIRST];
						if (m_sts[iItem].style != s) {
							fNeedsUpdate = true;
						}
						m_sts[iItem].style = s;
						m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
					} else if (id == STYLEEDIT) {
						CAutoPtrArray<CPPageSubStyle> pages;
						CAtlArray<STSStyle*> styles;

						STSStyle* stss = m_sts.GetStyle(iItem);
						int iSelPage = 0;

						POSITION pos = m_sts.m_styles.GetStartPosition();
						for (int i = 0; pos; i++) {
							CString key;
							STSStyle* val;
							m_sts.m_styles.GetNextAssoc(pos, key, val);

							CAutoPtr<CPPageSubStyle> page(DNew CPPageSubStyle());
							page->InitSubStyle(key, val);
							pages.Add(page);
							styles.Add(val);

							if (stss == val) {
								iSelPage = i;
							}
						}

						CPropertySheet dlg(_T("Styles..."), this, iSelPage);
						for (size_t i = 0, l = pages.GetCount(); i < l; i++) {
							dlg.AddPage(pages[i]);
						}

						if (dlg.DoModal() == IDOK) {
							for (size_t j = 0, l = pages.GetCount(); j < l; j++) {
								stss = styles[j];
								pages[j]->GetSubStyle(stss);

								for (int i = 0; i < (int)m_sts.GetCount(); i++) {
									if (m_sts.GetStyle(i) == stss) {
										CString str;
										m_list.SetItemText(i, COL_TEXT, m_sts.GetStrW(i, true));
										m_list.SetItemText(i, COL_FONT, stss->fontName);
										str.Format(_T("%d"), stss->charSet);
										m_list.SetItemText(i, COL_CHARSET, str);
										str.Format(_T("%d"), m_sts[i].layer);
									}
								}
							}

							fNeedsUpdate = true;
						}
					} else if (id == UNICODEYES || id == UNICODENO) {
						m_sts.ConvertUnicode(iItem, id == UNICODEYES);
						m_list.SetItemText(iItem, COL_TEXT, m_sts.GetStrW(iItem, true));
						m_list.SetItemText(iItem, COL_UNICODE, m_sts.IsEntryUnicode(iItem) ? _T("yes") : _T("no"));
						fNeedsUpdate = true;
					} else if (id == LAYERDEC || id == LAYERINC) {
						int d = (id == LAYERDEC) ? -1 : 1;
						fNeedsUpdate = true;
						m_sts[iItem].layer += d;
						CString s;
						s.Format(_T("%d"), m_sts[iItem].layer);
						m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
					} else if (ACTORFIRST <= id && id <= ACTORLAST) {
						CString s = actors[id - ACTORFIRST];
						if (m_sts[iItem].actor != s) {
							fNeedsUpdate = true;
						}
						m_sts[iItem].actor = s;
						m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
					} else if (EFFECTFIRST <= id && id <= EFFECTLAST) {
						CString s = effects[id - EFFECTFIRST];
						if (m_sts[iItem].effect != s) {
							fNeedsUpdate = true;
						}
						m_sts[iItem].effect = s;
						m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
					}
					break;
			}
		}

		if (fNeedsUpdate) {
			UpdatePreview();
		}
	}

	*pResult = 0;
}
Ejemplo n.º 25
0
void CPPageInternalFiltersListBox::OnRButtonDown(UINT nFlags, CPoint point)
{
    CCheckListBox::OnRButtonDown(nFlags, point);

    CMenu m;
    m.CreatePopupMenu();

    enum {
        ENABLE_ALL = 1,
        DISABLE_ALL,
        ENABLE_VIDEO,
        DISABLE_VIDEO,
        ENABLE_AUDIO,
        DISABLE_AUDIO
    };

    int totalFilters = 0, totalChecked = 0;
    for (int i = 0; i < FILTER_TYPE_NB; i++) {
        totalFilters += m_nbFiltersPerType[i];
        totalChecked += m_nbChecked[i];
    }

    UINT state = (totalChecked != totalFilters) ? MF_ENABLED : MF_GRAYED;
    m.AppendMenu(MF_STRING | state, ENABLE_ALL, ResStr(IDS_ENABLE_ALL_FILTERS));
    state = (totalChecked != 0) ? MF_ENABLED : MF_GRAYED;
    m.AppendMenu(MF_STRING | state, DISABLE_ALL, ResStr(IDS_DISABLE_ALL_FILTERS));

    if (m_n == 1) {
        m.AppendMenu(MF_SEPARATOR);
        state = (m_nbChecked[AUDIO_DECODER] != m_nbFiltersPerType[AUDIO_DECODER]) ? MF_ENABLED : MF_GRAYED;
        m.AppendMenu(MF_STRING | state, ENABLE_AUDIO, ResStr(IDS_ENABLE_AUDIO_FILTERS));
        state = (m_nbChecked[AUDIO_DECODER] != 0) ? MF_ENABLED : MF_GRAYED;
        m.AppendMenu(MF_STRING | state, DISABLE_AUDIO, ResStr(IDS_DISABLE_AUDIO_FILTERS));

        m.AppendMenu(MF_SEPARATOR);
        state = (m_nbChecked[VIDEO_DECODER] != m_nbFiltersPerType[VIDEO_DECODER]) ? MF_ENABLED : MF_GRAYED;
        m.AppendMenu(MF_STRING | state, ENABLE_VIDEO, ResStr(IDS_ENABLE_VIDEO_FILTERS));
        state = (m_nbChecked[VIDEO_DECODER] != 0) ? MF_ENABLED : MF_GRAYED;
        m.AppendMenu(MF_STRING | state, DISABLE_VIDEO, ResStr(IDS_DISABLE_VIDEO_FILTERS));
    }

    CPoint p = point;
    ::MapWindowPoints(m_hWnd, HWND_DESKTOP, &p, 1);

    UINT id = m.TrackPopupMenu(TPM_LEFTBUTTON | TPM_RETURNCMD, p.x, p.y, this);

    if (id == 0) {
        return;
    }

    int index = 0;
    for (int i = 0; i < m_filters.GetCount(); i++) {
        switch (m_filters[i].type) {
            case SOURCE_FILTER:
                if (m_n == 1) {
                    continue;
                }
                break;
            case AUDIO_DECODER:
            case VIDEO_DECODER:
                if (m_n == 0) {
                    continue;
                }
                break;
            default:
                continue;
        }

        switch (id) {
            case ENABLE_ALL:
                SetCheck(index, TRUE);
                break;
            case DISABLE_ALL:
                SetCheck(index, FALSE);
                break;
            case ENABLE_AUDIO:
                if (m_filters[i].type == AUDIO_DECODER) {
                    SetCheck(index, TRUE);
                }
                break;
            case DISABLE_AUDIO:
                if (m_filters[i].type == AUDIO_DECODER) {
                    SetCheck(index, FALSE);
                }
                break;
            case ENABLE_VIDEO:
                if (m_filters[i].type == VIDEO_DECODER) {
                    SetCheck(index, TRUE);
                }
                break;
            case DISABLE_VIDEO:
                if (m_filters[i].type == VIDEO_DECODER) {
                    SetCheck(index, FALSE);
                }
                break;
        }
        index++;
    }

    GetParent()->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), CLBN_CHKCHANGE), (LPARAM)m_hWnd);
}
Ejemplo n.º 26
0
HRESULT CSaveTaskDlg::InitFileCopy()
{
	AppSettings& s = AfxGetAppSettings();

	if (OpenImageCheck(m_in) && s.strSnapShotExt != _T(".*")) {
		OpenImageDIB(m_in, m_out, s.iThumbQuality, 0);
		return S_OK;
	}

	if (FAILED(pGB.CoCreateInstance(CLSID_FilterGraph)) || !(pMC = pGB) || !(pME = pGB) || !(pMS = pGB)) {
		SetFooterIcon(MAKEINTRESOURCE(IDI_ERROR));
		SetFooterText(ResStr(IDS_AG_ERROR));
		return S_FALSE;
	}

	HRESULT hr;

	CStringW fnw = m_in;
	CComPtr<IFileSourceFilter> pReader;

	if (!pReader && m_in.Mid(m_in.ReverseFind('.')+1).MakeLower() == _T("cda")) {
		hr = S_OK;
		CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CCDDAReader(NULL, &hr);

		if (FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL))) {
			pReader.Release();
		}
	}

	if (!pReader) {
		hr = S_OK;
		CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CCDXAReader(NULL, &hr);

		if (FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL))) {
			pReader.Release();
		}
	}

	if (!pReader ) {
		hr = S_OK;
		CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)DNew CVTSReader(NULL, &hr);

		if (FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL))) {
			pReader.Release();
		} else {
			CPath pout(m_out);
			pout.RenameExtension(_T(".ifo"));
			CopyFile(m_in, pout, FALSE);
		}
	}

	if (!pReader) {
		hr = S_OK;
		CComPtr<IUnknown> pUnk;
		pUnk.CoCreateInstance(CLSID_AsyncReader);

		if (!(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL))) {
			pReader.Release();
		}
	}

	if (!pReader) {
		hr = S_OK;
		CComPtr<IUnknown> pUnk;
		pUnk.CoCreateInstance(CLSID_URLReader);

		if (CComQIPtr<IBaseFilter> pSrc = pUnk) {
			pGB->AddFilter(pSrc, fnw);

			if (!(pReader = pUnk) || FAILED(hr = pReader->Load(fnw, NULL))) {
				pReader.Release();
				pGB->RemoveFilter(pSrc);
			}
		}
	}

	CComQIPtr<IBaseFilter> pSrc = pReader;

	if (FAILED(pGB->AddFilter(pSrc, fnw))) {
		SetFooterIcon(MAKEINTRESOURCE(IDI_ERROR));
		SetFooterText(_T("Sorry, can't save this file, press Cancel"));
		return S_FALSE;
	}

	CComQIPtr<IBaseFilter> pMid = DNew CStreamDriveThruFilter(NULL, &hr);

	if (FAILED(pGB->AddFilter(pMid, L"StreamDriveThru"))) {
		SetFooterIcon(MAKEINTRESOURCE(IDI_ERROR));
		SetFooterText(ResStr(IDS_AG_ERROR));

		return S_FALSE;
	}

	CComQIPtr<IBaseFilter> pDst;
	pDst.CoCreateInstance(CLSID_FileWriter);
	CComQIPtr<IFileSinkFilter2> pFSF = pDst;
	pFSF->SetFileName(CStringW(m_out), NULL);
	pFSF->SetMode(AM_FILE_OVERWRITE);

	if (FAILED(pGB->AddFilter(pDst, L"File Writer"))) {
		SetFooterIcon(MAKEINTRESOURCE(IDI_ERROR));
		SetFooterText(ResStr(IDS_AG_ERROR));

		return S_FALSE;
	}

	hr = pGB->Connect(
			 GetFirstPin((pSrc), PINDIR_OUTPUT),
			 GetFirstPin((pMid), PINDIR_INPUT));

	if (FAILED(hr)) {
		SetFooterIcon(MAKEINTRESOURCE(IDI_ERROR));
		SetFooterText(_T("Error Connect pSrc / pMid"));

		return S_FALSE;
	}

	hr = pGB->Connect(
			 GetFirstPin((pMid), PINDIR_OUTPUT),
			 GetFirstPin((pDst), PINDIR_INPUT));
	if (FAILED(hr)) {
		SetFooterIcon(MAKEINTRESOURCE(IDI_ERROR));
		SetFooterText(_T("Error Connect pMid / pDst"));

		return S_FALSE;
	}

	pMS = pMid;

	pMC->Run();

	return S_OK;
}
Ejemplo n.º 27
0
BOOL CPPageOutput::OnInitDialog()
{
    __super::OnInitDialog();

    SetHandCursor(m_hWnd, IDC_AUDRND_COMBO);

    const CAppSettings& s = AfxGetAppSettings();
    const CRenderersSettings& renderersSettings = s.m_RenderersSettings;

    m_iDSVideoRendererType  = s.iDSVideoRendererType;
    m_iRMVideoRendererType  = s.iRMVideoRendererType;
    m_iQTVideoRendererType  = s.iQTVideoRendererType;

    m_APSurfaceUsageCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_SURF_OFFSCREEN));
    m_APSurfaceUsageCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_SURF_2D));
    m_APSurfaceUsageCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_SURF_3D));
    m_iAPSurfaceUsage       = renderersSettings.iAPSurfaceUsage;

    m_DX9ResizerCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_RESIZE_NN));
    m_DX9ResizerCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_RESIZER_BILIN));
    m_DX9ResizerCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_RESIZER_BIL_PS));
    m_DX9ResizerCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_RESIZER_BICUB1));
    m_DX9ResizerCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_RESIZER_BICUB2));
    m_DX9ResizerCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_RESIZER_BICUB3));
    m_iDX9Resizer           = renderersSettings.iDX9Resizer;

    m_fVMR9MixerMode        = renderersSettings.fVMR9MixerMode;
    m_fVMR9MixerYUV         = renderersSettings.fVMR9MixerYUV;
    m_fVMR9AlterativeVSync  = renderersSettings.m_RenderSettings.fVMR9AlterativeVSync;
    m_fD3DFullscreen        = s.fD3DFullscreen;

    int EVRBuffers[] = {4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30, 35, 40, 45, 50, 55, 60};
    CString EVRBuffer;
    for (size_t i = 0; i < _countof(EVRBuffers); i++) {
        EVRBuffer.Format(_T("%d"), EVRBuffers[i]);
        m_EVRBuffersCtrl.AddString(EVRBuffer);
    }
    m_iEvrBuffers.Format(L"%d", renderersSettings.iEvrBuffers);

    m_iAudioRendererTypeCtrl.SetRedraw(FALSE);
    m_fResetDevice = s.m_RenderersSettings.fResetDevice;
    m_AudioRendererDisplayNames.Add(_T(""));
    m_iAudioRendererTypeCtrl.AddString(_T("1: ") + ResStr(IDS_PPAGE_OUTPUT_SYS_DEF));
    m_iAudioRendererType = 0;

    int i = 2;
    CString Cbstr;

    BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker) {
        LPOLESTR olestr = NULL;
        if (FAILED(pMoniker->GetDisplayName(0, 0, &olestr))) {
            continue;
        }

        CStringW str(olestr);
        CoTaskMemFree(olestr);

        m_AudioRendererDisplayNames.Add(CString(str));

        CComPtr<IPropertyBag> pPB;
        if (SUCCEEDED(pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB))) {
            CComVariant var;
            pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL);

            CString fstr(var.bstrVal);

            var.Clear();
            if (SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL))) {
                BSTR* pbstr;
                if (SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pbstr))) {
                    fstr.Format(_T("%s (%08x)"), CString(fstr), *((DWORD*)pbstr + 1));
                    SafeArrayUnaccessData(var.parray);
                }
            }
            Cbstr.Format(_T("%d: %s"), i, fstr);
        } else {
            Cbstr.Format(_T("%d: %s"), i, CString(str));
        }
        m_iAudioRendererTypeCtrl.AddString(Cbstr);

        if (s.strAudioRendererDisplayName == str && m_iAudioRendererType == 0) {
            m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount() - 1;
        }
        i++;
    }
Ejemplo n.º 28
0
STDAPI DllRegisterServer()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0) != 1)
		theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0);

	if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VMRZOOMENABLED), -1) == -1)
		theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VMRZOOMENABLED), 0);

	if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), -1) == -1)
		theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), 0);

	/*removeme*/
	JajDeGonoszVagyok();

	return AMovieDllRegisterServer2(TRUE);
}
Ejemplo n.º 29
0
void CSubtitleDlDlg::OnOK()
{
	SetStatus(ResStr(IDS_SUBDL_DLG_DOWNLOADING));

	for (int i = 0; i < m_list.GetItemCount(); ++i) {
		if (m_list.GetCheck(i)) {
			m_selsubs.AddTail(*reinterpret_cast<isdb_subtitle*>(m_list.GetItemData(i)));
		}
	}

	m_fReplaceSubs = IsDlgButtonChecked(IDC_CHECK1) == BST_CHECKED;

	CMainFrame* pMF = static_cast<CMainFrame*>(GetParentFrame());

	if (m_fReplaceSubs) {
		pMF->m_pSubStreams.RemoveAll();
	}

	CComPtr<ISubStream> pSubStreamToSet;

	POSITION pos = m_selsubs.GetHeadPosition();

	while (pos) {
		const isdb_subtitle& sub = m_selsubs.GetNext(pos);
		AppSettings& s = AfxGetAppSettings();
		CInternetSession is;
		CStringA url = "http://" + s.strISDb + "/dl.php?";
		CStringA args, ticket, str;
		args.Format("id=%d&ticket=%s", sub.id, UrlEncode(ticket));
		url.Append(args);

		if (OpenUrl(is, CString(url), str)) {

			if (pMF->b_UseVSFilter) {
				if (CComQIPtr<IDirectVobSub> pDVS = pMF->GetVSFilter()) {
					TCHAR lpszTempPath[_MAX_PATH] = { 0 };
					if (::GetTempPath(_MAX_PATH, lpszTempPath)) {
						CString subFileName(lpszTempPath);
						subFileName.Append(CString(sub.name));
						if (::PathFileExists(subFileName)) {
							::DeleteFile(subFileName);
						}

						CFile cf;
						if (cf.Open(subFileName, CFile::modeCreate|CFile::modeWrite|CFile::shareDenyNone)) {
							cf.Write(str.GetString(), str.GetLength());
							cf.Close();

							if (SUCCEEDED(pDVS->put_FileName((LPWSTR)(LPCWSTR)subFileName))) {
								pDVS->put_SelectedLanguage(0);
								pDVS->put_HideSubtitles(true);
								pDVS->put_HideSubtitles(false);
							}

							::DeleteFile(subFileName);
						}
					}

					__super::OnOK();
					return;
				}
			}

			CAutoPtr<CRenderedTextSubtitle> pRTS(DNew CRenderedTextSubtitle(&pMF->m_csSubLock, &s.subdefstyle, s.fUseDefaultSubtitlesStyle));
			if (pRTS && pRTS->Open((BYTE*)(LPCSTR)str, str.GetLength(), DEFAULT_CHARSET, CString(sub.name)) && pRTS->GetStreamCount() > 0) {
				CComPtr<ISubStream> pSubStream = pRTS.Detach();
				pMF->m_pSubStreams.AddTail(pSubStream);

				if (!pSubStreamToSet) {
					pSubStreamToSet = pSubStream;
				}
			}
		}
	}

	if (pSubStreamToSet) {
		pMF->SetSubtitle(pSubStreamToSet);

		AfxGetAppSettings().fEnableSubtitles = true;
	}

	__super::OnOK();
}
Ejemplo n.º 30
0
LONG WINAPI CMiniDump::UnhandledExceptionFilter( _EXCEPTION_POINTERS *lpTopLevelExceptionFilter )
{
	LONG	retval	= EXCEPTION_CONTINUE_SEARCH;
	HMODULE	hDll	= NULL;
	_TCHAR	szResult[ 800 ];
	_TCHAR	szDbgHelpPath[ _MAX_PATH ];

	if ( !m_bMiniDumpEnabled )
		return 0;

	// firstly see if dbghelp.dll is around and has the function we need
	// look next to the EXE first, as the one in System32 might be old
	// (e.g. Windows 2000)

	if ( GetModuleFileName(NULL, szDbgHelpPath, _MAX_PATH) )
	{
		_TCHAR *pSlash = _tcsrchr( szDbgHelpPath, _T('\\') );
		if ( pSlash != NULL )
		{
			_tcscpy_s( pSlash + 1, _MAX_PATH + szDbgHelpPath - pSlash, _T("DBGHELP.DLL") );
			hDll = ::LoadLibrary( szDbgHelpPath );
		}
	}

	if ( hDll == NULL )
	{
		// load any version we can
		hDll = ::LoadLibrary( _T("DBGHELP.DLL") );
	}

	if ( hDll != NULL )
	{
		MINIDUMPWRITEDUMP pMiniDumpWriteDump = (MINIDUMPWRITEDUMP)::GetProcAddress( hDll, "MiniDumpWriteDump" );
		if ( pMiniDumpWriteDump != NULL )
		{
			_TCHAR szDumpPath[ _MAX_PATH ];
			_TCHAR szVersion[ 40 ];

			GetModuleFileName( NULL, szDumpPath, _MAX_PATH );
			_stprintf_s( szVersion, countof(szVersion), _T(".%d.%d.%d.%d"), VERSION_MAJOR, VERSION_MINOR, VERSION_REV, VERSION_PATCH );
			_tcscat_s( szDumpPath, _MAX_PATH, szVersion );
			_tcscat_s( szDumpPath, _MAX_PATH, _T(".dmp") );

			// create the file
			HANDLE hFile = ::CreateFile( szDumpPath, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,
										 FILE_ATTRIBUTE_NORMAL, NULL );

			if ( hFile != INVALID_HANDLE_VALUE )
			{
				_MINIDUMP_EXCEPTION_INFORMATION ExInfo;

				ExInfo.ThreadId = ::GetCurrentThreadId();
				ExInfo.ExceptionPointers = lpTopLevelExceptionFilter;
				ExInfo.ClientPointers = NULL;

				// write the dump
				BOOL bOK = pMiniDumpWriteDump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL );
				if ( bOK )
				{
					_stprintf_s( szResult, countof(szResult), ResStr(IDS_MPC_CRASH), szDumpPath );
					retval = EXCEPTION_EXECUTE_HANDLER;
				}
				else
				{
					_stprintf_s( szResult, countof(szResult), ResStr(IDS_MPC_MINIDUMP_FAIL), szDumpPath, GetLastError() );
				}

				::CloseHandle( hFile );
			}
			else
			{
				_stprintf_s( szResult, countof(szResult), ResStr(IDS_MPC_MINIDUMP_FAIL), szDumpPath, GetLastError() );
			}
		}
		FreeLibrary( hDll );
	}

	if ( szResult )
		MessageBox( NULL, szResult, _T("MPC-HC Mini Dump"), MB_OK );

	return retval;
}