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

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: Fix crash on some Windows versions when there is no camera available. Created 9 years, 5 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
« no previous file with comments | « media/video/capture/win/filter_base_win.cc ('k') | media/video/capture/win/pin_base_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
22 : public IPin,
23 public IMemInputPin,
24 public base::RefCounted<PinBase> {
25 public:
26 explicit PinBase(IBaseFilter* owner);
27 virtual ~PinBase();
28
29 // Function used for changing the owner.
30 // If the owner is deleted the owner should first call this function
31 // with owner = NULL.
32 void SetOwner(IBaseFilter* owner);
33
34 // Checks if a media type is acceptable. This is called when this pin is
35 // connected to an output pin. Must return true if the media type is
36 // acceptable, false otherwise.
37 virtual bool IsMediaTypeValid(const AM_MEDIA_TYPE* media_type) = 0;
38
39 // Enumerates valid media types.
40 virtual bool GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) = 0;
41
42 // Called when new media is received. Note that this is not on the same
43 // thread as where the pin is created.
44 STDMETHOD(Receive)(IMediaSample* sample) = 0;
45
46 STDMETHOD(Connect)(IPin* receive_pin, const AM_MEDIA_TYPE* media_type);
47
48 STDMETHOD(ReceiveConnection)(IPin* connector,
49 const AM_MEDIA_TYPE* media_type);
50
51 STDMETHOD(Disconnect)();
52
53 STDMETHOD(ConnectedTo)(IPin** pin);
54
55 STDMETHOD(ConnectionMediaType)(AM_MEDIA_TYPE* media_type);
56
57 STDMETHOD(QueryPinInfo)(PIN_INFO* info);
58
59 STDMETHOD(QueryDirection)(PIN_DIRECTION* pin_dir);
60
61 STDMETHOD(QueryId)(LPWSTR* id);
62
63 STDMETHOD(QueryAccept)(const AM_MEDIA_TYPE* media_type);
64
65 STDMETHOD(EnumMediaTypes)(IEnumMediaTypes** types);
66
67 STDMETHOD(QueryInternalConnections)(IPin** pins, ULONG* no_pins);
68
69 STDMETHOD(EndOfStream)();
70
71 STDMETHOD(BeginFlush)();
72
73 STDMETHOD(EndFlush)();
74
75 STDMETHOD(NewSegment)(REFERENCE_TIME start,
76 REFERENCE_TIME stop,
77 double dRate);
78
79 // Inherited from IMemInputPin.
80 STDMETHOD(GetAllocator)(IMemAllocator** allocator);
81
82 STDMETHOD(NotifyAllocator)(IMemAllocator* allocator, BOOL read_only);
83
84 STDMETHOD(GetAllocatorRequirements)(ALLOCATOR_PROPERTIES* properties);
85
86 STDMETHOD(ReceiveMultiple)(IMediaSample** samples,
87 long sample_count,
88 long* processed);
89 STDMETHOD(ReceiveCanBlock)();
90
91 // Inherited from IUnknown.
92 STDMETHOD(QueryInterface)(REFIID id, void** object_ptr);
93
94 STDMETHOD_(ULONG, AddRef)();
95
96 STDMETHOD_(ULONG, Release)();
97
98 private:
99 AM_MEDIA_TYPE current_media_type_;
100 base::win::ScopedComPtr<IPin> connected_pin_;
101 // owner_ is the filter owning this pin. We don't reference count it since
102 // that would create a circular reference count.
103 IBaseFilter* owner_;
104 };
105
106 } // namespace media
107
108 #endif // MEDIA_VIDEO_CAPTURE_WIN_PIN_BASE_WIN_H_
OLDNEW
« no previous file with comments | « media/video/capture/win/filter_base_win.cc ('k') | media/video/capture/win/pin_base_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698