From f3e80dddd7376aa9deeb27de25e1d50030a2ad98 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 10 Jun 2014 16:55:38 -0700 Subject: Offer a type-safe album art interface. Bug: 15514223 Change-Id: Iddfc33a00e6cd3779ca09c01a55f62b151f6ec95 --- include/private/media/VideoFrame.h | 58 -------------------------------------- 1 file changed, 58 deletions(-) (limited to 'include/private') diff --git a/include/private/media/VideoFrame.h b/include/private/media/VideoFrame.h index a211ed9..5dd425b 100644 --- a/include/private/media/VideoFrame.h +++ b/include/private/media/VideoFrame.h @@ -25,64 +25,6 @@ namespace android { -// A simple buffer to hold binary data -class MediaAlbumArt -{ -public: - MediaAlbumArt(): mSize(0), mData(0) {} - - explicit MediaAlbumArt(const char* url) { - mSize = 0; - mData = NULL; - FILE *in = fopen(url, "r"); - if (!in) { - return; - } - fseek(in, 0, SEEK_END); - mSize = ftell(in); // Allocating buffer of size equals to the external file size. - if (mSize == 0 || (mData = new uint8_t[mSize]) == NULL) { - fclose(in); - if (mSize != 0) { - mSize = 0; - } - return; - } - rewind(in); - if (fread(mData, 1, mSize, in) != mSize) { // Read failed. - delete[] mData; - mData = NULL; - mSize = 0; - return; - } - fclose(in); - } - - MediaAlbumArt(const MediaAlbumArt& copy) { - mSize = copy.mSize; - mData = NULL; // initialize it first - if (mSize > 0 && copy.mData != NULL) { - mData = new uint8_t[copy.mSize]; - if (mData != NULL) { - memcpy(mData, copy.mData, mSize); - } else { - mSize = 0; - } - } - } - - ~MediaAlbumArt() { - if (mData != 0) { - delete[] mData; - } - } - - // Intentional public access modifier: - // We have to know the internal structure in order to share it between - // processes? - uint32_t mSize; // Number of bytes in mData - uint8_t* mData; // Actual binary data -}; - // Represents a color converted (RGB-based) video frame // with bitmap pixels stored in FrameBuffer class VideoFrame -- cgit v1.1