diff options
-rw-r--r-- | docs/Changelog.txt | 1 | ||||
-rw-r--r-- | src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp | 15 | ||||
-rw-r--r-- | src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h | 9 | ||||
-rw-r--r-- | src/mpc-hc/FGManager.cpp | 67 |
4 files changed, 66 insertions, 26 deletions
diff --git a/docs/Changelog.txt b/docs/Changelog.txt index 7ce15b918..09c650be2 100644 --- a/docs/Changelog.txt +++ b/docs/Changelog.txt @@ -35,6 +35,7 @@ Legend: - Fix seeking
- Fix volume slider going out of bounds with IE in player.html
- Fix incorrect encoding of the parent dir's path in browser.html
+! MPC Video Decoder: Fix low merit internal filter.
! Ticket #2423, Fix wrong rounding leading to small black bars when resizing the window.
This was mostly visible when using the "auto-fit" zoom or when resizing manually.
! Ticket #2783, Fix crash when generating the chapter marks
diff --git a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp index 068896533..c9c9812ea 100644 --- a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp +++ b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.cpp @@ -502,9 +502,6 @@ const AMOVIESETUP_MEDIATYPE CMPCVideoDecFilter::sudPinTypesIn[] = { const int CMPCVideoDecFilter::sudPinTypesInCount = _countof(CMPCVideoDecFilter::sudPinTypesIn);
-const bool* CMPCVideoDecFilter::FFmpegFilters = NULL;
-const bool* CMPCVideoDecFilter::DXVAFilters = NULL;
-
const AMOVIESETUP_MEDIATYPE CMPCVideoDecFilter::sudPinTypesOut[] = {
{&MEDIATYPE_Video, &MEDIASUBTYPE_NV12},
{&MEDIATYPE_Video, &MEDIASUBTYPE_NV24}
@@ -778,36 +775,36 @@ int CMPCVideoDecFilter::FindCodec(const CMediaType* mtIn) switch (ffCodecs[i].nFFCodec) {
case AV_CODEC_ID_H264:
#if INTERNAL_DECODER_H264_DXVA
- m_bUseDXVA = DXVAFilters && DXVAFilters[TRA_DXVA_H264];
+ m_bUseDXVA = m_DXVAFilters && m_DXVAFilters[TRA_DXVA_H264];
#else
m_bUseDXVA = false;
#endif
#if INTERNAL_DECODER_H264
- m_bUseFFmpeg = FFmpegFilters && FFmpegFilters[FFM_H264];
+ m_bUseFFmpeg = m_FFmpegFilters && m_FFmpegFilters[FFM_H264];
#else
m_bUseFFmpeg = false;
#endif
break;
case AV_CODEC_ID_VC1:
#if INTERNAL_DECODER_VC1_DXVA
- m_bUseDXVA = DXVAFilters && DXVAFilters[TRA_DXVA_VC1];
+ m_bUseDXVA = m_DXVAFilters && m_DXVAFilters[TRA_DXVA_VC1];
#else
m_bUseDXVA = false;
#endif
#if INTERNAL_DECODER_VC1
- m_bUseFFmpeg = FFmpegFilters && FFmpegFilters[FFM_VC1];
+ m_bUseFFmpeg = m_FFmpegFilters && m_FFmpegFilters[FFM_VC1];
#else
m_bUseFFmpeg = false;
#endif
break;
case AV_CODEC_ID_WMV3:
#if INTERNAL_DECODER_WMV3_DXVA
- m_bUseDXVA = DXVAFilters && DXVAFilters[TRA_DXVA_WMV3];
+ m_bUseDXVA = m_DXVAFilters && m_DXVAFilters[TRA_DXVA_WMV3];
#else
m_bUseDXVA = false;
#endif
#if INTERNAL_DECODER_WMV
- m_bUseFFmpeg = FFmpegFilters && FFmpegFilters[FFM_WMV];
+ m_bUseFFmpeg = m_FFmpegFilters && m_FFmpegFilters[FFM_WMV];
#else
m_bUseFFmpeg = false;
#endif
diff --git a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h index 0e0ce1790..fe6a823f3 100644 --- a/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h +++ b/src/filters/transform/MPCVideoDec/MPCVideoDecFilter.h @@ -96,6 +96,9 @@ protected: CCpuId* m_pCpuId;
CCritSec m_csProps;
+ CAutoPtr<bool> m_DXVAFilters;
+ CAutoPtr<bool> m_FFmpegFilters;
+
// === Persistants parameters (registry)
int m_nThreadNumber;
int m_nDiscardMode;
@@ -207,9 +210,6 @@ public: const static AMOVIESETUP_MEDIATYPE sudPinTypesOut[];
const static int sudPinTypesOutCount;
- static const bool* FFmpegFilters;
- static const bool* DXVAFilters;
-
CMPCVideoDecFilter(LPUNKNOWN lpunk, HRESULT* phr);
virtual ~CMPCVideoDecFilter();
@@ -222,6 +222,9 @@ public: void UpdateFrameTime(REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop, bool b_repeat_pict = false);
CString GetFileExtension();
+ void SetDXVAFilters(CAutoPtr<bool> DXVAFilters) { m_DXVAFilters = DXVAFilters; };
+ void SetFFmpegFilters(CAutoPtr<bool> FFmpegFilters) { m_FFmpegFilters = FFmpegFilters; };
+
// === Overriden DirectShow functions
HRESULT SetMediaType(PIN_DIRECTION direction, const CMediaType* pmt);
HRESULT CheckInputType(const CMediaType* mtIn);
diff --git a/src/mpc-hc/FGManager.cpp b/src/mpc-hc/FGManager.cpp index 882e13903..1e9e0d8dd 100644 --- a/src/mpc-hc/FGManager.cpp +++ b/src/mpc-hc/FGManager.cpp @@ -42,6 +42,35 @@ #include <ksproxy.h>
#include "moreuuids.h"
+class CFGVideoDecoderInternal : public CFGFilterInternal<CMPCVideoDecFilter>
+{
+ CAutoPtr<bool> m_FFMpegFilters;
+ CAutoPtr<bool> m_DXVAFilters;
+
+public:
+ CFGVideoDecoderInternal(CStringW name = L"", UINT64 merit = MERIT64_DO_USE, CAutoPtr<bool> FFMpegFilters = CAutoPtr<bool>(), CAutoPtr<bool> DXVAFilters = CAutoPtr<bool>())
+ : CFGFilterInternal<CMPCVideoDecFilter>(name, merit)
+ , m_FFMpegFilters(FFMpegFilters)
+ , m_DXVAFilters(DXVAFilters) {}
+
+ HRESULT Create(IBaseFilter** ppBF, CInterfaceList<IUnknown, &IID_IUnknown>& pUnks) {
+ CheckPointer(ppBF, E_POINTER);
+
+ HRESULT hr = S_OK;
+ CComPtr<CMPCVideoDecFilter> pBF = DEBUG_NEW CMPCVideoDecFilter(NULL, &hr);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ pBF->SetFFmpegFilters(m_FFMpegFilters);
+ pBF->SetDXVAFilters(m_DXVAFilters);
+
+ *ppBF = pBF.Detach();
+
+ return hr;
+ }
+};
+
//
// CFGManager
//
@@ -1862,7 +1891,13 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) // High merit MPC Video Decoder
#if HAS_FFMPEG_VIDEO_DECODERS || HAS_DXVA_VIDEO_DECODERS
- pFGF = DEBUG_NEW CFGFilterInternal<CMPCVideoDecFilter>(MPCVideoDecName, MERIT64_ABOVE_DSHOW);
+ CAutoPtr<bool> autoPtrDXVAFilters(DEBUG_NEW bool[TRA_DXVA_LAST + !TRA_DXVA_LAST]);
+ memcpy(autoPtrDXVAFilters, dxva_filters, TRA_DXVA_LAST + !TRA_DXVA_LAST);
+
+ CAutoPtr<bool> autoPtrFFMpegFilters(DEBUG_NEW bool[FFM_LAST + !FFM_LAST]);
+ memcpy(autoPtrFFMpegFilters, ffmpeg_filters, FFM_LAST + !FFM_LAST);
+
+ pFGF = DEBUG_NEW CFGVideoDecoderInternal(MPCVideoDecName, MERIT64_ABOVE_DSHOW, autoPtrFFMpegFilters, autoPtrDXVAFilters);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_TSCC);
#if INTERNAL_DECODER_FLV
@@ -2071,15 +2106,20 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) m_transform.AddTail(pFGF);
#endif /* #if HAS_FFMPEG_VIDEO_DECODERS || HAS_DXVA_VIDEO_DECODERS */
+ // Low merit MPC Video Decoder
#if HAS_FFMPEG_VIDEO_DECODERS || HAS_DXVA_VIDEO_DECODERS
- CMPCVideoDecFilter::FFmpegFilters = (HAS_FFMPEG_DECODERS) ? s.FFmpegFilters : NULL;
- CMPCVideoDecFilter::DXVAFilters = (HAS_DXVA_VIDEO_DECODERS) ? s.DXVAFilters : NULL;
-#endif
-#if 0 /* low merit instance doesn't work because the values in array CMPCVideoDecFilter::FFmpegFilters/DXVAFilters are 0 when formats are disabled in normal merit filter */
-#if HAS_FFMPEG_VIDEO_DECODERS || HAS_DXVA_VIDEO_DECODERS
- // Low merit MPC Video Decoder
- pFGF = DEBUG_NEW CFGFilterInternal<CMPCVideoDecFilter>(LowMerit(MPCVideoDecName), MERIT64_DO_USE);
+ CAutoPtr<bool> autoPtrDisabledDXVAFilters(DEBUG_NEW bool[TRA_DXVA_LAST + !TRA_DXVA_LAST]);
+ for (size_t i = 0; i < TRA_DXVA_LAST + !TRA_DXVA_LAST; i++) {
+ autoPtrDisabledDXVAFilters[i] = !dxva_filters[i];
+ }
+
+ CAutoPtr<bool> autoPtrDisabledFFMpegFilters(DEBUG_NEW bool[FFM_LAST + !FFM_LAST]);
+ for (size_t i = 0; i < FFM_LAST + !FFM_LAST; i++) {
+ autoPtrDisabledFFMpegFilters[i] = !ffmpeg_filters[i];
+ }
+
+ pFGF = DEBUG_NEW CFGVideoDecoderInternal(LowMerit(MPCVideoDecName), MERIT64_DO_USE, autoPtrDisabledFFMpegFilters, autoPtrDisabledDXVAFilters);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_TSCC);
#if INTERNAL_DECODER_FLV
if (!(ffmpeg_filters[FFM_FLV4])) {
@@ -2108,7 +2148,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_H264 | INTERNAL_DECODER_H264_DXVA
- if (!(ffmpeg_filters[FFM_H264]) && !(dxva_filters[TRA_DXVA_H264])) {
+ if (!(ffmpeg_filters[FFM_H264]) || !(dxva_filters[TRA_DXVA_H264])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_H264);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_h264);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_X264);
@@ -2135,7 +2175,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_VC1 | INTERNAL_DECODER_VC1_DXVA
- if (!(ffmpeg_filters[FFM_VC1]) && !(dxva_filters[TRA_DXVA_VC1])) {
+ if (!(ffmpeg_filters[FFM_VC1]) || !(dxva_filters[TRA_DXVA_VC1])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_WVC1);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_wvc1);
}
@@ -2201,7 +2241,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_WMV | INTERNAL_DECODER_WMV3_DXVA
- if ((ffmpeg_filters[FFM_WMV]) || (dxva_filters[TRA_DXVA_WMV3])) {
+ if (!(ffmpeg_filters[FFM_WMV]) || !(dxva_filters[TRA_DXVA_WMV3])) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_WMV3);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_wmv3);
}
@@ -2267,7 +2307,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_MJPEG
- if (ffmpeg_filters[FFM_MJPEG]) {
+ if (!ffmpeg_filters[FFM_MJPEG]) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_MJPG);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_QTJpeg);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_MJPA);
@@ -2275,7 +2315,7 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) }
#endif
#if INTERNAL_DECODER_INDEO
- if (ffmpeg_filters[FFM_INDEO]) {
+ if (!ffmpeg_filters[FFM_INDEO]) {
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_IV31);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_IV32);
pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_IV41);
@@ -2284,7 +2324,6 @@ CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk) #endif
m_transform.AddTail(pFGF);
#endif /* HAS_FFMPEG_VIDEO_DECODERS || HAS_DXVA_VIDEO_DECODERS */
-#endif /* 0 */
#if INTERNAL_DECODER_MPEG2
// Keep software decoder after DXVA decoder !
|