|
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/. */ |
|
5 |
|
6 #include "VideoSegment.h" |
|
7 |
|
8 #include "gfx2DGlue.h" |
|
9 #include "ImageContainer.h" |
|
10 |
|
11 namespace mozilla { |
|
12 |
|
13 using namespace layers; |
|
14 |
|
15 VideoFrame::VideoFrame(already_AddRefed<Image>& aImage, |
|
16 const gfxIntSize& aIntrinsicSize) |
|
17 : mImage(aImage), mIntrinsicSize(aIntrinsicSize), mForceBlack(false) |
|
18 {} |
|
19 |
|
20 VideoFrame::VideoFrame() |
|
21 : mIntrinsicSize(0, 0), mForceBlack(false) |
|
22 {} |
|
23 |
|
24 VideoFrame::~VideoFrame() |
|
25 {} |
|
26 |
|
27 void |
|
28 VideoFrame::SetNull() { |
|
29 mImage = nullptr; |
|
30 mIntrinsicSize = gfxIntSize(0, 0); |
|
31 } |
|
32 |
|
33 void |
|
34 VideoFrame::TakeFrom(VideoFrame* aFrame) |
|
35 { |
|
36 mImage = aFrame->mImage.forget(); |
|
37 mIntrinsicSize = aFrame->mIntrinsicSize; |
|
38 mForceBlack = aFrame->GetForceBlack(); |
|
39 } |
|
40 |
|
41 VideoChunk::VideoChunk() |
|
42 {} |
|
43 |
|
44 VideoChunk::~VideoChunk() |
|
45 {} |
|
46 |
|
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 } |
|
56 |
|
57 VideoSegment::VideoSegment() |
|
58 : MediaSegmentBase<VideoSegment, VideoChunk>(VIDEO) |
|
59 {} |
|
60 |
|
61 VideoSegment::~VideoSegment() |
|
62 {} |
|
63 |
|
64 } |