Index: media/video/capture/win/pin_base_win.h |
=================================================================== |
--- media/video/capture/win/pin_base_win.h (revision 0) |
+++ media/video/capture/win/pin_base_win.h (revision 0) |
@@ -0,0 +1,105 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// Implement a simple base class for a DirectShow input pin. It may only be |
+// used in a single threaded apartment. |
+ |
+#ifndef MEDIA_VIDEO_CAPTURE_WIN_PIN_BASE_WIN_H_ |
+#define MEDIA_VIDEO_CAPTURE_WIN_PIN_BASE_WIN_H_ |
+#pragma once |
+ |
+// Avoid including strsafe.h via dshow as it will cause build warnings. |
+#define NO_DSHOW_STRSAFE |
+#include <dshow.h> |
+ |
+#include "base/memory/ref_counted.h" |
+ |
+namespace media { |
+ |
+class PinBase : public IPin, |
scherkus (not reviewing)
2011/06/24 20:15:26
nit: style should be same as initializer list (dro
Per K
2011/06/27 11:47:50
Done.
|
+ public IMemInputPin, |
+ public base::RefCounted<PinBase> { |
+ public: |
+ explicit PinBase(IBaseFilter* owner); |
+ virtual ~PinBase(); |
+ |
+ // Checks if a media type is acceptable. This is called when this pin is |
+ // connected to an output pin. Must return true if the media type is |
+ // acceptable, false otherwise. |
+ virtual bool IsMediaTypeValid(const AM_MEDIA_TYPE* media_type) = 0; |
+ |
+ // Enumerates valid media types. |
+ virtual bool GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) = 0; |
+ |
+ // Called when new media is received. Note that this is not on the same |
+ // thread as where the pin is created. |
+ virtual HRESULT STDMETHODCALLTYPE Receive(IMediaSample *pSample) = 0; |
tommi (sloooow) - chröme
2011/06/27 13:20:37
fix all "virtual HRESULT STDMETHODCALLTYPE" to use
|
+ |
+ virtual HRESULT STDMETHODCALLTYPE Connect(IPin *pReceivePin, |
+ const AM_MEDIA_TYPE *pmt); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE ReceiveConnection( |
+ IPin *pConnector, |
+ const AM_MEDIA_TYPE *pmt); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE Disconnect(); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE ConnectedTo(IPin **pPin); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE ConnectionMediaType(AM_MEDIA_TYPE *pmt); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE QueryPinInfo(PIN_INFO *pInfo); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE QueryDirection(PIN_DIRECTION *pPinDir); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE QueryId(LPWSTR *Id); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE QueryAccept(const AM_MEDIA_TYPE *pmt); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE EnumMediaTypes(IEnumMediaTypes **ppEnum); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE QueryInternalConnections(IPin **apPin, |
+ ULONG *nPin); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE EndOfStream(); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE BeginFlush(); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE EndFlush(); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE NewSegment(REFERENCE_TIME tStart, |
+ REFERENCE_TIME tStop, |
+ double dRate); |
+ |
+ // Inherited from IMemInputPin. |
+ virtual HRESULT STDMETHODCALLTYPE GetAllocator(IMemAllocator **ppAllocator); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE NotifyAllocator(IMemAllocator *pAllocator, |
+ BOOL bReadOnly); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE GetAllocatorRequirements( |
+ ALLOCATOR_PROPERTIES *pProps); |
+ |
+ virtual HRESULT STDMETHODCALLTYPE ReceiveMultiple(IMediaSample **pSamples, |
+ long nSamples, |
+ long *nSamplesProcessed); |
+ virtual HRESULT STDMETHODCALLTYPE ReceiveCanBlock(); |
+ |
+ // Inherited from IUnknown. |
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, |
+ void** object_ptr); |
+ |
+ virtual ULONG STDMETHODCALLTYPE AddRef(); |
+ |
+ virtual ULONG STDMETHODCALLTYPE Release(); |
+ |
+ private: |
+ AM_MEDIA_TYPE current_media_type_; |
+ IPin* connected_pin_; |
+ IBaseFilter* owner_; |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_VIDEO_CAPTURE_WIN_PIN_BASE_WIN_H_ |