content/media/VideoSegment.cpp

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

     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 file,
     4  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "VideoSegment.h"
     8 #include "gfx2DGlue.h"
     9 #include "ImageContainer.h"
    11 namespace mozilla {
    13 using namespace layers;
    15 VideoFrame::VideoFrame(already_AddRefed<Image>& aImage,
    16                        const gfxIntSize& aIntrinsicSize)
    17   : mImage(aImage), mIntrinsicSize(aIntrinsicSize), mForceBlack(false)
    18 {}
    20 VideoFrame::VideoFrame()
    21   : mIntrinsicSize(0, 0), mForceBlack(false)
    22 {}
    24 VideoFrame::~VideoFrame()
    25 {}
    27 void
    28 VideoFrame::SetNull() {
    29   mImage = nullptr;
    30   mIntrinsicSize = gfxIntSize(0, 0);
    31 }
    33 void
    34 VideoFrame::TakeFrom(VideoFrame* aFrame)
    35 {
    36   mImage = aFrame->mImage.forget();
    37   mIntrinsicSize = aFrame->mIntrinsicSize;
    38   mForceBlack = aFrame->GetForceBlack();
    39 }
    41 VideoChunk::VideoChunk()
    42 {}
    44 VideoChunk::~VideoChunk()
    45 {}
    47 void
    48 VideoSegment::AppendFrame(already_AddRefed<Image>&& aImage,
    49                           TrackTicks aDuration,
    50                           const IntSize& aIntrinsicSize)
    51 {
    52   VideoChunk* chunk = AppendChunk(aDuration);
    53   VideoFrame frame(aImage, ThebesIntSize(aIntrinsicSize));
    54   chunk->mFrame.TakeFrom(&frame);
    55 }
    57 VideoSegment::VideoSegment()
    58   : MediaSegmentBase<VideoSegment, VideoChunk>(VIDEO)
    59 {}
    61 VideoSegment::~VideoSegment()
    62 {}
    64 }

mercurial