blob: 2b209fe626ea8c2cdb8c68fa06aa0dc3777e0bfa [file] [log] [blame]
Pawin Vongmasa36653902018-11-15 00:10:25 -08001/*
2 * Copyright (C) 2018 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 ANDROID_C2_SOFT_GSM_DEC_H_
18#define ANDROID_C2_SOFT_GSM_DEC_H_
19
20#include <SimpleC2Component.h>
21
22
23extern "C" {
24 #include "gsm.h"
25}
26
27namespace android {
28
29#define FRGSM_IN_FRM_SZ 33
30#define FRGSM_IN_FRM_SZ_MINUS_1 32
31#define FRGSM_OUT_FRM_SZ 160
32#define MSGSM_IN_FRM_SZ (FRGSM_IN_FRM_SZ + FRGSM_IN_FRM_SZ_MINUS_1)
33#define MSGSM_OUT_FRM_SZ (FRGSM_OUT_FRM_SZ * 2)
34
35struct C2SoftGsmDec : public SimpleC2Component {
36 class IntfImpl;
37
38 C2SoftGsmDec(const char *name, c2_node_id_t id,
39 const std::shared_ptr<IntfImpl> &intfImpl);
40 virtual ~C2SoftGsmDec();
41
42 // From SimpleC2Component
43 c2_status_t onInit() override;
44 c2_status_t onStop() override;
45 void onReset() override;
46 void onRelease() override;
47 c2_status_t onFlush_sm() override;
48 void process(
49 const std::unique_ptr<C2Work> &work,
50 const std::shared_ptr<C2BlockPool> &pool) override;
51 c2_status_t drain(
52 uint32_t drainMode,
53 const std::shared_ptr<C2BlockPool> &pool) override;
54 private:
55 std::shared_ptr<IntfImpl> mIntf;
56 gsm mGsm;
57 bool mSignalledError;
58 bool mSignalledEos;
59
60 C2_DO_NOT_COPY(C2SoftGsmDec);
61};
62
63} // namespace android
64
65#endif // ANDROID_C2_SOFT_GSM_DEC_H_