751 lines
25 KiB
C++
751 lines
25 KiB
C++
/*
|
|||
|
|
* Copyright (c) 2026 Amlogic, Inc. All rights reserved.
|
||
|
|
*
|
||
|
|
* This source code is subject to the terms and conditions defined in the
|
||
|
|
* file 'LICENSE' which is part of this source code package.
|
||
|
|
*
|
||
|
|
* Description: Aml MP Player Service Implementation
|
||
|
|
*/
|
||
|
|
#ifdef CONFIG_AMP_SERVER
|
||
|
|
|
||
|
|
#define LOG_TAG "AmlMpAidlConvert"
|
||
|
|
|
||
|
|
#include "AmlMpAidlConvert.h"
|
||
|
|
|
||
|
|
#ifdef MLOGI
|
||
|
|
#undef MLOGI
|
||
|
|
#endif
|
||
|
|
#define MLOGI(fmt, ...) ALOG(LOG_INFO, LOG_TAG, "clien:%d, " fmt, playerId, ##__VA_ARGS__)
|
||
|
|
|
||
|
|
#ifdef MLOGW
|
||
|
|
#undef MLOGW
|
||
|
|
#endif
|
||
|
|
#define MLOGW(fmt, ...) ALOG(LOG_WARN, LOG_TAG, "clien:%d, " fmt, playerId, ##__VA_ARGS__)
|
||
|
|
|
||
|
|
#ifdef MLOGE
|
||
|
|
#undef MLOGE
|
||
|
|
#endif
|
||
|
|
#define MLOGE(fmt, ...) ALOG(LOG_ERROR, LOG_TAG, "clien:%d, " fmt, playerId, ##__VA_ARGS__)
|
||
|
|
|
||
|
|
namespace com::amlogic::aml_mp::player {
|
||
|
|
// From AIDL -> C
|
||
|
|
|
||
|
|
#define copyReservedFromAidl() \
|
||
|
|
do {\
|
||
|
|
if (sizeof(param.reserved) != aidlParam.reserved.size()) { \
|
||
|
|
ALOGE("why here? %s:%d", __FUNCTION__, __LINE__); \
|
||
|
|
} \
|
||
|
|
int32_t cpySize = std::min(sizeof(param.reserved), aidlParam.reserved.size()); \
|
||
|
|
if (cpySize > 0) { \
|
||
|
|
memcpy(param.reserved, aidlParam.reserved.data(), cpySize); \
|
||
|
|
} \
|
||
|
|
} while (0); \
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_PlayerCreateParams& param, const AmlMpPlayerCreateParams& aidlParam) {
|
||
|
|
std::memset(¶m, 0, sizeof(param));
|
||
|
|
param.channelId = static_cast<Aml_MP_ChannelId>(aidlParam.channelId);
|
||
|
|
param.demuxId = static_cast<Aml_MP_DemuxId>(aidlParam.demuxId);
|
||
|
|
param.sourceType = static_cast<Aml_MP_InputSourceType>(aidlParam.sourceType);
|
||
|
|
param.drmMode = static_cast<Aml_MP_InputStreamType>(aidlParam.drmMode);
|
||
|
|
param.options = aidlParam.options;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_BufferItem& param, const AmlMpBufferItem& aidlParam) {
|
||
|
|
param.size = aidlParam.size;
|
||
|
|
param.dataLen = aidlParam.dataLen;
|
||
|
|
param.bufferedMs = aidlParam.bufferedMs;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_BufferStat& bufferStat, const AmlMpBufferStat& aidlBufferStat) {
|
||
|
|
convertFromAidl(bufferStat.audioBuffer, aidlBufferStat.audioBuffer);
|
||
|
|
convertFromAidl(bufferStat.videoBuffer, aidlBufferStat.videoBuffer);
|
||
|
|
convertFromAidl(bufferStat.subtitleBuffer, aidlBufferStat.subtitleBuffer);
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_VideoParams& param, const AmlMpVideoParams& aidlParam) {
|
||
|
|
std::memset(¶m, 0, sizeof(param));
|
||
|
|
param.pid = aidlParam.pid;
|
||
|
|
param.videoCodec = static_cast<Aml_MP_CodecID>(aidlParam.codec);
|
||
|
|
param.width = aidlParam.width;
|
||
|
|
param.height = aidlParam.height;
|
||
|
|
param.frameRate = aidlParam.frameRate;
|
||
|
|
int32_t cpySize = std::min(aidlParam.extraData.size(), sizeof(param.extraData));
|
||
|
|
if (cpySize > 0) {
|
||
|
|
memcpy(param.extraData, aidlParam.extraData.data(), cpySize);
|
||
|
|
param.extraDataSize = cpySize;
|
||
|
|
}
|
||
|
|
param.secureLevel = static_cast<Aml_MP_DemuxMemSecLevel>(aidlParam.secureLevel);
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_AudioParams& param, const AmlMpAudioParams& aidlParam) {
|
||
|
|
std::memset(¶m, 0, sizeof(param));
|
||
|
|
param.pid = aidlParam.pid;
|
||
|
|
param.audioCodec = static_cast<Aml_MP_CodecID>(aidlParam.audioCodec);
|
||
|
|
param.nChannels = aidlParam.nChannels;
|
||
|
|
param.nSampleRate = aidlParam.nSampleRate;
|
||
|
|
param.secureLevel = static_cast<Aml_MP_DemuxMemSecLevel>(aidlParam.secureLevel);
|
||
|
|
|
||
|
|
int32_t cpySize = std::min(aidlParam.extraData.size(), sizeof(param.extraData));
|
||
|
|
if (cpySize > 0) {
|
||
|
|
memcpy(param.extraData, aidlParam.extraData.data(), cpySize);
|
||
|
|
param.extraDataSize = cpySize;
|
||
|
|
}
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_SubtitleParams& param, const AmlMpSubtitleParams& aidlParam) {
|
||
|
|
std::memset(¶m, 0, sizeof(param));
|
||
|
|
param.pid = aidlParam.pid;
|
||
|
|
param.subtitleCodec = static_cast<Aml_MP_CodecID>(aidlParam.subtitleCodec);
|
||
|
|
param.videoFormat = static_cast<Aml_MP_CodecID>(aidlParam.videoFormat);
|
||
|
|
param.channelId = aidlParam.channelId;
|
||
|
|
param.ancillaryPageId = aidlParam.ancillaryPageId;
|
||
|
|
param.compositionPageId = aidlParam.compositionPageId;
|
||
|
|
param.flag = aidlParam.flag;
|
||
|
|
param.demuxId = aidlParam.demuxId;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_ADVolume& param, const AmlMpADVolume &aidlParam) {
|
||
|
|
param.masterVolume = aidlParam.masterVolume;
|
||
|
|
param.slaveVolume = aidlParam.slaveVolume;
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_Rect& param, const AmlMpRect &aidlParam) {
|
||
|
|
param.left = aidlParam.left;
|
||
|
|
param.top = aidlParam.top;
|
||
|
|
param.right = aidlParam.right;
|
||
|
|
param.bottom = aidlParam.bottom;
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(AML_MP_TeletextCtrlParam& param, const AmlMpTeletextCtrl &aidlParam) {
|
||
|
|
param.magazine = aidlParam.magazine;
|
||
|
|
param.page = aidlParam.page;
|
||
|
|
param.event = (Aml_MP_TeletextEvent)aidlParam.event;
|
||
|
|
int32_t cpySize = std::min(aidlParam.iso639Lang.size(), sizeof(param.iso639_lang));
|
||
|
|
if (cpySize > 0) {
|
||
|
|
memcpy(param.iso639_lang, aidlParam.iso639Lang.data(), cpySize);
|
||
|
|
}
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_AudioLanguage& param, const AmlMpAudioLanguage &aidlParam) {
|
||
|
|
param.firstLanguage = aidlParam.firstLanguage;
|
||
|
|
param.secondLanguage = aidlParam.secondLanguage;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_AvInfo& param, const AmlMpAvInfo &aidlParam) {
|
||
|
|
param.dataLength = aidlParam.dataLength;
|
||
|
|
param.streamTypeMask = aidlParam.streamTypeMask;
|
||
|
|
if (aidlParam.actualLength > 0 && param.data != nullptr) {
|
||
|
|
memcpy(param.data, aidlParam.data.data(), aidlParam.actualLength);
|
||
|
|
}
|
||
|
|
param.actualLength = aidlParam.actualLength;
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_AdecStat& param, const AmlMpAdecStat &aidlParam) {
|
||
|
|
param.frame_count = aidlParam.frameCount;
|
||
|
|
param.error_frame_count = aidlParam.errorFrameCount;
|
||
|
|
param.drop_frame_count = aidlParam.dropFrameCount;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_VideoInfo& param, const AmlMpVideoInfo &aidlParam) {
|
||
|
|
param.width = aidlParam.width;
|
||
|
|
param.height = aidlParam.height;
|
||
|
|
param.frameRate = aidlParam.frameRate;
|
||
|
|
param.bitrate = aidlParam.bitrate;
|
||
|
|
param.ratio64 = (Aml_MP_VideoRatio)aidlParam.ratio64;
|
||
|
|
param.dar.numerator = aidlParam.dar.numerator;
|
||
|
|
param.dar.denominator = aidlParam.dar.denominator;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_VdecStat& param, const AmlMpVdecStat &aidlParam) {
|
||
|
|
param.qos.num = aidlParam.qos.num;
|
||
|
|
param.qos.type = aidlParam.qos.type;
|
||
|
|
param.qos.size = aidlParam.qos.size;
|
||
|
|
param.qos.pts = aidlParam.qos.pts;
|
||
|
|
param.qos.max_qp = aidlParam.qos.maxQp;
|
||
|
|
param.qos.avg_qp = aidlParam.qos.avgQp;
|
||
|
|
param.qos.min_qp = aidlParam.qos.minQp;
|
||
|
|
param.qos.max_skip = aidlParam.qos.maxSkip;
|
||
|
|
param.qos.avg_skip = aidlParam.qos.avgSkip;
|
||
|
|
param.qos.min_skip = aidlParam.qos.minSkip;
|
||
|
|
param.qos.max_mv = aidlParam.qos.maxMv;
|
||
|
|
param.qos.min_mv = aidlParam.qos.minMv;
|
||
|
|
param.qos.avg_mv = aidlParam.qos.avgMv;
|
||
|
|
param.qos.decode_buffer = aidlParam.qos.decodeBuffer;
|
||
|
|
|
||
|
|
param.decode_time_cost = aidlParam.decodeTimeCost;
|
||
|
|
param.frame_width = aidlParam.frameWidth;
|
||
|
|
param.frame_height = aidlParam.frameHeight;
|
||
|
|
param.frame_rate = aidlParam.frameRate;
|
||
|
|
param.bit_depth_luma = aidlParam.bitDepthLuma;
|
||
|
|
param.frame_dur = aidlParam.frameDur;
|
||
|
|
param.bit_depth_chroma = aidlParam.bitDepthChroma;
|
||
|
|
param.error_count = aidlParam.errorCount;
|
||
|
|
param.status = aidlParam.status;
|
||
|
|
param.frame_count = aidlParam.frameCount;
|
||
|
|
param.error_frame_count = aidlParam.errorFrameCount;
|
||
|
|
param.drop_frame_count = aidlParam.dropFrameCount;
|
||
|
|
param.total_data = aidlParam.totalData;
|
||
|
|
param.double_write_mode = aidlParam.doubleWriteMode;
|
||
|
|
param.offset = aidlParam.offset;
|
||
|
|
param.ratio_control = aidlParam.ratioControl;
|
||
|
|
param.vf_type = aidlParam.vfType;
|
||
|
|
param.signal_type = aidlParam.signalType;
|
||
|
|
param.pts = aidlParam.pts;
|
||
|
|
param.pts_us64 = aidlParam.ptsUs64;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_AudioInfo& param, const AmlMpAudioInfo &aidlParam) {
|
||
|
|
param.sample_rate = aidlParam.sampleRate;
|
||
|
|
param.channels = aidlParam.channels;
|
||
|
|
param.channel_mask = aidlParam.channelMask;
|
||
|
|
param.bitrate = aidlParam.bitrate;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_SubtitleInfo& param, const AmlMpSubtitleInfo &aidlParam) {
|
||
|
|
param.what = aidlParam.what;
|
||
|
|
param.extra = aidlParam.extra;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_SubDecStat& param, const AmlMpSubDecStat &aidlParam) {
|
||
|
|
param.frameCount = aidlParam.frameCount;
|
||
|
|
param.errorFrameCount = aidlParam.errorFrameCount;
|
||
|
|
param.dropFrameCount = aidlParam.dropFrameCount;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_PlayerEventScrambling& param, const AmlMpPlayerEventScrambling &aidlParam) {
|
||
|
|
param.type = (Aml_MP_StreamType)aidlParam.type;
|
||
|
|
param.scramling = aidlParam.scramling;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_PlayerEventPidChangeInfo& param, const AmlMpPlayerEventPidChanged &aidlParam) {
|
||
|
|
param.programPid = aidlParam.programPid;
|
||
|
|
param.programNumber = aidlParam.programNumber;
|
||
|
|
param.type = (Aml_MP_StreamType)aidlParam.type;
|
||
|
|
param.oldStreamPid = aidlParam.oldStreamPid;
|
||
|
|
param.newStreamPid = aidlParam.newStreamPid;
|
||
|
|
|
||
|
|
if (param.type == AML_MP_STREAM_TYPE_VIDEO) {
|
||
|
|
convertFromAidl(param.u.videoParams, aidlParam.videoParams);
|
||
|
|
} else if (param.type == AML_MP_STREAM_TYPE_AUDIO) {
|
||
|
|
convertFromAidl(param.u.audioParams, aidlParam.audioParams);
|
||
|
|
} else if (param.type == AML_MP_STREAM_TYPE_SUBTITLE) {
|
||
|
|
convertFromAidl(param.u.subtitleParams, aidlParam.subtitleParams);
|
||
|
|
}
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_PlayerEventVideoFormat& param, const AmlMpPlayerEventVideoFormat &aidlParam) {
|
||
|
|
param.frame_width = aidlParam.frameWidth;
|
||
|
|
param.frame_height = aidlParam.frameHeight;
|
||
|
|
param.frame_rate = aidlParam.frameRate;
|
||
|
|
param.frame_aspectratio = aidlParam.frameAspectratio;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_PlayerEventAudioFormat& param, const AmlMpPlayerEventAudioFormat &aidlParam) {
|
||
|
|
param.sample_rate = aidlParam.sampleRate;
|
||
|
|
param.channels = aidlParam.channels;
|
||
|
|
param.channel_mask = aidlParam.channelMask;
|
||
|
|
param.audio_codec = (Aml_MP_CodecID)aidlParam.audioCodec;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_SubtitleDimension& param, const AmlMpSubtitleDimension &aidlParam) {
|
||
|
|
param.width = aidlParam.width;
|
||
|
|
param.height = aidlParam.height;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_SubtitleChannelUpdate& param, const AmlMpSubtitleChannelUpdate &aidlParam) {
|
||
|
|
param.event = aidlParam.event;
|
||
|
|
param.id = aidlParam.id;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(std::string& param, const AmlMpSubtitleLanguage &aidlParam) {
|
||
|
|
param = aidlParam.lang;
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_PlayerEventMpegUserData& param, const AmlMpPlayerEventMpegUserData &aidlParam) {
|
||
|
|
param.data = (uint8_t *)aidlParam.data.data(); // not copy data.
|
||
|
|
param.len = aidlParam.data.size();
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertFromAidl(Aml_MP_SubtitleData& param, const AmlMpSubtitleData &aidlParam) {
|
||
|
|
param.data = (const char *)aidlParam.data.data(); // not copy data.
|
||
|
|
param.size = aidlParam.data.size();
|
||
|
|
param.type = (AML_MP_SubtitleDataType)aidlParam.type;
|
||
|
|
param.x = aidlParam.x;
|
||
|
|
param.y = aidlParam.y;
|
||
|
|
param.width = aidlParam.width;
|
||
|
|
param.height = aidlParam.height;
|
||
|
|
param.videoWidth = aidlParam.videoWidth;
|
||
|
|
param.videoHeight = aidlParam.videoHeight;
|
||
|
|
param.showing = aidlParam.showing;
|
||
|
|
|
||
|
|
copyReservedFromAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
// C -> AIDL
|
||
|
|
|
||
|
|
#define copyReservToAidl() \
|
||
|
|
do { \
|
||
|
|
int32_t cpySize = sizeof(param->reserved); \
|
||
|
|
if (cpySize > 0) { \
|
||
|
|
aidlParam.reserved.resize(cpySize); \
|
||
|
|
memcpy(aidlParam.reserved.data(), param->reserved, cpySize); \
|
||
|
|
} \
|
||
|
|
} while (0); \
|
||
|
|
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpSubtitleData& aidlParam, const void *inParam) {
|
||
|
|
if (inParam == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
const Aml_MP_SubtitleData *param = (const Aml_MP_SubtitleData*)inParam;
|
||
|
|
if (param->size > 0) {
|
||
|
|
aidlParam.data.resize(param->size);
|
||
|
|
memcpy(aidlParam.data.data(), param->data, param->size);
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.type = param->type;
|
||
|
|
aidlParam.x = param->x;
|
||
|
|
aidlParam.y = param->y;
|
||
|
|
aidlParam.width = param->width;
|
||
|
|
aidlParam.height = param->height;
|
||
|
|
aidlParam.videoWidth = param->videoWidth;
|
||
|
|
aidlParam.videoHeight = param->videoHeight;
|
||
|
|
aidlParam.showing = param->showing;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl( AmlMpBufferItem& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_BufferItem *param = (const Aml_MP_BufferItem*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.size = param->size;
|
||
|
|
aidlParam.dataLen = param->dataLen;
|
||
|
|
aidlParam.bufferedMs = param->bufferedMs;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpBufferStat& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_BufferStat *param = (const Aml_MP_BufferStat*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
convertToAidl(aidlParam.audioBuffer, ¶m->audioBuffer);
|
||
|
|
convertToAidl(aidlParam.videoBuffer, ¶m->videoBuffer);
|
||
|
|
convertToAidl(aidlParam.subtitleBuffer, ¶m->subtitleBuffer);
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl( AmlMpAvInfo& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_AvInfo *param = (const Aml_MP_AvInfo*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.dataLength = param->dataLength;
|
||
|
|
aidlParam.streamTypeMask = param->streamTypeMask;
|
||
|
|
aidlParam.actualLength = param->actualLength;
|
||
|
|
if (param->dataLength > 0 && param->actualLength > 0) {
|
||
|
|
aidlParam.data.resize(param->dataLength);
|
||
|
|
memcpy(aidlParam.data.data(), param->data, param->dataLength);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpPlayerCreateParams& aidlParam, const void* inParam) {
|
||
|
|
const Aml_MP_PlayerCreateParams *param = (const Aml_MP_PlayerCreateParams*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.channelId = static_cast<Aml_MP_ChannelId>(param->channelId);
|
||
|
|
aidlParam.demuxId = static_cast<Aml_MP_DemuxId>(param->demuxId);
|
||
|
|
aidlParam.sourceType = static_cast<Aml_MP_InputSourceType>(param->sourceType);
|
||
|
|
aidlParam.drmMode = static_cast<Aml_MP_InputStreamType>(param->drmMode);
|
||
|
|
aidlParam.options = param->options;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpVideoParams& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_VideoParams *param = (const Aml_MP_VideoParams*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.pid = param->pid;
|
||
|
|
aidlParam.codec = static_cast<Aml_MP_CodecID>(param->videoCodec);
|
||
|
|
aidlParam.width = param->width;
|
||
|
|
aidlParam.height = param->height;
|
||
|
|
aidlParam.frameRate = param->frameRate;
|
||
|
|
aidlParam.secureLevel = static_cast<Aml_MP_DemuxMemSecLevel>(param->secureLevel);
|
||
|
|
int32_t cpySize = std::min(param->extraDataSize, sizeof(param->extraData));
|
||
|
|
if (cpySize > 0) {
|
||
|
|
aidlParam.extraData.resize(cpySize);
|
||
|
|
memcpy(aidlParam.extraData.data(), param->extraData, cpySize);
|
||
|
|
}
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpAudioParams& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_AudioParams *param = (const Aml_MP_AudioParams*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.pid = param->pid;
|
||
|
|
aidlParam.audioCodec = static_cast<Aml_MP_CodecID>(param->audioCodec);
|
||
|
|
aidlParam.nChannels = param->nChannels;
|
||
|
|
aidlParam.nSampleRate = param->nSampleRate;
|
||
|
|
int32_t cpySize = std::min(sizeof(param->extraData), param->extraDataSize);
|
||
|
|
if (cpySize > 0) {
|
||
|
|
aidlParam.extraData.resize(cpySize);
|
||
|
|
memcpy(aidlParam.extraData.data(), param->extraData, cpySize);
|
||
|
|
}
|
||
|
|
aidlParam.secureLevel = static_cast<Aml_MP_DemuxMemSecLevel>(param->secureLevel);
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpSubtitleParams& aidlParam, const void* inParam) {
|
||
|
|
const Aml_MP_SubtitleParams *param = (const Aml_MP_SubtitleParams*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.pid = param->pid;
|
||
|
|
aidlParam.subtitleCodec = static_cast<Aml_MP_CodecID>(param->subtitleCodec);
|
||
|
|
aidlParam.videoFormat = static_cast<Aml_MP_CodecID>(param->videoFormat);
|
||
|
|
aidlParam.channelId = param->channelId;
|
||
|
|
aidlParam.ancillaryPageId = param->ancillaryPageId;
|
||
|
|
aidlParam.compositionPageId = param->compositionPageId;
|
||
|
|
aidlParam.flag = param->flag;
|
||
|
|
aidlParam.demuxId = param->demuxId;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpADVolume& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_ADVolume *param = (const Aml_MP_ADVolume*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.masterVolume = param->masterVolume;
|
||
|
|
aidlParam.slaveVolume = param->slaveVolume;
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpTeletextCtrl& aidlParam, const void *inParam) {
|
||
|
|
const AML_MP_TeletextCtrlParam *param = (const AML_MP_TeletextCtrlParam*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.magazine = param->magazine;
|
||
|
|
aidlParam.page = param->page;
|
||
|
|
aidlParam.event = param->event;
|
||
|
|
|
||
|
|
int32_t cpySize = sizeof(param->iso639_lang);
|
||
|
|
if (cpySize > 0) {
|
||
|
|
aidlParam.iso639Lang.resize(cpySize);
|
||
|
|
memcpy(aidlParam.iso639Lang.data(), param->iso639_lang, cpySize);
|
||
|
|
}
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpRect& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_Rect *param = (const Aml_MP_Rect*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.left = param->left;
|
||
|
|
aidlParam.top = param->top;
|
||
|
|
aidlParam.right = param->right;
|
||
|
|
aidlParam.bottom = param->bottom;
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpAudioLanguage& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_AudioLanguage *param = (const Aml_MP_AudioLanguage*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.firstLanguage = param->firstLanguage;
|
||
|
|
aidlParam.secondLanguage = param->secondLanguage;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpAdecStat& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_AdecStat *param = (const Aml_MP_AdecStat*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.frameCount = param->frame_count;
|
||
|
|
aidlParam.errorFrameCount = param->error_frame_count;
|
||
|
|
aidlParam.dropFrameCount = param->drop_frame_count;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpVideoInfo& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_VideoInfo *param = (const Aml_MP_VideoInfo*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.width = param->width;
|
||
|
|
aidlParam.height = param->height;
|
||
|
|
aidlParam.frameRate = param->frameRate;
|
||
|
|
aidlParam.bitrate = param->bitrate;
|
||
|
|
aidlParam.ratio64 = param->ratio64;
|
||
|
|
aidlParam.dar.numerator = param->dar.numerator;
|
||
|
|
aidlParam.dar.denominator = param->dar.denominator;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpVdecStat& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_VdecStat *param = (const Aml_MP_VdecStat*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.qos.type = param->qos.type;
|
||
|
|
aidlParam.qos.size = param->qos.size;
|
||
|
|
aidlParam.qos.pts = param->qos.pts;
|
||
|
|
aidlParam.qos.maxQp = param->qos.max_qp;
|
||
|
|
aidlParam.qos.avgQp = param->qos.avg_qp;
|
||
|
|
aidlParam.qos.minQp = param->qos.min_qp;
|
||
|
|
aidlParam.qos.maxSkip = param->qos.max_skip;
|
||
|
|
aidlParam.qos.avgSkip = param->qos.avg_skip;
|
||
|
|
aidlParam.qos.minSkip = param->qos.min_skip;
|
||
|
|
aidlParam.qos.maxMv = param->qos.max_mv;
|
||
|
|
aidlParam.qos.minMv = param->qos.min_mv;
|
||
|
|
aidlParam.qos.avgMv = param->qos.avg_mv;
|
||
|
|
aidlParam.qos.decodeBuffer = param->qos.decode_buffer;
|
||
|
|
|
||
|
|
aidlParam.decodeTimeCost = param->decode_time_cost;
|
||
|
|
aidlParam.frameWidth = param->frame_width;
|
||
|
|
aidlParam.frameHeight = param->frame_height;
|
||
|
|
aidlParam.frameRate = param->frame_rate;
|
||
|
|
aidlParam.bitDepthLuma = param->bit_depth_luma;
|
||
|
|
aidlParam.frameDur = param->frame_dur;
|
||
|
|
aidlParam.bitDepthChroma = param->bit_depth_chroma;
|
||
|
|
aidlParam.errorCount = param->error_count;
|
||
|
|
aidlParam.status = param->status;
|
||
|
|
aidlParam.frameCount = param->frame_count;
|
||
|
|
aidlParam.errorFrameCount = param->error_frame_count;
|
||
|
|
aidlParam.dropFrameCount = param->drop_frame_count;
|
||
|
|
aidlParam.totalData = param->total_data;
|
||
|
|
aidlParam.doubleWriteMode = param->double_write_mode;
|
||
|
|
aidlParam.offset = param->offset;
|
||
|
|
aidlParam.ratioControl = param->ratio_control;
|
||
|
|
aidlParam.vfType = param->vf_type;
|
||
|
|
aidlParam.signalType = param->signal_type;
|
||
|
|
aidlParam.pts = param->pts;
|
||
|
|
aidlParam.ptsUs64 = param->pts_us64;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpAudioInfo& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_AudioInfo *param = (const Aml_MP_AudioInfo*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.sampleRate = param->sample_rate;
|
||
|
|
aidlParam.channels = param->channels;
|
||
|
|
aidlParam.channelMask = param->channel_mask;
|
||
|
|
aidlParam.bitrate = param->bitrate;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpSubtitleInfo& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_SubtitleInfo *param = (const Aml_MP_SubtitleInfo*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.what = param->what;
|
||
|
|
aidlParam.extra = param->extra;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpSubDecStat& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_SubDecStat *param = (const Aml_MP_SubDecStat*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.frameCount = param->frameCount;
|
||
|
|
aidlParam.errorFrameCount = param->errorFrameCount;
|
||
|
|
aidlParam.dropFrameCount = param->dropFrameCount;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpPlayerEventScrambling& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_PlayerEventScrambling *param = (const Aml_MP_PlayerEventScrambling*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.type = param->type;
|
||
|
|
aidlParam.scramling = param->scramling;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpPlayerEventPidChanged& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_PlayerEventPidChangeInfo *param = (const Aml_MP_PlayerEventPidChangeInfo*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.programPid = param->programPid;
|
||
|
|
aidlParam.programPid = param->programNumber;
|
||
|
|
aidlParam.programPid = param->type;
|
||
|
|
aidlParam.programPid = param->oldStreamPid;
|
||
|
|
aidlParam.programPid = param->newStreamPid;
|
||
|
|
|
||
|
|
if (param->type == AML_MP_STREAM_TYPE_VIDEO) {
|
||
|
|
convertToAidl(aidlParam.videoParams, &(param->u.videoParams));
|
||
|
|
} else if (param->type == AML_MP_STREAM_TYPE_AUDIO) {
|
||
|
|
convertToAidl(aidlParam.audioParams, &(param->u.audioParams));
|
||
|
|
} else if (param->type == AML_MP_STREAM_TYPE_SUBTITLE) {
|
||
|
|
convertToAidl(aidlParam.subtitleParams, &(param->u.subtitleParams));
|
||
|
|
}
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpPlayerEventVideoFormat& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_PlayerEventVideoFormat *param = (const Aml_MP_PlayerEventVideoFormat*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.frameWidth = param->frame_width;
|
||
|
|
aidlParam.frameHeight = param->frame_height;
|
||
|
|
aidlParam.frameRate = param->frame_rate;
|
||
|
|
aidlParam.frameAspectratio = param->frame_aspectratio;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpPlayerEventAudioFormat& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_PlayerEventAudioFormat *param = (const Aml_MP_PlayerEventAudioFormat*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.sampleRate = param->sample_rate;
|
||
|
|
aidlParam.channels = param->channels;
|
||
|
|
aidlParam.channelMask = param->channel_mask;
|
||
|
|
aidlParam.audioCodec = param->audio_codec;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpSubtitleDimension& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_SubtitleDimension *param = (const Aml_MP_SubtitleDimension*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.width = param->width;
|
||
|
|
aidlParam.height = param->height;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpSubtitleChannelUpdate& aidlParam, const void *inParam) {
|
||
|
|
const Aml_MP_SubtitleChannelUpdate *param = (const Aml_MP_SubtitleChannelUpdate*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.event = param->event;
|
||
|
|
aidlParam.id = param->id;
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpSubtitleLanguage& aidlParam, const void *inParam) {
|
||
|
|
const char *param = (const char*)inParam;
|
||
|
|
if (param == nullptr) {
|
||
|
|
aidlParam.lang.clear();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
aidlParam.lang = std::string(param);
|
||
|
|
}
|
||
|
|
|
||
|
|
void convertToAidl(AmlMpPlayerEventMpegUserData& aidlParam, const void *inParam) {
|
||
|
|
if (inParam == nullptr) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
const Aml_MP_PlayerEventMpegUserData *param = (const Aml_MP_PlayerEventMpegUserData*)inParam;
|
||
|
|
|
||
|
|
if (param->len > 0) {
|
||
|
|
aidlParam.data.resize(param->len);
|
||
|
|
memcpy(aidlParam.data.data(), param->data, param->len);
|
||
|
|
}
|
||
|
|
|
||
|
|
copyReservToAidl();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif
|