| Wei-Ta Chen | 4b6f494 | 2009-09-01 17:44:49 +0800 | [diff] [blame] | 1 | /* | 
 | 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 |  | 
| James Dong | 8e9d67a | 2012-02-06 23:46:37 -0800 | [diff] [blame] | 17 | #include <media/stagefright/foundation/ADebug.h> | 
| Wei-Ta Chen | 4b6f494 | 2009-09-01 17:44:49 +0800 | [diff] [blame] | 18 | #include <SkBitmap.h> | 
 | 19 |  | 
 | 20 | #include "SkOmxPixelRef.h" | 
 | 21 |  | 
 | 22 | using namespace android; | 
 | 23 |  | 
 | 24 | SkOmxPixelRef::SkOmxPixelRef(SkColorTable* ctable, MediaBuffer* buffer, | 
| Andreas Huber | 987dbde | 2009-12-16 13:13:27 -0800 | [diff] [blame] | 25 |         sp<MediaSource> decoder)  { | 
| Wei-Ta Chen | 4b6f494 | 2009-09-01 17:44:49 +0800 | [diff] [blame] | 26 |     mBuffer = buffer; | 
 | 27 |     mDecoder = decoder; | 
 | 28 |     mSize = buffer->size(); | 
 | 29 |     mCTable = ctable; | 
 | 30 |     SkSafeRef(mCTable); | 
 | 31 | } | 
 | 32 |  | 
 | 33 | SkOmxPixelRef::~SkOmxPixelRef() { | 
 | 34 |     mBuffer->release(); | 
| James Dong | 8e9d67a | 2012-02-06 23:46:37 -0800 | [diff] [blame] | 35 |     CHECK_EQ(mDecoder->stop(), (status_t)OK); | 
| Wei-Ta Chen | 4b6f494 | 2009-09-01 17:44:49 +0800 | [diff] [blame] | 36 |     SkSafeUnref(mCTable); | 
 | 37 | } | 
 | 38 |  | 
 | 39 | void* SkOmxPixelRef::onLockPixels(SkColorTable** ct) { | 
 | 40 |     *ct = mCTable; | 
 | 41 |     return mBuffer->data(); | 
 | 42 | } | 
 | 43 |  | 
 | 44 | void SkOmxPixelRef::onUnlockPixels() { | 
 | 45 |     // nothing to do | 
 | 46 | } |