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 25 namespace android { 26 27 class SkOmxPixelRef : public SkPixelRef { 28 public: 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 36 SK_DECLARE_UNFLATTENABLE_OBJECT() 37 protected: 38 // overrides from SkPixelRef 39 virtual void* onLockPixels(SkColorTable**); 40 virtual void onUnlockPixels(); 41 42 private: 43 MediaBuffer* mBuffer; 44 sp<MediaSource> mDecoder; 45 size_t mSize; 46 SkColorTable* mCTable; 47 48 typedef SkPixelRef INHERITED; 49 }; 50 51 } // namespace android 52 #endif // SKOMXPIXELREF_DEFINED 53