1 // Copyright (C) 2020 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 #include "host-common/MediaSnapshotState.h" 18 19 #include <cstdint> 20 #include <list> 21 #include <mutex> 22 #include <string> 23 #include <vector> 24 25 #include <stdio.h> 26 #include <string.h> 27 28 #include <stddef.h> 29 30 namespace android { 31 namespace emulation { 32 33 class MediaVideoHelper { 34 public: 35 MediaVideoHelper() = default; 36 virtual ~MediaVideoHelper() = default; 37 // return true if success; false otherwise init()38 virtual bool init() { return false; } decode(const uint8_t * frame,size_t szBytes,uint64_t inputPts)39 virtual void decode(const uint8_t* frame, 40 size_t szBytes, 41 uint64_t inputPts) {} flush()42 virtual void flush() {} deInit()43 virtual void deInit() {} 44 45 bool receiveFrame(MediaSnapshotState::FrameInfo* pFrameInfo); setIgnoreDecodedFrames()46 void setIgnoreDecodedFrames() { mIgnoreDecoderOutput = true; } setSaveDecodedFrames()47 void setSaveDecodedFrames() { mIgnoreDecoderOutput = false; } 48 error()49 virtual int error() const { return 0; } good()50 virtual bool good() const { return true; } fatal()51 virtual bool fatal() const { return false; } 52 53 protected: 54 bool mIgnoreDecoderOutput = false; 55 56 mutable std::list<MediaSnapshotState::FrameInfo> mSavedDecodedFrames; 57 58 }; // MediaVideoHelper 59 60 } // namespace emulation 61 } // namespace android 62