Files
drivers_peripheral/codec
YOUR_NAME a8c7228216 fix: framework code rectification
Signed-off-by: YOUR_NAME <guodongqi2@huawei.com>
2022-01-26 09:09:51 +08:00
..
2022-01-23 09:45:25 +08:00
2022-01-07 17:32:12 +08:00
2022-01-21 21:31:00 +08:00
2021-05-20 11:31:15 +08:00
2021-05-20 11:31:15 +08:00

Codec

Introduction

This repository mainly defines and implements the Hardware Driver Interfaces (HDIs) of the codec module, allowing upper-layer services to perform the following operations:

  • Creating and destroying a codec
  • Starting and stopping the codec
  • Encoding original code streams into compressed code streams
  • Decoding compressed code streams into original code streams
  • Flushing the cache

Directory Structure

The source code directory structure is as follows:

/drivers/peripheral/codec
├── interfaces         # Driver capability APIs provided for upper-layer services
│   └── include       # APIs exposed externally

Available APIs

The codec module provides APIs that can be directly called by the framework layer to create or destroy a codec, start or stop a codec, perform encoding or decoding operations, flush the cache, and set a callback.

Table 1 describes major HDI APIs provided by the codec module.

Table 1 Major HDI APIs of the codec module

Header File

API

Description

codec_interface.h

int32_t CodecInit();

Initializes the internal audio and video submodules of the codec.

int32_t CodecDeinit();

Deinitializes the internal audio and video submodules of the codec.

int32_t CodecEnumerateCapbility(uint32_t index, CodecCapbility *cap);

Obtains the capabilities of a specified media type based on an index.

int32_t CodecGetCapbility(AvCodecMime mime, CodecType type, uint32_t flags, CodecCapbility *cap);

Obtains the capabilities of a specified media type.

int32_t CodecCreate(const char* name, const Param *attr, int len, CODEC_HANDLETYPE *handle);

Creates a specific codec component and returns the component context through a handle.

int32_t CodecDestroy(CODEC_HANDLETYPE handle);

Destroys a codec component.

int32_t CodecSetPortMode(CODEC_HANDLETYPE handle, DirectionType type, BufferMode mode);

Sets the input or output buffer mode.

int32_t CodecSetParameter(CODEC_HANDLETYPE handle, const Param *params, int paramCnt);

Sets parameters required by a codec component.

int32_t CodecGetParameter(CODEC_HANDLETYPE handle, Param *params, int paramCnt);

Obtains parameters from a codec component.

int32_t CodecStart(CODEC_HANDLETYPE handle);

Starts a codec component.

int32_t CodecStop(CODEC_HANDLETYPE handle);

Stops a codec component.

int32_t CodecFlush(CODEC_HANDLETYPE handle, DirectionType directType);

Clears the cache when the codec component is the running state.

int32_t CodecQueueInput(CODEC_HANDLETYPE handle, const InputInfo *inputData, uint32_t timeoutMs);

Queues input data.

int32_t CodecDequeInput(CODEC_HANDLETYPE handle, uint32_t timeoutMs, InputInfo *inputData);

Dequeues input data that has been used.

int32_t CodecQueueOutput(CODEC_HANDLETYPE handle, OutputInfo *outInfo, uint32_t timeoutMs, int releaseFenceFd);

Queues output data.

int32_t CodecDequeueOutput(CODEC_HANDLETYPE handle, uint32_t timeoutMs, int *acquireFd, OutputInfo *outInfo);

Dequeues output data.

int32_t CodecSetCallback(CODEC_HANDLETYPE handle, const CodecCallback *cb, UINTPTR instance);

Sets the callback function.

Usage Guidelines

The core functionalities of this repository are as follows:

  • Provides codec HDIs that can be directly called by the framework layer to perform encoding and decoding-related operations.
  • Provides standard interfaces for device developers to ensure that the OEM vendors comply with the HDI adapter standard. This promises a healthy evolution of the ecosystem.

For details about the invocation and implementation, see the API reference.

Repositories Involved

Driver subsystem

drivers_framework

drivers_adapter

drivers_adapter_khdf_linux

drivers_peripheral