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