Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a624cc88 authored by Jeremy Wu's avatar Jeremy Wu Committed by Automerger Merge Worker
Browse files

Merge changes I6e6d6b01,I273747d5,I8f6489d6 into main am: c159d204

parents 269c90fc c159d204
Loading
Loading
Loading
Loading
+52 −0
Original line number Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef MMC_MMC_INTERFACE_MMC_INTERFACE_H_
#define MMC_MMC_INTERFACE_MMC_INTERFACE_H_

#include <stdint.h>

#include "mmc/proto/mmc_config.pb.h"

namespace mmc {

// An abstract interface representing either an encoder or a decoder.
class MmcInterface {
 public:
  virtual ~MmcInterface() = default;

  // Builds and configures the encoder/decoder instance.
  //
  // Returns:
  //   Input frame size accepted by the transcoder, if init succeeded.
  //   Negative errno on error, otherwise.
  virtual int init(ConfigParam config) = 0;

  // Resets the encoder/decoder instance.
  virtual void cleanup() = 0;

  // Transcodes data in |i_buf|, and stores the result in |o_buf|.
  //
  // Returns:
  //   Transcoded data length, if transcode succeeded.
  //   Negative errno on error, otherwise.
  virtual int transcode(uint8_t* i_buf, int i_len, uint8_t* o_buf,
                        int o_len) = 0;
};

}  // namespace mmc

#endif  // MMC_MMC_INTERFACE_MMC_INTERFACE_H_
+10 −0
Original line number Diff line number Diff line
@@ -24,3 +24,13 @@ proto_library("mmc_config_proto") {
  ]
  standalone=true
}

proto_library("mmc_service_proto") {
  proto_in_dir = "./"
  proto_out_dir = "include/mmc/proto"
  sources = [
    "${proto_in_dir}/mmc_service.proto",
  ]
  deps = [ ":mmc_config_proto" ]
  standalone=true
}
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ option optimize_for = LITE_RUNTIME;
// union of Lc3 config and codec parameters
message Lc3Param {
  // encoder/decoder config
  int32 dt_hz = 1;
  int32 dt_us = 1;
  int32 sr_hz = 2;
  int32 sr_pcm_hz = 3;

+35 −0
Original line number Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

syntax = "proto3";

package mmc;

import "mmc_config.proto";

option optimize_for = LITE_RUNTIME;

message CodecInitRequest {
  // Codec-specific parameters passed by client.
  ConfigParam config = 1;
}

message CodecInitResponse {
  // Socket name generated by the daemon.
  string socket_token = 1;
  // Input frame size accepted by the codec server.
  int32 input_frame_size = 2;
}