Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1166)

Unified Diff: media/video/capture/win/pin_base_win.h

Issue 7229013: This is the VideoCaptureDevice implementation for windows. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,
+ 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/23 14:05:56 follow chromium style (variable naming and positio
Per K 2011/06/27 11:47:50 Done.
+
+ 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_;
tommi (sloooow) - chröme 2011/06/23 14:05:56 ScopedComPtr?
Per K 2011/06/27 11:47:50 Done.
+ IBaseFilter* owner_;
tommi (sloooow) - chröme 2011/06/23 14:05:56 ScopedComPtr? if not, document why.
Per K 2011/06/27 11:47:50 Done.
+};
+
+} // namespace media
+
+#endif // MEDIA_VIDEO_CAPTURE_WIN_PIN_BASE_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698