The DejaVU Framework --
hush 3.1
-
[up]
[top] -
index
make
include
source
logic
grammar
scripts
html
configure
mx
slides
talks
scenes
reports
projects
<body bgcolor="#FFFFFF" text="#000000">
//------------------------------------------------------------------------------
// File: PullPin.h
//
// Desc: DirectShow base classes - defines CPullPin class.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
ifndef __PULLPIN_H__
define __PULLPIN_H__
//
// CPullPin
//
// object supporting pulling data from an IAsyncReader interface.
// Given a start/stop position, calls a pure Receive method with each
// IMediaSample received.
//
// This is essentially for use in a MemInputPin when it finds itself
// connected to an IAsyncReader pin instead of a pushing pin.
//
<h4 align=right text=red> CPullPin</h4><hr>
class CPullPin : public CAMThread
{
IAsyncReader* m_pReader;
REFERENCE_TIME m_tStart;
REFERENCE_TIME m_tStop;
REFERENCE_TIME m_tDuration;
BOOL m_bSync;
enum ThreadMsg {
TM_Pause, // stop pulling and wait for next message
TM_Start, // start pulling
TM_Exit, // stop and exit
};
ThreadMsg m_State;
// override pure thread proc from CAMThread
DWORD ThreadProc(void);
// running pull method (check m_bSync)
void Process(void);
// clean up any cancelled i/o after a flush
void CleanupCancelled(void);
// suspend thread from pulling, eg during seek
HRESULT PauseThread();
// start thread pulling - create thread if necy
HRESULT StartThread();
// stop and close thread
HRESULT StopThread();
// called from ProcessAsync to queue and collect requests
HRESULT QueueSample(
REFERENCE_TIME& tCurrent,
REFERENCE_TIME tAlignStop,
BOOL bDiscontinuity);
HRESULT CollectAndDeliver(
REFERENCE_TIME tStart,
REFERENCE_TIME tStop);
HRESULT DeliverSample(
IMediaSample* pSample,
REFERENCE_TIME tStart,
REFERENCE_TIME tStop);
protected:
IMemAllocator * m_pAlloc;
public:
CPullPin();
virtual ~CPullPin();
// returns S_OK if successfully connected to an IAsyncReader interface
// from this object
// Optional allocator should be proposed as a preferred allocator if
// necessary
// bSync is TRUE if we are to use sync reads instead of the
// async methods.
HRESULT Connect(IUnknown* pUnk, IMemAllocator* pAlloc, BOOL bSync);
// disconnect any connection made in Connect
HRESULT Disconnect();
// agree an allocator using RequestAllocator - optional
// props param specifies your requirements (non-zero fields).
// returns an error code if fail to match requirements.
// optional IMemAllocator interface is offered as a preferred allocator
// but no error occurs if it can't be met.
virtual HRESULT DecideAllocator(
IMemAllocator* pAlloc,
ALLOCATOR_PROPERTIES * pProps);
// set start and stop position. if active, will start immediately at
// the new position. Default is 0 to duration
HRESULT Seek(REFERENCE_TIME tStart, REFERENCE_TIME tStop);
// return the total duration
HRESULT Duration(REFERENCE_TIME* ptDuration);
// start pulling data
HRESULT Active(void);
// stop pulling data
HRESULT Inactive(void);
// helper functions
LONGLONG AlignDown(LONGLONG ll, LONG lAlign) {
// aligning downwards is just truncation
return ll & ~(lAlign-1);
};<hr>
LONGLONG AlignUp(LONGLONG ll, LONG lAlign) {
// align up: round up to next boundary
return (ll + (lAlign -1)) & ~(lAlign -1);
};<hr>
// GetReader returns the (addrefed) IAsyncReader interface
// for SyncRead etc
IAsyncReader* GetReader() {
m_pReader->AddRef();
return m_pReader;
};<hr>
// -- pure --
// override this to handle data arrival
// return value other than S_OK will stop data
virtual HRESULT Receive(IMediaSample*) PURE;
// override this to handle end-of-stream
virtual HRESULT EndOfStream(void) PURE;
// called on runtime errors that will have caused pulling
// to stop
// these errors are all returned from the upstream filter, who
// will have already reported any errors to the filtergraph.
virtual void OnError(HRESULT hr) PURE;
// flush this pin and all downstream
virtual HRESULT BeginFlush() PURE;
virtual HRESULT EndFlush() PURE;
};<hr>
endif //__PULLPIN_H__
<hr>
<style type="text/css">
div.mainnavigate {
margin: 20px 2px;
/*
background-color: #ffffff;
*/
border: 1px solid black;
}
</style>
<div class=xnavigate>
[]
<black>readme</black>
course(s)
preface
<black>I</black>
1
2
<black>II</black>
3
4
<black>III</black>
5
6
7
<black>IV</black>
8
9
10
<black>V</black>
11
12
afterthought(s)
<black>appendix</black>
reference(s)
example(s)
<black>resource(s)</black>
_
</div>
<hr>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.
</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2780434-1";
urchinTracker();
</script>
</body>
</html>
<hr>
<hr>
<table cellpadding=10>
<tr>
<td>
<address>
Hush Online Technology
</address>
hush@cs.vu.nl
<br>03/12/09
</td><td>
</td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td>
</td>
</tr>
</table>