• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  /*
2   * Copyright (C) 2012 The Android Open Source Project
3   *
4   * Licensed under the Apache License, Version 2.0 (the "License");
5   * you may not use this file except in compliance with the License.
6   * You may obtain a copy of the License at
7   *
8   *      http://www.apache.org/licenses/LICENSE-2.0
9   *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  #ifndef SOFT_GSM_H_
18  
19  #define SOFT_GSM_H_
20  
21  #include "SimpleSoftOMXComponent.h"
22  
23  extern "C" {
24  #include "gsm.h"
25  }
26  
27  namespace android {
28  
29  struct SoftGSM : public SimpleSoftOMXComponent {
30      SoftGSM(const char *name,
31              const OMX_CALLBACKTYPE *callbacks,
32              OMX_PTR appData,
33              OMX_COMPONENTTYPE **component);
34  
35  protected:
36      virtual ~SoftGSM();
37  
38      virtual OMX_ERRORTYPE internalGetParameter(
39              OMX_INDEXTYPE index, OMX_PTR params);
40  
41      virtual OMX_ERRORTYPE internalSetParameter(
42              OMX_INDEXTYPE index, const OMX_PTR params);
43  
44      virtual void onQueueFilled(OMX_U32 portIndex);
45  
46      virtual void onPortFlushCompleted(OMX_U32 portIndex);
47      virtual void onReset();
48  
49  private:
50      enum {
51          kNumBuffers = 4,
52          kMaxNumSamplesPerFrame = 16384,
53      };
54  
55      bool mSignalledError;
56      gsm mGsm;
57  
58      void initPorts();
59  
60      static int DecodeGSM(gsm handle, int16_t *out, uint8_t *in, size_t inSize);
61  
62      DISALLOW_EVIL_CONSTRUCTORS(SoftGSM);
63  };
64  
65  }  // namespace android
66  
67  #endif  // SOFT_GSM_H_
68  
69