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

Side by Side 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: Fixed code review issues found by Scherkus and Tommi. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Implement a simple base class for a DirectShow input pin. It may only be
6 // used in a single threaded apartment.
7
8 #ifndef MEDIA_VIDEO_CAPTURE_WIN_PIN_BASE_WIN_H_
9 #define MEDIA_VIDEO_CAPTURE_WIN_PIN_BASE_WIN_H_
10 #pragma once
11
12 // Avoid including strsafe.h via dshow as it will cause build warnings.
13 #define NO_DSHOW_STRSAFE
14 #include <dshow.h>
15
16 #include "base/memory/ref_counted.h"
17 #include "base/win/scoped_comptr.h"
18
19 namespace media {
20
21 class PinBase : public IPin,
22 public IMemInputPin,
23 public base::RefCounted<PinBase> {
24 public:
25 explicit PinBase(IBaseFilter* owner);
26 virtual ~PinBase();
27
28 // Checks if a media type is acceptable. This is called when this pin is
29 // connected to an output pin. Must return true if the media type is
30 // acceptable, false otherwise.
31 virtual bool IsMediaTypeValid(const AM_MEDIA_TYPE* media_type) = 0;
32
33 // Enumerates valid media types.
34 virtual bool GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) = 0;
35
36 // Called when new media is received. Note that this is not on the same
37 // thread as where the pin is created.
38 STDMETHOD(Receive)(IMediaSample* pSample) = 0;
tommi (sloooow) - chröme 2011/06/27 13:20:37 pSample -> sample
Per K 2011/06/28 10:14:07 Done.
39
40 STDMETHOD(Connect)(IPin* pReceivePin, const AM_MEDIA_TYPE* pmt);
tommi (sloooow) - chröme 2011/06/27 13:20:37 fix variable names here and below.
Per K 2011/06/28 10:14:07 Done.
41
42 STDMETHOD(ReceiveConnection)(IPin* pConnector, const AM_MEDIA_TYPE* pmt);
43
44 STDMETHOD(Disconnect)();
45
46 STDMETHOD(ConnectedTo)(IPin** pin);
47
48 STDMETHOD(ConnectionMediaType)(AM_MEDIA_TYPE* pmt);
49
50 STDMETHOD(QueryPinInfo)(PIN_INFO* info);
51
52 STDMETHOD(QueryDirection)(PIN_DIRECTION* pin_dir);
53
54 STDMETHOD(QueryId)(LPWSTR* id);
55
56 STDMETHOD(QueryAccept)(const AM_MEDIA_TYPE* mt);
57
58 STDMETHOD(EnumMediaTypes)(IEnumMediaTypes** types);
59
60 STDMETHOD(QueryInternalConnections)(IPin** pin, ULONG* no_pins);
61
62 STDMETHOD(EndOfStream)();
63
64 STDMETHOD(BeginFlush)();
65
66 STDMETHOD(EndFlush)();
67
68 STDMETHOD(NewSegment)(REFERENCE_TIME start,
69 REFERENCE_TIME stop,
70 double dRate);
71
72 // Inherited from IMemInputPin.
73 STDMETHOD(GetAllocator)(IMemAllocator** allocator);
74
75 STDMETHOD(NotifyAllocator)(IMemAllocator* allocator, BOOL read_only);
76
77 STDMETHOD(GetAllocatorRequirements)(ALLOCATOR_PROPERTIES* properties);
78
79 STDMETHOD(ReceiveMultiple)(IMediaSample** samples,
80 long sample_count,
81 long* processed);
82 STDMETHOD(ReceiveCanBlock)();
83
84 // Inherited from IUnknown.
85 STDMETHOD(QueryInterface)(REFIID id, void** object_ptr);
86
87 STDMETHOD_(ULONG, AddRef)();
88
89 STDMETHOD_(ULONG, Release)();
90
91 private:
92 AM_MEDIA_TYPE current_media_type_;
93 base::win::ScopedComPtr<IPin> connected_pin_;
94 // owner_ is the filter owning this pin. We don't reference count it since
95 // that would create a circular reference count.
96 IBaseFilter* owner_;
97 };
98
99 } // namespace media
100
101 #endif // MEDIA_VIDEO_CAPTURE_WIN_PIN_BASE_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698