Skip to content

Commit 62f8cee

Browse files
author
Alexander Matveev
committed
8247947: Build DirectShow Samples (Base Classes) from source checked into repo
Reviewed-by: kcr, arapte
1 parent 527cc2b commit 62f8cee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+38677
-11
lines changed

build.gradle

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2862,15 +2862,7 @@ project(":media") {
28622862
"CC=${mediaProperties.compiler}", "AR=${mediaProperties.ar}", "LINKER=${mediaProperties.linker}")
28632863

28642864
if (t.name == "win") {
2865-
Map winEnv = new HashMap(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
2866-
2867-
String sdkDir = System.getenv("BASECLASSES_SDK_DIR");
2868-
if (sdkDir == null) {
2869-
sdkDir = "C:/Program Files/Microsoft SDKs/Windows/v7.1" // Default value
2870-
winEnv["BASECLASSES_SDK_DIR"] = sdkDir
2871-
}
2872-
environment(winEnv)
2873-
2865+
environment(WINDOWS_NATIVE_COMPILE_ENVIRONMENT)
28742866
args("RESOURCE=${nativeOutputDir}/${buildType}/${WIN.media.fxpluginsRcFile}")
28752867
}
28762868
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
//------------------------------------------------------------------------------
2+
// File: AMExtra.cpp
3+
//
4+
// Desc: DirectShow base classes - implements CRenderedInputPin class.
5+
//
6+
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
7+
//------------------------------------------------------------------------------
8+
9+
10+
#include <streams.h> // DirectShow base class definitions
11+
#include <mmsystem.h> // Needed for definition of timeGetTime
12+
#include <limits.h> // Standard data type limit definitions
13+
#include <measure.h> // Used for time critical log functions
14+
15+
#include "amextra.h"
16+
17+
#pragma warning(disable:4355)
18+
19+
// Implements CRenderedInputPin class
20+
21+
CRenderedInputPin::CRenderedInputPin(__in_opt LPCTSTR pObjectName,
22+
__in CBaseFilter *pFilter,
23+
__in CCritSec *pLock,
24+
__inout HRESULT *phr,
25+
__in_opt LPCWSTR pName) :
26+
CBaseInputPin(pObjectName, pFilter, pLock, phr, pName),
27+
m_bAtEndOfStream(FALSE),
28+
m_bCompleteNotified(FALSE)
29+
{
30+
}
31+
#ifdef UNICODE
32+
CRenderedInputPin::CRenderedInputPin(__in_opt LPCSTR pObjectName,
33+
__in CBaseFilter *pFilter,
34+
__in CCritSec *pLock,
35+
__inout HRESULT *phr,
36+
__in_opt LPCWSTR pName) :
37+
CBaseInputPin(pObjectName, pFilter, pLock, phr, pName),
38+
m_bAtEndOfStream(FALSE),
39+
m_bCompleteNotified(FALSE)
40+
{
41+
}
42+
#endif
43+
44+
// Flush end of stream condition - caller should do any
45+
// necessary stream level locking before calling this
46+
47+
STDMETHODIMP CRenderedInputPin::EndOfStream()
48+
{
49+
HRESULT hr = CheckStreaming();
50+
51+
// Do EC_COMPLETE handling for rendered pins
52+
if (S_OK == hr && !m_bAtEndOfStream) {
53+
m_bAtEndOfStream = TRUE;
54+
FILTER_STATE fs;
55+
EXECUTE_ASSERT(SUCCEEDED(m_pFilter->GetState(0, &fs)));
56+
if (fs == State_Running) {
57+
DoCompleteHandling();
58+
}
59+
}
60+
return hr;
61+
}
62+
63+
64+
// Called to complete the flush
65+
66+
STDMETHODIMP CRenderedInputPin::EndFlush()
67+
{
68+
CAutoLock lck(m_pLock);
69+
70+
// Clean up renderer state
71+
m_bAtEndOfStream = FALSE;
72+
m_bCompleteNotified = FALSE;
73+
74+
return CBaseInputPin::EndFlush();
75+
}
76+
77+
78+
// Notify of Run() from filter
79+
80+
HRESULT CRenderedInputPin::Run(REFERENCE_TIME tStart)
81+
{
82+
UNREFERENCED_PARAMETER(tStart);
83+
m_bCompleteNotified = FALSE;
84+
if (m_bAtEndOfStream) {
85+
DoCompleteHandling();
86+
}
87+
return S_OK;
88+
}
89+
90+
91+
// Clear status on going into paused state
92+
93+
HRESULT CRenderedInputPin::Active()
94+
{
95+
m_bAtEndOfStream = FALSE;
96+
m_bCompleteNotified = FALSE;
97+
return CBaseInputPin::Active();
98+
}
99+
100+
101+
// Do stuff to deliver end of stream
102+
103+
void CRenderedInputPin::DoCompleteHandling()
104+
{
105+
ASSERT(m_bAtEndOfStream);
106+
if (!m_bCompleteNotified) {
107+
m_bCompleteNotified = TRUE;
108+
m_pFilter->NotifyEvent(EC_COMPLETE, S_OK, (LONG_PTR)(IBaseFilter *)m_pFilter);
109+
}
110+
}
111+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//------------------------------------------------------------------------------
2+
// File: AMExtra.h
3+
//
4+
// Desc: DirectShow base classes.
5+
//
6+
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
7+
//------------------------------------------------------------------------------
8+
9+
10+
#ifndef __AMEXTRA__
11+
#define __AMEXTRA__
12+
13+
// Simple rendered input pin
14+
//
15+
// NOTE if your filter queues stuff before rendering then it may not be
16+
// appropriate to use this class
17+
//
18+
// In that case queue the end of stream condition until the last sample
19+
// is actually rendered and flush the condition appropriately
20+
21+
class CRenderedInputPin : public CBaseInputPin
22+
{
23+
public:
24+
25+
CRenderedInputPin(__in_opt LPCTSTR pObjectName,
26+
__in CBaseFilter *pFilter,
27+
__in CCritSec *pLock,
28+
__inout HRESULT *phr,
29+
__in_opt LPCWSTR pName);
30+
#ifdef UNICODE
31+
CRenderedInputPin(__in_opt LPCSTR pObjectName,
32+
__in CBaseFilter *pFilter,
33+
__in CCritSec *pLock,
34+
__inout HRESULT *phr,
35+
__in_opt LPCWSTR pName);
36+
#endif
37+
38+
// Override methods to track end of stream state
39+
STDMETHODIMP EndOfStream();
40+
STDMETHODIMP EndFlush();
41+
42+
HRESULT Active();
43+
HRESULT Run(REFERENCE_TIME tStart);
44+
45+
protected:
46+
47+
// Member variables to track state
48+
BOOL m_bAtEndOfStream; // Set by EndOfStream
49+
BOOL m_bCompleteNotified; // Set when we notify for EC_COMPLETE
50+
51+
private:
52+
void DoCompleteHandling();
53+
};
54+
55+
#endif // __AMEXTRA__
56+

0 commit comments

Comments
 (0)