content/media/directshow/SourceFilter.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

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.

     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/. */
     7 #if !defined(nsDirectShowSource_h___)
     8 #define nsDirectShowSource_h___
    10 #include "BaseFilter.h"
    11 #include "BasePin.h"
    12 #include "MediaType.h"
    14 #include "nsDeque.h"
    15 #include "nsAutoPtr.h"
    16 #include "DirectShowUtils.h"
    17 #include "mozilla/RefPtr.h"
    19 namespace mozilla {
    21 class MediaResource;
    22 class ReadRequest;
    23 class OutputPin;
    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:
    42   // Constructs source filter to deliver given media type.
    43   SourceFilter(const GUID& aMajorType, const GUID& aSubType);
    44   ~SourceFilter();
    46   nsresult Init(MediaResource *aResource, int64_t aMP3Offset);
    48   // BaseFilter overrides.
    49   // Only one output - the byte stream.
    50   int GetPinCount() MOZ_OVERRIDE { return 1; }
    52   media::BasePin* GetPin(int n) MOZ_OVERRIDE;
    54   // Get's the media type we're supplying.
    55   const media::MediaType* GetMediaType() const;
    57   uint32_t GetAndResetBytesConsumedCount();
    59 protected:
    61   // Our async pull output pin.
    62   nsAutoPtr<OutputPin> mOutputPin;
    64   // Type of byte stream we output.
    65   media::MediaType mMediaType;
    67 };
    69 } // namespace mozilla
    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
    76 #endif

mercurial