blob: dfdf676a2a062622bd0299d469a2ce918049c33b [file] [log] [blame]
Wei-Ta Chen4b6f4942009-09-01 17:44:49 +08001/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <media/stagefright/MediaDebug.h>
18#include <SkBitmap.h>
19
20#include "SkOmxPixelRef.h"
21
22using namespace android;
23
24SkOmxPixelRef::SkOmxPixelRef(SkColorTable* ctable, MediaBuffer* buffer,
Andreas Huber987dbde2009-12-16 13:13:27 -080025 sp<MediaSource> decoder) {
Wei-Ta Chen4b6f4942009-09-01 17:44:49 +080026 mBuffer = buffer;
27 mDecoder = decoder;
28 mSize = buffer->size();
29 mCTable = ctable;
30 SkSafeRef(mCTable);
31}
32
33SkOmxPixelRef::~SkOmxPixelRef() {
34 mBuffer->release();
35 CHECK_EQ(mDecoder->stop(), OK);
36 SkSafeUnref(mCTable);
37}
38
39void* SkOmxPixelRef::onLockPixels(SkColorTable** ct) {
40 *ct = mCTable;
41 return mBuffer->data();
42}
43
44void SkOmxPixelRef::onUnlockPixels() {
45 // nothing to do
46}