content/media/raw/RawReader.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 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #if !defined(RawReader_h_)
     7 #define RawReader_h_
     9 #include "MediaDecoderReader.h"
    10 #include "RawStructs.h"
    12 namespace mozilla {
    14 class RawReader : public MediaDecoderReader
    15 {
    16 public:
    17   RawReader(AbstractMediaDecoder* aDecoder);
    18   ~RawReader();
    20   virtual nsresult Init(MediaDecoderReader* aCloneDonor);
    21   virtual nsresult ResetDecode();
    22   virtual bool DecodeAudioData();
    24   virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
    25                                   int64_t aTimeThreshold);
    27   virtual bool HasAudio()
    28   {
    29     return false;
    30   }
    32   virtual bool HasVideo()
    33   {
    34     return true;
    35   }
    37   virtual nsresult ReadMetadata(MediaInfo* aInfo,
    38                                 MetadataTags** aTags);
    39   virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime);
    40   virtual nsresult GetBuffered(dom::TimeRanges* aBuffered, int64_t aStartTime);
    42 private:
    43   bool ReadFromResource(MediaResource *aResource, uint8_t *aBuf, uint32_t aLength);
    45   RawVideoHeader mMetadata;
    46   uint32_t mCurrentFrame;
    47   double mFrameRate;
    48   uint32_t mFrameSize;
    49   nsIntRect mPicture;
    50 };
    52 } // namespace mozilla
    54 #endif

mercurial