3 ** Copyright (C) 2008 The Android Open Source Project
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
9 ** http://www.apache.org/licenses/LICENSE-2.0
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
18 #ifndef ANDROID_VIDEO_FRAME_H
19 #define ANDROID_VIDEO_FRAME_H
24 #include <utils/Log.h>
28 // A simple buffer to hold binary data
32 MediaAlbumArt(): mSize(0), mData(0) {}
34 explicit MediaAlbumArt(const char* url) {
37 FILE *in = fopen(url, "r");
41 fseek(in, 0, SEEK_END);
42 mSize = ftell(in); // Allocating buffer of size equals to the external file size.
43 if (mSize == 0 || (mData = new uint8_t[mSize]) == NULL) {
51 if (fread(mData, 1, mSize, in) != mSize) { // Read failed.
60 MediaAlbumArt(const MediaAlbumArt& copy) {
62 mData = NULL; // initialize it first
63 if (mSize > 0 && copy.mData != NULL) {
64 mData = new uint8_t[copy.mSize];
66 memcpy(mData, copy.mData, mSize);
79 // Intentional public access modifier:
80 // We have to know the internal structure in order to share it between
82 uint32_t mSize; // Number of bytes in mData
83 uint8_t* mData; // Actual binary data
86 // Represents a color converted (RGB-based) video frame
87 // with bitmap pixels stored in FrameBuffer
91 VideoFrame(): mWidth(0), mHeight(0), mDisplayWidth(0), mDisplayHeight(0), mSize(0), mData(0) {}
93 VideoFrame(const VideoFrame& copy) {
95 mHeight = copy.mHeight;
96 mDisplayWidth = copy.mDisplayWidth;
97 mDisplayHeight = copy.mDisplayHeight;
99 mData = NULL; // initialize it first
100 if (mSize > 0 && copy.mData != NULL) {
101 mData = new uint8_t[mSize];
103 memcpy(mData, copy.mData, mSize);
116 // Intentional public access modifier:
119 uint32_t mDisplayWidth;
120 uint32_t mDisplayHeight;
121 uint32_t mSize; // Number of bytes in mData
122 uint8_t* mData; // Actual binary data
123 int32_t mRotationAngle; // rotation angle, clockwise
126 }; // namespace android
128 #endif // ANDROID_VIDEO_FRAME_H