diff options
author | clsid2 <clsid2@users.sourceforge.net> | 2010-01-21 21:53:12 +0300 |
---|---|---|
committer | clsid2 <clsid2@users.sourceforge.net> | 2010-01-21 21:53:12 +0300 |
commit | 755d4397d7070da2de369aeda608addbb19b0874 (patch) | |
tree | 23a73c920bf6b9b4c54dc3dbb1af8c25ebb04c52 /src/filters/transform/mpcvideodec | |
parent | 10e2fe95b6b90086530b085b77a69334ab5a69b7 (diff) |
Fixed custom MPC build without ffmpeg decoders.
It is now also possible to build a DXVA-only standalone MPCVideoDec filter.
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1542 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/transform/mpcvideodec')
-rw-r--r-- | src/filters/transform/mpcvideodec/MPCVideoDecFilter.cpp | 31 | ||||
-rw-r--r-- | src/filters/transform/mpcvideodec/MPCVideoDecSettingsWnd.cpp | 48 |
2 files changed, 60 insertions, 19 deletions
diff --git a/src/filters/transform/mpcvideodec/MPCVideoDecFilter.cpp b/src/filters/transform/mpcvideodec/MPCVideoDecFilter.cpp index 7c98a1d77..424799ea1 100644 --- a/src/filters/transform/mpcvideodec/MPCVideoDecFilter.cpp +++ b/src/filters/transform/mpcvideodec/MPCVideoDecFilter.cpp @@ -181,6 +181,7 @@ DXVA_PARAMS DXVA_VC1 = FFMPEG_CODECS ffCodecs[] =
{
+#if INCLUDE_MPC_VIDEO_DECODER
// Flash video
{ &MEDIASUBTYPE_FLV1, CODEC_ID_FLV1, MAKEFOURCC('F','L','V','1'), NULL },
{ &MEDIASUBTYPE_flv1, CODEC_ID_FLV1, MAKEFOURCC('f','l','v','1'), NULL },
@@ -255,6 +256,7 @@ FFMPEG_CODECS ffCodecs[] = // AMV Video
{ &MEDIASUBTYPE_AMVV, CODEC_ID_AMV, MAKEFOURCC('A','M','V','V'), NULL },
+#endif /* INCLUDE_MPC_VIDEO_DECODER */
// H264/AVC
{ &MEDIASUBTYPE_H264, CODEC_ID_H264, MAKEFOURCC('H','2','6','4'), &DXVA_H264 },
@@ -270,7 +272,8 @@ FFMPEG_CODECS ffCodecs[] = { &MEDIASUBTYPE_AVC1, CODEC_ID_H264, MAKEFOURCC('A','V','C','1'), &DXVA_H264 },
{ &MEDIASUBTYPE_avc1, CODEC_ID_H264, MAKEFOURCC('a','v','c','1'), &DXVA_H264 },
{ &MEDIASUBTYPE_H264_bis, CODEC_ID_H264, MAKEFOURCC('a','v','c','1'), &DXVA_H264 },
-
+
+#if INCLUDE_MPC_VIDEO_DECODER
// SVQ3
{ &MEDIASUBTYPE_SVQ3, CODEC_ID_SVQ3, MAKEFOURCC('S','V','Q','3'), NULL },
@@ -293,12 +296,13 @@ FFMPEG_CODECS ffCodecs[] = // Theora
{ &MEDIASUBTYPE_THEORA, CODEC_ID_THEORA, MAKEFOURCC('T','H','E','O'), NULL },
{ &MEDIASUBTYPE_theora, CODEC_ID_THEORA, MAKEFOURCC('t','h','e','o'), NULL },
+#endif /* INCLUDE_MPC_VIDEO_DECODER */
// WVC1
{ &MEDIASUBTYPE_WVC1, CODEC_ID_VC1, MAKEFOURCC('W','V','C','1'), &DXVA_VC1 },
{ &MEDIASUBTYPE_wvc1, CODEC_ID_VC1, MAKEFOURCC('w','v','c','1'), &DXVA_VC1 },
-
+#if INCLUDE_MPC_VIDEO_DECODER
// Other MPEG-4
{ &MEDIASUBTYPE_MP4V, CODEC_ID_MPEG4, MAKEFOURCC('M','P','4','V'), NULL },
{ &MEDIASUBTYPE_mp4v, CODEC_ID_MPEG4, MAKEFOURCC('m','p','4','v'), NULL },
@@ -340,11 +344,13 @@ FFMPEG_CODECS ffCodecs[] = { &MEDIASUBTYPE_ump4, CODEC_ID_MPEG4, MAKEFOURCC('u','m','p','4'), NULL },
{ &MEDIASUBTYPE_WV1F, CODEC_ID_MPEG4, MAKEFOURCC('W','V','1','F'), NULL },
{ &MEDIASUBTYPE_wv1f, CODEC_ID_MPEG4, MAKEFOURCC('w','v','1','f'), NULL },
+#endif /* INCLUDE_MPC_VIDEO_DECODER */
};
/* Important: the order should be exactly the same as in ffCodecs[] */
const AMOVIESETUP_MEDIATYPE CMPCVideoDecFilter::sudPinTypesIn[] =
{
+#if INCLUDE_MPC_VIDEO_DECODER
// Flash video
{ &MEDIATYPE_Video, &MEDIASUBTYPE_FLV1 },
{ &MEDIATYPE_Video, &MEDIASUBTYPE_flv1 },
@@ -419,6 +425,7 @@ const AMOVIESETUP_MEDIATYPE CMPCVideoDecFilter::sudPinTypesIn[] = // AMV Video
{ &MEDIATYPE_Video, &MEDIASUBTYPE_AMVV },
+#endif /* INCLUDE_MPC_VIDEO_DECODER */
// H264/AVC
{ &MEDIATYPE_Video, &MEDIASUBTYPE_H264 },
@@ -435,6 +442,7 @@ const AMOVIESETUP_MEDIATYPE CMPCVideoDecFilter::sudPinTypesIn[] = { &MEDIATYPE_Video, &MEDIASUBTYPE_avc1 },
{ &MEDIATYPE_Video, &MEDIASUBTYPE_H264_bis },
+#if INCLUDE_MPC_VIDEO_DECODER
// SVQ3
{ &MEDIATYPE_Video, &MEDIASUBTYPE_SVQ3 },
@@ -457,11 +465,13 @@ const AMOVIESETUP_MEDIATYPE CMPCVideoDecFilter::sudPinTypesIn[] = // Theora
{ &MEDIATYPE_Video, &MEDIASUBTYPE_THEORA },
{ &MEDIATYPE_Video, &MEDIASUBTYPE_theora },
+#endif /* INCLUDE_MPC_VIDEO_DECODER */
// VC1
{ &MEDIATYPE_Video, &MEDIASUBTYPE_WVC1 },
{ &MEDIATYPE_Video, &MEDIASUBTYPE_wvc1 },
-
+
+#if INCLUDE_MPC_VIDEO_DECODER
// IMPORTANT : some of the last MediaTypes present in next group may be not available in
// the standalone filter (workaround to prevent GraphEdit crash).
// Other MPEG-4
@@ -505,6 +515,7 @@ const AMOVIESETUP_MEDIATYPE CMPCVideoDecFilter::sudPinTypesIn[] = { &MEDIATYPE_Video, &MEDIASUBTYPE_ump4 },
{ &MEDIATYPE_Video, &MEDIASUBTYPE_WV1F },
{ &MEDIATYPE_Video, &MEDIASUBTYPE_wv1f }
+#endif /* INCLUDE_MPC_VIDEO_DECODER */
};
const int CMPCVideoDecFilter::sudPinTypesInCount = countof(CMPCVideoDecFilter::sudPinTypesIn);
@@ -619,7 +630,9 @@ CMPCVideoDecFilter::CMPCVideoDecFilter(LPUNKNOWN lpunk, HRESULT* phr) avcodec_init();
avcodec_register_all();
av_log_set_callback(LogLibAVCodec);
+#if INCLUDE_MPC_VIDEO_DECODER
init_libvo();
+#endif
EnumWindows(EnumFindProcessWnd, (LPARAM)&hWnd);
DetectVideoCard(hWnd);
@@ -785,7 +798,7 @@ int CMPCVideoDecFilter::FindCodec(const CMediaType* mtIn) return ((m_bUseDXVA || m_bUseFFmpeg) ? i : -1);
#else
- bool bCodecActivated = true;
+ bool bCodecActivated = false;
switch (ffCodecs[i].nFFCodec)
{
case CODEC_ID_FLV1 :
@@ -846,8 +859,6 @@ int CMPCVideoDecFilter::FindCodec(const CMediaType* mtIn) case CODEC_ID_VP6A :
bCodecActivated = (m_nActiveCodecs & MPCVD_VP6) != 0;
break;
- default :
- ASSERT(FALSE);
}
return (bCodecActivated ? i : -1);
#endif
@@ -878,12 +889,13 @@ void CMPCVideoDecFilter::Cleanup() }
if (m_pFrame) av_free(m_pFrame);
+#if INCLUDE_MPC_VIDEO_DECODER
if (m_pSwsContext)
{
sws_freeContext(m_pSwsContext);
m_pSwsContext = NULL;
}
-
+#endif /* INCLUDE_MPC_VIDEO_DECODER */
m_pAVCodec = NULL;
m_pAVCtx = NULL;
@@ -1372,7 +1384,7 @@ void CMPCVideoDecFilter::SetTypeSpecificFlags(IMediaSample* pMS) }
}
-
+#if INCLUDE_MPC_VIDEO_DECODER
int CMPCVideoDecFilter::GetCspFromMediaType(GUID& subtype)
{
if (subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV || subtype == MEDIASUBTYPE_YV12)
@@ -1434,6 +1446,7 @@ template<class T> inline T odd2even(T x) x + 1 :
x;
}
+#endif /* INCLUDE_MPC_VIDEO_DECODER */
HRESULT CMPCVideoDecFilter::SoftwareDecode(IMediaSample* pIn, BYTE* pDataIn, int nSize, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop)
{
@@ -1475,6 +1488,7 @@ HRESULT CMPCVideoDecFilter::SoftwareDecode(IMediaSample* pIn, BYTE* pDataIn, int pOut->SetTime(&rtStart, &rtStop);
pOut->SetMediaTime(NULL, NULL);
+#if INCLUDE_MPC_VIDEO_DECODER
if (m_pSwsContext == NULL) InitSwscale();
if (m_pSwsContext != NULL)
@@ -1503,6 +1517,7 @@ HRESULT CMPCVideoDecFilter::SoftwareDecode(IMediaSample* pIn, BYTE* pDataIn, int sws_scale_ordered (m_pSwsContext, m_pFrame->data, srcStride, 0, m_pAVCtx->height, dst, dstStride);
// CopyBuffer(pDataOut, m_pFrame->data, m_pAVCtx->width, m_pAVCtx->height, m_pFrame->linesize[0], MEDIASUBTYPE_I420, false);
}
+#endif /* INCLUDE_MPC_VIDEO_DECODER */
#if defined(_DEBUG) && 0
static REFERENCE_TIME rtLast = 0;
diff --git a/src/filters/transform/mpcvideodec/MPCVideoDecSettingsWnd.cpp b/src/filters/transform/mpcvideodec/MPCVideoDecSettingsWnd.cpp index db8320cd5..bc33092a8 100644 --- a/src/filters/transform/mpcvideodec/MPCVideoDecSettingsWnd.cpp +++ b/src/filters/transform/mpcvideodec/MPCVideoDecSettingsWnd.cpp @@ -87,10 +87,11 @@ bool CMPCVideoDecSettingsWnd::OnActivate() int nPosY = 10;
GUID* DxvaGui = NULL;
-#if defined(REGISTER_FILTER) | INCLUDE_MPC_VIDEO_DECODER
+#if 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
+ #if 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);
@@ -103,7 +104,11 @@ bool CMPCVideoDecSettingsWnd::OnActivate() m_cbThreadNumber.AddString (_T("6"));
m_cbThreadNumber.AddString (_T("7"));
m_cbThreadNumber.AddString (_T("8"));
+
+ #endif /* INTERNAL_DECODER_H264 */
+ #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, 190, nPosY+15), this, IDC_STATIC);
@@ -114,7 +119,8 @@ bool CMPCVideoDecSettingsWnd::OnActivate() 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
+
+ #endif /* INTERNAL_DECODER_H264 */
// Error recognition
nPosY += VERTICAL_SPACING;
@@ -140,7 +146,7 @@ bool CMPCVideoDecSettingsWnd::OnActivate() m_cbARMode.SetCheck(FALSE);
nPosY = 170;
-#endif
+#endif /* INCLUDE_MPC_VIDEO_DECODER */
m_grpDXVA.Create (ResStr (IDS_VDF_DXVA_SETTING), WS_VISIBLE|WS_CHILD | BS_GROUPBOX, CRect (10, nPosY, 330, nPosY+110), this, IDC_STATIC);
@@ -180,10 +186,10 @@ bool CMPCVideoDecSettingsWnd::OnActivate() 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
+#if INCLUDE_MPC_VIDEO_DECODER
+ #if INTERNAL_DECODER_H264
m_cbThreadNumber.SetCurSel (m_pMDF->GetThreadNumber() - 1);
m_cbDiscardMode.SetCurSel (FindDiscardIndex (m_pMDF->GetDiscardMode()));
#endif
@@ -191,10 +197,10 @@ bool CMPCVideoDecSettingsWnd::OnActivate() m_cbIDCTAlgo.SetCurSel (m_pMDF->GetIDCTAlgo());
m_cbARMode.SetCheck(m_pMDF->GetARMode());
+#endif /* INCLUDE_MPC_VIDEO_DECODER */
m_cbDXVACompatibilityCheck.SetCurSel(m_pMDF->GetDXVACheckCompatibility());
}
- #endif
return true;
}
@@ -207,23 +213,23 @@ bool CMPCVideoDecSettingsWnd::OnApply() {
OnDeactivate();
- #if defined(REGISTER_FILTER) | INCLUDE_MPC_VIDEO_DECODER
if(m_pMDF && m_cbErrorRecognition.m_hWnd)
{
- #if defined(REGISTER_FILTER) | INTERNAL_DECODER_H264
+#if INCLUDE_MPC_VIDEO_DECODER
+ #if INTERNAL_DECODER_H264
m_pMDF->SetThreadNumber (m_cbThreadNumber.GetCurSel() + 1);
m_pMDF->SetDiscardMode (g_AVDiscard[m_cbDiscardMode.GetCurSel()]);
- #endif
+ #endif /* INTERNAL_DECODER_H264 */
m_pMDF->SetErrorRecognition (m_cbErrorRecognition.GetCurSel()+1);
m_pMDF->SetIDCTAlgo (m_cbIDCTAlgo.GetCurSel());
m_pMDF->SetARMode(m_cbARMode.GetCheck());
+#endif /* INCLUDE_MPC_VIDEO_DECODER */
m_pMDF->SetDXVACheckCompatibility(m_cbDXVACompatibilityCheck.GetCurSel());
m_pMDF->Apply();
}
- #endif
return true;
}
@@ -271,14 +277,23 @@ bool CMPCVideoDecCodecWnd::OnActivate() m_lstCodecs.Create (dwStyle | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP, CRect (20,30, 320, 270), this, 0);
+#if INTERNAL_DECODER_H264_DXVA
m_lstCodecs.AddString (_T("H.264/AVC (DXVA)"));
m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_H264_DXVA) != 0);
+#endif
+#if INTERNAL_DECODER_H264
m_lstCodecs.AddString (_T("H.264/AVC (FFmpeg)"));
m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_H264) != 0);
+#endif
+#if INTERNAL_DECODER_VC1_DXVA
m_lstCodecs.AddString (_T("VC1 (DXVA)"));
m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_VC1_DXVA) != 0);
+#endif
+#if INTERNAL_DECODER_VC1
m_lstCodecs.AddString (_T("VC1 (FFmpeg)"));
m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_VC1) != 0);
+#endif
+#if INCLUDE_MPC_VIDEO_DECODER
m_lstCodecs.AddString (_T("Xvid"));
m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_XVID) != 0);
m_lstCodecs.AddString (_T("DivX"));
@@ -299,6 +314,7 @@ bool CMPCVideoDecCodecWnd::OnActivate() m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_AMVV) != 0);
m_lstCodecs.AddString (_T("Theora"));
m_lstCodecs.SetCheck (nPos++, (nActiveCodecs & MPCVD_THEORA) != 0);
+#endif
for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
pWnd->SetFont(&m_font, FALSE);
@@ -319,10 +335,19 @@ bool CMPCVideoDecCodecWnd::OnApply() int nActiveCodecs = 0;
int nPos = 0;
+#if INTERNAL_DECODER_H264_DXVA
if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_H264_DXVA;
+#endif
+#if INTERNAL_DECODER_H264
if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_H264;
+#endif
+#if INTERNAL_DECODER_VC1_DXVA
if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_VC1_DXVA;
+#endif
+#if INTERNAL_DECODER_VC1
if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_VC1;
+#endif
+#if INCLUDE_MPC_VIDEO_DECODER
if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_XVID;
if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_DIVX;
if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_MSMPEG4;
@@ -333,6 +358,7 @@ bool CMPCVideoDecCodecWnd::OnApply() if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_SVQ3;
if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_AMVV;
if (m_lstCodecs.GetCheck (nPos++)) nActiveCodecs |= MPCVD_THEORA;
+#endif
m_pMDF->SetActiveCodecs ((MPC_VIDEO_CODEC)nActiveCodecs);
m_pMDF->Apply();
|