182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON/* 282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* Copyright (c) 2009-2011 Intel Corporation. All rights reserved. 382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* 482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* Licensed under the Apache License, Version 2.0 (the "License"); 582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* you may not use this file except in compliance with the License. 682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* You may obtain a copy of the License at 782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* 882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* http://www.apache.org/licenses/LICENSE-2.0 982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* 1082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* Unless required by applicable law or agreed to in writing, software 1182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* distributed under the License is distributed on an "AS IS" BASIS, 1282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* See the License for the specific language governing permissions and 1482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON* limitations under the License. 1582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON*/ 1682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 1782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#ifndef VIDEO_DECODER_AVC_SECURE_H_ 1882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#define VIDEO_DECODER_AVC_SECURE_H_ 1982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 2082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include "VideoDecoderAVC.h" 2182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 2282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 2382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTONclass VideoDecoderAVCSecure : public VideoDecoderAVC { 2482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTONpublic: 2582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON VideoDecoderAVCSecure(const char *mimeType); 2682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON virtual ~VideoDecoderAVCSecure(); 2782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 2882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON virtual Decode_Status start(VideoConfigBuffer *buffer); 2982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON virtual void stop(void); 3082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 3182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON // data in the decoded buffer is all encrypted. 3282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON virtual Decode_Status decode(VideoDecodeBuffer *buffer); 3382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 3482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTONprivate: 3582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON enum { 3682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON MAX_SLICE_HEADER_SIZE = 30, 3782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON MAX_NALU_HEADER_BUFFER = 8192, 3882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON MAX_NALU_NUMBER = 400, // > 4096/12 3982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON }; 4082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 4182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON // Information of Network Abstraction Layer Unit 4282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON struct NaluInfo { 4382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON int32_t naluOffset; // offset of NAL unit in the firewalled buffer 4482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON int32_t naluLen; // length of NAL unit 4582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON int32_t naluHeaderLen; // length of NAL unit header 4682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON }; 4782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 4882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON struct NaluMetadata { 4982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON NaluInfo *naluInfo; 5082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON int32_t naluNumber; // number of NAL units 5182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON }; 5282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 5382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON struct NaluByteStream { 5482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON int32_t naluOffset; 5582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON int32_t naluLen; 5682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON int32_t streamPos; 5782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON uint8_t *byteStream; // 4 bytes of naluCount, 4 bytes of naluOffset, 4 bytes of naulLen, 4 bytes of naluHeaderLen, followed by naluHeaderData 5882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON int32_t naluCount; 5982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON }; 6082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 6182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON virtual Decode_Status decodeSlice(vbp_data_h264 *data, uint32_t picIndex, uint32_t sliceIndex); 6282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON int32_t findNalUnitOffset(uint8_t *stream, int32_t offset, int32_t length); 6382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON Decode_Status copyNaluHeader(uint8_t *stream, NaluByteStream *naluStream); 6482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON Decode_Status parseAnnexBStream(uint8_t *stream, int32_t length, NaluByteStream *naluStream); 6582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 6682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTONprivate: 6782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON NaluMetadata mMetadata; 6882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON NaluByteStream mByteStream; 6982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON uint8_t *mNaluHeaderBuffer; 7082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON uint8_t *mInputBuffer; 7182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON}; 7282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 7382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 7482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 7582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#endif /* VIDEO_DECODER_AVC_SECURE_H_ */ 76