• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 #include <media/stagefright/foundation/ADebug.h>
18 #include <SkBitmap.h>
19 
20 #include "SkOmxPixelRef.h"
21 
22 using namespace android;
23 
SkOmxPixelRef(SkColorTable * ctable,MediaBuffer * buffer,sp<MediaSource> decoder)24 SkOmxPixelRef::SkOmxPixelRef(SkColorTable* ctable, MediaBuffer* buffer,
25         sp<MediaSource> decoder)  {
26     mBuffer = buffer;
27     mDecoder = decoder;
28     mSize = buffer->size();
29     mCTable = ctable;
30     SkSafeRef(mCTable);
31 }
32 
~SkOmxPixelRef()33 SkOmxPixelRef::~SkOmxPixelRef() {
34     mBuffer->release();
35     CHECK_EQ(mDecoder->stop(), (status_t)OK);
36     SkSafeUnref(mCTable);
37 }
38 
onLockPixels(SkColorTable ** ct)39 void* SkOmxPixelRef::onLockPixels(SkColorTable** ct) {
40     *ct = mCTable;
41     return mBuffer->data();
42 }
43 
onUnlockPixels()44 void SkOmxPixelRef::onUnlockPixels() {
45     // nothing to do
46 }
47