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#ifndef SKOMXPIXELREF_DEFINED
18#define SKOMXPIXELREF_DEFINED
19
20#include <media/stagefright/MediaBuffer.h>
21#include <media/stagefright/OMXClient.h>
22#include <media/stagefright/OMXCodec.h>
23#include <SkPixelRef.h>
24
25namespace android {
26
27class SkOmxPixelRef : public SkPixelRef {
28public:
29    SkOmxPixelRef(SkColorTable* ctable, MediaBuffer* buffer,
30            sp<MediaSource> decoder);
31    virtual ~SkOmxPixelRef();
32
33     //! Return the allocation size for the pixels
34    size_t getSize() const { return mSize; }
35
36protected:
37    // overrides from SkPixelRef
38    virtual void* onLockPixels(SkColorTable**);
39    virtual void onUnlockPixels();
40
41private:
42    MediaBuffer* mBuffer;
43    sp<MediaSource> mDecoder;
44    size_t          mSize;
45    SkColorTable*   mCTable;
46
47    typedef SkPixelRef INHERITED;
48};
49
50} // namespace android
51#endif // SKOMXPIXELREF_DEFINED
52