video_decoder.h revision 776e6f289c7396a1143b8b36b03f88b08ac8cba3
1776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org/* 2776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 3776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org * 4776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org * Use of this source code is governed by a BSD-style license 5776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org * that can be found in the LICENSE file in the root of the source 6776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org * tree. An additional intellectual property rights grant can be found 7776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org * in the file PATENTS. All contributing project authors may 8776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org * be found in the AUTHORS file in the root of the source tree. 9776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org */ 10776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 11776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org#ifndef WEBRTC_VIDEO_DECODER_H_ 12776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org#define WEBRTC_VIDEO_DECODER_H_ 13776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 14776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org#include <vector> 15776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 16776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org#include "webrtc/common_types.h" 17776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org#include "webrtc/typedefs.h" 18776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org#include "webrtc/video_frame.h" 19776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 20776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.orgnamespace webrtc { 21776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 22776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.orgclass RTPFragmentationHeader; 23776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org// TODO(pbos): Expose these through a public (root) header or change these APIs. 24776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.orgstruct CodecSpecificInfo; 25776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.orgstruct VideoCodec; 26776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 27776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.orgclass DecodedImageCallback { 28776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org public: 29776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org virtual ~DecodedImageCallback() {} 30776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 31776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org virtual int32_t Decoded(I420VideoFrame& decodedImage) = 0; 32776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) { 33776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org return -1; 34776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org } 35776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 36776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org virtual int32_t ReceivedDecodedFrame(const uint64_t pictureId) { return -1; } 37776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org}; 38776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 39776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.orgclass VideoDecoder { 40776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org public: 41776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org enum DecoderType { 42776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org kVp8, 43776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org }; 44776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 45776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org static VideoDecoder* Create(DecoderType codec_type); 46776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 47776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org virtual ~VideoDecoder() {} 48776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 49776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org virtual int32_t InitDecode(const VideoCodec* codecSettings, 50776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org int32_t numberOfCores) = 0; 51776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 52776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org virtual int32_t Decode(const EncodedImage& inputImage, 53776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org bool missingFrames, 54776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org const RTPFragmentationHeader* fragmentation, 55776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org const CodecSpecificInfo* codecSpecificInfo = NULL, 56776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org int64_t renderTimeMs = -1) = 0; 57776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 58776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org virtual int32_t RegisterDecodeCompleteCallback( 59776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org DecodedImageCallback* callback) = 0; 60776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 61776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org virtual int32_t Release() = 0; 62776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org virtual int32_t Reset() = 0; 63776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 64776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org virtual int32_t SetCodecConfigParameters(const uint8_t* /*buffer*/, 65776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org int32_t /*size*/) { 66776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org return -1; 67776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org } 68776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 69776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org virtual VideoDecoder* Copy() { return NULL; } 70776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org}; 71776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 72776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org} // namespace webrtc 73776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org 74776e6f289c7396a1143b8b36b03f88b08ac8cba3pbos@webrtc.org#endif // WEBRTC_VIDEO_DECODER_H_ 75