diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2012-11-01 22:29:57 +0400 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2012-11-01 22:35:29 +0400 |
commit | 224c816cf29c5243064e7047a96a16e7c6b12304 (patch) | |
tree | 3b2e41b1afada178e2d03cfa4649e4258ee41ba7 | |
parent | db41affe87e66b8394bc6b0888baacf3a9b72864 (diff) |
Always save the last image in a DVD menu, even if its not a EOS frame.
-rw-r--r-- | decoder/LAVVideo/LAVVideo.cpp | 4 | ||||
-rw-r--r-- | decoder/LAVVideo/LAVVideo.h | 3 | ||||
-rw-r--r-- | decoder/LAVVideo/subtitles/LAVSubtitleConsumer.cpp | 3 | ||||
-rw-r--r-- | decoder/LAVVideo/subtitles/LAVSubtitleConsumer.h | 1 | ||||
-rw-r--r-- | decoder/LAVVideo/subtitles/LAVSubtitleProvider.cpp | 6 |
5 files changed, 16 insertions, 1 deletions
diff --git a/decoder/LAVVideo/LAVVideo.cpp b/decoder/LAVVideo/LAVVideo.cpp index 7caf737c..e2c1c488 100644 --- a/decoder/LAVVideo/LAVVideo.cpp +++ b/decoder/LAVVideo/LAVVideo.cpp @@ -60,6 +60,7 @@ CLAVVideo::CLAVVideo(LPUNKNOWN pUnk, HRESULT* phr) , m_pSubtitleInput(NULL) , m_SubtitleConsumer(NULL) , m_pLastSequenceFrame(NULL) + , m_bInDVDMenu(FALSE) { *phr = S_OK; m_pInput = new CDeCSSTransformInputPin(TEXT("CDeCSSTransformInputPin"), this, phr, L"Input"); @@ -710,6 +711,7 @@ HRESULT CLAVVideo::PerformFlush() m_Decoder.Flush(); ReleaseFrame(&m_pLastSequenceFrame); + m_bInDVDMenu = FALSE; if (m_pFilterGraph) avfilter_graph_free(&m_pFilterGraph); @@ -1322,7 +1324,7 @@ HRESULT CLAVVideo::DeliverToRenderer(LAVFrame *pFrame) if (!(pFrame->flags & LAV_FRAME_FLAG_REDRAW)) { // Release the old End-of-Sequence frame, this ensures any "normal" frame will clear the stored EOS frame ReleaseFrame(&m_pLastSequenceFrame); - if (pFrame->flags & LAV_FRAME_FLAG_END_OF_SEQUENCE && pFrame->format != LAVPixFmt_DXVA2) { + if ((pFrame->flags & LAV_FRAME_FLAG_END_OF_SEQUENCE || m_bInDVDMenu) && pFrame->format != LAVPixFmt_DXVA2) { CopyLAVFrame(pFrame, &m_pLastSequenceFrame); } } diff --git a/decoder/LAVVideo/LAVVideo.h b/decoder/LAVVideo/LAVVideo.h index b59bc13e..85237b7f 100644 --- a/decoder/LAVVideo/LAVVideo.h +++ b/decoder/LAVVideo/LAVVideo.h @@ -153,6 +153,7 @@ public: STDMETHODIMP_(LAVFrame*) GetFlushFrame(); STDMETHODIMP RedrawStillImage(); + STDMETHODIMP SetInDVDMenu(bool menu) { m_bInDVDMenu = menu; return S_OK; } public: // Pin Configuration @@ -210,6 +211,8 @@ private: DWORD m_bMadVR; DWORD m_dwDecodeFlags; + BOOL m_bInDVDMenu; + AVFilterGraph *m_pFilterGraph; AVFilterContext *m_pFilterBufferSrc; AVFilterContext *m_pFilterBufferSink; diff --git a/decoder/LAVVideo/subtitles/LAVSubtitleConsumer.cpp b/decoder/LAVVideo/subtitles/LAVSubtitleConsumer.cpp index f3679a7e..7252d767 100644 --- a/decoder/LAVVideo/subtitles/LAVSubtitleConsumer.cpp +++ b/decoder/LAVVideo/subtitles/LAVSubtitleConsumer.cpp @@ -28,6 +28,7 @@ static const SubRenderOption options[] = { { "originalVideoSize", OFFSET(originalVideoSize), SROPT_TYPE_SIZE, SROPT_FLAG_READONLY }, { "redraw", OFFSET(redraw), SROPT_TYPE_BOOL, 0 }, + { "menu", OFFSET(menu), SROPT_TYPE_BOOL, 0 }, { 0 } }; @@ -338,6 +339,8 @@ STDMETHODIMP CLAVSubtitleConsumer::OnSubOptionSet(LPCSTR field) { if (strcmp(field, "redraw") == 0) { m_pLAVVideo->RedrawStillImage(); + } else if (strcmp(field, "menu") == 0) { + m_pLAVVideo->SetInDVDMenu(context.menu); } return S_OK; diff --git a/decoder/LAVVideo/subtitles/LAVSubtitleConsumer.h b/decoder/LAVVideo/subtitles/LAVSubtitleConsumer.h index 72c7bfe7..1ad5fc36 100644 --- a/decoder/LAVVideo/subtitles/LAVSubtitleConsumer.h +++ b/decoder/LAVVideo/subtitles/LAVSubtitleConsumer.h @@ -38,6 +38,7 @@ typedef struct LAVSubtitleConsumerContext { SIZE originalVideoSize; ///< Size of the video bool redraw; + bool menu; } LAVSubtitleConsumerContext; class CLAVVideo; diff --git a/decoder/LAVVideo/subtitles/LAVSubtitleProvider.cpp b/decoder/LAVVideo/subtitles/LAVSubtitleProvider.cpp index 69bd5187..f6f176a5 100644 --- a/decoder/LAVVideo/subtitles/LAVSubtitleProvider.cpp +++ b/decoder/LAVVideo/subtitles/LAVSubtitleProvider.cpp @@ -195,6 +195,10 @@ STDMETHODIMP CLAVSubtitleProvider::Flush() CAutoLock lock(this); ClearSubtitleRects(); SAFE_DELETE(m_pHLI); + + if (m_pConsumer) + m_pConsumer->SetBool("menu", false); + return S_OK; } @@ -320,6 +324,8 @@ void CLAVSubtitleProvider::ProcessSubtitleRect(AVSubtitle *sub, REFERENCE_TIME r if (m_pAVCtx->codec_id == AV_CODEC_ID_DVD_SUBTITLE) { if (rtStart == AV_NOPTS_VALUE && sub->rects[0]->forced) { ClearSubtitleRects(); + if (m_pConsumer) + m_pConsumer->SetBool("menu", true); } if (rtStart != AV_NOPTS_VALUE) { CAutoLock lock(this); |