|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #if !defined(nsDirectShowSource_h___) |
|
8 #define nsDirectShowSource_h___ |
|
9 |
|
10 #include "BaseFilter.h" |
|
11 #include "BasePin.h" |
|
12 #include "MediaType.h" |
|
13 |
|
14 #include "nsDeque.h" |
|
15 #include "nsAutoPtr.h" |
|
16 #include "DirectShowUtils.h" |
|
17 #include "mozilla/RefPtr.h" |
|
18 |
|
19 namespace mozilla { |
|
20 |
|
21 class MediaResource; |
|
22 class ReadRequest; |
|
23 class OutputPin; |
|
24 |
|
25 |
|
26 // SourceFilter is an asynchronous DirectShow source filter which |
|
27 // reads from an MediaResource, and supplies data via a pull model downstream |
|
28 // using OutputPin. It us used to supply a generic byte stream into |
|
29 // DirectShow. |
|
30 // |
|
31 // Implements: |
|
32 // * IBaseFilter |
|
33 // * IMediaFilter |
|
34 // * IPersist |
|
35 // * IUnknown |
|
36 // |
|
37 class DECLSPEC_UUID("5c2a7ad0-ba82-4659-9178-c4719a2765d6") |
|
38 SourceFilter : public media::BaseFilter |
|
39 { |
|
40 public: |
|
41 |
|
42 // Constructs source filter to deliver given media type. |
|
43 SourceFilter(const GUID& aMajorType, const GUID& aSubType); |
|
44 ~SourceFilter(); |
|
45 |
|
46 nsresult Init(MediaResource *aResource, int64_t aMP3Offset); |
|
47 |
|
48 // BaseFilter overrides. |
|
49 // Only one output - the byte stream. |
|
50 int GetPinCount() MOZ_OVERRIDE { return 1; } |
|
51 |
|
52 media::BasePin* GetPin(int n) MOZ_OVERRIDE; |
|
53 |
|
54 // Get's the media type we're supplying. |
|
55 const media::MediaType* GetMediaType() const; |
|
56 |
|
57 uint32_t GetAndResetBytesConsumedCount(); |
|
58 |
|
59 protected: |
|
60 |
|
61 // Our async pull output pin. |
|
62 nsAutoPtr<OutputPin> mOutputPin; |
|
63 |
|
64 // Type of byte stream we output. |
|
65 media::MediaType mMediaType; |
|
66 |
|
67 }; |
|
68 |
|
69 } // namespace mozilla |
|
70 |
|
71 // For mingw __uuidof support |
|
72 #ifdef __CRT_UUID_DECL |
|
73 __CRT_UUID_DECL(mozilla::SourceFilter, 0x5c2a7ad0,0xba82,0x4659,0x91,0x78,0xc4,0x71,0x9a,0x27,0x65,0xd6); |
|
74 #endif |
|
75 |
|
76 #endif |