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#include "VideoDecoderWMV.h" 1882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include "VideoDecoderMPEG4.h" 1982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include "VideoDecoderAVC.h" 2082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 2182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#ifdef USE_INTEL_SECURE_AVC 2282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include "VideoDecoderAVCSecure.h" 2382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#endif 2482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 2582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#ifdef USE_HW_VP8 2682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include "VideoDecoderVP8.h" 2782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#endif 2882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include "VideoDecoderHost.h" 2982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include "VideoDecoderTrace.h" 3082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#include <string.h> 3182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 3282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTONIVideoDecoder* createVideoDecoder(const char* mimeType) { 3382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON if (mimeType == NULL) { 3482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON ETRACE("NULL mime type."); 3582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON return NULL; 3682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON } 3782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 3882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON if (strcasecmp(mimeType, "video/wmv") == 0 || 3982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON strcasecmp(mimeType, "video/vc1") == 0 || 4082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON strcasecmp(mimeType, "video/x-ms-wmv") == 0) { 4182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON VideoDecoderWMV *p = new VideoDecoderWMV(mimeType); 4282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON return (IVideoDecoder *)p; 4382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON } else if (strcasecmp(mimeType, "video/avc") == 0 || 4482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON strcasecmp(mimeType, "video/h264") == 0) { 4582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON VideoDecoderAVC *p = new VideoDecoderAVC(mimeType); 4682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON return (IVideoDecoder *)p; 4782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON } else if (strcasecmp(mimeType, "video/mp4v-es") == 0 || 4882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON strcasecmp(mimeType, "video/mpeg4") == 0 || 4982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON strcasecmp(mimeType, "video/h263") == 0 || 5082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON strcasecmp(mimeType, "video/3gpp") == 0) { 5182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON VideoDecoderMPEG4 *p = new VideoDecoderMPEG4(mimeType); 5282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON return (IVideoDecoder *)p; 5382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON } 5482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#ifdef USE_INTEL_SECURE_AVC 5582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON else if (strcasecmp(mimeType, "video/avc-secure") == 0) { 5682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON VideoDecoderAVC *p = new VideoDecoderAVCSecure(mimeType); 5782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON return (IVideoDecoder *)p; 5882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON } 5982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#endif 6082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 6182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#ifdef USE_HW_VP8 6282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON else if (strcasecmp(mimeType, "video/vp8") == 0 || 6382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON strcasecmp(mimeType, "video/x-vnd.on2.vp8") == 0) { 6482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON VideoDecoderVP8 *p = new VideoDecoderVP8(mimeType); 6582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON return (IVideoDecoder *)p; 6682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON } 6782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON#endif 6882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 6982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON else { 7082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON ETRACE("Unknown mime type: %s", mimeType); 7182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON } 7282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON return NULL; 7382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON} 7482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 7582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTONvoid releaseVideoDecoder(IVideoDecoder* p) { 7682b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON if (p) { 7782b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON const VideoFormatInfo *info = p->getFormatInfo(); 7882b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON if (info && info->mimeType) { 7982b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON ITRACE("Deleting decoder for %s", info->mimeType); 8082b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON } 8182b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON } 8282b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON delete p; 8382b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON} 8482b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 8582b428e49a70ddc051a36d2b3a25d90db79770dcGuilhem IMBERTON 86