`
`Page 20 of 41
`
`The default implementation returns m bEOSDelivered. This is used by the base renderer class
`so that only one EC COMPLETE message is sent to the filter graph manager each time it is run,
`regardless of the number of times EndOfStream is called.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Q'41!.l+' 111.q9 Topic Contents
`
`l@!§il!MM
`
`CBaseRenderer: :lsStrea ming
`
`CBaseRenderer Class
`
`Determines if the filter is streaming data.
`
`BOOL lsStreaming(void);
`
`Return Values
`
`Returns TRUE if the renderer is rendering, or FALSE if it isn't.
`
`Remarks
`
`The default implementation returns m bStreaming. In the base renderer class, "streaming"
`and "rendering" are used in the same context as "running".
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Qij[.jlj,M 111.11119 Topic Contents 1@!§111¥+
`
`CBaseRenderer::NonDelegatingQuerylnterface
`
`CBaseRenderer Class
`
`Retrieves an interface and increments the reference count.
`
`H RESULT Non Delegati ngQuerylnterface(
`REFllD riid,
`void** ppv
`);
`
`Parameters
`
`1351
`
`
`
`CBaseRenderer Class
`
`Page 21of41
`
`riid
`
`ppv
`
`Reference identifier.
`
`Pointer to the interface.
`
`Return Values
`
`Returns E~POINTER if ppv is invalid. Returns NOERROR if the query is successful or
`E~ NOINTERFACE if it is not.
`
`Remarks
`
`This member function overrides CBaseFilter:: NonDelegatingQueryinterface. It exposes the
`IMediaPosition and IMediaSeeking interfaces and then calls
`CBaseFilter::NonDelegatingQuerylnterface for interfaces implemented in the base classes.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`MQij[.jjj,M l!i.! 111j Topic Contents
`
`l@i§il!MM
`
`CBaseRenderer:: NotReady
`
`CBaseRenderer Class
`
`Forces the m evComolete event into a nonsignaled state.
`
`void NotReady(void);
`
`Return Values
`
`No return value.
`
`Remarks
`
`This member function calls the CAM Event:: Reset member function of the m evComplete event
`object.
`
`© 1997 Microsoft Cornoratjon . All rights reserved. Terms of Use.
`
`MQ<§i[.jjj,M 111.l:.!j Topic Contents
`
`i@faii!MM
`
`CBaseRenderer:: NotifyEndOfStrea m
`
`1352
`
`
`
`CBaseRenderer Class
`
`Page 22 of 41
`
`CBaseRenderer Class
`
`Sends an EC COMPLETE event to the filter graph manager.
`
`void NotifyEndOfStream(void);
`
`Return Values
`
`No return value.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`MQl@[.jlj,M l!i.! 111j Topic Contents
`
`l@i§lllMM
`
`C BaseRenderer:: 0 n Receive Fi rstSa m pie
`
`CBaseRenderer Class
`
`Provides derived classes with an opportunity to render static data.
`
`virtual void OnReceiveFirstSample(
`IMediaSample *pMediaSample
`);
`
`Parameters
`
`pMediaSample
`Media sample.
`
`Return Values
`
`No return value.
`
`Remarks
`
`This member function is unimplemented. It is primarily used by video renderers. When they
`receive their first sample while paused, they typically draw the frame as a poster image. This
`virtual method is called by the base classes when the first sample arrives.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`MQl@[.jlj,M 11!.l:.!j Topic Contents
`
`l@i§lllMM
`
`1353
`
`
`
`CBaseRenderer Class
`
`Page 23 of 41
`
`CBaseRenderer: :OnRenderEnd
`
`CBaseRenderer Class
`
`Notifies the derived class that rendering has finished.
`
`virtual void OnRenderEnd(
`IMediaSample *pMediaSample
`);
`
`Parameters
`
`pMediaSample
`Media sample.
`
`Return Values
`
`No return value.
`
`Remarks
`
`This member function is available for quality management and performance measuring. It is
`called immediately after the sample is rendered.
`
`Quality management implementations typically need to know how long it takes the renderer to
`render the data.
`
`© 1997 Microsoft Corooratjon . All rights reserved. Terms of Use.
`
`MQ<§i[.jjj,M MB.HS
`
`Topic Contents
`
`i@faiilMM
`
`CBaseRenderer: :On RenderSta rt
`
`CBaseRenderer Class
`
`Notifies the derived class that rendering is about to start.
`
`virtual void OnRenderStart(
`IMediaSample *pMediaSample
`);
`
`Parameters
`
`pMediaSample
`Media sample.
`
`1354
`
`
`
`CBaseRenderer Class
`
`Page 24 of 41
`
`Return Values
`
`No return value.
`
`Remarks
`
`This member function is available for quality management and performance measuring. It is
`called immediately before the sample is rendered.
`
`Quality management implementations typically need to know how long it takes the renderer to
`render the data.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`MQij[.jlj,M l!i.! 111j Topic Contents
`
`l@i§il!MM
`
`CBaseRenderer: :On Sta rtStrea ming
`
`CBaseRenderer Class
`
`Notifies the derived class that streaming has started.
`
`virtual HRESULT OnStartStreaming(void);
`
`Return Values
`
`Returns NOERROR in the default implementation.
`
`Remarks
`
`This member function is called from CBaseRenderer: :StartStreaming. Override this in your
`derived class to provide special handling when streaming starts.
`
`© 1997 Microsoft Cornoratjon . All rights reserved. Terms of Use.
`
`MQ<§i[.jlj,M lh.l:.!j Topic Contents
`
`i@faii!MM
`
`CBaseRenderer: :OnStopStrea ming
`
`CBaseRenderer Class
`
`Notifies the derived class that streaming has stopped.
`
`1355
`
`
`
`CBaseRenderer Class
`
`Page 25 of 41
`
`virtual HRESULT OnStopStreaming(void);
`
`Return Values
`
`Returns NOERROR in the default implementation.
`
`Remarks
`
`This member function is called from CBaseRenderer: :StopStreaming. Override this in your
`derived class to provide special handling when streaming stops.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`MQl@[.jjj,M l!i.! 11ij Topic Contents
`
`l@i§lllMM
`
`CBaseRenderer: :OnWaitEnd
`
`CBaseRenderer Class
`
`Notifies the derived class that a wait for a rendering time has just ended.
`
`virtual void OnWaitEnd(void);
`
`Return Values
`
`No return value.
`
`Remarks
`
`This member function is available for quality control and is called from
`CBaseRenderer: :WaitForRenderTime just after waiting for the presentation time for a sample.
`Override this member function to obtain performance measurements in a derived class.
`
`© 1997 Microsoft Cornoratjon . All rights reserved. Terms of Use.
`
`MQl§i[.jjj,M MB.HJ Topic Contents
`
`i@faii!MM
`
`CBaseRenderer: :OnWaitStart
`
`CBaseRenderer Class
`
`Notifies the derived class that a wait for a rendering time is about to start.
`
`1356
`
`
`
`CBaseRenderer Class
`
`Page 26 of 41
`
`virtual void OnWaitStart(void);
`
`Return Values
`
`No return value.
`
`Remarks
`
`This member function is available for quality control and is called from
`CBaseRenderer: :WaitForRenderTime just before waiting for the presentation time for a sample.
`Override this member function to obtain performance measurements in a derived class.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`MQij[.jlj,M l!i.! 111j Topic Contents
`
`l@i§il!MM
`
`CBaseRenderer:: Pa use
`
`CBaseRenderer Class
`
`Changes the renderer to State_Paused if it isn't already.
`
`HRESULT Pause(void);
`
`Return Values
`
`Returns an HRESULT value.
`
`Remarks
`
`The following steps comprise a pause operation.
`
`1. Commit the allocator used for the connection.
`2. Allow the thread for the upstream filter to wait in Receive.
`3. Cancel any outstanding clock advise links.
`4. Check to see if the renderer is connected and allow a state change.
`5. If a sample is available, complete the state change to State_Paused.
`
`If the member function succeeds, DirectShow sets the filter's m State member variable to
`State_Paused. If the renderer is in the State_Stopped state, DirectShow calls the
`CBasePin: :Active member function for each of the renderer's connected pins.
`
`This member function overrides CBaseFilter: :Pause.
`
`© 1997 Microsoft Corporation . All rights reserved . Terms of Use.
`
`1357
`
`
`
`CBaseRenderer Class
`
`Page 27 of 41
`
`+Qi§1[.]++ 1 !!·HM
`
`Topic Contents
`
`i@l§ii!MM
`
`CBaseRenderer:: Pre pa re Receive
`
`CBaseRenderer Class
`
`Ensures that a sample can be rendered.
`
`virtual HRESULT PrepareReceive(
`IMediaSample *pMediaSample
`);
`
`Parameters
`
`pMediaSample
`Media sample.
`
`Return Values
`
`Returns NOERROR if successful, VFW_E_SAMPLE_REJECTED if the delivered sample is later
`than the sample's timestamp, or E_UNEXPECTED if a renderable sample is already available.
`
`Remarks
`
`This member function is called when the upstream filter delivers a sample. If the upstream
`filter is running (streaming), the sample is scheduled with the reference clock. If the upstream
`filter is not streaming, a sample in paused mode has been received, so any state transition can
`be completed. On leaving this function, everything will be unlocked so an application thread
`can get in and change the state to stopped. In this case, it will also signal the thread event so
`that the wait call is stopped.
`
`This function is typically called from the IMeminputPin: :Receive method on the renderer's
`input pin. Although PrepareReceive returns VFW_E_SAMPLE_REJECTED if the sample was
`delivered too late to be useful, the IMeminputPin::Receive method should not pass the
`VFW_E_SAMPLE_REJECTED error on to the upstream filter in this case. Instead,
`IMeminputPin::Receive should return NOERROR, because no error occurred.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Qij[.jjj,M 11!.l:.!9 Topic Contents
`
`i@l§ii!MM
`
`CBaseRenderer:: Pre pa reRender
`
`1358
`
`
`
`CBaseRenderer Class
`
`Page 28 of 41
`
`CBaseRenderer Class
`
`Provides an opportunity for the derived class to prepare itself for rendering a sample.
`
`virtual void PrepareRender(void);
`
`Return Values
`
`No return value.
`
`Remarks
`
`This member function is called from CBaseRenderer:: Receive before rendering each frame. A
`derived class can take this opportunity to prepare itself for rendering. For example, a video
`renderer might realize its palette. This is not implemented in the base class.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Qi§1[.]++ 1 !!·HM Topic Contents
`
`i@l§ii!MM
`
`CBaseRenderer:: Ready
`
`CBaseRenderer Class
`
`Puts the m evComplete event into a signaled state.
`
`void Ready(void);
`
`Return Values
`
`No return value.
`
`Remarks
`
`This member function calls the m evComplete CAM Event object's Set member function.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Qij[.jlj,M M!i.11119 Topic Contents
`
`i@l§lllMM
`
`CBaseRenderer:: Receive
`
`1359
`
`
`
`CBaseRenderer Class
`
`Page 29 of 41
`
`CBaseRenderer Class
`
`Called by the upstream filter when a sample is available to render.
`
`virtual HRESULT Receive(
`IMediaSample *pMediaSample
`);
`
`Parameters
`
`pMediaSample
`Media sample.
`
`Return Values
`
`Returns an HRESULT value.
`
`Remarks
`
`This member function sets an advise link with the clock, waits for the time to arrive, and then
`renders the data by calling the pure virtual DoRenderSample member function that the derived
`class will have overridden. After rendering the sample, the end of stream can also be signaled
`if it was the last one sent before EndOfStream was called.
`
`© 1997 Microsoft Corporation . All rights reserved . Terms of Use.
`
`•;<MM+' •11·!:.!¥
`
`Topic Contents
`
`lmli§lllMM
`
`CBaseRenderer:: Render
`
`CBaseRenderer Class
`
`Asks the derived class to render the sample.
`
`virtual HRESULT Render(
`IMediaSample *pMediaSample
`);
`
`Parameters
`
`pMediaSample
`Media sample.
`
`Return Values
`
`Returns an HRESULT value.
`
`1360
`
`
`
`CBaseRenderer Class
`
`Page 30 of 41
`
`Remarks
`
`This member function is called when the derived class should render the sample. The action
`taken is dependent on the nature of the renderer; a video renderer will typically draw the
`image in a window. This class calls the pure virtual DoRenderSample to be implemented by the
`derived class.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`MQl@[.jlj,M l!i.! 11ij Topic Contents
`
`l@l§lllMM
`
`CBaseRenderer:: ResetEndOfStrea m
`
`CBaseRenderer Class
`
`Resets the end-of-stream flag.
`
`virtual HRESULT ResetEndOfStream(void);
`
`Return Values
`
`Returns an HRESULT value.
`
`Remarks
`
`This member function is typically called when changing to stopped states. A renderer must
`keep track of when it gets told that no more data is going to arrive (this is done when the
`sourcing filter calls I Pin:: EndOfStream). At this point the renderer finishes rendering any data
`it has and then sends an EC_COMPLETE event to the filter graph manager.
`
`However, when the filter is stopped, the whole state is cleared. When the filter is subsequently
`run, the source filter will signal the end of stream again if it has no data to send. In this case,
`the renderer should signal another EC_COMPLETE event to the filter graph manager. This
`member function resets the state so that when next requested it will send an EC_COMPLETE
`event.
`
`© 1997 Microsoft Comoration. All rights reserved. Terms of Use.
`
`MQi§1!.l+• 1 11·1::'1 Topic Contents
`
`l@l§il!MM
`
`CBaseRenderer:: ResetEndOfStrea mTi mer
`
`CBaseRenderer Class
`
`1361
`
`
`
`CBaseRenderer Class
`
`Page 31of41
`
`If the end-of-stream timer is nonzero, this function sets it to zero.
`
`void ResetEndOfStreamTimer(void);
`
`Return Values
`
`No return value.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Q'41!.l+' +11.q9 Topic Contents
`
`l@!§il!MM
`
`CBaseRenderer:: Run
`
`CBaseRenderer Class
`
`Transitions the renderer to State_Running if it is not in this state already.
`
`HRESULT Run(void);
`
`Return Values
`
`Returns an HRESULT value.
`
`Remarks
`
`If the renderer is in the State_Stopped state, the CBaseRenderer:: Pause member function is
`called first to transition the renderer to the State_Paused state, which has the effect of
`activating any of the filter's connected pins. If this member function succeeds, the renderer's
`m State member variable is set to State_Running.
`
`This member function overrides CBaseFilter:: Run.
`
`© 1997 Microsoft Corooratjon . All rights reserved. Terms of Use.
`
`+;<§1[.]lj,M Mil.HM Topic Contents
`
`l@!§il!MM
`
`CBaseRenderer: :Schedule Sam pie
`
`CBaseRenderer Class
`
`Schedules the sample for rendering.
`
`1362
`
`
`
`CBaseRenderer Class
`
`Page 32 of 41
`
`virtual BOOL ScheduleSample(
`IMediaSample *pMediaSample
`);
`
`Parameters
`
`pMediaSample
`Media sample.
`
`Return Values
`
`No return value.
`
`Remarks
`
`One of the main purposes of the renderer base class is to manage the timing and
`synchronization of the samples it is sent; that is, the timely presentation of data. It also must
`look after quality management, which might involve dropping samples or rendering them
`earlier than indicated in the time stamps on the sample. This method and its overrides in
`derived classes manage the setting up of advise links with the clock, so that the samples can
`be rendered at the appropriate time.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Qi§1H++ 1 !!·HM Topic Contents
`
`ifflj[§ii!¥M
`
`CBaseRenderer: :Send EndOfStrea m
`
`CBaseRenderer Class
`
`Signals an EC_COMPLETE event to the filter graph manager.
`
`virtual HRESULT SendEndOfStream(void);
`
`Return Values
`
`Returns an HRESULT value.
`
`Remarks
`
`When the renderer receives an end-of-stream notification, it will finish rendering any data it
`currently has and then send an EC_COMPLETE event to the filter graph manager.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Q<@[.]jj,+ 111.11119 Topic Contents 1@1§11!¥+
`
`1363
`
`
`
`CBaseRenderer Class
`
`Page 33 of 41
`
`CBaseRenderer: :Send NotifyWi ndow
`
`CBaseRenderer Class
`
`Passes the notification window handle to the upstream filter.
`
`void SendNotifyWindow(
`IPin *pPin,
`HWND hwnd
`);
`
`Parameters
`
`pPin
`
`IPin interface of the upstream pin.
`hwnd
`Handle of the notification window.
`
`Return Values
`
`No return value.
`
`Remarks
`
`If the output pin of the upstream filter supports the IMediaEventSink interface, this member
`function sends it the EC_NOTIFY _WINDOW event code with the window handle in hwnd.
`
`© 1997 Microsoft Corooratjon . All rights reserved. Terms of Use.
`
`MQ<§i[.jjj,M MB.HS Topic Contents
`
`i@faiilMM
`
`CBaseRenderer: :SendRepaint
`
`CBaseRenderer Class
`
`Signals an EC REPAINT message to the filter graph.
`
`void SendRepaint(void);
`
`Return Values
`
`No return value.
`
`1364
`
`
`
`CBaseRenderer Class
`
`Page 34 of 41
`
`Remarks
`
`This should be used with some care. EC REPAINT events are processed by the filter graph
`manager by setting the current position to the same position that the graph is currently in.
`This has the effect of sending the same data through the graph again, which is an expensive
`operation. Video renderers are the main users of this event, because they sometimes need the
`same image sent again to refresh the display.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`MQij[.jjj,M l!i.! 111j
`
`Topic Contents
`
`l@i§il!MM
`
`CBaseRenderer: :SetAbortSig na I
`
`CBaseRenderer Class
`
`Sets the m bAbort abort signal flag.
`
`void SetAbortSignal(
`BOOL bAbort
`);
`
`Parameters
`
`bAbort
`Abort value to be set.
`
`Return Values
`
`Returns an HRESULT value.
`
`© 1997 Microsoft Corporation . All rights reserved . Terms of Use.
`
`MQ<§i[.jjj,M 111.],.(j
`
`Topic Contents
`
`l@bll!MM
`
`CBaseRenderer: :SetMediaType
`
`CBaseRenderer Class
`
`Informs the derived class of the selected media type.
`
`virtual HRESULT SetMediaType(
`
`1365
`
`
`
`CBaseRenderer Class
`
`Page 35 of 41
`
`const CMediaType *pmt
`);
`
`Parameters
`
`pmt
`
`Media type to be set.
`
`Return Values
`
`Returns NOERROR by default; the overriding member function should return a valid HRESULT
`value.
`
`Remarks
`
`This member function is called by the CRendererinputPin: :SetMediaType member function and
`has no implementation in this class. Derived classes can optionally override to add
`functionality.
`
`© 1997 Microsoft Corporation . All rights reserved . Terms of Use.
`
`• Q<M [.] +• I![.],.[. Topic Contents •@M* 1gnw
`
`CBaseRenderer: :SetRepa i ntStatus
`
`CBaseRenderer Class
`
`Resets the m bRepaintStatus flag when EC REPAINT has been signaled to the filter graph.
`
`void SetRepaintStatus(
`BOOL bRepaint
`);
`
`Parameters
`
`bRepaint
`Boolean value assigned to the m bRepaintStatus flag.
`
`Return Values
`
`No return value.
`
`Remarks
`
`The m bRepaintStatus flag ensures that the filter graph is not flooded with redundant calls.
`Once one EC REPAINT message has been sent, no more will be sent until the renderer
`receives some data.
`
`1366
`
`
`
`CBaseRenderer Class
`
`Page 36 of 41
`
`© 1997 Microsoft Corporation . All rights reserved. Terms of Use.
`
`MQi§i[.]11,M '!!·HM Topic Contents
`
`lmll§I 11$8
`
`CBaseRenderer: :Shau Id DrawSa mpleNow
`
`CBaseRenderer Class
`
`Determines if the sample should be drawn between the start and stop times given.
`
`virtual HRESULT ShouldDrawSampleNow(
`IMediaSample *pMediaSample,
`REFERENCE_TIME *pStartTime,
`REFERENCE_ TIME *pEndTime
`);
`
`Parameters
`
`pMediaSample
`Media sample.
`pStartTime
`Start time in question.
`pEndTime
`End time in question.
`
`Return Values
`
`Returns S_FALSE by default. The overriding member function can return S_OK to indicate that
`the sample should be drawn immediately instead of waiting for its scheduled time.
`
`Remarks
`
`This member function is used by the derived video renderer class for quality management.
`
`© 1997 Microsoft Corporation . All rights reserved. Terms of Use.
`
`MQi§i[.]11,M '!!·HM Topic Contents
`
`lmll§I 11$8
`
`MQl§i[.jjj,M '!!·HM Topic Contents
`
`l@i§i MUMM
`
`CBaseRenderer: :Signa ITi merFi red
`
`1367
`
`
`
`Page 37 of 41
`
`CBaseRenderer Class
`
`CBaseRenderer Class
`
`Resets the current advise time to zero after a timer fires.
`
`virtual void SignalTimerFired(void);
`
`Return Values
`
`No return value.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Qi§1[.]++ 1 !!·HM Topic Contents
`
`i@l§ii!MM
`
`CBaseRenderer: :Sou rceTh read Ca nWa it
`
`CBaseRenderer Class
`
`Sets or resets the thread event.
`
`virtual HRESULT SourceThreadCanWait(
`BOOL bCanWait
`);
`
`Parameters
`
`bCanWait
`TRUE or FALSE, depending on intent.
`
`Return Values
`
`Returns an HRESULT value.
`
`Remarks
`
`In some states, such as paused or running, it is expected that the upstream filter's thread will
`be blocked in the call to the renderer's input pin Receive method. In other cases, such as when
`the renderer is stopped, the upstream filter should not be required to wait. This member
`function represents a manual reset event that sets this TRUE to wait, or FALSE to keep the
`thread from waiting.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Qi§1[.]++ 1 !!·HM Topic Contents
`
`i@l§ii!MM
`
`1368
`
`
`
`CBaseRenderer Class
`
`Page 38 of 41
`
`CBaseRenderer: :Sta rtStrea ming
`
`CBaseRenderer Class
`
`Called to schedule any pending sample with the clock, and to display timing information.
`
`virtual HRESULT StartStreaming(void);
`
`Return Values
`
`Returns an HRESULT value.
`
`Remarks
`
`If no sample is available but an end-of-stream flag is queued, this member function sends an
`EC_COMPLETE message to the filter graph manager. If a sample is available, the
`EC_COMPLETE message will not be sent until it has been rendered.
`
`© 1997 Microsoft Corporation . All rights reserved . Terms of Use .
`
`• Q<M [.] +• I![.],.[. Topic Contents •@M* 1gnw
`
`CBaseRenderer: :Stop
`
`CBaseRenderer Class
`
`Transitions the renderer to State_Stopped if it is not in this state already.
`
`HRESULT Stop(void);
`
`Return Values
`
`Returns an HRESULT value.
`
`Remarks
`
`If the renderer is not in the State_Stopped state, the CRendererinoutPin: :Inactive member
`function is called for each of the renderer's connected pins. If this member function succeeds,
`the filter's m State member variable is set to State_Stopped.
`
`This member function overrides CBaseFilter: :Stop.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`MQi@[.jjj,M 1!1.11119 Topic Contents
`
`i@faii!MM
`
`1369
`
`
`
`CBaseRenderer Class
`
`Page 39 of 41
`
`CBaseRenderer: :StopStrea ming
`
`CBaseRenderer Class
`
`Sets the internal flag to indicate not to schedule arrival of any more samples.
`
`virtual HRESULT StopStreaming(void);
`
`Return Values
`
`Returns an HRESULT value.
`
`Remarks
`
`Call this member function when streaming stops. The state change methods in the filter
`implementation take care of canceling any clock advise link that has been set up and clearing
`any pending sample.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Qi§1H++ 1 !!·HM Topic Contents
`
`ifflj[§ii!¥M
`
`CBaseRenderer: :Ti merCa 11 back
`
`CBaseRenderer Class
`
`Checks if it is time to signal the end of the current data stream.
`
`void TimerCallback(void);
`
`Return Values
`
`No return value.
`
`Remarks
`
`If the m EndOfStreamTimer data member is nonzero, this function sets it to zero and calls
`CBaseRenderer: :SendEndOfStream to signal the end of the current data stream.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Q<@[.]ij,+ 111.11119 Topic Contents 1@1§11!¥+
`
`1370
`
`
`
`CBaseRenderer Class
`
`Page 40 of 41
`
`C BaseRenderer:: Wa itForReceiveToCom plete
`
`CBaseRenderer Class
`
`Waits for the CBaseRenderer:: Receive method to complete.
`
`void WaitForReceiveToComplete( );
`
`Return Values
`
`No return value.
`
`Remarks
`
`Use this method when you wish to avoid deadlock which occurs when CBaseRenderer: :Stop is
`called and the CBaseRenderer:: Receive hasn't completed.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Qi§1[.]++ 1 !!·HM Topic Contents
`
`i@l§ii!MM
`
`CBaseRenderer: :Wa itForRenderTi me
`
`CBaseRenderer Class
`
`Waits for either the due time for the current sample to arrive or for rendering to be stopped.
`
`virtual HRESULT WaitForRenderTime(void);
`
`Return Values
`
`Returns an HRESULT value.
`
`Remarks
`
`The member function is virtual because derived classes might have more events that they also
`want to wait on, which might interrupt the waiting process. The base class has two events:
`m RenderEvent and m ThreadSignal. The former is signaled by the clock when the sample is
`due for rendering. The latter is signaled by the filter when it should give up waiting and abort
`(making the assumption that the filter was stopped).
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`1371
`
`
`
`CBaseRenderer Class
`
`Page 41of41
`
`1372
`
`
`
`CBaseStreamControl Class
`
`Page I of9
`
`e4140.111,e 1:1.11119 T op1c Contents
`
`i@IQilt§jM
`
`CBaseStreamControl Class
`
`IAMStreamControl
`
`CBaseStreamControl
`
`The CBaseStreamControl class implements the IAMStreamControl interface on input and
`output pins in a filter graph. This class provides control of the starting and stopping of various
`components of the stream. Various streams can be turned on or off without affecting the rest
`of the graph. For example, an audio stream can be turned off while a video stream continues,
`for muting. Or perhaps a capture stream can be turned off while preview continues to flow.
`This could be used to assist in frame accuracy when exact capture start or stop times are
`important.
`
`CBaseStreamControl enables you to specify start and stop times in the StartAt and StooAt
`member functions and provides stream information in the t'..etinfo member function.
`CBaseStreamControl uses the StreamControlState enumerated data type to describe the
`various states a stream is in. If a stream is flowing it iS indicated by the STREAM . ...FLOWING
`setting, otherNise it is in a discarding state indicated by the STREAM .... DISCARDING setting.
`
`Filters that need to implement the interface on their own should typically inherit from
`CBaseStreamControl to obtain an implementation of the StartAt, Stopft,t. and Getinfo
`methods. The CBaseStreamControl class also maintains state information and decides what
`to do with the sample. To implement your own filter with pins that support
`CBaseStreamControl you must:
`
`• Inform the filter object of all state changes through the NC!tifVFilterState member
`function.
`• Inform the filter object of all SetSyncSource calls to the filter.
`• Inform the filter object when in a flushing state. and when flushing has completed, in the
`CBaseStreamControl:: Flushing member function.
`• Use the CheckStreamState function to make decisions about discarding or passing along
`samples.
`• Make sure output pins set discontinuity flags on the first sample flowed after samples
`have been discarded.
`• Tell your pin what the sink is when your filter joins a filter graph, as shown in the
`following example.
`
`STDMETHODIMP CMyFilter::JoinFilte:rGraph{IFilte:rGraph * p3raph, LPCWSTR pName)
`{
`
`HRESULT hr= CBaseFilter::JoinFilte:rGraph{p3raph, pNameJ;
`if {hr == 5 OK)
`m_pMyPin~>SetFilte:rGraph{m_pSinkl;
`return hr;
`
`If you are implementing the IAMStreamContro! interface without using CBaseStreamControl,
`
`1373
`
`
`
`CBaseStreamControl Class
`
`Page 2 of9
`
`the last two preceding points do not apply.
`
`For sample code see the video capture sample at DXmedia\Samples\DS\vidcap.
`
`Member Functions
`Description
`Name
`CBaseStreamControl Constructs a CBaseStreamControl object.
`CheckStreamState Retrieves a stream's current state.
`Flushing
`Notifies the pin when the filter is flushing.
`Getinfo
`Retrieves information about the current streaming settings.
`NotifyFilterState
`Notifies the pin of what state your filter is in.
`SetFilterGraph
`Sets the event sink notification that your filter graph is using.
`SetSy ncSo u rce
`Identifies the reference clock being used by the graph your filter is in.
`StartAt
`Informs the pin when to start sending streaming data.
`StopAt
`Informs the pin when to stop processing data and discard any new
`samples.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Qij[.jlj,M 111.l:.!j Topic Contents
`
`l@i§lllMM
`
`+QiM!.l+' •11·!:.!i Topic Contents
`
`l@i§lllMM
`
`C BaseStrea mControl:: C BaseStrea mControl
`
`CBaseStreamControl Class
`
`Constructs a CBaseStrea mControl object.
`
`CBaseStreamControl( );
`
`Return Values
`
`No return value.
`
`Remarks
`
`This method initializes start time and stop time to MAX_TIME, which implies that times are
`unspecified.
`
`© 1997 Microsoft Comoration. All rights reserved. Terms of Use.
`
`+Q'41!.l++ +11.q; Topic Contents
`
`l@i§lllMM
`
`1374
`
`
`
`CBaseStreamControl Class
`
`Page 3 of9
`
`CBaseStrea mControl: :CheckStrea mState
`
`CBaseStreamControl Class
`
`Retrieves a stream's current state.
`
`enum streamcontrolstate Checkstreamstate( IMediasample * psample ) ;
`
`Values
`
`pSample
`Pointer to an IMediaSamole interface.
`
`Return Values
`
`Returns a StreamControlState enumeration type.
`
`Remarks
`
`Your filter calls this member function when your pin receives a sample that it is about to
`forward. The first sample you forward after throwing one or more away should be marked as a
`discontinuity.
`
`If your filter implements the IAMDroppedFrames interface and is counting how many frames
`are dropped, it should not count a frame that is discarded as dropped.
`
`The following example shows what you should include if your filter inherits from
`CBaseStrea mControl.
`
`//Pin has been given a sample to pass on, psample
`//m_fLastSampleDiscarded is initialized to TRUE when streaming starts
`
`int iStreamstate = Checkstreamstate(psample);
`if (iStreamState == STREAM_FLOWING) {
`if (m_fLastsampleDiscarded)
`psample->SetDiscontinuity(TRUE);
`m fLastSampleDiscarded = FALSE;
`//now deliver it or put it o a queue to be delivered, or whatever.
`else {
`m fLastSampleDiscarded =TRUE;
`//next one is discontinuity
`//do NOT deliver this sample. Just throw it away
`
`© 1997 Microsoft Corporation . All rights reserved. Terms of Use.
`
`MQi§i[.]11,M Ill.HS Topic Contents •@M* 1gnw
`
`CBaseStreamControl::Flushing
`
`1375
`
`
`
`CBaseStreamControl Class
`
`Page 4 of9
`
`CBaseStreamControl Class
`
`Notifies the pin that the filter is flushing.
`
`void Flushing(
`BOOL binProgress );
`
`Parameters
`
`blnProgress
`TRUE indicates flushing in progress; FALSE indicates not flushing.
`
`Return Values
`
`No return value.
`
`Remarks
`
`If you are implementing your own filter, your pin must call this member function on BeginFlush
`and EndFlush (DeliverBeginFlush and DeliverEndFlush for output pins) to say when it is
`flushing, as shown in the following example.
`
`HRESULT CMyPin: :BeginFlush ()
`{
`
`Flushing (TRUE ) ;
`//or CBaseinputPin for input pins
`return CBaseoutputPin::BeginFlush();
`
`HRESULT CMyPin: :EndFlush()
`{
`
`Flushing (FALSE ) ;
`//or CBaseinputPin for input pins
`return CBaseOutputPin::EndFlush () ;
`
`Note that capture filters that do not support seeking do not call this method.
`
`© 1997 Microsoft Corporation. All rights reserved . Terms of Use.
`
`• Q<M [.] +• I![.],.[. Topic Contents
`
`•@M* 1gnw
`
`CBaseStrea mControl: :Getlnfo
`
`CBaseStreamControl Class
`
`Retrieves information about the current streaming settings.
`
`1376
`
`
`
`CBaseStreamControl Class
`
`Page 5 of9
`
`HRESULT Getlnfo(
`AM_STREAM_INFO *plnfo
`);
`
`Parameters
`
`pinfo
`
`Pointer to an AM STREAM INFO structure.
`
`Return Values
`
`Returns S_OK.
`
`Remarks
`
`This member function implements the IAMStreamControl interface and is called by the user to
`find out if a pin is streaming and to obtain the stream's attributes.
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Qi§1H++ 1 !!·HM Topic Contents
`
`ifflj[§ii!¥M
`
`CBaseStreamControl::NotifyFilterState
`
`CBaseStreamControl Class
`
`Notifies the pin of your filter's state.
`
`void NotifyFilterState(
`FILTER_STATE new_state,
`REFERENCE_ TIME tStart = 0 );
`
`Parameters
`
`new_state
`Filter's new state.
`tStart
`Time at which streaming starts (only valid when new_state is in State_Running).
`
`Return Values
`
`No return value.
`
`Remarks
`
`This member function notifies the pin of a filter's new state by setting a FILTER STATE
`enumeration type variable.
`
`1377
`
`
`
`CBaseStreamControl Class
`
`Page 6 of9
`
`If you are implementing your own filter, inform your pin's
`CBaseStreamControl::NotifyFilterState member function what state your filter is in every
`time your filter changes state, as shown in the following example.
`
`STDMETHODIMP CMyFilter: :Run(REFERENCE TIME tstart)
`{
`-
`
`//once error check is successful
`m_pMyPin->NotifyFilterstate (State_Running, tstart);
`
`//now continue with whatever should occur next, for example ...
`return CBaseFilter::Run(tstart ) ;
`
`STDMETHODIMP CMyFilter: :Pause()
`{
`
`//once error check is successful
`m_pMyPin->NotifyFilterstate (State_Paused, O) ;
`
`//now continue with whatever should occur next, for example ...
`return CBaseFilter::Pause();
`
`STDMETHODIMP CMyFilter: :Stop()
`{
`
`//once error check is successful
`m_pMyPin->NotifyFilterstate (State_stopped, O);
`
`//now continue with whatever should occur next, for example ...
`return CBaseFilter::Stop(tstart) ;
`
`© 1997 Microsoft Corporation. All rights reserved. Terms of Use.
`
`+Qi§1[.]++ 1 !!·HM Topic Contents
`
`i@i§ii!MM
`
`MQij[.jjj,M M!i.11119 Topic Contents
`
`i@i§ii!MM
`
`CBaseStrea mControl: :Set Fi lterG