14b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber/* 24b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * Copyright (C) 2011 The Android Open Source Project 34b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * 44b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * Licensed under the Apache License, Version 2.0 (the "License"); 54b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * you may not use this file except in compliance with the License. 64b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * You may obtain a copy of the License at 74b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * 84b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * http://www.apache.org/licenses/LICENSE-2.0 94b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * 104b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * Unless required by applicable law or agreed to in writing, software 114b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * distributed under the License is distributed on an "AS IS" BASIS, 124b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 134b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * See the License for the specific language governing permissions and 144b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber * limitations under the License. 154b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber */ 164b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 174b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber#ifndef SOFT_G711_H_ 184b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 194b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber#define SOFT_G711_H_ 204b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 214b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber#include "SimpleSoftOMXComponent.h" 224b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 234b3913a3e43d3180b21d77cc2f717b446350354fAndreas Hubernamespace android { 244b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 254b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huberstruct SoftG711 : public SimpleSoftOMXComponent { 264b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber SoftG711(const char *name, 274b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber const OMX_CALLBACKTYPE *callbacks, 284b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber OMX_PTR appData, 294b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber OMX_COMPONENTTYPE **component); 304b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 314b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huberprotected: 324b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber virtual ~SoftG711(); 334b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 344b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber virtual OMX_ERRORTYPE internalGetParameter( 354b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber OMX_INDEXTYPE index, OMX_PTR params); 364b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 374b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber virtual OMX_ERRORTYPE internalSetParameter( 384b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber OMX_INDEXTYPE index, const OMX_PTR params); 394b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 404b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber virtual void onQueueFilled(OMX_U32 portIndex); 414b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 424b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huberprivate: 434b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber enum { 444b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber kNumBuffers = 4, 454b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber kMaxNumSamplesPerFrame = 16384, 464b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber }; 474b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 484b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber bool mIsMLaw; 494b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber OMX_U32 mNumChannels; 504b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber bool mSignalledError; 514b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 524b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber void initPorts(); 534b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 544b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber static void DecodeALaw(int16_t *out, const uint8_t *in, size_t inSize); 554b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber static void DecodeMLaw(int16_t *out, const uint8_t *in, size_t inSize); 564b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 574b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber DISALLOW_EVIL_CONSTRUCTORS(SoftG711); 584b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber}; 594b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 604b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber} // namespace android 614b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 624b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber#endif // SOFT_G711_H_ 634b3913a3e43d3180b21d77cc2f717b446350354fAndreas Huber 64