feat: add media libs & samples

Signed-off-by: e.hong <e.hong@unionman.com.cn>
Change-Id: I12a4e49b27c552956da140401ceb14750bdf4342
This commit is contained in:
e.hong
2022-09-20 10:24:43 +08:00
parent 04d3019ef5
commit 10abdf7700
57 changed files with 7534 additions and 16 deletions
+12 -3
View File
@@ -24,8 +24,14 @@
<policy name="projectPolicy" desc="">
<policyitem type="copyright" name="Unionman Technology Co., Ltd." path=".*" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="Developed By Unionman"/>
<policyitem type="copyright" name="Unionman Co., Ltd." path=".*" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="Developed By ISCAS"/>
<policyitem type="copyright" name="Amlogic" path=".*" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="Developed By Amlogic"/>
<policyitem type="copyright" name="Google" path=".*" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="Developed By Google"/>
<policyitem type="copyright" name="Nokia" path=".*" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="Developed By Nokia"/>
<policyitem type="copyright" name="contributors" path=".*" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="Developed By contributors"/>
<policyitem type="license" name="GPL" path=".*" desc="linux kernel adapter codes"/>
<policyitem type="license" name="BSD" path=".*" desc="soc codes"/>
<policyitem type="license" name="EndUserLicenseAgreement" path=".*" desc="二进制文件遵循的licence"/>
</policy>
</policy>
</policylist>
<filefilterlist>
<filefilter name="defaultFilter" desc="Files not to check">
@@ -39,8 +45,11 @@
<filteritem type="filepath" name="a311d/hardware/gpu/lib64/.*" desc="gpu 64bit libs file"/>
<filteritem type="filepath" name="a311d/hardware/gpu/modules/.*" desc="gpu modules file"/>
<filteritem type="filepath" name="a311d/hardware/media/firmware/.*" desc="media firmware"/>
<filteritem type="filepath" name="a311d/hardware/media/lib/libvpcodec.z.so" desc="media venc lib"/>
<filteritem type="filepath" name="a311d/hardware/media/lib64/libvpcodec.z.so" desc="media 64bit venc lib"/>
<filteritem type="filepath" name="a311d/hardware/media/libvpcodec/lib/libvpcodec.z.so" desc="media venc lib"/>
<filteritem type="filepath" name="a311d/hardware/media/libvpcodec/lib64/libvpcodec.z.so" desc="media 64bit venc lib"/>
<filteritem type="filepath" name="a311d/hardware/media/libamcodec/lib/.*" desc="media codec lib"/>
<filteritem type="filepath" name="a311d/hardware/media/libamvdec/lib/.*" desc="media codec lib"/>
<filteritem type="filepath" name="a311d/hardware/media/libamplayer/lib/.*" desc="media player lib"/>
<filteritem type="filepath" name="a311d/hardware/isp/bin/.*" desc="isp bin file"/>
<filteritem type="filepath" name="a311d/hardware/isp/bin64/.*" desc="isp 64bit bin file"/>
<filteritem type="filepath" name="a311d/hardware/isp/lib/.*" desc="isp lib file"/>
+4 -13
View File
@@ -14,22 +14,13 @@
import("//build/ohos.gni")
import("//build/ohos/ndk/ndk.gni")
ohos_prebuilt_shared_library("libvpcodec") {
if (target_cpu == "arm") {
source = "lib/libvpcodec.z.so"
} else if (target_cpu == "arm64") {
source = "lib64/libvpcodec.z.so"
}
install_enable = true
install_images = [ "system" ]
part_name = "unionman_products"
}
group("media") {
deps = [
":libvpcodec",
"firmware:media_firmware",
"libamcodec:libamcodec",
"libamplayer:kplayer",
"libamvdec:ionplayer",
"libvpcodec:libvpcodec",
"modules:media_modules",
]
}
+40
View File
@@ -0,0 +1,40 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# 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.
import("//build/ohos.gni")
ohos_prebuilt_shared_library("libamcodec") {
source = "lib/libamcodec.so"
install_images = [ "vendor" ]
subsystem_name = "unionman_products"
part_name = "unionman_products"
deps = [
":libammad",
":libfaad-aml",
]
}
ohos_prebuilt_shared_library("libammad") {
source = "lib/libammad.so"
install_images = [ "vendor" ]
subsystem_name = "unionman_products"
part_name = "unionman_products"
}
ohos_prebuilt_shared_library("libfaad-aml") {
source = "lib/libfaad-aml.so"
install_images = [ "vendor" ]
subsystem_name = "unionman_products"
part_name = "unionman_products"
}
+134
View File
@@ -0,0 +1,134 @@
/*
* Copyright (C) 2010 Amlogic Corporation.
*
* 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.
*/
/**
* @file aformat.h
* @brief Porting from decoder driver for audio format
* @author Tim Yao <timyao@amlogic.com>
* @version 1.0.0
* @date 2011-02-24
*/
/* Copyright (C) 2007-2011, Amlogic Inc.
* All right reserved
*
*/
/*
* AMLOGIC Audio/Video streaming port driver.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the named License,
* or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
* Author: Tim Yao <timyao@amlogic.com>
*
*/
#ifndef AFORMAT_H
#define AFORMAT_H
typedef enum {
AFORMAT_UNKNOWN = -1,
AFORMAT_MPEG = 0,
AFORMAT_PCM_S16LE = 1,
AFORMAT_AAC = 2,
AFORMAT_AC3 = 3,
AFORMAT_ALAW = 4,
AFORMAT_MULAW = 5,
AFORMAT_DTS = 6,
AFORMAT_PCM_S16BE = 7,
AFORMAT_FLAC = 8,
AFORMAT_COOK = 9,
AFORMAT_PCM_U8 = 10,
AFORMAT_ADPCM = 11,
AFORMAT_AMR = 12,
AFORMAT_RAAC = 13,
AFORMAT_WMA = 14,
AFORMAT_WMAPRO = 15,
AFORMAT_PCM_BLURAY = 16,
AFORMAT_ALAC = 17,
AFORMAT_VORBIS = 18,
AFORMAT_AAC_LATM = 19,
AFORMAT_APE = 20,
AFORMAT_EAC3 = 21,
AFORMAT_PCM_WIFIDISPLAY = 22,
AFORMAT_DRA = 23,
AFORMAT_SIPR = 24,
AFORMAT_TRUEHD = 25,
AFORMAT_MPEG1 = 26, //AFORMAT_MPEG-->mp3,AFORMAT_MPEG1-->mp1,AFROMAT_MPEG2-->mp2
AFORMAT_MPEG2 = 27,
AFORMAT_WMAVOI = 28,
AFORMAT_WMALOSSLESS =29,
AFORMAT_OPUS = 30,
AFORMAT_UNSUPPORT ,
AFORMAT_MAX
} aformat_t;
#define AUDIO_EXTRA_DATA_SIZE (8192)
#define IS_AFMT_VALID(afmt) ((afmt > AFORMAT_UNKNOWN) && (afmt < AFORMAT_MAX))
#define IS_AUIDO_NEED_EXT_INFO(afmt) ((afmt == AFORMAT_ADPCM) \
||(afmt == AFORMAT_VORBIS) \
||(afmt == AFORMAT_OPUS) \
||(afmt == AFORMAT_WMA) \
||(afmt == AFORMAT_WMAPRO) \
||(afmt == AFORMAT_PCM_S16BE) \
||(afmt == AFORMAT_PCM_S16LE) \
||(afmt == AFORMAT_PCM_U8) \
||(afmt == AFORMAT_PCM_BLURAY) \
||(afmt == AFORMAT_AMR)\
||(afmt == AFORMAT_ALAC)\
||(afmt == AFORMAT_AC3) \
||(afmt == AFORMAT_EAC3) \
||(afmt == AFORMAT_APE) \
||(afmt == AFORMAT_FLAC)\
||(afmt == AFORMAT_PCM_WIFIDISPLAY) \
||(afmt == AFORMAT_COOK) \
||(afmt == AFORMAT_RAAC)) \
||(afmt == AFORMAT_TRUEHD) \
||(afmt == AFORMAT_WMAVOI) \
||(afmt == AFORMAT_WMALOSSLESS)
#define IS_AUDIO_NOT_SUPPORT_EXCEED_2CH(afmt) ((afmt == AFORMAT_RAAC) \
||(afmt == AFORMAT_COOK) \
/*||(afmt == AFORMAT_FLAC)*/)
#define IS_AUDIO_NOT_SUPPORT_EXCEED_6CH(afmt) ((afmt == AFORMAT_WMAPRO))
#define IS_AUDIO_NOT_SUPPORT_EXCEED_FS48k(afmt) ((afmt == AFORMAT_WMAPRO))
#define IS_AUIDO_NEED_PREFEED_HEADER(afmt) ((afmt == AFORMAT_VORBIS) )
#define IS_AUDIO_NOT_SUPPORTED_BY_AUDIODSP(afmt,codec) \
((afmt == AFORMAT_AAC_LATM || afmt == AFORMAT_AAC) \
&&codec->profile == 0/* FF_PROFILE_AAC_MAIN*/)
#define IS_SUB_NEED_PREFEED_HEADER(sfmt) ((sfmt == CODEC_ID_DVD_SUBTITLE) )
#endif /* AFORMAT_H */
+465
View File
@@ -0,0 +1,465 @@
/*
* Copyright (C) 2010 Amlogic Corporation.
*
* 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.
*/
/**
* @file amstream.h
* @brief Porting from decoder driver for codec ioctl commands
* @author Tim Yao <timyao@amlogic.com>
* @version 1.0.0
* @date 2011-02-24
*/
/* Copyright (C) 2007-2011, Amlogic Inc.
* All right reserved
*
*/
/*
* AMLOGIC Audio/Video streaming port driver.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the named License,
* or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
* Author: Tim Yao <timyao@amlogic.com>
*
*/
#ifndef AMSTREAM_H
#define AMSTREAM_H
#include "amports/vformat.h"
#include "amports/aformat.h"
#define PORT_FLAG_IN_USE 0x0001
#define PORT_FLAG_VFORMAT 0x0002
#define PORT_FLAG_AFORMAT 0x0004
#define PORT_FLAG_FORMAT (PORT_FLAG_VFORMAT | PORT_FLAG_AFORMAT)
#define PORT_FLAG_VID 0x0008
#define PORT_FLAG_AID 0x0010
#define PORT_FLAG_ID (PORT_FLAG_VID | PORT_FLAG_AID)
#define PORT_FLAG_INITED 0x100
#define PORT_TYPE_VIDEO 0x01
#define PORT_TYPE_AUDIO 0x02
#define PORT_TYPE_MPTS 0x04
#define PORT_TYPE_MPPS 0x08
#define PORT_TYPE_ES 0x10
#define PORT_TYPE_RM 0x20
#define AMSTREAM_IOC_MAGIC 'S'
#define AMSTREAM_IOC_VB_START _IOW((AMSTREAM_IOC_MAGIC), 0x00, int)
#define AMSTREAM_IOC_VB_SIZE _IOW((AMSTREAM_IOC_MAGIC), 0x01, int)
#define AMSTREAM_IOC_AB_START _IOW((AMSTREAM_IOC_MAGIC), 0x02, int)
#define AMSTREAM_IOC_AB_SIZE _IOW((AMSTREAM_IOC_MAGIC), 0x03, int)
#define AMSTREAM_IOC_VFORMAT _IOW((AMSTREAM_IOC_MAGIC), 0x04, int)
#define AMSTREAM_IOC_AFORMAT _IOW((AMSTREAM_IOC_MAGIC), 0x05, int)
#define AMSTREAM_IOC_VID _IOW((AMSTREAM_IOC_MAGIC), 0x06, int)
#define AMSTREAM_IOC_AID _IOW((AMSTREAM_IOC_MAGIC), 0x07, int)
#define AMSTREAM_IOC_VB_STATUS _IOR((AMSTREAM_IOC_MAGIC), 0x08, int)
#define AMSTREAM_IOC_AB_STATUS _IOR((AMSTREAM_IOC_MAGIC), 0x09, int)
#define AMSTREAM_IOC_SYSINFO _IOW((AMSTREAM_IOC_MAGIC), 0x0a, int)
#define AMSTREAM_IOC_ACHANNEL _IOW((AMSTREAM_IOC_MAGIC), 0x0b, int)
#define AMSTREAM_IOC_SAMPLERATE _IOW((AMSTREAM_IOC_MAGIC), 0x0c, int)
#define AMSTREAM_IOC_DATAWIDTH _IOW((AMSTREAM_IOC_MAGIC), 0x0d, int)
#define AMSTREAM_IOC_TSTAMP _IOW((AMSTREAM_IOC_MAGIC), 0x0e, int)
#define AMSTREAM_IOC_VDECSTAT _IOR((AMSTREAM_IOC_MAGIC), 0x0f, int)
#define AMSTREAM_IOC_ADECSTAT _IOR((AMSTREAM_IOC_MAGIC), 0x10, int)
#define AMSTREAM_IOC_PORT_INIT _IO((AMSTREAM_IOC_MAGIC), 0x11)
#define AMSTREAM_IOC_TRICKMODE _IOW((AMSTREAM_IOC_MAGIC), 0x12, int)
#define AMSTREAM_IOC_AUDIO_INFO _IOW((AMSTREAM_IOC_MAGIC), 0x13, int)
#define AMSTREAM_IOC_TRICK_STAT _IOR((AMSTREAM_IOC_MAGIC), 0x14, int)
#define AMSTREAM_IOC_AUDIO_RESET _IO((AMSTREAM_IOC_MAGIC), 0x15)
#define AMSTREAM_IOC_SID _IOW((AMSTREAM_IOC_MAGIC), 0x16, int)
#define AMSTREAM_IOC_VPAUSE _IOW((AMSTREAM_IOC_MAGIC), 0x17, int)
#define AMSTREAM_IOC_AVTHRESH _IOW((AMSTREAM_IOC_MAGIC), 0x18, int)
#define AMSTREAM_IOC_SYNCTHRESH _IOW((AMSTREAM_IOC_MAGIC), 0x19, int)
#define AMSTREAM_IOC_SUB_RESET _IOW((AMSTREAM_IOC_MAGIC), 0x1a, int)
#define AMSTREAM_IOC_SUB_LENGTH _IOR((AMSTREAM_IOC_MAGIC), 0x1b, int)
#define AMSTREAM_IOC_SET_DEC_RESET _IOW((AMSTREAM_IOC_MAGIC), 0x1c, int)
#define AMSTREAM_IOC_TS_SKIPBYTE _IOW((AMSTREAM_IOC_MAGIC), 0x1d, int)
#define AMSTREAM_IOC_SUB_TYPE _IOW((AMSTREAM_IOC_MAGIC), 0x1e, int)
#define AMSTREAM_IOC_CLEAR_VIDEO _IOW((AMSTREAM_IOC_MAGIC), 0x1f, int)
#define AMSTREAM_IOC_APTS _IOR((AMSTREAM_IOC_MAGIC), 0x40, int)
#define AMSTREAM_IOC_VPTS _IOR((AMSTREAM_IOC_MAGIC), 0x41, int)
#define AMSTREAM_IOC_PCRSCR _IOR((AMSTREAM_IOC_MAGIC), 0x42, int)
#define AMSTREAM_IOC_SYNCENABLE _IOW((AMSTREAM_IOC_MAGIC), 0x43, int)
#define AMSTREAM_IOC_GET_SYNC_ADISCON _IOR((AMSTREAM_IOC_MAGIC), 0x44, int)
#define AMSTREAM_IOC_SET_SYNC_ADISCON _IOW((AMSTREAM_IOC_MAGIC), 0x45, int)
#define AMSTREAM_IOC_GET_SYNC_VDISCON _IOR((AMSTREAM_IOC_MAGIC), 0x46, int)
#define AMSTREAM_IOC_SET_SYNC_VDISCON _IOW((AMSTREAM_IOC_MAGIC), 0x47, int)
#define AMSTREAM_IOC_GET_VIDEO_DISABLE _IOR((AMSTREAM_IOC_MAGIC), 0x48, int)
#define AMSTREAM_IOC_SET_VIDEO_DISABLE _IOW((AMSTREAM_IOC_MAGIC), 0x49, int)
#define AMSTREAM_IOC_SET_PCRSCR _IOW((AMSTREAM_IOC_MAGIC), 0x4a, int)
#define AMSTREAM_IOC_GET_VIDEO_AXIS _IOR((AMSTREAM_IOC_MAGIC), 0x4b, int)
#define AMSTREAM_IOC_SET_VIDEO_AXIS _IOW((AMSTREAM_IOC_MAGIC), 0x4c, int)
#define AMSTREAM_IOC_GET_VIDEO_CROP _IOR((AMSTREAM_IOC_MAGIC), 0x4d, int)
#define AMSTREAM_IOC_SET_VIDEO_CROP _IOW((AMSTREAM_IOC_MAGIC), 0x4e, int)
#define AMSTREAM_IOC_PCRID _IOW((AMSTREAM_IOC_MAGIC), 0x4f, int)
/* VPP.3D IOCTL command list^M */
#define AMSTREAM_IOC_SET_3D_TYPE _IOW((AMSTREAM_IOC_MAGIC), 0x3c, unsigned int)
#define AMSTREAM_IOC_GET_3D_TYPE _IOW((AMSTREAM_IOC_MAGIC), 0x3d, unsigned int)
#define AMSTREAM_IOC_SUB_NUM _IOR((AMSTREAM_IOC_MAGIC), 0x50, int)
#define AMSTREAM_IOC_SUB_INFO _IOR((AMSTREAM_IOC_MAGIC), 0x51, int)
#define AMSTREAM_IOC_GET_BLACKOUT_POLICY _IOR((AMSTREAM_IOC_MAGIC), 0x52, int)
#define AMSTREAM_IOC_SET_BLACKOUT_POLICY _IOW((AMSTREAM_IOC_MAGIC), 0x53, int)
#define AMSTREAM_IOC_UD_LENGTH _IOR((AMSTREAM_IOC_MAGIC), 0x54, int)
#define AMSTREAM_IOC_UD_POC _IOR((AMSTREAM_IOC_MAGIC), 0x55, int)
#define AMSTREAM_IOC_GET_SCREEN_MODE _IOR((AMSTREAM_IOC_MAGIC), 0x58, int)
#define AMSTREAM_IOC_SET_SCREEN_MODE _IOW((AMSTREAM_IOC_MAGIC), 0x59, int)
#define AMSTREAM_IOC_GET_VIDEO_DISCONTINUE_REPORT _IOR((AMSTREAM_IOC_MAGIC), 0x5a, int)
#define AMSTREAM_IOC_SET_VIDEO_DISCONTINUE_REPORT _IOW((AMSTREAM_IOC_MAGIC), 0x5b, int)
#define AMSTREAM_IOC_VF_STATUS _IOR((AMSTREAM_IOC_MAGIC), 0x60, int)
#define AMSTREAM_IOC_CLEAR_VBUF _IO((AMSTREAM_IOC_MAGIC), 0x80)
#define AMSTREAM_IOC_APTS_LOOKUP _IOR((AMSTREAM_IOC_MAGIC), 0x81, int)
#define GET_FIRST_APTS_FLAG _IOR((AMSTREAM_IOC_MAGIC), 0x82, int)
#define AMSTREAM_IOC_GET_SYNC_ADISCON_DIFF _IOR((AMSTREAM_IOC_MAGIC), 0x83, int)
#define AMSTREAM_IOC_GET_SYNC_VDISCON_DIFF _IOR((AMSTREAM_IOC_MAGIC), 0x84, int)
#define AMSTREAM_IOC_SET_SYNC_ADISCON_DIFF _IOW((AMSTREAM_IOC_MAGIC), 0x85, int)
#define AMSTREAM_IOC_SET_SYNC_VDISCON_DIFF _IOW((AMSTREAM_IOC_MAGIC), 0x86, int)
#define AMSTREAM_IOC_GET_FREERUN_MODE _IOR((AMSTREAM_IOC_MAGIC), 0x87, int)
#define AMSTREAM_IOC_SET_FREERUN_MODE _IOW((AMSTREAM_IOC_MAGIC), 0x88, int)
#define AMSTREAM_IOC_SET_VSYNC_UPINT _IOW((AMSTREAM_IOC_MAGIC), 0x89, int)
#define AMSTREAM_IOC_GET_VSYNC_SLOW_FACTOR _IOW((AMSTREAM_IOC_MAGIC), 0x8a, int)
#define AMSTREAM_IOC_SET_VSYNC_SLOW_FACTOR _IOW((AMSTREAM_IOC_MAGIC), 0x8b, int)
#define AMSTREAM_IOC_SET_DEMUX _IOW((AMSTREAM_IOC_MAGIC), 0x90, int)
#define AMSTREAM_IOC_SET_DRMMODE _IOW((AMSTREAM_IOC_MAGIC), 0x91, int)
#define AMSTREAM_IOC_TSTAMP_uS64 _IOW((AMSTREAM_IOC_MAGIC), 0x95, int)
#define AMSTREAM_IOC_SET_VIDEO_DELAY_LIMIT_MS _IOW((AMSTREAM_IOC_MAGIC), 0xa0, int)
#define AMSTREAM_IOC_GET_VIDEO_DELAY_LIMIT_MS _IOR((AMSTREAM_IOC_MAGIC), 0xa1, int)
#define AMSTREAM_IOC_SET_AUDIO_DELAY_LIMIT_MS _IOW((AMSTREAM_IOC_MAGIC), 0xa2, int)
#define AMSTREAM_IOC_GET_AUDIO_DELAY_LIMIT_MS _IOR((AMSTREAM_IOC_MAGIC), 0xa3, int)
#define AMSTREAM_IOC_GET_AUDIO_CUR_DELAY_MS _IOR((AMSTREAM_IOC_MAGIC), 0xa4, int)
#define AMSTREAM_IOC_GET_VIDEO_CUR_DELAY_MS _IOR((AMSTREAM_IOC_MAGIC), 0xa5, int)
#define AMSTREAM_IOC_GET_AUDIO_AVG_BITRATE_BPS _IOR((AMSTREAM_IOC_MAGIC), 0xa6, int)
#define AMSTREAM_IOC_GET_VIDEO_AVG_BITRATE_BPS _IOR((AMSTREAM_IOC_MAGIC), 0xa7, int)
#define AMSTREAM_IOC_SET_APTS _IOW((AMSTREAM_IOC_MAGIC), 0xa8, int)
#define AMSTREAM_IOC_GET_LAST_CHECKIN_APTS _IOR((AMSTREAM_IOC_MAGIC), 0xa9, int)
#define AMSTREAM_IOC_GET_LAST_CHECKIN_VPTS _IOR((AMSTREAM_IOC_MAGIC), 0xaa, int)
#define AMSTREAM_IOC_GET_LAST_CHECKOUT_APTS _IOR((AMSTREAM_IOC_MAGIC), 0xab, int)
#define AMSTREAM_IOC_GET_LAST_CHECKOUT_VPTS _IOR((AMSTREAM_IOC_MAGIC), 0xac, int)
/* subtitle.c get/set subtitle info */
#define AMSTREAM_IOC_GET_SUBTITLE_INFO _IOR((AMSTREAM_IOC_MAGIC), 0xad, int)
#define AMSTREAM_IOC_SET_SUBTITLE_INFO _IOW((AMSTREAM_IOC_MAGIC), 0xae, int)
#define AMSTREAM_IOC_SET_OMX_VPTS _IOW((AMSTREAM_IOC_MAGIC), 0xaf, int)
#define AMSTREAM_IOC_GET_OMX_VPTS _IOW((AMSTREAM_IOC_MAGIC), 0xb0, int)
#define AMSTREAM_IOC_GET_TRICK_VPTS _IOR((AMSTREAM_IOC_MAGIC), 0xf0, int)
#define AMSTREAM_IOC_DISABLE_SLOW_SYNC _IOW((AMSTREAM_IOC_MAGIC), 0xf1, int)
#define AMSTREAM_IOC_GET_AUDIO_CHECKIN_BITRATE_BPS _IOR(AMSTREAM_IOC_MAGIC, 0xf2, int)
#define AMSTREAM_IOC_GET_VIDEO_CHECKIN_BITRATE_BPS _IOR(AMSTREAM_IOC_MAGIC, 0xf3, int)
#define AMSTREAM_IOC_GET_VERSION _IOR((AMSTREAM_IOC_MAGIC), 0xc0, int)
#define AMSTREAM_IOC_GET _IOWR((AMSTREAM_IOC_MAGIC), 0xc1, struct am_ioctl_parm)
#define AMSTREAM_IOC_SET _IOW((AMSTREAM_IOC_MAGIC), 0xc2, struct am_ioctl_parm)
#define AMSTREAM_IOC_GET_EX _IOWR((AMSTREAM_IOC_MAGIC), 0xc3, struct am_ioctl_parm_ex)
#define AMSTREAM_IOC_SET_EX _IOW((AMSTREAM_IOC_MAGIC), 0xc4, struct am_ioctl_parm_ex)
#define AMSTREAM_IOC_GET_PTR _IOWR((AMSTREAM_IOC_MAGIC), 0xc5, struct am_ioctl_parm_ptr)
#define AMSTREAM_IOC_SET_PTR _IOW((AMSTREAM_IOC_MAGIC), 0xc6, struct am_ioctl_parm_ptr)
#define AMAUDIO_IOC_MAGIC 'A'
#define AMAUDIO_IOC_SET_RESAMPLE_ENA _IOW(AMAUDIO_IOC_MAGIC, 0x19, unsigned long)
#define AMAUDIO_IOC_GET_RESAMPLE_ENA _IOR(AMAUDIO_IOC_MAGIC, 0x1a, unsigned long)
#define AMAUDIO_IOC_SET_RESAMPLE_TYPE _IOW(AMAUDIO_IOC_MAGIC, 0x1b, unsigned long)
#define AMAUDIO_IOC_GET_RESAMPLE_TYPE _IOR(AMAUDIO_IOC_MAGIC, 0x1c, unsigned long)
#define AMAUDIO_IOC_SET_RESAMPLE_DELTA _IOW(AMAUDIO_IOC_MAGIC, 0x1d, unsigned long)
enum FRAME_BASE_VIDEO_PATH {
FRAME_BASE_PATH_IONVIDEO = 0,
FRAME_BASE_PATH_AMLVIDEO_AMVIDEO,
FRAME_BASE_PATH_AMLVIDEO1_AMVIDEO2,
FRAME_BASE_PATH_DI_AMVIDEO,
FRAME_BASE_PATH_AMVIDEO,
FRAME_BASE_PATH_AMVIDEO2,
FRAME_BASE_PATH_V4L_VIDEO,
FRAME_BASE_PATH_TUNNEL_MODE,
FRAME_BASE_PATH_V4L_OSD,
FRAME_BASE_PATH_DI_V4LVIDEO,
FRAME_BASE_PATH_PIP_TUNNEL_MODE,
FRAME_BASE_PATH_MAX
};
struct buf_status {
int size;
int data_len;
int free_len;
unsigned int read_pointer;
unsigned int write_pointer;
};
/*struct vdec_status.status*/
#define STAT_TIMER_INIT 0x01
#define STAT_MC_LOAD 0x02
#define STAT_ISR_REG 0x04
#define STAT_VF_HOOK 0x08
#define STAT_TIMER_ARM 0x10
#define STAT_VDEC_RUN 0x20
//-/*struct vdec_status.status on error*/
#define PARSER_FATAL_ERROR (0x10<<16)
#define DECODER_ERROR_VLC_DECODE_TBL (0x20<<16)
#define PARSER_ERROR_WRONG_HEAD_VER (0x40<<16)
#define PARSER_ERROR_WRONG_PACKAGE_SIZE (0x80<<16)
#define DECODER_FATAL_ERROR_SIZE_OVERFLOW (0x100<<16)
#define DECODER_FATAL_ERROR_UNKNOW (0x200<<16)
#define DECODER_FATAL_ERROR_NO_MEM (0x400<<16)
#define DECODER_ERROR_MASK (0xffff<<16)
enum E_ASPECT_RATIO {
ASPECT_RATIO_4_3,
ASPECT_RATIO_16_9,
ASPECT_UNDEFINED = 255
};
struct vdec_status {
unsigned int width;
unsigned int height;
unsigned int fps;
unsigned int error_count;
unsigned int status;
enum E_ASPECT_RATIO euAspectRatio;
};
struct adec_status {
unsigned int channels;
unsigned int sample_rate;
unsigned int resolution;
unsigned int error_count;
unsigned int status;
};
struct am_io_param {
union {
int data;
int id;//get bufstatus? //or others
};
int len; //buffer size;
union {
char buf[1];
struct buf_status status;
struct vdec_status vstatus;
struct adec_status astatus;
};
};
struct subtitle_info {
unsigned char id;
unsigned char width;
unsigned char height;
unsigned char type;
};
struct userdata_poc_info_t {
unsigned int poc_info;
unsigned int poc_number;
};
/*******************************************************************
* 0x100~~0x1FF : set cmd
* 0x200~~0x2FF : set ex cmd
* 0x300~~0x3FF : set ptr cmd
* 0x400~~0x7FF : set reserved cmd
* 0x800~~0x8FF : get cmd
* 0x900~~0x9FF : get ex cmd
* 0xA00~~0xAFF : get ptr cmd
* 0xBFF~~0xFFF : get reserved cmd
* 0xX00~~0xX5F : amstream cmd(X: cmd type)
* 0xX60~~0xXAF : video cmd(X: cmd type)
* 0xXAF~~0xXFF : reserved cmd(X: cmd type)
*******************************************************************/
/* amstream set cmd */
#define AMSTREAM_SET_VB_START 0x101
#define AMSTREAM_SET_VB_SIZE 0x102
#define AMSTREAM_SET_AB_START 0x103
#define AMSTREAM_SET_AB_SIZE 0x104
#define AMSTREAM_SET_VFORMAT 0x105
#define AMSTREAM_SET_AFORMAT 0x106
#define AMSTREAM_SET_VID 0x107
#define AMSTREAM_SET_AID 0x108
#define AMSTREAM_SET_SID 0x109
#define AMSTREAM_SET_PCRID 0x10A
#define AMSTREAM_SET_ACHANNEL 0x10B
#define AMSTREAM_SET_SAMPLERATE 0x10C
#define AMSTREAM_SET_DATAWIDTH 0x10D
#define AMSTREAM_SET_TSTAMP 0x10E
#define AMSTREAM_SET_TSTAMP_US64 0x10F
#define AMSTREAM_SET_APTS 0x110
#define AMSTREAM_PORT_INIT 0x111
#define AMSTREAM_SET_TRICKMODE 0x112 /* amstream,video */
#define AMSTREAM_AUDIO_RESET 0x013
#define AMSTREAM_SUB_RESET 0x114
#define AMSTREAM_DEC_RESET 0x115
#define AMSTREAM_SET_TS_SKIPBYTE 0x116
#define AMSTREAM_SET_SUB_TYPE 0x117
#define AMSTREAM_SET_PCRSCR 0x118
#define AMSTREAM_SET_DEMUX 0x119
#define AMSTREAM_SET_VIDEO_DELAY_LIMIT_MS 0x11A
#define AMSTREAM_SET_AUDIO_DELAY_LIMIT_MS 0x11B
#define AMSTREAM_SET_DRMMODE 0x11C
/* video set cmd */
#define AMSTREAM_SET_OMX_VPTS 0x160
#define AMSTREAM_SET_VPAUSE 0x161
#define AMSTREAM_SET_AVTHRESH 0x162
#define AMSTREAM_SET_SYNCTHRESH 0x163
#define AMSTREAM_SET_SYNCENABLE 0x164
#define AMSTREAM_SET_SYNC_ADISCON 0x165
#define AMSTREAM_SET_SYNC_VDISCON 0x166
#define AMSTREAM_SET_SYNC_ADISCON_DIFF 0x167
#define AMSTREAM_SET_SYNC_VDISCON_DIFF 0x168
#define AMSTREAM_SET_VIDEO_DISABLE 0x169
#define AMSTREAM_SET_VIDEO_DISCONTINUE_REPORT 0x16A
#define AMSTREAM_SET_SCREEN_MODE 0x16B
#define AMSTREAM_SET_BLACKOUT_POLICY 0x16C
#define AMSTREAM_CLEAR_VBUF 0x16D
#define AMSTREAM_SET_CLEAR_VIDEO 0x16E
#define AMSTREAM_SET_FREERUN_MODE 0x16F
#define AMSTREAM_SET_DISABLE_SLOW_SYNC 0x170
#define AMSTREAM_SET_3D_TYPE 0x171
#define AMSTREAM_SET_VSYNC_UPINT 0x172
#define AMSTREAM_SET_VSYNC_SLOW_FACTOR 0x173
#define AMSTREAM_SET_FRAME_BASE_PATH 0x174
#define AMSTREAM_SET_EOS 0x175
#define AMSTREAM_SET_RECEIVE_ID 0x176
#define AMSTREAM_SET_IS_RESET 0x177
#define AMSTREAM_SET_NO_POWERDOWN 0x178
#define AMSTREAM_SET_DVMETAWITHEL 0x179
/* video set ex cmd */
#define AMSTREAM_SET_EX_VIDEO_AXIS 0x260
#define AMSTREAM_SET_EX_VIDEO_CROP 0x261
/* amstream set ptr cmd */
#define AMSTREAM_SET_PTR_AUDIO_INFO 0x300
#define AMSTREAM_SET_PTR_CONFIGS 0x301
/* amstream get cmd */
#define AMSTREAM_GET_SUB_LENGTH 0x800
#define AMSTREAM_GET_UD_LENGTH 0x801
#define AMSTREAM_GET_APTS_LOOKUP 0x802
#define AMSTREAM_GET_FIRST_APTS_FLAG 0x803
#define AMSTREAM_GET_APTS 0x804
#define AMSTREAM_GET_VPTS 0x805
#define AMSTREAM_GET_PCRSCR 0x806
#define AMSTREAM_GET_LAST_CHECKIN_APTS 0x807
#define AMSTREAM_GET_LAST_CHECKIN_VPTS 0x808
#define AMSTREAM_GET_LAST_CHECKOUT_APTS 0x809
#define AMSTREAM_GET_LAST_CHECKOUT_VPTS 0x80A
#define AMSTREAM_GET_SUB_NUM 0x80B
#define AMSTREAM_GET_VIDEO_DELAY_LIMIT_MS 0x80C
#define AMSTREAM_GET_AUDIO_DELAY_LIMIT_MS 0x80D
#define AMSTREAM_GET_AUDIO_CUR_DELAY_MS 0x80E
#define AMSTREAM_GET_VIDEO_CUR_DELAY_MS 0x80F
#define AMSTREAM_GET_AUDIO_AVG_BITRATE_BPS 0x810
#define AMSTREAM_GET_VIDEO_AVG_BITRATE_BPS 0x811
/* video get cmd */
#define AMSTREAM_GET_OMX_VPTS 0x860
#define AMSTREAM_GET_TRICK_STAT 0x861
#define AMSTREAM_GET_TRICK_VPTS 0x862
#define AMSTREAM_GET_SYNC_ADISCON 0x863
#define AMSTREAM_GET_SYNC_VDISCON 0x864
#define AMSTREAM_GET_SYNC_ADISCON_DIFF 0x865
#define AMSTREAM_GET_SYNC_VDISCON_DIFF 0x866
#define AMSTREAM_GET_VIDEO_DISABLE 0x867
#define AMSTREAM_GET_VIDEO_DISCONTINUE_REPORT 0x868
#define AMSTREAM_GET_SCREEN_MODE 0x869
#define AMSTREAM_GET_BLACKOUT_POLICY 0x86A
#define AMSTREAM_GET_FREERUN_MODE 0x86B
#define AMSTREAM_GET_3D_TYPE 0x86C
#define AMSTREAM_GET_VSYNC_SLOW_FACTOR 0x86D
/* amstream get ex cmd */
#define AMSTREAM_GET_EX_VB_STATUS 0x900
#define AMSTREAM_GET_EX_AB_STATUS 0x901
#define AMSTREAM_GET_EX_VDECSTAT 0x902
#define AMSTREAM_GET_EX_ADECSTAT 0x903
#define AMSTREAM_GET_EX_UD_POC 0x904
/* video get ex cmd */
#define AMSTREAM_GET_EX_VF_STATUS 0x960
#define AMSTREAM_GET_EX_VIDEO_AXIS 0x961
#define AMSTREAM_GET_EX_VIDEO_CROP 0x962
/* amstream get ptr cmd */
#define AMSTREAM_GET_PTR_SUB_INFO 0xA00
struct am_ioctl_parm {
union {
unsigned int data_32;
unsigned long long data_64;
vformat_t data_vformat;
aformat_t data_aformat;
char data[8];
};
unsigned int cmd;
char reserved[4];
};
struct am_ioctl_parm_ex {
union {
struct buf_status status;
struct vdec_status vstatus;
struct adec_status astatus;
struct userdata_poc_info_t data_userdata_info;
char data[24];
};
unsigned int cmd;
char reserved[4];
};
struct am_ioctl_parm_ptr {
union {
struct audio_info *pdata_audio_info;
struct subtitle_info *pdata_sub_info;
void *pointer;
char data[8];
};
unsigned int cmd;
unsigned int len;
};
void set_vdec_func(int (*vdec_func)(struct vdec_status *));
void set_adec_func(int (*adec_func)(struct adec_status *));
#endif /* AMSTREAM_H */
+150
View File
@@ -0,0 +1,150 @@
/*
* Copyright (C) 2010 Amlogic Corporation.
*
* 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.
*/
/**
* @file vformat.h
* @brief Porting from decoder driver for video format
* @author Tim Yao <timyao@amlogic.com>
* @version 1.0.0
* @date 2011-02-24
*/
/* Copyright (C) 2007-2011, Amlogic Inc.
* All right reserved
*
*/
/*
* AMLOGIC Audio/Video streaming port driver.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the named License,
* or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*
* Author: Tim Yao <timyao@amlogic.com>
*
*/
#ifndef VFORMAT_H
#define VFORMAT_H
typedef enum {
VIDEO_DEC_FORMAT_UNKNOW,
VIDEO_DEC_FORMAT_MPEG4_3,
VIDEO_DEC_FORMAT_MPEG4_4,
VIDEO_DEC_FORMAT_MPEG4_5,
VIDEO_DEC_FORMAT_H264,
VIDEO_DEC_FORMAT_MJPEG,
VIDEO_DEC_FORMAT_MP4,
VIDEO_DEC_FORMAT_H263,
VIDEO_DEC_FORMAT_REAL_8,
VIDEO_DEC_FORMAT_REAL_9,
VIDEO_DEC_FORMAT_WMV3,
VIDEO_DEC_FORMAT_WVC1,
VIDEO_DEC_FORMAT_SW,
VIDEO_DEC_FORMAT_AVS,
VIDEO_DEC_FORMAT_H264_4K2K,
VIDEO_DEC_FORMAT_HEVC,
VIDEO_DEC_FORMAT_VP9 ,
VIDEO_DEC_FORMAT_MAX
} vdec_type_t;
typedef enum {
VFORMAT_UNKNOWN = -1,
VFORMAT_MPEG12 = 0,
VFORMAT_MPEG4,
VFORMAT_H264,
VFORMAT_MJPEG,
VFORMAT_REAL,
VFORMAT_JPEG,
VFORMAT_VC1,
VFORMAT_AVS,
VFORMAT_SW,
VFORMAT_H264MVC,
VFORMAT_H264_4K2K,
VFORMAT_HEVC,
VFORMAT_H264_ENC,
VFORMAT_JPEG_ENC,
VFORMAT_VP9,
VFORMAT_AVS2,
/*add new here before.*/
VFORMAT_MAX,
VFORMAT_UNSUPPORT = VFORMAT_MAX
} vformat_t;
#define IS_VFMT_VALID(vfmt) ((vfmt > VFORMAT_UNKNOWN) && (vfmt < VFORMAT_MAX))
#define IS_NEED_VDEC_INFO(vfmt) ((vfmt == VFORMAT_MPEG4) || (vfmt == VFORMAT_REAL))
#define CODEC_TAG_MJPEG (0x47504a4d)
#define CODEC_TAG_mjpeg (0x47504a4c)
#define CODEC_TAG_jpeg (0x6765706a)
#define CODEC_TAG_mjpa (0x61706a6d)
#define CODEC_TAG_XVID (0x44495658)
#define CODEC_TAG_xvid (0x64697678)
#define CODEC_TAG_XVIX (0x58495658)
#define CODEC_TAG_xvix (0x78697678)
#define CODEC_TAG_MP4 (0x8e22ada)
#define CODEC_TAG_COL1 (0x314c4f43)
#define CODEC_TAG_DIV3 (0x33564944)
#define CODEC_TAG_MP43 (0x3334504d)
#define CODEC_TAG_M4S2 (0x3253344d)
#define CODEC_TAG_DIV4 (0x34564944)
#define CODEC_TAG_divx (0x78766964)
#define CODEC_TAG_DIVX (0x58564944)
#define CODEC_TAG_DIV5 (0x35564944)
#define CODEC_TAG_3IV2 (0x32564933)
#define CODEC_TAG_3iv2 (0x32766933)
#define CODEC_TAG_DX50 (0x30355844)
#define CODEC_TAG_DIV6 (0x36564944)
#define CODEC_TAG_RMP4 (0x34504d52)
#define CODEC_TAG_MP42 (0x3234504d)
#define CODEC_TAG_MPG4 (0x3447504d)
#define CODEC_TAG_MP4V (0x5634504d)
#define CODEC_TAG_mp4v (0x7634706d)
#define CODEC_TAG_AVC1 (0x31435641)
#define CODEC_TAG_avc1 (0x31637661)
#define CODEC_TAG_H264 (0x34363248)
#define CODEC_TAG_h264 (0x34363268)
#define CODEC_TAG_HEVC (0x43564548)
#define CODEC_TAG_hvc1 (0x31637668)
#define CODEC_TAG_hev1 (0x31766568)
#define CODEC_TAG_H263 (0x33363248)
#define CODEC_TAG_h263 (0x33363268)
#define CODEC_TAG_s263 (0x33363273)
#define CODEC_TAG_F263 (0x33363246)
#define CODEC_TAG_WMV1 (0x31564d57)
#define CODEC_TAG_WMV2 (0x32564d57)
#define CODEC_TAG_WMV3 (0x33564d57)
#define CODEC_TAG_WVC1 (0x31435657)
#define CODEC_TAG_WMVA (0x41564d57)
#define CODEC_TAG_FMP4 (0x34504d46)
#define CODEC_TAG_FVFW (0x57465646)
#define CODEC_TAG_VC_1 (0x312d4356)
#define CODEC_TAG_vc_1 (0x312d6376)
#endif /* VFORMAT_H */
@@ -0,0 +1,44 @@
/*
* drivers/amlogic/media/video_processor/videosync/videosync.h
*
* Copyright (C) 2017 Amlogic, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*/
#ifndef _VIDEOSYNC_H
#define _VIDEOSYNC_H
#define VIDEOSYNC_IOC_MAGIC 'P'
#define VIDEOSYNC_IOC_ALLOC_ID _IOR(VIDEOSYNC_IOC_MAGIC, 0x00, int)
#define VIDEOSYNC_IOC_FREE_ID _IOW(VIDEOSYNC_IOC_MAGIC, 0x01, int)
#define VIDEOSYNC_IOC_SET_FREERUN_MODE _IOW(VIDEOSYNC_IOC_MAGIC, 0x02, int)
#define VIDEOSYNC_IOC_GET_FREERUN_MODE _IOR(VIDEOSYNC_IOC_MAGIC, 0x03, int)
#define VIDEOSYNC_IOC_SET_OMX_VPTS _IOW(VIDEOSYNC_IOC_MAGIC, 0x04, unsigned int)
#define VIDEOSYNC_IOC_GET_OMX_VPTS _IOR(VIDEOSYNC_IOC_MAGIC, 0x05, unsigned int)
#define VIDEOSYNC_IOC_GET_OMX_VERSION \
_IOR(VIDEOSYNC_IOC_MAGIC, 0x06, unsigned int)
#define VIDEOSYNC_IOC_SET_OMX_ZORDER \
_IOW(VIDEOSYNC_IOC_MAGIC, 0x07, unsigned int)
#define VIDEOSYNC_IOC_SET_FIRST_FRAME_NOSYNC \
_IOR(VIDEOSYNC_IOC_MAGIC, 0x08, unsigned int)
#define VIDEOSYNC_IOC_SET_VPAUSE \
_IOW(VIDEOSYNC_IOC_MAGIC, 0x09, unsigned int)
#define VIDEOSYNC_IOC_SET_VMASTER \
_IOW(VIDEOSYNC_IOC_MAGIC, 0x0a, unsigned int)
#define VIDEOSYNC_IOC_GET_VPTS \
_IOR(VIDEOSYNC_IOC_MAGIC, 0x0b, unsigned int)
#define VIDEOSYNC_IOC_GET_PCRSCR \
_IOR(VIDEOSYNC_IOC_MAGIC, 0x0c, unsigned int)
#endif
+36
View File
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2010 Amlogic Corporation.
*
* 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.
*/
/**
* @file audio_priv.h
* @brief Funtion prototypes of audio lib
* @author Zhang Chen <chen.zhang@amlogic.com>
* @version 1.0.0
* @date 2011-02-24
*/
/* Copyright (C) 2007-2011, Amlogic Inc.
* All right reserved
*
*/
#ifndef CODEC_PRIV_H_
#define CODEC_PRIV_H_
void audio_start(void **priv, codec_para_t *pcodec);
void audio_stop(void **priv);
void audio_pause(void *priv);
void audio_resume(void *priv);
#endif
+149
View File
@@ -0,0 +1,149 @@
/*
* Copyright (C) 2010 Amlogic Corporation.
*
* 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.
*/
/**
* @file codec.h
* @brief Function prototypes of codec lib
* @author Zhang Chen <chen.zhang@amlogic.com>
* @version 1.0.0
* @date 2011-02-24
*/
/* Copyright (C) 2007-2011, Amlogic Inc.
* All right reserved
*
*/
#ifndef CODEC_CTRL_H_
#define CODEC_CTRL_H_
#include <codec_type.h>
#include <codec_error.h>
int codec_init(codec_para_t *);
int codec_close(codec_para_t *);
void codec_close_audio_async(codec_para_t *pcodec);
void codec_audio_basic_init(void);
void codec_close_audio(codec_para_t *);
void codec_resume_audio(codec_para_t *, unsigned int);
int codec_reset(codec_para_t *);
int codec_init_sub(codec_para_t *);
int codec_open_sub_read(void);
int codec_close_sub(codec_para_t *);
int codec_close_sub_fd(CODEC_HANDLE);
int codec_reset_subtile(codec_para_t *pcodec);
int codec_poll_sub(codec_para_t *);
int codec_poll_sub_fd(CODEC_HANDLE, int);
int codec_get_sub_size(codec_para_t *);
int codec_get_sub_size_fd(CODEC_HANDLE);
int codec_read_sub_data(codec_para_t *, char *, unsigned int);
int codec_read_sub_data_fd(CODEC_HANDLE, char *, unsigned int);
int codec_write_sub_data(codec_para_t *, char *, unsigned int);
int codec_init_cntl(codec_para_t *);
int codec_close_cntl(codec_para_t *);
int codec_poll_cntl(codec_para_t *);
int codec_get_cntl_state(codec_para_t *);
int codec_get_cntl_vpts(codec_para_t *pcodec);
int codec_set_cntl_mode(codec_para_t *, unsigned int);
int codec_set_mode(codec_para_t *, unsigned int);
int codec_set_cntl_avthresh(codec_para_t *, unsigned int);
int codec_set_cntl_syncthresh(codec_para_t *pcodec, unsigned int syncthresh);
int codec_reset_audio(codec_para_t *pcodec);
int codec_set_audio_pid(codec_para_t *pcodec);
int codec_set_sub_id(codec_para_t *pcodec);
int codec_set_sub_type(codec_para_t *pcodec);
int codec_audio_reinit(codec_para_t *pcodec);
int codec_set_dec_reset(codec_para_t *pcodec);
int codec_write(codec_para_t *pcodec, void *buffer, int len);
int codec_checkin_pts(codec_para_t *pcodec, unsigned long pts);
int codec_get_vbuf_state(codec_para_t *, struct buf_status *);
int codec_get_abuf_state(codec_para_t *, struct buf_status *);
int codec_get_vdec_state(codec_para_t *, struct vdec_status *);
int codec_get_adec_state(codec_para_t *, struct adec_status *);
int codec_pause(codec_para_t *);
int codec_resume(codec_para_t *);
int codec_audio_search(codec_para_t *p);
int codec_set_mute(codec_para_t *p, int mute);
int codec_get_volume_range(codec_para_t *, int *min, int *max);
int codec_set_volume(codec_para_t *, float val);
int codec_get_volume(codec_para_t *, float *val);
int codec_set_lrvolume(codec_para_t *, float lvol, float rvol);
int codec_get_lrvolume(codec_para_t *, float *lvol, float* rvol);
int codec_get_mutesta(codec_para_t *);
int codec_set_volume_balance(codec_para_t *, int); /*left0-100)right*/
int codec_swap_left_right(codec_para_t *);
int codec_left_mono(codec_para_t *p);
int codec_right_mono(codec_para_t *p);
int codec_stereo(codec_para_t *p);
int codec_lr_mix_set(codec_para_t *p, int enable);
int codec_get_soundtrack(codec_para_t *p, int* strack);
int codec_audio_automute(void *priv, int auto_mute);
int codec_audio_spectrum_switch(codec_para_t *p, int isStart, int interval);
int codec_audio_isready(codec_para_t *p);
int codec_audio_get_nb_frames(codec_para_t *p);
int codec_audio_set_audioinfo(codec_para_t *p);
int codec_pcmpara_Applied_get(codec_para_t *p, int *pfs, int *pch,int *lfepresent);
int codec_get_apts(codec_para_t *pcodec);
int codec_get_vpts(codec_para_t *pcodec);
int codec_get_pcrscr(codec_para_t *pcodec);
int codec_set_pcrscr(codec_para_t *pcodec, int val);
int codec_set_syncenable(codec_para_t *pcodec, int enable);
int codec_set_sync_audio_discont(codec_para_t *pcodec, int discontinue);
int codec_get_sync_audio_discont(codec_para_t *pcodec);
int codec_set_sync_video_discont(codec_para_t *pcodec, int discontinue);
int codec_get_sync_video_discont(codec_para_t *pcodec);
unsigned long codec_get_sync_audio_discont_diff(codec_para_t *pcodec);
unsigned long codec_get_sync_video_discont_diff(codec_para_t *pcodec);
int codec_set_sync_audio_discont_diff(codec_para_t *pcodec, unsigned long discontinue_diff);
int codec_set_sync_video_discont_diff(codec_para_t *pcodec, unsigned long discontinue_diff);
int codec_get_sub_num(codec_para_t *pcodec);
int codec_get_sub_info(codec_para_t *pcodec, subtitle_info_t *sub_info);
int codec_set_av_threshold(codec_para_t *pcodec, int threshold);
int codec_get_freerun_mode(codec_para_t *pcodec);
int codec_set_freerun_mode(codec_para_t *pcodec, unsigned int mode);
int codec_init_audio_utils(codec_para_t *pcodec);
int codec_release_audio_utils(codec_para_t *pcodec);
int codec_set_audio_resample_ena(codec_para_t *pcodec, unsigned long mode);
int codec_get_audio_resample_ena(codec_para_t *pcodec);
int codec_set_audio_resample_type(codec_para_t *pcodec, unsigned long type);
int codec_set_video_delay_limited_ms(codec_para_t *pcodec, int delay_ms);
int codec_get_video_delay_limited_ms(codec_para_t *pcodec, int *delay_ms);
int codec_set_audio_delay_limited_ms(codec_para_t *pcodec, int delay_ms);
int codec_get_audio_delay_limited_ms(codec_para_t *pcodec, int *delay_ms);
int codec_get_audio_cur_delay_ms(codec_para_t *pcodec, int *delay_ms);
int codec_get_video_cur_delay_ms(codec_para_t *pcodec, int *delay_ms);
int codec_get_video_cur_bitrate(codec_para_t *pcodec, int *bitrate);
int codec_get_audio_cur_bitrate(codec_para_t *pcodec, int *bitrate);
int codec_set_vsync_upint(codec_para_t *pcodec, unsigned int mode);
int codec_get_last_checkout_apts(codec_para_t* pcodec, unsigned long *apts);
int codec_get_last_checkin_apts(codec_para_t* pcodec, unsigned long *apts);
int codec_disalbe_slowsync(codec_para_t *pcodec, int disable_slowsync);
int codec_utils_set_video_position(int x, int y, int w, int h, int rotation);
int codec_amsub_read_outdata(codec_para_t *pcodec,amsub_info_t *amsub_info);
void codec_close_subtitle(codec_para_t *pcodec);
void codec_resume_subtitle(codec_para_t *pcodec, unsigned int has_sub);
int codec_set_eos(codec_para_t *pcodec, int is_eos);
#endif
+55
View File
@@ -0,0 +1,55 @@
/*
* Copyright (C) 2010 Amlogic Corporation.
*
* 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.
*/
/**
* @file codec_error.h
* @brief Codec error type definitions
* @author Zhang Chen <chen.zhang@amlogic.com>
* @version 1.0.0
* @date 2011-02-24
*/
/* Copyright (C) 2007-2011, Amlogic Inc.
* All right reserved
*
*/
#ifndef CODEC_ERROR_H_
#define CODEC_ERROR_H_
#define C_PAE (0x01000000)
#define CODEC_ERROR_NONE ( 0)
#define CODEC_ERROR_INVAL (C_PAE | 1)
#define CODEC_ERROR_NOMEM (C_PAE | 2)
#define CODEC_ERROR_BUSY (C_PAE | 3)
#define CODEC_ERROR_IO (C_PAE | 4)
#define CODEC_ERROR_PARAMETER (C_PAE | 5)
#define CODEC_ERROR_AUDIO_TYPE_UNKNOW (C_PAE | 6)
#define CODEC_ERROR_VIDEO_TYPE_UNKNOW (C_PAE | 7)
#define CODEC_ERROR_STREAM_TYPE_UNKNOW (C_PAE | 8)
#define CODEC_ERROR_VDEC_TYPE_UNKNOW (C_PAE | 9)
#define CODEC_ERROR_INIT_FAILED (C_PAE | 10)
#define CODEC_ERROR_SET_BUFSIZE_FAILED (C_PAE | 11)
#define CODEC_OPEN_HANDLE_FAILED (C_PAE | 12)
#endif
+37
View File
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2010 Amlogic Corporation.
*
* 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.
*/
/**
* @file codec_msg.h
* @brief Function prototype of codec error
* @author Zhang Chen <chen.zhang@amlogic.com>
* @version 1.0.0
* @date 2011-02-24
*/
/* Copyright (C) 2007-2011, Amlogic Inc.
* All right reserved
*
*/
#ifndef CODEC_MSG_H
#define CODEC_MSG_H
const char * codec_error_msg(int error);
int system_error_to_codec_error(int error);
void print_error_msg(int error, int syserr, char *func, int line);
#endif
+224
View File
@@ -0,0 +1,224 @@
/*
* Copyright (C) 2010 Amlogic Corporation.
*
* 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.
*/
/**
* @file codec_type.h
* @brief Definitions of codec type and structures
* @author Zhang Chen <chen.zhang@amlogic.com>
* @version 1.0.0
* @date 2011-02-24
*/
/* Copyright (C) 2007-2011, Amlogic Inc.
* All right reserved
*
*/
#ifndef CODEC_TYPE_H_
#define CODEC_TYPE_H_
#include "amports/amstream.h"
#include "amports/vformat.h"
#include "amports/aformat.h"
#include "ppmgr/ppmgr.h"
#include <stdlib.h>
#include <stdint.h>
typedef int CODEC_HANDLE;
typedef enum {
STREAM_TYPE_UNKNOW,
STREAM_TYPE_ES_VIDEO,
STREAM_TYPE_ES_AUDIO,
STREAM_TYPE_ES_SUB,
STREAM_TYPE_PS,
STREAM_TYPE_TS,
STREAM_TYPE_RM,
} stream_type_t;
typedef enum {
DECODER_TYPE_SINGLE_MODE,
DECODER_TYPE_FRAME_MODE,
DECODER_TYPE_STREAM_MODE,
} decoder_type_t;
typedef enum {
DISPLAY_MODE_AMVIDEO,
DISPLAY_MODE_PIPVIDEO,
} display_mode_type_t;
typedef struct {
unsigned int format; ///< video format, such as H264, MPEG2...
unsigned int width; ///< video source width
unsigned int height; ///< video source height
unsigned int rate; ///< video source frame duration
unsigned int extra; ///< extra data information of video stream
unsigned int status; ///< status of video stream
unsigned int ratio; ///< aspect ratio of video source
void * param; ///< other parameters for video decoder
unsigned long long ratio64; ///< aspect ratio of video source
} dec_sysinfo_t;
typedef struct {
int valid; ///< audio extradata valid(1) or invalid(0), set by dsp
int sample_rate; ///< audio stream sample rate
int channels; ///< audio stream channels
int bitrate; ///< audio stream bit rate
int codec_id; ///< codec format id
int block_align; ///< audio block align from ffmpeg
int extradata_size; ///< extra data size
char extradata[AUDIO_EXTRA_DATA_SIZE];; ///< extra data information for decoder
} audio_info_t;
typedef struct {
int valid; ///< audio extradata valid(1) or invalid(0), set by dsp
int sample_rate; ///< audio stream sample rate
int channels; ///< audio stream channels
int bitrate; ///< audio stream bit rate
int codec_id; ///< codec format id
int block_align; ///< audio block align from ffmpeg
int extradata_size; ///< extra data size
char extradata[512];; ///< extra data information for decoder
} Asf_audio_info_t;
typedef struct {
CODEC_HANDLE handle; ///< codec device handler
CODEC_HANDLE cntl_handle; ///< video control device handler
CODEC_HANDLE sub_handle; ///< subtile device handler
CODEC_HANDLE audio_utils_handle; ///< audio utils handler
stream_type_t stream_type; ///< stream type(es, ps, rm, ts)
unsigned int has_video:
1; ///< stream has video(1) or not(0)
unsigned int has_audio:
1; ///< stream has audio(1) or not(0)
unsigned int has_sub:
1; ///< stream has subtitle(1) or not(0)
unsigned int noblock:
1; ///< codec device is NONBLOCK(1) or not(0)
int video_type; ///< stream video type(H264, VC1...)
int audio_type; ///< stream audio type(PCM, WMA...)
int sub_type; ///< stream subtitle type(TXT, SSA...)
int video_pid; ///< stream video pid
int audio_pid; ///< stream audio pid
int sub_pid; ///< stream subtitle pid
int audio_channels; ///< stream audio channel number
int audio_samplerate; ///< steram audio sample rate
int vbuf_size; ///< video buffer size of codec device
int abuf_size; ///< audio buffer size of codec device
dec_sysinfo_t am_sysinfo; ///< system information for video
audio_info_t audio_info; ///< audio information pass to audiodsp
int packet_size; ///< data size per packet
int avsync_threshold; ///<for adec in ms>
void * adec_priv; ///<for adec>
void * amsub_priv; // <for amsub>
int SessionID;
int dspdec_not_supported;//check some profile that audiodsp decoder can not support,we switch to arm decoder
int switch_audio_flag; //<switch audio flag switching(1) else(0)
int automute_flag;
decoder_type_t decoder_type;
display_mode_type_t display_mode;
char *sub_filename;
int associate_dec_supported;//support associate or not
int mixing_level;
int use_hardabuf;
unsigned int drmmode;
enum FRAME_BASE_VIDEO_PATH video_path;
} codec_para_t;
typedef struct {
signed char id;
unsigned char width;
unsigned char height;
unsigned char type;
} subtitle_info_t;
#define MAX_SUB_NUM (32)
#define IS_VALID_PID(t) (t>=0 && t<=0x1fff)
#define IS_VALID_STREAM(t) (t>0 && t<=0x1fff)
#define IS_VALID_ATYPE(t) (t>=0 && t<AFORMAT_MAX)
#define IS_VALID_VTYPE(t) (t>=0 && t<VFORMAT_MAX)
//pass to arm audio decoder
typedef struct {
int sample_rate; ///< audio stream sample rate
int channels; ///< audio stream channels
int format; ///< codec format id
int bitrate;
int block_align;
int codec_id; //original codecid corespingding to ffmepg
int handle; ///< codec device handler
int extradata_size; ///< extra data size
char extradata[AUDIO_EXTRA_DATA_SIZE];
int SessionID;
int dspdec_not_supported;//check some profile that audiodsp decoder can not support,we switch to arm decoder
int droppcm_flag; // drop pcm flag, if switch audio (1)
int automute;
unsigned int has_video;
int associate_dec_supported;//support associate or not
int mixing_level;
int use_hardabuf;
} arm_audio_info;
typedef struct {
int sub_type;
int sub_pid;
int stream_type; // to judge sub how to get data
char *sub_filename;
unsigned int curr_timeMs; //for idx+sub
unsigned int next_pts; //for idx+sub
unsigned int pts;
unsigned int m_delay;
unsigned short sub_start_x;
unsigned short sub_start_y;
unsigned short sub_width;
unsigned short sub_height;
char * odata; // point to decoder data
unsigned buffer_size;
} amsub_info_t;
#define TYPE_DRMINFO 0x80
#define TYPE_PATTERN 0x40
typedef enum {
DRM_LEVEL1 = 1,
DRM_LEVEL2 = 2,
DRM_LEVEL3 = 3,
DRM_NONE = 4,
} drm_level_t;
typedef struct drm_info {
drm_level_t drm_level;
uint32_t drm_flag;
uint32_t drm_hasesdata;
uint32_t drm_priv;
uint32_t drm_pktsize;
uint32_t drm_pktpts;
uint32_t drm_phy;
uint32_t drm_vir;
uint32_t drm_remap;
uint32_t data_offset;
uint32_t handle;
uint32_t extpad[7];
} drminfo_t;
//audio decoder type, default arc
#define AUDIO_ARC_DECODER 0
#define AUDIO_ARM_DECODER 1
#define AUDIO_FFMPEG_DECODER 2
#define AUDIO_ARMWFD_DECODER 3
#endif
+42
View File
@@ -0,0 +1,42 @@
/*
* Copyright (C) 2010 Amlogic Corporation.
*
* 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.
*/
/**
* @file ppmgr.h
* @brief Porting from ppmgr driver for codec ioctl commands
* @author Tim Yao <timyao@amlogic.com>
* @version 1.0.0
* @date 2011-02-24
*/
/* Copyright (C) 2007-2011, Amlogic Inc.
* All right reserved
*
*/
#ifndef PPMGR_H
#define PPMGR_H
#define PPMGR_IOC_MAGIC 'P'
//#define PPMGR_IOC_2OSD0 _IOW(PPMGR_IOC_MAGIC, 0x00, unsigned int)
//#define PPMGR_IOC_ENABLE_PP _IOW(PPMGR_IOC_MAGIC,0X01,unsigned int)
//#define PPMGR_IOC_CONFIG_FRAME _IOW(PPMGR_IOC_MAGIC,0X02,unsigned int)
#define PPMGR_IOC_GET_ANGLE _IOR(PPMGR_IOC_MAGIC,0X03,unsigned long)
#define PPMGR_IOC_SET_ANGLE _IOW(PPMGR_IOC_MAGIC,0X04,unsigned long)
#endif /* PPMGR_H */
@@ -0,0 +1,70 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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 AMVDEC_AMVIDEO_HEADER_SS
#define AMVDEC_AMVIDEO_HEADER_SS
#include <stdlib.h>
//#include <linux/videodev2.h>
#include "videodev2.h"
#define FLAGS_OVERLAY_MODE (1)
#define FLAGS_V4L_MODE (2)
struct amvideo_dev;
typedef struct vframebuf{
char * vbuf;
int fd;
int index;
int offset;
int length;
int64_t pts;
int duration;
int width;
int height;
}vframebuf_t;
struct amvideo_dev_ops{
int (*setparameters)(struct amvideo_dev *dev,int cmd,void*para);
int (*init)(struct amvideo_dev *dev,int flags,int width,int height,int fmt,int buffernum);
int (*release)(struct amvideo_dev *dev);
int (*dequeuebuf)(struct amvideo_dev *dev,vframebuf_t*vf);
int (*queuebuf)(struct amvideo_dev *dev,vframebuf_t*vf);
int (*start)(struct amvideo_dev *dev);
int (*stop)(struct amvideo_dev *dev);
};
typedef struct amvideo_dev{
char devname[8];
int mode;
int display_mode;
struct amvideo_dev_ops ops;
void *devpriv;
}amvideo_dev_t;
typedef struct amvideo{
amvideo_dev_t *dev;
}amvideo_t;
amvideo_dev_t *new_amvideo(int flags);
int amvideo_setparameters(amvideo_dev_t *dev, int cmd, void * parameters);
int amvideo_init(amvideo_dev_t *dev,int flags,int width,int height,int fmt,int buffernum);
int amvideo_start(amvideo_dev_t *dev);
int amvideo_stop(amvideo_dev_t *dev);
int amvideo_release(amvideo_dev_t *dev);
int amlv4l_dequeuebuf(amvideo_dev_t *dev, vframebuf_t*vf);
int amlv4l_queuebuf(amvideo_dev_t *dev, vframebuf_t*vf);
#endif
+47
View File
@@ -0,0 +1,47 @@
/*
* ion.c
*
* Memory Allocator functions for ion
*
* Copyright 2011 Google, Inc
*
* 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 __SYS_CORE_ION_H
#define __SYS_CORE_ION_H
#include "ion_dev.h"
#ifdef __cplusplus
extern "C" {
#endif
int ion_open();
int ion_close(int fd);
int ion_alloc(int fd, size_t len, size_t align, unsigned int heap_mask,
unsigned int flags, struct ion_handle **handle);
int ion_alloc_fd(int fd, size_t len, size_t align, unsigned int heap_mask,
unsigned int flags, int *handle_fd);
int ion_sync_fd(int fd, int handle_fd);
int ion_free(int fd, struct ion_handle *handle);
int ion_map(int fd, struct ion_handle *handle, size_t length, int prot,
int flags, off_t offset, unsigned char **ptr, int *map_fd);
int ion_share(int fd, struct ion_handle *handle, int *share_fd);
int ion_import(int fd, int share_fd, struct ion_handle **handle);
#ifdef __cplusplus
}
#endif
#endif /* __SYS_CORE_ION_H */
@@ -0,0 +1,87 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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.
*/
/****************************************************************************
****************************************************************************
***
*** This header was automatically generated from a Linux kernel header
*** of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef _LINUX_ION_H
#define _LINUX_ION_H
#include <linux/types.h>
struct ion_handle;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
enum ion_heap_type {
ION_HEAP_TYPE_SYSTEM,
ION_HEAP_TYPE_SYSTEM_CONTIG,
ION_HEAP_TYPE_CARVEOUT,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
ION_HEAP_TYPE_CUSTOM,
ION_NUM_HEAPS = 16,
};
#define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
#define ION_FLAG_CACHED 1
#define ION_FLAG_CACHED_NEEDS_SYNC 2
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct ion_allocation_data {
size_t len;
size_t align;
unsigned int heap_mask;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned int flags;
struct ion_handle *handle;
};
struct ion_fd_data {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct ion_handle *handle;
int fd;
};
struct ion_handle_data {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct ion_handle *handle;
};
struct ion_custom_data {
unsigned int cmd;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long arg;
};
#define ION_IOC_MAGIC 'I'
#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, struct ion_allocation_data)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data)
#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ION_IOC_SYNC _IOWR(ION_IOC_MAGIC, 7, struct ion_fd_data)
#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
#endif
@@ -0,0 +1,71 @@
/*
* include/linux/v4l2-common.h
*
* Common V4L2 and V4L2 subdev definitions.
*
* Users are advised to #include this file either through videodev2.h
* (V4L2) or through v4l2-subdev.h (V4L2 subdev) rather than to refer
* to this file directly.
*
* Copyright (C) 2012 Nokia Corporation
* Contact: Sakari Ailus <sakari.ailus@iki.fi>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef __V4L2_COMMON__
#define __V4L2_COMMON__
/*
*
* Selection interface definitions
*
*/
/* Current cropping area */
#define V4L2_SEL_TGT_CROP 0x0000
/* Default cropping area */
#define V4L2_SEL_TGT_CROP_DEFAULT 0x0001
/* Cropping bounds */
#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002
/* Current composing area */
#define V4L2_SEL_TGT_COMPOSE 0x0100
/* Default composing area */
#define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101
/* Composing bounds */
#define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102
/* Current composing area plus all padding pixels */
#define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103
/* Backward compatibility target definitions --- to be removed. */
#define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP
#define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE
#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL V4L2_SEL_TGT_CROP
#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL V4L2_SEL_TGT_COMPOSE
#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS V4L2_SEL_TGT_CROP_BOUNDS
#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS V4L2_SEL_TGT_COMPOSE_BOUNDS
/* Selection flags */
#define V4L2_SEL_FLAG_GE (1 << 0)
#define V4L2_SEL_FLAG_LE (1 << 1)
#define V4L2_SEL_FLAG_KEEP_CONFIG (1 << 2)
/* Backward compatibility flag definitions --- to be removed. */
#define V4L2_SUBDEV_SEL_FLAG_SIZE_GE V4L2_SEL_FLAG_GE
#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE V4L2_SEL_FLAG_LE
#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG V4L2_SEL_FLAG_KEEP_CONFIG
#endif /* __V4L2_COMMON__ */
@@ -0,0 +1,804 @@
/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */
/*
* Video for Linux Two controls header file
*
* Copyright (C) 1999-2012 the contributors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Alternatively you can redistribute this file under the terms of the
* BSD license as stated below:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. The names of its contributors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The contents of this header was split off from videodev2.h. All control
* definitions should be added to this header, which is included by
* videodev2.h.
*/
#ifndef __LINUX_V4L2_CONTROLS_H
#define __LINUX_V4L2_CONTROLS_H
/* Control classes */
#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */
#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */
#define V4L2_CTRL_CLASS_DV 0x00a00000 /* Digital Video controls */
/* User-class control IDs */
#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
#define V4L2_CID_USER_BASE V4L2_CID_BASE
#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1)
#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0)
#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1)
#define V4L2_CID_SATURATION (V4L2_CID_BASE+2)
#define V4L2_CID_HUE (V4L2_CID_BASE+3)
#define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5)
#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6)
#define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7)
#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8)
#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9)
#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10)
#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */
#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12)
#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13)
#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14)
#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15)
#define V4L2_CID_GAMMA (V4L2_CID_BASE+16)
#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */
#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17)
#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18)
#define V4L2_CID_GAIN (V4L2_CID_BASE+19)
#define V4L2_CID_HFLIP (V4L2_CID_BASE+20)
#define V4L2_CID_VFLIP (V4L2_CID_BASE+21)
/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */
#define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
#define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24)
enum v4l2_power_line_frequency {
V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0,
V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1,
V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2,
V4L2_CID_POWER_LINE_FREQUENCY_AUTO = 3,
};
#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25)
#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26)
#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27)
#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28)
#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29)
#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
#define V4L2_CID_COLORFX (V4L2_CID_BASE+31)
enum v4l2_colorfx {
V4L2_COLORFX_NONE = 0,
V4L2_COLORFX_BW = 1,
V4L2_COLORFX_SEPIA = 2,
V4L2_COLORFX_NEGATIVE = 3,
V4L2_COLORFX_EMBOSS = 4,
V4L2_COLORFX_SKETCH = 5,
V4L2_COLORFX_SKY_BLUE = 6,
V4L2_COLORFX_GRASS_GREEN = 7,
V4L2_COLORFX_SKIN_WHITEN = 8,
V4L2_COLORFX_VIVID = 9,
V4L2_COLORFX_AQUA = 10,
V4L2_COLORFX_ART_FREEZE = 11,
V4L2_COLORFX_SILHOUETTE = 12,
V4L2_COLORFX_SOLARIZATION = 13,
V4L2_COLORFX_ANTIQUE = 14,
V4L2_COLORFX_SET_CBCR = 15,
};
#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
#define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37)
#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38)
#define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (V4L2_CID_BASE+39)
#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40)
#define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41)
#define V4L2_CID_COLORFX_CBCR (V4L2_CID_BASE+42)
/* last CID + 1 */
#define V4L2_CID_LASTP1 (V4L2_CID_BASE+43)
/* MPEG-class control IDs */
#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
/* MPEG streams, specific to multiplexed streams */
#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0)
enum v4l2_mpeg_stream_type {
V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */
V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */
V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */
V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */
V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */
V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */
};
#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1)
#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2)
#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3)
#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4)
#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5)
#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6)
#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7)
enum v4l2_mpeg_stream_vbi_fmt {
V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */
V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */
};
/* MPEG audio controls specific to multiplexed streams */
#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100)
enum v4l2_mpeg_audio_sampling_freq {
V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2,
};
#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101)
enum v4l2_mpeg_audio_encoding {
V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2,
V4L2_MPEG_AUDIO_ENCODING_AAC = 3,
V4L2_MPEG_AUDIO_ENCODING_AC3 = 4,
};
#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
enum v4l2_mpeg_audio_l1_bitrate {
V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0,
V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1,
V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2,
V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3,
V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4,
V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5,
V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6,
V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7,
V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8,
V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9,
V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10,
V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11,
V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12,
V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13,
};
#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103)
enum v4l2_mpeg_audio_l2_bitrate {
V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0,
V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1,
V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2,
V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3,
V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4,
V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5,
V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6,
V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7,
V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8,
V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9,
V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10,
V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11,
V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13,
};
#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104)
enum v4l2_mpeg_audio_l3_bitrate {
V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0,
V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1,
V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2,
V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3,
V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4,
V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5,
V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6,
V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7,
V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8,
V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9,
V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10,
V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11,
V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13,
};
#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105)
enum v4l2_mpeg_audio_mode {
V4L2_MPEG_AUDIO_MODE_STEREO = 0,
V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1,
V4L2_MPEG_AUDIO_MODE_DUAL = 2,
V4L2_MPEG_AUDIO_MODE_MONO = 3,
};
#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106)
enum v4l2_mpeg_audio_mode_extension {
V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0,
V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1,
V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3,
};
#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107)
enum v4l2_mpeg_audio_emphasis {
V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0,
V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2,
};
#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108)
enum v4l2_mpeg_audio_crc {
V4L2_MPEG_AUDIO_CRC_NONE = 0,
V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
};
#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109)
#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110)
#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111)
enum v4l2_mpeg_audio_ac3_bitrate {
V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0,
V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1,
V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2,
V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3,
V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4,
V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5,
V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6,
V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7,
V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8,
V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9,
V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10,
V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11,
V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12,
V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13,
V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14,
V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15,
V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16,
V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
};
#define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE+112)
enum v4l2_mpeg_audio_dec_playback {
V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0,
V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1,
V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT = 2,
V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT = 3,
V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4,
V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5,
};
#define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113)
/* MPEG video controls specific to multiplexed streams */
#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
enum v4l2_mpeg_video_encoding {
V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2,
};
#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
enum v4l2_mpeg_video_aspect {
V4L2_MPEG_VIDEO_ASPECT_1x1 = 0,
V4L2_MPEG_VIDEO_ASPECT_4x3 = 1,
V4L2_MPEG_VIDEO_ASPECT_16x9 = 2,
V4L2_MPEG_VIDEO_ASPECT_221x100 = 3,
};
#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202)
#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203)
#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204)
#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205)
#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206)
enum v4l2_mpeg_video_bitrate_mode {
V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
};
#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
#define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (V4L2_CID_MPEG_BASE+212)
#define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER (V4L2_CID_MPEG_BASE+213)
#define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE+214)
#define V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (V4L2_CID_MPEG_BASE+215)
#define V4L2_CID_MPEG_VIDEO_HEADER_MODE (V4L2_CID_MPEG_BASE+216)
enum v4l2_mpeg_video_header_mode {
V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE = 0,
V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME = 1,
};
#define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC (V4L2_CID_MPEG_BASE+217)
#define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE (V4L2_CID_MPEG_BASE+218)
#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES (V4L2_CID_MPEG_BASE+219)
#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB (V4L2_CID_MPEG_BASE+220)
#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE+221)
enum v4l2_mpeg_video_multi_slice_mode {
V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0,
V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1,
V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
};
#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222)
#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223)
#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224)
#define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_BASE+225)
#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302)
#define V4L2_CID_MPEG_VIDEO_H263_MIN_QP (V4L2_CID_MPEG_BASE+303)
#define V4L2_CID_MPEG_VIDEO_H263_MAX_QP (V4L2_CID_MPEG_BASE+304)
#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP (V4L2_CID_MPEG_BASE+350)
#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP (V4L2_CID_MPEG_BASE+351)
#define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP (V4L2_CID_MPEG_BASE+352)
#define V4L2_CID_MPEG_VIDEO_H264_MIN_QP (V4L2_CID_MPEG_BASE+353)
#define V4L2_CID_MPEG_VIDEO_H264_MAX_QP (V4L2_CID_MPEG_BASE+354)
#define V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM (V4L2_CID_MPEG_BASE+355)
#define V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE (V4L2_CID_MPEG_BASE+356)
#define V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE (V4L2_CID_MPEG_BASE+357)
enum v4l2_mpeg_video_h264_entropy_mode {
V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC = 0,
V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC = 1,
};
#define V4L2_CID_MPEG_VIDEO_H264_I_PERIOD (V4L2_CID_MPEG_BASE+358)
#define V4L2_CID_MPEG_VIDEO_H264_LEVEL (V4L2_CID_MPEG_BASE+359)
enum v4l2_mpeg_video_h264_level {
V4L2_MPEG_VIDEO_H264_LEVEL_1_0 = 0,
V4L2_MPEG_VIDEO_H264_LEVEL_1B = 1,
V4L2_MPEG_VIDEO_H264_LEVEL_1_1 = 2,
V4L2_MPEG_VIDEO_H264_LEVEL_1_2 = 3,
V4L2_MPEG_VIDEO_H264_LEVEL_1_3 = 4,
V4L2_MPEG_VIDEO_H264_LEVEL_2_0 = 5,
V4L2_MPEG_VIDEO_H264_LEVEL_2_1 = 6,
V4L2_MPEG_VIDEO_H264_LEVEL_2_2 = 7,
V4L2_MPEG_VIDEO_H264_LEVEL_3_0 = 8,
V4L2_MPEG_VIDEO_H264_LEVEL_3_1 = 9,
V4L2_MPEG_VIDEO_H264_LEVEL_3_2 = 10,
V4L2_MPEG_VIDEO_H264_LEVEL_4_0 = 11,
V4L2_MPEG_VIDEO_H264_LEVEL_4_1 = 12,
V4L2_MPEG_VIDEO_H264_LEVEL_4_2 = 13,
V4L2_MPEG_VIDEO_H264_LEVEL_5_0 = 14,
V4L2_MPEG_VIDEO_H264_LEVEL_5_1 = 15,
};
#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA (V4L2_CID_MPEG_BASE+360)
#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA (V4L2_CID_MPEG_BASE+361)
#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE+362)
enum v4l2_mpeg_video_h264_loop_filter_mode {
V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED = 0,
V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED = 1,
V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2,
};
#define V4L2_CID_MPEG_VIDEO_H264_PROFILE (V4L2_CID_MPEG_BASE+363)
enum v4l2_mpeg_video_h264_profile {
V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE = 0,
V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE = 1,
V4L2_MPEG_VIDEO_H264_PROFILE_MAIN = 2,
V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED = 3,
V4L2_MPEG_VIDEO_H264_PROFILE_HIGH = 4,
V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10 = 5,
V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422 = 6,
V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE = 7,
V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA = 8,
V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA = 9,
V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA = 10,
V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA = 11,
V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE = 12,
V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH = 13,
V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA = 14,
V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH = 15,
V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH = 16,
};
#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE+364)
#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE+365)
#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (V4L2_CID_MPEG_BASE+366)
#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC (V4L2_CID_MPEG_BASE+367)
enum v4l2_mpeg_video_h264_vui_sar_idc {
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED = 0,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1 = 1,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_12x11 = 2,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_10x11 = 3,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_16x11 = 4,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_40x33 = 5,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_24x11 = 6,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_20x11 = 7,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_32x11 = 8,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_80x33 = 9,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_18x11 = 10,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_15x11 = 11,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_64x33 = 12,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_160x99 = 13,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_4x3 = 14,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_3x2 = 15,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1 = 16,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED = 17,
};
#define V4L2_CID_MPEG_VIDEO_H264_SEI_FRAME_PACKING (V4L2_CID_MPEG_BASE+368)
#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_CURRENT_FRAME_0 (V4L2_CID_MPEG_BASE+369)
#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE (V4L2_CID_MPEG_BASE+370)
enum v4l2_mpeg_video_h264_sei_fp_arrangement_type {
V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_CHECKERBOARD = 0,
V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_COLUMN = 1,
V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_ROW = 2,
V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_SIDE_BY_SIDE = 3,
V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TOP_BOTTOM = 4,
V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TEMPORAL = 5,
};
#define V4L2_CID_MPEG_VIDEO_H264_FMO (V4L2_CID_MPEG_BASE+371)
#define V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE (V4L2_CID_MPEG_BASE+372)
enum v4l2_mpeg_video_h264_fmo_map_type {
V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_INTERLEAVED_SLICES = 0,
V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_SCATTERED_SLICES = 1,
V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_FOREGROUND_WITH_LEFT_OVER = 2,
V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_BOX_OUT = 3,
V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_RASTER_SCAN = 4,
V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_WIPE_SCAN = 5,
V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_EXPLICIT = 6,
};
#define V4L2_CID_MPEG_VIDEO_H264_FMO_SLICE_GROUP (V4L2_CID_MPEG_BASE+373)
#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_DIRECTION (V4L2_CID_MPEG_BASE+374)
enum v4l2_mpeg_video_h264_fmo_change_dir {
V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_RIGHT = 0,
V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_LEFT = 1,
};
#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_RATE (V4L2_CID_MPEG_BASE+375)
#define V4L2_CID_MPEG_VIDEO_H264_FMO_RUN_LENGTH (V4L2_CID_MPEG_BASE+376)
#define V4L2_CID_MPEG_VIDEO_H264_ASO (V4L2_CID_MPEG_BASE+377)
#define V4L2_CID_MPEG_VIDEO_H264_ASO_SLICE_ORDER (V4L2_CID_MPEG_BASE+378)
#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING (V4L2_CID_MPEG_BASE+379)
#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE (V4L2_CID_MPEG_BASE+380)
enum v4l2_mpeg_video_h264_hierarchical_coding_type {
V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_B = 0,
V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_P = 1,
};
#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER (V4L2_CID_MPEG_BASE+381)
#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP (V4L2_CID_MPEG_BASE+382)
#define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE+400)
#define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE+401)
#define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE+402)
#define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP (V4L2_CID_MPEG_BASE+403)
#define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP (V4L2_CID_MPEG_BASE+404)
#define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL (V4L2_CID_MPEG_BASE+405)
enum v4l2_mpeg_video_mpeg4_level {
V4L2_MPEG_VIDEO_MPEG4_LEVEL_0 = 0,
V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B = 1,
V4L2_MPEG_VIDEO_MPEG4_LEVEL_1 = 2,
V4L2_MPEG_VIDEO_MPEG4_LEVEL_2 = 3,
V4L2_MPEG_VIDEO_MPEG4_LEVEL_3 = 4,
V4L2_MPEG_VIDEO_MPEG4_LEVEL_3B = 5,
V4L2_MPEG_VIDEO_MPEG4_LEVEL_4 = 6,
V4L2_MPEG_VIDEO_MPEG4_LEVEL_5 = 7,
};
#define V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE (V4L2_CID_MPEG_BASE+406)
enum v4l2_mpeg_video_mpeg4_profile {
V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE = 0,
V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE = 1,
V4L2_MPEG_VIDEO_MPEG4_PROFILE_CORE = 2,
V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE_SCALABLE = 3,
V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 4,
};
#define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (V4L2_CID_MPEG_BASE+407)
/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0)
enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0,
V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1,
};
#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1)
#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2)
enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0,
V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2,
V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3,
V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4,
};
#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3)
enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type {
V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0,
V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
};
#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4)
enum v4l2_mpeg_cx2341x_video_temporal_filter_mode {
V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0,
V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1,
};
#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5)
#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6)
enum v4l2_mpeg_cx2341x_video_median_filter_type {
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0,
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1,
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2,
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3,
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4,
};
#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7)
#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8)
#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9)
#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11)
/* MPEG-class control IDs specific to the Samsung MFC 5.1 driver as defined by V4L2 */
#define V4L2_CID_MPEG_MFC51_BASE (V4L2_CTRL_CLASS_MPEG | 0x1100)
#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY (V4L2_CID_MPEG_MFC51_BASE+0)
#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE (V4L2_CID_MPEG_MFC51_BASE+1)
#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE (V4L2_CID_MPEG_MFC51_BASE+2)
enum v4l2_mpeg_mfc51_video_frame_skip_mode {
V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED = 0,
V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1,
V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2,
};
#define V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE (V4L2_CID_MPEG_MFC51_BASE+3)
enum v4l2_mpeg_mfc51_video_force_frame_type {
V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_DISABLED = 0,
V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME = 1,
V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_NOT_CODED = 2,
};
#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING (V4L2_CID_MPEG_MFC51_BASE+4)
#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING_YUV (V4L2_CID_MPEG_MFC51_BASE+5)
#define V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT (V4L2_CID_MPEG_MFC51_BASE+6)
#define V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF (V4L2_CID_MPEG_MFC51_BASE+7)
#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_ACTIVITY (V4L2_CID_MPEG_MFC51_BASE+50)
#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_DARK (V4L2_CID_MPEG_MFC51_BASE+51)
#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_SMOOTH (V4L2_CID_MPEG_MFC51_BASE+52)
#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_MPEG_MFC51_BASE+53)
#define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_MPEG_MFC51_BASE+54)
/* Camera class control IDs */
#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
#define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1)
enum v4l2_exposure_auto_type {
V4L2_EXPOSURE_AUTO = 0,
V4L2_EXPOSURE_MANUAL = 1,
V4L2_EXPOSURE_SHUTTER_PRIORITY = 2,
V4L2_EXPOSURE_APERTURE_PRIORITY = 3
};
#define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2)
#define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3)
#define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4)
#define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5)
#define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6)
#define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7)
#define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8)
#define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9)
#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10)
#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11)
#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12)
#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13)
#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14)
#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15)
#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
#define V4L2_CID_AUTO_EXPOSURE_BIAS (V4L2_CID_CAMERA_CLASS_BASE+19)
#define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (V4L2_CID_CAMERA_CLASS_BASE+20)
enum v4l2_auto_n_preset_white_balance {
V4L2_WHITE_BALANCE_MANUAL = 0,
V4L2_WHITE_BALANCE_AUTO = 1,
V4L2_WHITE_BALANCE_INCANDESCENT = 2,
V4L2_WHITE_BALANCE_FLUORESCENT = 3,
V4L2_WHITE_BALANCE_FLUORESCENT_H = 4,
V4L2_WHITE_BALANCE_HORIZON = 5,
V4L2_WHITE_BALANCE_DAYLIGHT = 6,
V4L2_WHITE_BALANCE_FLASH = 7,
V4L2_WHITE_BALANCE_CLOUDY = 8,
V4L2_WHITE_BALANCE_SHADE = 9,
};
#define V4L2_CID_WIDE_DYNAMIC_RANGE (V4L2_CID_CAMERA_CLASS_BASE+21)
#define V4L2_CID_IMAGE_STABILIZATION (V4L2_CID_CAMERA_CLASS_BASE+22)
#define V4L2_CID_ISO_SENSITIVITY (V4L2_CID_CAMERA_CLASS_BASE+23)
#define V4L2_CID_ISO_SENSITIVITY_AUTO (V4L2_CID_CAMERA_CLASS_BASE+24)
enum v4l2_iso_sensitivity_auto_type {
V4L2_ISO_SENSITIVITY_MANUAL = 0,
V4L2_ISO_SENSITIVITY_AUTO = 1,
};
#define V4L2_CID_EXPOSURE_METERING (V4L2_CID_CAMERA_CLASS_BASE+25)
enum v4l2_exposure_metering {
V4L2_EXPOSURE_METERING_AVERAGE = 0,
V4L2_EXPOSURE_METERING_CENTER_WEIGHTED = 1,
V4L2_EXPOSURE_METERING_SPOT = 2,
};
#define V4L2_CID_SCENE_MODE (V4L2_CID_CAMERA_CLASS_BASE+26)
enum v4l2_scene_mode {
V4L2_SCENE_MODE_NONE = 0,
V4L2_SCENE_MODE_BACKLIGHT = 1,
V4L2_SCENE_MODE_BEACH_SNOW = 2,
V4L2_SCENE_MODE_CANDLE_LIGHT = 3,
V4L2_SCENE_MODE_DAWN_DUSK = 4,
V4L2_SCENE_MODE_FALL_COLORS = 5,
V4L2_SCENE_MODE_FIREWORKS = 6,
V4L2_SCENE_MODE_LANDSCAPE = 7,
V4L2_SCENE_MODE_NIGHT = 8,
V4L2_SCENE_MODE_PARTY_INDOOR = 9,
V4L2_SCENE_MODE_PORTRAIT = 10,
V4L2_SCENE_MODE_SPORTS = 11,
V4L2_SCENE_MODE_SUNSET = 12,
V4L2_SCENE_MODE_TEXT = 13,
};
#define V4L2_CID_3A_LOCK (V4L2_CID_CAMERA_CLASS_BASE+27)
#define V4L2_LOCK_EXPOSURE (1 << 0)
#define V4L2_LOCK_WHITE_BALANCE (1 << 1)
#define V4L2_LOCK_FOCUS (1 << 2)
#define V4L2_CID_AUTO_FOCUS_START (V4L2_CID_CAMERA_CLASS_BASE+28)
#define V4L2_CID_AUTO_FOCUS_STOP (V4L2_CID_CAMERA_CLASS_BASE+29)
#define V4L2_CID_AUTO_FOCUS_STATUS (V4L2_CID_CAMERA_CLASS_BASE+30)
#define V4L2_AUTO_FOCUS_STATUS_IDLE (0 << 0)
#define V4L2_AUTO_FOCUS_STATUS_BUSY (1 << 0)
#define V4L2_AUTO_FOCUS_STATUS_REACHED (1 << 1)
#define V4L2_AUTO_FOCUS_STATUS_FAILED (1 << 2)
#define V4L2_CID_AUTO_FOCUS_RANGE (V4L2_CID_CAMERA_CLASS_BASE+31)
enum v4l2_auto_focus_range {
V4L2_AUTO_FOCUS_RANGE_AUTO = 0,
V4L2_AUTO_FOCUS_RANGE_NORMAL = 1,
V4L2_AUTO_FOCUS_RANGE_MACRO = 2,
V4L2_AUTO_FOCUS_RANGE_INFINITY = 3,
};
/* FM Modulator class control IDs */
#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1)
#define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2)
#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3)
#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5)
#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65)
#define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66)
#define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80)
#define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81)
#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82)
#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83)
#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84)
#define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96)
#define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97)
#define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98)
#define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112)
enum v4l2_preemphasis {
V4L2_PREEMPHASIS_DISABLED = 0,
V4L2_PREEMPHASIS_50_uS = 1,
V4L2_PREEMPHASIS_75_uS = 2,
};
#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113)
#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114)
/* Flash and privacy (indicator) light controls */
#define V4L2_CID_FLASH_CLASS_BASE (V4L2_CTRL_CLASS_FLASH | 0x900)
#define V4L2_CID_FLASH_CLASS (V4L2_CTRL_CLASS_FLASH | 1)
#define V4L2_CID_FLASH_LED_MODE (V4L2_CID_FLASH_CLASS_BASE + 1)
enum v4l2_flash_led_mode {
V4L2_FLASH_LED_MODE_NONE,
V4L2_FLASH_LED_MODE_FLASH,
V4L2_FLASH_LED_MODE_TORCH,
};
#define V4L2_CID_FLASH_STROBE_SOURCE (V4L2_CID_FLASH_CLASS_BASE + 2)
enum v4l2_flash_strobe_source {
V4L2_FLASH_STROBE_SOURCE_SOFTWARE,
V4L2_FLASH_STROBE_SOURCE_EXTERNAL,
};
#define V4L2_CID_FLASH_STROBE (V4L2_CID_FLASH_CLASS_BASE + 3)
#define V4L2_CID_FLASH_STROBE_STOP (V4L2_CID_FLASH_CLASS_BASE + 4)
#define V4L2_CID_FLASH_STROBE_STATUS (V4L2_CID_FLASH_CLASS_BASE + 5)
#define V4L2_CID_FLASH_TIMEOUT (V4L2_CID_FLASH_CLASS_BASE + 6)
#define V4L2_CID_FLASH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 7)
#define V4L2_CID_FLASH_TORCH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 8)
#define V4L2_CID_FLASH_INDICATOR_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 9)
#define V4L2_CID_FLASH_FAULT (V4L2_CID_FLASH_CLASS_BASE + 10)
#define V4L2_FLASH_FAULT_OVER_VOLTAGE (1 << 0)
#define V4L2_FLASH_FAULT_TIMEOUT (1 << 1)
#define V4L2_FLASH_FAULT_OVER_TEMPERATURE (1 << 2)
#define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3)
#define V4L2_FLASH_FAULT_OVER_CURRENT (1 << 4)
#define V4L2_FLASH_FAULT_INDICATOR (1 << 5)
#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)
/* JPEG-class control IDs */
#define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900)
#define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1)
#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1)
enum v4l2_jpeg_chroma_subsampling {
V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0,
V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1,
V4L2_JPEG_CHROMA_SUBSAMPLING_420 = 2,
V4L2_JPEG_CHROMA_SUBSAMPLING_411 = 3,
V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4,
V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5,
};
#define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2)
#define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3)
#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4)
#define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0)
#define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1)
#define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16)
#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
/* Image source controls */
#define V4L2_CID_IMAGE_SOURCE_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_SOURCE | 0x900)
#define V4L2_CID_IMAGE_SOURCE_CLASS (V4L2_CTRL_CLASS_IMAGE_SOURCE | 1)
#define V4L2_CID_VBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1)
#define V4L2_CID_HBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2)
#define V4L2_CID_ANALOGUE_GAIN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3)
/* Image processing controls */
#define V4L2_CID_IMAGE_PROC_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_PROC | 0x900)
#define V4L2_CID_IMAGE_PROC_CLASS (V4L2_CTRL_CLASS_IMAGE_PROC | 1)
#define V4L2_CID_LINK_FREQ (V4L2_CID_IMAGE_PROC_CLASS_BASE + 1)
#define V4L2_CID_PIXEL_RATE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 2)
#define V4L2_CID_TEST_PATTERN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 3)
#endif
File diff suppressed because it is too large Load Diff
+54
View File
@@ -0,0 +1,54 @@
End User License Agreement
THIS END USER LICENSE AGREEMENT (“AGREEMENT”) IS A LEGAL AGREEMENT BETWEEN YOU (EITHER A SINGLE INDIVIDUAL, OR SINGLE LEGAL ENTITY) AND【 Amlogic Technology Co., Ltd. 】 (HERE AFTER REFERRED TO AS"【 Amlogic 】") FOR THE USE OF THE SOFTWARE ACCOMPANYING THIS AGREEMENT. 【 Amlogic 】 IS ONLY WILLING TO LICENSE THE SOFTWARE TO YOU ON CONDITION THAT YOU ACCEPT ALL OF THE TERMS IN THIS AGREEMENT. BY DOWNDOADING OR BY INSTALLING OR OTHERWISE USING OR COPYING THE SOFTWARE YOU INDICATE THAT YOU AGREE TO BE BOUND BY ALL OF THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT,【 Amlogic 】 WILL NOT LICENSE THE SOFTWARE TO YOU AND YOU MAY NOT INSTALL, USE OR COPY THE SOFTWARE, AND YOU SHALL PROMPTLY DESTROY, DELETE, OR RETURN THE SOFTWARE TO YOUR SUPPLIER.
“SOFTWARE” means the software in object code provided under the terms of this Agreement.
【HuiZhou,Guangdong Province, China】 is the signing place of this Agreement.
1.GRANT OF LICENSE
In consideration of your agreement to abide by the following terms, and subject to the terms and conditions of this Agreement, 【 Amlogic 】 hereby grants YOU, a non-transferable, non-exclusive, royalty-free, revocable, worldwide copyright license (without the right to sublicense) to internally use and copy the SOFTWARE to 【usage mode eg.“set up internal development environment with development boards”】 integrating 【 Amlogic 】 【product type of the licensor,eg.“chips”】, solely for the purpose of【purpose of use for the SOFTWARE,eg.“designing, developing or testing your applications”】 .
All rights to the SOFTWARE and all intellectual property rights contained therein are reserved and shall remain the sole and exclusive property of 【 Amlogic 】. The SOFTWARE is licensed but not sold. Except as expressly licensed in Clause 1, in no event shall the license granted in this Clause 1 be construed as granting YOU expressly or by implication, estoppels or otherwise, licenses to any intellectual property rights, including but not limited to patent rights, copyrights, trademark or trade secret in the SOFTWARE.
No right is granted to YOU under this Agreement to manufacture, have manufactured, or sell, supply or distribute any products which use or embody any of the SOFTWARE or any of the intellectual property rights embodied therein.
2.RESTRICTIONS
YOU shall reproduce and not remove or obscure any notice incorporated by 【 Amlogic 】 in the SOFTWARE to protect 【 Amlogic 】’s intellectual property rights embodied therein.
YOU shall not decompile, disassemble, or reverse engineer the SOFTWARE.
YOU shall not distribute the SOFTWARE under an open source license as listed by the Open Source Initiative (a non-profit corporation whose website is www.opensource.org), or other license which requires the source code or object code of the SOFTWARE to be licensed or otherwise shared with any third party.
3.CONFLICT WITH OPEN SOURCE SOFTWARE LICENSE
The SOFTWARE may contain open source software. If the license applied on such open source software has conflict with this Agreement, the license applied on such open source software will prevail and apply to the open source software.
4.FEEDBACK
YOU may choose to provide suggestions, comments, feedback, ideas, modifications or know-how (whether in oral or written form) relating to the use of the SOFTWARE ("Feedback") to 【 Amlogic 】 under the terms of this Agreement. YOU hereby grants to 【 Amlogic 】 and its affiliates, under all of you and your affiliates (as applicable) intellectual property rights, a perpetual, irrevocable, royalty free, non-exclusive, worldwide license to (i) use, copy and modify the Feedback; (ii) sell, supply, or otherwise distribute the Feedback; (iii) design, have designed, manufacture, have manufactured, use, import, sell, and otherwise distribute and dispose of products that incorporate the Feedback; and (iv) sublicense (together with the rights to further sublicense) the rights granted in this paragraph to any third party.
5.NO WARRANTY
YOU AGREE THAT THE SOFTWARE IS PROVIDED BY 【 Amlogic 】 ON AN "AS IS" BASIS. 【 Amlogic 】 MAKES NO WARRANTY, EXPRESSED OR IMPLIED OR STATUTORY, WITH RESPECT TO ANY OF THE SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.
YOU EXPRESSLY ASSUME ALL LIABILITIES AND RISKS, FOR USE OR OPERATION OF THE SOFTWARE, INCLUDING WITHOUT LIMITATION, SOFTWARE APPLICATIONS DESIGNED OR INTENDED FOR MISSION CRITICAL APPLICATIONS, SUCH AS PACEMAKERS, WEAPONRY, AIRCRAFT NAVIGATION, FACTORY CONTROL SYSTEMS, ETC. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
6.NO LIABILITY
PLEASE NOTE THAT YOU SHOULD USE THE SOFTWARE AT YOUR OWN RISK.
IN NO EVENT SHALL 【 Amlogic 】 BE LIABLE FOR ANY DIRECT OR INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHER LEGAL THEORY, EVEN IF 【 Amlogic 】 HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. EVEN IF THE SOFTWARE HAS ANY MATERIAL, VERIFIABLE, AND REPRODUCIBLE PROGRAM ERRORS, 【 Amlogic 】 SHALL HAVE NO LIABILITY TO MODIFY SUCH ERRORS.
NOTWITHSTANDING ANYTHING TO THE CONTRARY CONTAINED IN THIS AGREEMENT, THE MAXIMUM LIABILITY OF 【 Amlogic 】 TO YOU IN AGGREGATE FOR ALL CLAIMS MADE AGAINST 【 Amlogic 】 IN CONTRACT TORT OR OTHERWISE UNDER OR IN CONNECTION WITH THE SUBJECT MATTER OF THIS AGREEMENT SHALL NOT EXCEED THE TOTAL OF SUMS RECEIVED BY 【 Amlogic 】 FROM YOU FOR THIS AGREEMENT. THE EXISTENCE OF MORE THAN ONE CLAIM WILL NOT ENLARGE OR EXTEND THE LIMIT.
7.CONFIDENTIALITY
YOU acknowledge and agree that the SOFTWARE provided under this Agreement contain trade secrets and confidential material of 【 Amlogic 】 and YOU agree to maintain all such information in confidence and apply security measures no less stringent than the measures which YOU apply to protect your own like information, but not less than a reasonable degree of care, to prevent their unauthorized disclosure and use. The period of confidentiality shall be indefinite. YOU agree not to use any such information other than in normal use of the SOFTWARE under the license granted in this Agreement.
8.TERM AND TERMINATION
This Agreement shall remain in force until terminated. 【 Amlogic 】 may terminate this Agreement at any time with or without any cause. Upon termination of this Agreement, YOU shall immediately stop using the SOFTWARE and confidential information and destroy all copies of the SOFTWARE and confidential information in your possession, together with all documentation and related materials. The provisions of clauses 2, 3, 4, 5, 6, 78 and 9 shall survive termination of this Agreement.
9.GENERAL
Any provision of this Agreement which is prohibited or unenforceable in any jurisdiction shall be ineffective to the extent of such prohibition or unenforceability without affecting, impairing or invalidating the remaining provisions hereof.
The failure by 【Amlogic】 to enforce any of the provisions of this Agreement, unless waived in writing, shall not constitute a waiver of 【Amlogic】's rights to enforce such provision or any other provision of this Agreement in the future.
This Agreement shall be governed by and construed in accordance with the laws of Peoples Republic of China, without reference to the principles of conflicts of laws. Any dispute arising out of or relating to this Agreement shall be submitted to 【favorite court of the licensor】and the parties waive all objections to that jurisdiction and venue.
Copyright (C) 【2022】【Amlogic Technology Co., Ltd.】 All rights reserved.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+58
View File
@@ -0,0 +1,58 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# 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.
import("//build/ohos.gni")
ohos_prebuilt_shared_library("libamplayer") {
source = "lib/libamplayer.so"
install_images = [ "vendor" ]
subsystem_name = "unionman_products"
part_name = "unionman_products"
}
ohos_executable("kplayer") {
install_enable = true
sources = [ "samples/kplayer.c" ]
install_images = [ "vendor" ]
cflags = [
"-fno-rtti",
"-fno-exceptions",
"-fno-common",
"-fstack-protector-strong",
"-Wshadow",
"-FPIC",
"-FS",
"-O2",
"-D_FORTIFY_SOURCE=2",
"-fvisibility=hidden",
"-Wno-error",
"-Wextra",
"-Wformat=2",
"-Wfloat-equal",
"-Wdate-time",
]
deps = [
":libamplayer",
"audio_render:libamplayer_audio_render",
]
include_dirs = [
"include",
"../libamcodec/include",
]
subsystem_name = "unionman_products"
part_name = "unionman_products"
}
+62
View File
@@ -0,0 +1,62 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# 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.
import("//build/ohos.gni")
ohos_shared_library("libamplayer_audio_render") {
install_enable = true
install_images = [ "vendor" ]
sources = [ "amplayer_audio_render_adapter.cpp" ]
include_dirs = [
"//utils/native/base/include",
"//drivers/peripheral/audio/interfaces/include",
"//drivers/peripheral/audio/hal/hdi_binder/proxy/include/",
"//drivers/peripheral/base",
"//foundation/multimedia/audio_framework/frameworks/native/hdiadapter/sink/primary",
"//foundation/multimedia/audio_framework/frameworks/native/hdiadapter/sink/common",
"../include",
]
configs = [
"//foundation/graphic/graphic_2d/frameworks/surface:surface_public_config",
"//foundation/multimedia/player_framework/services/utils:media_service_utils_public_config",
]
deps = [ "//foundation/multimedia/audio_framework/frameworks/native/hdiadapter/sink:audio_renderer_sink" ]
external_deps = [
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
]
cflags = [
"-fno-rtti",
"-fno-exceptions",
"-Wall",
"-fno-common",
"-fstack-protector-strong",
"-FPIC",
"-FS",
"-O2",
"-D_FORTIFY_SOURCE=2",
"-fvisibility=hidden",
"-Wformat=2",
"-Wfloat-equal",
"-Wdate-time",
]
subsystem_name = "unionman_products"
part_name = "unionman_products"
}
@@ -0,0 +1,211 @@
/*
* Copyright (c) 2022 Unionman Technology Co., Ltd.
* 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.
*/
#include <mutex>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <thread>
#include <map>
#include <condition_variable>
#include "errors.h"
#include "media_log.h"
#include "audio_renderer_sink.h"
#include "audio_external_render.h"
namespace
{
constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN, "AMPLAYER_AUDIO_RENDER"};
}
namespace OHOS
{
namespace AudioStandard
{
AudioRendererSink *g_audioRendrSinkInstance = AudioRendererSink::GetInstance();
static int audio_render_init(struct audio_render_s *r)
{
MEDIA_LOGD("%{public}s() in", __func__);
CHECK_AND_RETURN_RET(!g_audioRendrSinkInstance->rendererInited_, 0);
AudioSinkAttr sample_attrs;
int32_t ret;
sample_attrs.adapterName = "primary";
sample_attrs.format = AUDIO_FORMAT_PCM_16_BIT;
sample_attrs.sampleFmt = AUDIO_FORMAT_PCM_16_BIT;
sample_attrs.sampleRate = 48000;
sample_attrs.channel = 2;
sample_attrs.volume = 1.0;
ret = g_audioRendrSinkInstance->Init(sample_attrs);
if (ret != 0) {
MEDIA_LOGE("Error: audiorender Init() failed!");
return -1;
}
return 0;
}
static int audio_render_finalize(struct audio_render_s *r)
{
MEDIA_LOGD("%{public}s() in", __func__);
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->rendererInited_, -1);
g_audioRendrSinkInstance->Stop();
g_audioRendrSinkInstance->DeInit();
return 0;
}
static int audio_render_config(struct audio_render_s *r, uint32_t channels,
uint32_t bits_per_sample, uint32_t sample_rate)
{
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->rendererInited_, -1);
MEDIA_LOGD("audio_render_config in, channels:%{public}d, sampleRate:%{public}d", channels, sample_rate);
return 0;
}
static int audio_render_write(struct audio_render_s *r, uint8_t *data, uint32_t size)
{
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->rendererInited_, -1);
MEDIA_LOGD("%{public}s() size=%{public}u", __func__, size);
uint64_t writeLen = 0;
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->RenderFrame(*((char *)data), size, writeLen) == 0, -1);
return (int)writeLen;
}
static int audio_render_start(struct audio_render_s *r)
{
MEDIA_LOGD("%{public}s() in", __func__);
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->rendererInited_, -1);
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->Start() == 0, -1);
return 0;
}
static int audio_render_stop(struct audio_render_s *r)
{
MEDIA_LOGD("%{public}s() in", __func__);
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->rendererInited_, -1);
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->Stop() == 0, -1);
return 0;
}
static int audio_render_pause(struct audio_render_s *r)
{
MEDIA_LOGD("%{public}s() in", __func__);
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->rendererInited_, -1);
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->Pause() == 0, -1);
return 0;
}
static int audio_render_resume(struct audio_render_s *r)
{
MEDIA_LOGD("%{public}s() in", __func__);
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->rendererInited_, -1);
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->Resume() == 0, -1);
return 0;
}
static uint32_t get_latency_from_driver(struct audio_render_s *r)
{
uint32_t latency = 0;
char line[256];
FILE *fp = fopen("/proc/asound/card0/pcm1p/sub0/status", "rt");
if (!fp) {
return 0;
}
while (fgets(line, sizeof(line), fp)) {
line[sizeof(line) - 1] = '\0';
if (!strncmp(line, "delay", 5)) {
uint32_t frames = 0;
if (1 != sscanf(line, "%*[^:]:%u", &frames)) {
MEDIA_LOGE("Error: parse line failed: %{public}s", line);
break;
}
latency = (frames * 1000) / 48000;
// MEDIA_LOGD("get latency: %{public}u, %{public}u", frames, latency);
break;
}
}
fclose(fp);
return latency;
}
static uint32_t audio_render_get_latency(struct audio_render_s *r)
{
uint32_t latency;
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->rendererInited_, -1);
// CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->GetLatency(&latency) == 0, -1);
latency = get_latency_from_driver(r);
return latency;
}
static int audio_render_set_mute(struct audio_render_s *r, int mute)
{
MEDIA_LOGD("%{public}s() in. mute=%{public}d", __func__, mute);
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->rendererInited_, -1);
return 0;
}
static int audio_render_set_volume(struct audio_render_s *r, float volume)
{
MEDIA_LOGD("%{public}s() in. volume=%{public}f", __func__, volume);
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->rendererInited_, -1);
CHECK_AND_RETURN_RET(g_audioRendrSinkInstance->SetVolume(volume, volume) == 0, -1);
return 0;
}
static audio_render_t audio_render_ops = {
.init = audio_render_init,
.finalize = audio_render_finalize,
.config = audio_render_config,
.write = audio_render_write,
.start = audio_render_start,
.stop = audio_render_stop,
.pause = audio_render_pause,
.resume = audio_render_resume,
.get_latency = audio_render_get_latency,
.set_mute = audio_render_set_mute,
.set_volume = audio_render_set_volume
};
} // namespace AudioStandard
} // namespace OHOS
__attribute__((visibility("default"))) audio_render_t *audio_render_get(void)
{
return &OHOS::AudioStandard::audio_render_ops;
}
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2022 Unionman Technology Co., Ltd.
* 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 AMPLAYER_AUDIO_RENDER_ADAPTER
#define AMPLAYER_AUDIO_RENDER_ADAPTER
#include "audio_external_render.h"
#if defined(__cplusplus)
extern "C" {
#endif
audio_render_t *audio_render_get(void);
#if defined(__cplusplus)
} /* extern "C" */
#endif
#endif // AMPLAYER_AUDIO_RENDER_ADAPTER
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2022 Unionman Technology Co., Ltd.
* 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 AUDIO_EXTERNAL_RENDER_H
#define AUDIO_EXTERNAL_RENDER_H
#include <stdint.h>
#if defined(__cplusplus)
extern "C" {
#endif
typedef struct audio_render_s {
void *priv_data;
int (*init)(struct audio_render_s *r);
int (*finalize)(struct audio_render_s *r);
int (*config)(struct audio_render_s *r, uint32_t channels, uint32_t bits_per_sample, uint32_t sample_rate);
int (*write)(struct audio_render_s *r, uint8_t *data, uint32_t size);
int (*start)(struct audio_render_s *r);
int (*stop)(struct audio_render_s *r);
int (*pause)(struct audio_render_s *r);
int (*resume)(struct audio_render_s *r);
uint32_t (*get_latency)(struct audio_render_s *r); /* get latency in unit of ms */
int (*set_mute)(struct audio_render_s *r, int mute); /* 1: enable mute ; 0: disable mute */
int (*set_volume)(struct audio_render_s *r, float volume);
} audio_render_t;
audio_render_t *audio_render_get(void);
#if defined(__cplusplus)
} /* extern "C" */
#endif
#endif
+63
View File
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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 PLAYER_LOG_H
#define PLAYER_LOG_H
#define MAX_LOG_SIZE (20*1024)
__attribute__((format(printf, 2, 3)))
void log_lprint(const int level, const char *fmt, ...);
#define AM_LOG_PANIC 0
#define AM_LOG_FATAL 8
#define AM_LOG_ERROR 16
#define AM_LOG_WARNING 24
#define AM_LOG_INFO 32
#define AM_LOG_VERBOSE 40
#define AM_LOG_DEBUG 60
#define AM_LOG_DEBUG1 70
#define AM_LOG_DEBUG2 80
#define AM_LOG_TRACE 90
#ifdef ANDROID
#define log_print(fmt...) log_lprint(AM_LOG_INFO,##fmt)
#define log_error(fmt...) log_lprint(AM_LOG_ERROR,##fmt)
#define log_warning(fmt...) log_lprint(AM_LOG_WARNING,##fmt)
#define log_info(fmt...) log_lprint(AM_LOG_INFO,##fmt)
#else
#define log_print printf
#define log_error printf
#define log_warning printf
#define log_info printf
#endif
/*default global_level=5,
if the level<global_level print out
*/
#define log_debug(fmt...) log_lprint(AM_LOG_DEBUG,##fmt)
#define log_debug1(fmt...) log_lprint(AM_LOG_DEBUG1,##fmt)
#define log_debug2(fmt...) log_lprint(AM_LOG_DEBUG2,##fmt)
#define log_trace(fmt...) log_lprint(AM_LOG_TRACE,##fmt)
#define DEBUG_PN() log_print("[%s:%d]\n", __FUNCTION__, __LINE__)
void log_close(void);
int log_open(const char *name);
int update_loglevel_setting(void);
#endif
+107
View File
@@ -0,0 +1,107 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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 PLAYER_MESSAGE_H
#define PLAYER_MESSAGE_H
#define MESSAGE_MAX 8
#define CTRL_CMD_RESPONSE (0xffff)
typedef enum {
CMD_EXIT = (1 << 0),
CMD_PLAY = (1 << 1),
CMD_PLAY_START = (1 << 2),
CMD_STOP = (1 << 3),
CMD_START = (1 << 4),
CMD_NEXT = (1 << 5),
CMD_PREV = (1 << 6),
CMD_PAUSE = (1 << 7),
CMD_RESUME = (1 << 8),
CMD_SEARCH = (1 << 9),
CMD_FF = (1 << 10),
CMD_FB = (1 << 11),
CMD_SWITCH_AID = (1 << 12),
CMD_SWITCH_SID = (1 << 13),
CMD_SWITCH_TSPROGRAM= (1 << 14),
CMD_CTRL_MAX = (1 << 31),
} ctrl_cmd_t;
typedef enum {
CMD_LOOP = (1 << 0),
CMD_NOLOOP = (1 << 1),
CMD_BLACKOUT = (1 << 2),
CMD_NOBLACK = (1 << 3),
CMD_NOAUDIO = (1 << 4),
CMD_NOVIDEO = (1 << 5),
CMD_MUTE = (1 << 6),
CMD_UNMUTE = (1 << 7),
CMD_SET_VOLUME = (1 << 8),
CMD_SPECTRUM_SWITCH = (1 << 9),
CMD_SET_BALANCE = (1 << 10),
CMD_SWAP_LR = (1 << 11),
CMD_LEFT_MONO = (1 << 12),
CMD_RIGHT_MONO = (1 << 13),
CMD_SET_STEREO = (1 << 14),
CMD_EN_AUTOBUF = (1 << 15),
CMD_SET_AUTOBUF_LEV = (1 << 16),
CMD_SET_FREERUN_MODE = (1 << 17),
CMD_MODE_MAX = (1 << 31),
} ctrl_mode_t;
typedef enum {
CMD_GET_VOLUME = (1 << 0),
CMD_GET_VOL_RANGE = (1 << 1),
CMD_GET_PLAY_STA = (1 << 2),
CMD_GET_CURTIME = (1 << 3),
CMD_GET_DURATION = (1 << 4),
CMD_GET_MEDIA_INFO = (1 << 5),
CMD_LIST_PID = (1 << 6),
CMD_GET_MAX = (1 << 31),
} get_info_t;
typedef struct {
float min;
float max;
} volume_range_t;
typedef struct {
ctrl_cmd_t ctrl_cmd;
get_info_t info_cmd;
ctrl_mode_t set_mode;
int pid;
int cid;
union {
char *filename;
char *file_list;
int param;
float f_param;
};
union {
int param1;
float f_param1;
};
union {
int param2;
float f_param2;
};
} player_cmd_t;
int message_free(player_cmd_t * cmd);
player_cmd_t * message_alloc(void);
int cmd2str(player_cmd_t *cmd, char *buf);
#endif
+132
View File
@@ -0,0 +1,132 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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 _PLAYER_H_
#define _PLAYER_H_
#include <stdint.h>
//#include <codec.h>
#include <player_type.h>
#include <player_error.h>
#include <message.h>
#include <player_dump.h>
#include <player_set_sys.h>
#ifdef __cplusplus
extern "C" {
#endif
int player_init();
int player_start(play_control_t *p, unsigned long priv);
int player_stop(int pid);
int player_stop_async(int pid);
int player_exit(int pid);
int player_pause(int pid);
int player_resume(int pid);
int player_timesearch(int pid, float s_time);
int player_forward(int pid, int speed);
int player_backward(int pid, int speed);
int player_aid(int pid, int audio_id);
int player_sid(int pid, int sub_id);
int player_switch_program(int pid, int video_pid, int audio_pid);
int player_progress_exit(void);
int player_list_allpid(pid_info_t *pid);
int check_pid_valid(int pid);
int player_get_play_info(int pid, player_info_t *info);
int player_get_media_info(int pid, media_info_t *minfo);
int player_video_overlay_en(unsigned enable);
int player_start_play(int pid);
int player_send_message(int pid, player_cmd_t *cmd);
player_status player_get_state(int pid);
unsigned int player_get_extern_priv(int pid);
int player_enable_autobuffer(int pid, int enable);
int player_set_autobuffer_level(int pid, float min, float middle, float max);
int player_set_disp_lastframe(int pid, int disp);
int player_get_bitrate(int pid);
int audio_set_mute(int pid, int mute);
int audio_get_volume_range(int pid, float *min, float *max);
int audio_set_volume(int pid, float val);
int audio_get_volume(int pid, float *val);
// set audio adec pre_gain dB format
int audio_set_pre_gain(int pid, float gain);
int audio_get_pre_gain(int pid, float *gain);
int audio_set_pre_mute(int pid, uint32_t mute);
int audio_get_pre_mute(int pid, uint32_t *mute);
int audio_set_lrvolume(int pid, float lvol, float rvol);
int audio_get_lrvolume(int pid, float* lvol, float* rvol);
int audio_set_volume_balance(int pid, int balance);
int audio_swap_left_right(int pid);
int audio_left_mono(int pid);
int audio_right_mono(int pid);
int audio_stereo(int pid);
int audio_lr_mix_set(int pid, int enable);
int audio_cur_pcmpara_Applied_get(int pid, int *pfs, int *pch,int *lfepresent);
int audio_set_spectrum_switch(int pid, int isStart, int interval);
int player_register_update_callback(callback_t *cb, update_state_fun_t up_fn, int interval_s);
char *player_status2str(player_status status);
char *player_value2str(char *key, int value);
int player_cache_system_init(int enable, const char*dir, int max_size, int block_size);
int resume_auto_refresh_rate();
//control interface
int player_loop(int pid);
int player_noloop(int pid);
int check_url_type(char *filename);
int play_list_player(play_control_t *pctrl, unsigned long priv);
//freescale
int enable_freescale(int cfg);
int disable_freescale(int cfg);
int disable_freescale_MBX();
int enable_2Xscale();
int enable_2XYscale();
int enable_freescale_MBX();
int disable_2X_2XYscale();
int GL_2X_scale(int mSwitch);
int wait_play_end();
int wait_video_unreg();
int clear_video_buf();
int freescale_is_enable();
int64_t player_get_lpbufbuffedsize(int pid);
int64_t player_get_streambufbuffedsize(int pid);
int audio_get_decoder_enable(int pid);
int player_closeCodec(int pid);
//int player_get_sub_odata(int pid, amsub_info_t *amsub_info);
int player_get_sub_start_pts(int pid, unsigned int *start_pts);
int player_set_sub_filename(int pid, const char* filename);
int player_get_current_time(int pid, unsigned int* curr_timeMs);
int player_get_curr_sub_id(int pid, int *curr_sub_id);
// streaming protocol api, hls/dash etc.
int player_get_source_type(int pid);
int player_get_streaming_track_count(int pid, int * trackNum);
int player_get_streaming_track_info(int pid, int * info_num, av_stream_info_t *** info_t);
int player_select_streaming_track(int pid, int index, int select);
int player_get_streaming_selected_track(int pid, int type, int * selected_track);
int audio_set_playback_rate(int pid,void *rate);
int player_set_inner_exit(int pid);
int player_is_inner_exit(int pid);
#ifdef __cplusplus
}
#endif
#endif
+20
View File
@@ -0,0 +1,20 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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.
*/
/*
Just for old code compatible,no this header file may get compare error.
we can add more player controls to here later.
*/
+30
View File
@@ -0,0 +1,30 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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 _PLAYER_DUMP_H_
#define _PLAYER_DUMP_H_
#ifdef __cplusplus
extern "C" {
#endif
int player_dump_playinfo(int pid, int fd);
int player_dump_bufferinfo(int pid, int fd);
int player_dump_tsyncinfo(int pid, int fd);
#ifdef __cplusplus
}
#endif
#endif
+79
View File
@@ -0,0 +1,79 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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 _PLAYER_ERROR_H_
#define _PLAYER_ERROR_H_
#define P_PRE (0x02000000)
#define F_PRE (0x03000000)
#define X_PRE (0x04000000)
#define D_PRE (0x05000000)
#define PLAYER_SUCCESS (0)
#define PLAYER_FAILED (-(P_PRE|0x01))
#define PLAYER_NOMEM (-(P_PRE|0x02))
#define PLAYER_EMPTY_P (-(P_PRE|0x03))
#define PLAYER_NOT_VALID_PID (-(P_PRE|0x04))
#define PLAYER_CAN_NOT_CREAT_THREADS (-(P_PRE|0x05))
#define PLAYER_ERROR_PARAM (-(P_PRE|0x06))
#define PLAYER_ERROR_CALLBACK (-(P_PRE|0x07))
#define PLAYER_RD_FAILED (-(P_PRE|0x11))
#define PLAYER_RD_EMPTYP (-(P_PRE|0x12))
#define PLAYER_RD_TIMEOUT (-(P_PRE|0x13))
#define PLAYER_RD_AGAIN (-(P_PRE|0x14))
#define PLAYER_WR_FAILED (-(P_PRE|0x21))
#define PLAYER_WR_EMPTYP (-(P_PRE|0x22))
#define PLAYER_WR_AGAIN (-(P_PRE|0x23))
#define PLAYER_WR_FINISH (P_PRE|0x1)
#define PLAYER_PTS_ERROR (-(P_PRE|0x31))
#define PLAYER_NO_DECODER (-(P_PRE|0x32))
#define DECODER_RESET_FAILED (-(P_PRE|0x33))
#define DECODER_INIT_FAILED (-(P_PRE|0x34))
#define PLAYER_UNSUPPORT (-(P_PRE|0x35))
#define PLAYER_UNSUPPORT_VIDEO (-(P_PRE|0x36))
#define PLAYER_UNSUPPORT_AUDIO (-(P_PRE|0x37))
#define PLAYER_SEEK_OVERSPILL (-(P_PRE|0x38))
#define PLAYER_CHECK_CODEC_ERROR (-(P_PRE|0x39))
#define PLAYER_INVALID_CMD (-(P_PRE|0x40))
#define PLAYER_REAL_AUDIO_FAILED (-(P_PRE|0x41))
#define PLAYER_ADTS_NOIDX (-(P_PRE|0x42))
#define PLAYER_SEEK_FAILED (-(P_PRE|0x43))
#define PLAYER_NO_VIDEO (-(P_PRE|0x44))
#define PLAYER_NO_AUDIO (-(P_PRE|0x45))
#define PLAYER_SET_NOVIDEO (-(P_PRE|0x46))
#define PLAYER_SET_NOAUDIO (-(P_PRE|0x47))
#define PLAYER_FFFB_UNSUPPORT (-(P_PRE|0x48))
#define PLAYER_UNSUPPORT_VCODEC (-(P_PRE|0x49))
#define PLAYER_UNSUPPORT_ACODEC (-(P_PRE|0x4a))
#define FFMPEG_SUCCESS (0)
#define FFMPEG_OPEN_FAILED (-(F_PRE|0x1))
#define FFMPEG_PARSE_FAILED (-(F_PRE|0x2))
#define FFMPEG_EMP_POINTER (-(F_PRE|0x3))
#define FFMPEG_NO_FILE (-(F_PRE|0x4))
#define DIVX_SUCCESS (0)
#define DIVX_AUTHOR_ERR (-(X_PRE|0x1))
#define DIVX_EXPIRED (-(X_PRE|0x2))
#define DRM_NOERROR (0)
#define DRM_UNSUPPORT (-(D_PRE|0x1))
char * player_error_msg(int error);
#endif
+30
View File
@@ -0,0 +1,30 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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 PLAYER_ID_MGT__
#define PLAYER_ID_MGT__
int player_request_pid(void);
int player_release_pid(int pid);
int player_init_pid_data(int pid, void * data);
void * player_open_pid_data(int pid);
int player_close_pid_data(int pid);
int player_id_pool_init(void);
int player_list_pid(char id[], int size);
#endif
+107
View File
@@ -0,0 +1,107 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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 _PLAYER_SET_DISP_H_
#define _PLAYER_SET_DISP_H_
#include "audio_external_render.h"
#define MID_800_400_FREESCALE (0x10001) //mid 800*400
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
DISP_MODE_480I = 1,
DISP_MODE_480P = 2,
DISP_MODE_576I = 3,
DISP_MODE_576P = 4,
DISP_MODE_720P = 5,
DISP_MODE_1080I = 6,
DISP_MODE_1080P = 7
}
display_mode;
typedef struct {
display_mode disp_mode;
int osd_disble_coordinate[8];
int osd_enable_coordinate[8];
int video_enablecoordinate[4];
int fb0_freescale_width;
int fb0_freescale_height;
int fb1_freescale_width;
int fb1_freescale_height;
} freescale_setting_t;
int set_sysfs_str(const char *path, const char *val);
int get_sysfs_str(const char *path, char *valstr, int size);
int set_sysfs_int(const char *path, int val);
int get_sysfs_int(const char *path);
int set_black_policy(int blackout);
int get_black_policy();
int set_tsync_enable(int enable);
int get_tsync_enable(void);
int set_tsync_discontinue(int enable);
int get_pts_discontinue();
int set_fb0_blank(int blank);
int set_fb1_blank(int blank);
int set_subtitle_num(int num);
int av_get_subtitle_curr();
int set_subtitle_startpts(int pts);
int set_subtitle_fps(int fps);
int set_subtitle_subtype(int subtype);
void get_display_mode(char *mode);
int set_fb0_freescale(int freescale);
int set_fb1_freescale(int freescale);
int set_display_axis(int *coordinate);
int set_video_axis(int *coordinate);
int set_fb0_scale_width(int width);
int set_fb0_scale_height(int height);
int set_fb1_scale_width(int width);
int set_fb1_scale_height(int height);
int check_audiodsp_fatal_err(void);
int set_stb_source_hiu(void);
int set_stb_demux_source_hiu(void);
int set_subtitle_enable(int num);
int set_subtitle_curr(int num);
int check_file_same(char *filename2);
int set_auto_refresh_rate(int enable);
int get_auto_refresh_rate();
int reset_auto_refresh_rate();
//player sysfs API channel
int set_amutils_enable(int isOn);
int set_amutils_cmd(const char* cmd);
int get_amutils_cmd(char* cmd);
int check_audio_output();
int set_poweron_clock_level(int level);
int get_di_prog_proc_config();
int set_di_prog_proc_config(int val);
int get_di_detect_3d_enable();
int set_di_detect_3d_enable(int val);
int set_audio_external_render(audio_render_t *render);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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 PLAYER_THUMBNAIL_H
#define PLAYER_THUMBNAIL_H
#ifdef __cplusplus
extern "C" {
#endif
void * thumbnail_res_alloc(void);
int thumbnail_find_stream_info(void *handle, const char* filename);
int thumbnail_find_stream_info_end(void *handle);
int thumbnail_decoder_open(void *handle, const char* filename);
int thumbnail_extract_video_frame(void * handle, int64_t time, int flag);
int thumbnail_read_frame(void *handle, char* buffer);
void thumbnail_get_video_size(void *handle, int* width, int* height);
float thumbnail_get_aspect_ratio(void *handle);
void thumbnail_get_duration(void *handle, int64_t *duration);
int thumbnail_get_key_metadata(void* handle, char* key, const char** value);
int thumbnail_get_key_data(void* handle, char* key, const void** data, int* data_size);
void thumbnail_get_video_rotation(void *handle, int* rotation);
int thumbnail_decoder_close(void *handle);
void thumbnail_res_free(void* handle);
int thumbnail_get_tracks_info(void *handle, int *vtracks, int *atracks, int *stracks);
#ifdef __cplusplus
}
#endif
#endif
+355
View File
@@ -0,0 +1,355 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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 _PLAYER_TYPE_H_
#define _PLAYER_TYPE_H_
//#include <libavformat/avformat.h>
#include <stdint.h>
#include <stream_format.h>
#define MSG_SIZE 64
#define MAX_VIDEO_STREAMS 10
#define MAX_AUDIO_STREAMS 16
#define MAX_SUB_INTERNAL 64
#define MAX_SUB_EXTERNAL 24
#define MAX_SUB_STREAMS (MAX_SUB_INTERNAL + MAX_SUB_EXTERNAL)
#define MAX_PLAYER_THREADS 32
#define CALLBACK_INTERVAL (300)
//#define DEBUG_VARIABLE_DUR
typedef enum {
/******************************
* 0x1000x:
* player do parse file
* decoder not running
******************************/
PLAYER_INITING = 0x10001,
PLAYER_TYPE_REDY = 0x10002,
PLAYER_INITOK = 0x10003,
/******************************
* 0x2000x:
* playback status
* decoder is running
******************************/
PLAYER_RUNNING = 0x20001,
PLAYER_BUFFERING = 0x20002,
PLAYER_PAUSE = 0x20003,
PLAYER_SEARCHING = 0x20004,
PLAYER_SEARCHOK = 0x20005,
PLAYER_START = 0x20006,
PLAYER_FF_END = 0x20007,
PLAYER_FB_END = 0x20008,
PLAYER_PLAY_NEXT = 0x20009,
PLAYER_BUFFER_OK = 0x2000a,
PLAYER_FOUND_SUB = 0x2000b,
/******************************
* 0x3000x:
* player will exit
******************************/
PLAYER_ERR = 0x30001, /* to Fix confliction with OHOS, modify 'PLAYER_ERROR' as 'PLAYER_ERR' */
PLAYER_PLAYEND = 0x30002,
PLAYER_STOPED = 0x30003,
PLAYER_EXIT = 0x30004,
/******************************
* 0x4000x:
* divx drm
* decoder will exit or give
* a message dialog
* ****************************/
PLAYER_DIVX_AUTHORERR = 0x40001,
PLAYER_DIVX_RENTAL_EXPIRED = 0x40002,
PLAYER_DIVX_RENTAL_VIEW = 0x40003,
} player_status;
/**
* This structure contains the info of streaming protocol.
*/
typedef struct _tagAVStreamInfo {
int stream_type;
char * stream_lang;
char * stream_mime;
int stream_auto;
int stream_default;
int stream_forced;
} av_stream_info_t;
typedef struct {
int index;
int id;
int width;
int height;
int aspect_ratio_num;
int aspect_ratio_den;
int frame_rate_num;
int frame_rate_den;
int bit_rate;
vformat_t format;
int duartion;
unsigned int video_rotation_degree;
} mvideo_info_t;
typedef enum {
ACOVER_NONE = 0,
ACOVER_JPG ,
ACOVER_PNG ,
} audio_cover_type;
typedef struct {
char title[512];
char author[512];
char album[512];
char comment[512];
char year[4];
int track;
char genre[32];
char copyright[512];
audio_cover_type pic;
} audio_tag_info;
typedef struct {
int index;
int id;
int channel;
int sample_rate;
int bit_rate;
aformat_t aformat;
int duration;
audio_tag_info *audio_tag;
char language[128];
} maudio_info_t;
typedef struct {
int index;
int id;
char internal_external; //0:internal_sub 1:external_sub
unsigned short width;
unsigned short height;
unsigned int sub_type;
char resolution;
long long subtitle_size;
char sub_language[128];
} msub_info_t;
typedef struct {
int video_pid;
int audio_track_num;
int audio_pid[MAX_AUDIO_STREAMS]; //max audio streams is 16 per programe
char programe_name[64];
} ts_programe_detail_t;
typedef struct {
int programe_num;
ts_programe_detail_t ts_programe_detail[MAX_VIDEO_STREAMS];
} ts_programe_info_t;
typedef struct {
char *filename;
int duration;
long long file_size;
pfile_type type;
int bitrate;
int has_video;
int has_audio;
int has_sub;
int nb_streams;
int total_video_num;
int cur_video_index;
int total_audio_num;
int cur_audio_index;
int total_sub_num;
int cur_sub_index;
int seekable;
int drm_check;
int adif_file_flag;
} mstream_info_t;
typedef struct {
mstream_info_t stream_info;
mvideo_info_t *video_info[MAX_VIDEO_STREAMS];
maudio_info_t *audio_info[MAX_AUDIO_STREAMS];
msub_info_t *sub_info[MAX_SUB_STREAMS];
ts_programe_info_t ts_programe_info;
} media_info_t;
typedef struct player_info {
char *name;
player_status last_sta;
player_status status; /*stop,pause */
int full_time; /*Seconds */
int full_time_ms; /* mSeconds */
int current_time; /*Seconds */
int current_ms; /*ms*/
int last_time;
int error_no;
int64_t start_time;
int64_t first_time;
int pts_video;
//int pts_pcrscr;
unsigned int current_pts;
long curtime_old_time;
unsigned int video_error_cnt;
unsigned int audio_error_cnt;
float audio_bufferlevel; // relative value
float video_bufferlevel; // relative value
int64_t bufed_pos;
int bufed_time;/* Second*/
unsigned int drm_rental;
int64_t download_speed; //download speed
unsigned int last_pts;
int seek_point;
int seek_delay;
} player_info_t;
typedef struct pid_info {
int num;
int pid[MAX_PLAYER_THREADS];
} pid_info_t;
typedef struct player_file_type {
const char *fmt_string;
int video_tracks;
int audio_tracks;
int subtitle_tracks;
/**/
} player_file_type_t;
#define STATE_PRE(sta) (sta>>16)
#define PLAYER_THREAD_IS_INITING(sta) (STATE_PRE(sta)==0x1)
#define PLAYER_THREAD_IS_RUNNING(sta) (STATE_PRE(sta)==0x2)
#define PLAYER_THREAD_IS_STOPPED(sta) (sta==PLAYER_EXIT)
typedef int (*update_state_fun_t)(int pid, player_info_t *) ;
typedef int (*notify_callback)(int pid, int msg, unsigned long ext1, unsigned long ext2);
typedef enum {
PLAYER_EVENTS_PLAYER_INFO = 1, ///<ext1=player_info*,ext2=0,same as update_statue_callback
PLAYER_EVENTS_STATE_CHANGED, ///<ext1=new_state,ext2=0,
PLAYER_EVENTS_ERROR, ///<ext1=error_code,ext2=message char *
PLAYER_EVENTS_BUFFERING, ///<ext1=buffered=d,d={0-100},ext2=0,
PLAYER_EVENTS_FILE_TYPE, ///<ext1=player_file_type_t*,ext2=0
PLAYER_EVENTS_HTTP_WV, ///<(need use DRMExtractor),ext1=0, ext2=0
PLAYER_EVENTS_HWBUF_DATA_SIZE_CHANGED, ///<(need use DRMExtractor),ext1=0, ext2=0
PLAYER_EVENTS_NOT_SUPPORT_SEEKABLE, //not support seek;
PLAYER_EVENTS_VIDEO_SIZE_CHANGED, ///<ext1 refers to video width,ext2 refers to video height
PLAYER_EVENTS_SUBTITLE_DATA, // sub data ext1 refers to subtitledata struct
PLAYER_EVENTS_BLURAY_INFO, // ext1=info id, ext2=info data
} player_events;
typedef struct {
int vbufused;
int vbufsize;
int vdatasize;
int abufused;
int abufsize;
int adatasize;
int sbufused;
int sbufsize;
int sdatasize;
} hwbufstats_t;
typedef struct {
update_state_fun_t update_statue_callback;
int update_interval;
long callback_old_time;
notify_callback notify_fn;
} callback_t;
typedef struct {
char *file_name; //file url
char *headers; //file name's authentication information,maybe used in network streaming
//List *play_list;
int video_index; //video track, no assigned, please set to -1
int audio_index; //audio track, no assigned, please set to -1
int sub_index; //subtitle track, no assigned, please set to -1
float t_pos; //start postion, use second as unit
int read_max_cnt; //read retry maxium counts, if exceed it, return error
int avsync_threshold; //for adec av sync threshold in ms
union {
struct {
unsigned int loop_mode: 1; //file loop mode 0:loop 1:not loop
unsigned int nosound: 1; //0:play with audio 1:play without audio
unsigned int novideo: 1; //0:play with video 1:play without video
unsigned int hassub: 1; //0:ignore subtitle 1:extract subtitle if have
unsigned int need_start: 1; /*If set need_start, we need call player_start_play to playback*/
#ifdef DEBUG_VARIABLE_DUR
unsigned int is_variable: 1; //0:extrack duration from header 1:update duration during playback
#endif
unsigned int displast_frame : 1;//0:black out when player exit 1:keep last frame when player exit
};
int mode; //no use
};
callback_t callback_fn; //callback function
callback_t subdata_fn; // subtitle data notify function
void *subhd; // sub handle
int subdatasource; // sub data source
int byteiobufsize; //byteio buffer size used in ffmpeg
int loopbufsize; //loop buffer size used in ffmpeg
int enable_rw_on_pause; //no use
/*
data%<min && data% <max enter buffering;
data% >middle exit buffering;
*/
int auto_buffing_enable; //auto buffering switch
float buffing_min; //auto buffering low limit
float buffing_middle; //auto buffering middle limit
float buffing_max; //auto buffering high limit
int is_playlist; //no use
int is_type_parser; //is try to get file type
int is_livemode; // support timeshift for chinamobile
int buffing_starttime_s; //for rest buffing_middle,buffering seconds data to start.
int buffing_force_delay_s;
int lowbuffermode_flag;
int lowbuffermode_limited_ms;
int is_ts_soft_demux;
int reserved [56]; //reserved for furthur used,some one add more ,can del reserved num
int SessionID;
int t_duration_ms; //duration parsed from url
} play_control_t;
#define BLURAY_STREAM_PATH 1
#define BLURAY_STREAM_TYPE_VIDEO 'V'
#define BLURAY_STREAM_TYPE_AUDIO 'A'
#define BLURAY_STREAM_TYPE_SUB 'S'
typedef char LANG[4];
typedef struct bluray_stream_info_s {
uint8_t type;
LANG lang;
} bluray_stream_info_t;
typedef struct bluray_chapter_info_s {
uint32_t start;
uint32_t duration;
} bluray_chapter_info_t;
typedef struct bluray_info {
int info;
char *stream_path;
int stream_info_num;
bluray_stream_info_t *stream_info;
int chapter_num;
bluray_chapter_info_t *chapter_info;
} bluray_info_t;
#endif
+65
View File
@@ -0,0 +1,65 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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 _STREAM_FORMAT_H_
#define _STREAM_FORMAT_H_
#include "amports/vformat.h"
#include "amports/aformat.h"
typedef enum {
NONE = 0,
ID3V1,
ID3V2,
APEV1,
APEV2,
WMATAG,
MPEG4TAG,
} audio_tag_type;
typedef enum {
UNKNOWN_FILE = 0,
AVI_FILE = 1,
MPEG_FILE = 2,
WAV_FILE = 3,
MP3_FILE = 4,
AAC_FILE = 5,
AC3_FILE = 6,
RM_FILE = 7,
DTS_FILE = 8,
MKV_FILE = 9,
MOV_FILE = 10,
MP4_FILE = 11,
FLAC_FILE = 12,
H264_FILE = 13,
M2V_FILE = 14,
FLV_FILE = 15,
P2P_FILE = 16,
ASF_FILE = 17,
STREAM_FILE = 18,
APE_FILE = 19,
AMR_FILE = 20,
AVS_FILE = 21,
PMP_FILE = 22,
OGM_FILE = 23,
HEVC_FILE = 24,
DRA_FILE = 25,
IVF_FILE = 26,
AIFF_FILE = 27,
FILE_MAX,
} pfile_type;
#endif
+54
View File
@@ -0,0 +1,54 @@
End User License Agreement
THIS END USER LICENSE AGREEMENT (“AGREEMENT”) IS A LEGAL AGREEMENT BETWEEN YOU (EITHER A SINGLE INDIVIDUAL, OR SINGLE LEGAL ENTITY) AND【 Amlogic Technology Co., Ltd. 】 (HERE AFTER REFERRED TO AS"【 Amlogic 】") FOR THE USE OF THE SOFTWARE ACCOMPANYING THIS AGREEMENT. 【 Amlogic 】 IS ONLY WILLING TO LICENSE THE SOFTWARE TO YOU ON CONDITION THAT YOU ACCEPT ALL OF THE TERMS IN THIS AGREEMENT. BY DOWNDOADING OR BY INSTALLING OR OTHERWISE USING OR COPYING THE SOFTWARE YOU INDICATE THAT YOU AGREE TO BE BOUND BY ALL OF THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT,【 Amlogic 】 WILL NOT LICENSE THE SOFTWARE TO YOU AND YOU MAY NOT INSTALL, USE OR COPY THE SOFTWARE, AND YOU SHALL PROMPTLY DESTROY, DELETE, OR RETURN THE SOFTWARE TO YOUR SUPPLIER.
“SOFTWARE” means the software in object code provided under the terms of this Agreement.
【HuiZhou,Guangdong Province, China】 is the signing place of this Agreement.
1.GRANT OF LICENSE
In consideration of your agreement to abide by the following terms, and subject to the terms and conditions of this Agreement, 【 Amlogic 】 hereby grants YOU, a non-transferable, non-exclusive, royalty-free, revocable, worldwide copyright license (without the right to sublicense) to internally use and copy the SOFTWARE to 【usage mode eg.“set up internal development environment with development boards”】 integrating 【 Amlogic 】 【product type of the licensor,eg.“chips”】, solely for the purpose of【purpose of use for the SOFTWARE,eg.“designing, developing or testing your applications”】 .
All rights to the SOFTWARE and all intellectual property rights contained therein are reserved and shall remain the sole and exclusive property of 【 Amlogic 】. The SOFTWARE is licensed but not sold. Except as expressly licensed in Clause 1, in no event shall the license granted in this Clause 1 be construed as granting YOU expressly or by implication, estoppels or otherwise, licenses to any intellectual property rights, including but not limited to patent rights, copyrights, trademark or trade secret in the SOFTWARE.
No right is granted to YOU under this Agreement to manufacture, have manufactured, or sell, supply or distribute any products which use or embody any of the SOFTWARE or any of the intellectual property rights embodied therein.
2.RESTRICTIONS
YOU shall reproduce and not remove or obscure any notice incorporated by 【 Amlogic 】 in the SOFTWARE to protect 【 Amlogic 】’s intellectual property rights embodied therein.
YOU shall not decompile, disassemble, or reverse engineer the SOFTWARE.
YOU shall not distribute the SOFTWARE under an open source license as listed by the Open Source Initiative (a non-profit corporation whose website is www.opensource.org), or other license which requires the source code or object code of the SOFTWARE to be licensed or otherwise shared with any third party.
3.CONFLICT WITH OPEN SOURCE SOFTWARE LICENSE
The SOFTWARE may contain open source software. If the license applied on such open source software has conflict with this Agreement, the license applied on such open source software will prevail and apply to the open source software.
4.FEEDBACK
YOU may choose to provide suggestions, comments, feedback, ideas, modifications or know-how (whether in oral or written form) relating to the use of the SOFTWARE ("Feedback") to 【 Amlogic 】 under the terms of this Agreement. YOU hereby grants to 【 Amlogic 】 and its affiliates, under all of you and your affiliates (as applicable) intellectual property rights, a perpetual, irrevocable, royalty free, non-exclusive, worldwide license to (i) use, copy and modify the Feedback; (ii) sell, supply, or otherwise distribute the Feedback; (iii) design, have designed, manufacture, have manufactured, use, import, sell, and otherwise distribute and dispose of products that incorporate the Feedback; and (iv) sublicense (together with the rights to further sublicense) the rights granted in this paragraph to any third party.
5.NO WARRANTY
YOU AGREE THAT THE SOFTWARE IS PROVIDED BY 【 Amlogic 】 ON AN "AS IS" BASIS. 【 Amlogic 】 MAKES NO WARRANTY, EXPRESSED OR IMPLIED OR STATUTORY, WITH RESPECT TO ANY OF THE SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.
YOU EXPRESSLY ASSUME ALL LIABILITIES AND RISKS, FOR USE OR OPERATION OF THE SOFTWARE, INCLUDING WITHOUT LIMITATION, SOFTWARE APPLICATIONS DESIGNED OR INTENDED FOR MISSION CRITICAL APPLICATIONS, SUCH AS PACEMAKERS, WEAPONRY, AIRCRAFT NAVIGATION, FACTORY CONTROL SYSTEMS, ETC. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
6.NO LIABILITY
PLEASE NOTE THAT YOU SHOULD USE THE SOFTWARE AT YOUR OWN RISK.
IN NO EVENT SHALL 【 Amlogic 】 BE LIABLE FOR ANY DIRECT OR INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHER LEGAL THEORY, EVEN IF 【 Amlogic 】 HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. EVEN IF THE SOFTWARE HAS ANY MATERIAL, VERIFIABLE, AND REPRODUCIBLE PROGRAM ERRORS, 【 Amlogic 】 SHALL HAVE NO LIABILITY TO MODIFY SUCH ERRORS.
NOTWITHSTANDING ANYTHING TO THE CONTRARY CONTAINED IN THIS AGREEMENT, THE MAXIMUM LIABILITY OF 【 Amlogic 】 TO YOU IN AGGREGATE FOR ALL CLAIMS MADE AGAINST 【 Amlogic 】 IN CONTRACT TORT OR OTHERWISE UNDER OR IN CONNECTION WITH THE SUBJECT MATTER OF THIS AGREEMENT SHALL NOT EXCEED THE TOTAL OF SUMS RECEIVED BY 【 Amlogic 】 FROM YOU FOR THIS AGREEMENT. THE EXISTENCE OF MORE THAN ONE CLAIM WILL NOT ENLARGE OR EXTEND THE LIMIT.
7.CONFIDENTIALITY
YOU acknowledge and agree that the SOFTWARE provided under this Agreement contain trade secrets and confidential material of 【 Amlogic 】 and YOU agree to maintain all such information in confidence and apply security measures no less stringent than the measures which YOU apply to protect your own like information, but not less than a reasonable degree of care, to prevent their unauthorized disclosure and use. The period of confidentiality shall be indefinite. YOU agree not to use any such information other than in normal use of the SOFTWARE under the license granted in this Agreement.
8.TERM AND TERMINATION
This Agreement shall remain in force until terminated. 【 Amlogic 】 may terminate this Agreement at any time with or without any cause. Upon termination of this Agreement, YOU shall immediately stop using the SOFTWARE and confidential information and destroy all copies of the SOFTWARE and confidential information in your possession, together with all documentation and related materials. The provisions of clauses 2, 3, 4, 5, 6, 78 and 9 shall survive termination of this Agreement.
9.GENERAL
Any provision of this Agreement which is prohibited or unenforceable in any jurisdiction shall be ineffective to the extent of such prohibition or unenforceability without affecting, impairing or invalidating the remaining provisions hereof.
The failure by 【Amlogic】 to enforce any of the provisions of this Agreement, unless waived in writing, shall not constitute a waiver of 【Amlogic】's rights to enforce such provision or any other provision of this Agreement in the future.
This Agreement shall be governed by and construed in accordance with the laws of Peoples Republic of China, without reference to the principles of conflicts of laws. Any dispute arising out of or relating to this Agreement shall be submitted to 【favorite court of the licensor】and the parties waive all objections to that jurisdiction and venue.
Copyright (C) 【2022】【Amlogic Technology Co., Ltd.】 All rights reserved.
Binary file not shown.
+542
View File
@@ -0,0 +1,542 @@
/*
* Copyright (C) 2017 Amlogic, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*/
/**
* @file kplayer.c
* @brief
* @author Xu Hui <hui.xu@amlogic.com>
* @version 1.0.0
* @date 2011-02-28
*/
/*!< Copyright (C) 2007-2011, Amlogic Inc.
* All right reserved
*
*/
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include "player.h"
//#include "player_type.h"
//#include "streamsource.h"
typedef enum {
//EMU_STEP_NONE = 0,
EMU_STEP_PAUSE = 2,
EMU_STEP_RESUME = 3,
EMU_STEP_START = 4,
EMU_STEP_FF = 5,
EMU_STEP_RR = 6,
EMU_STEP_SEEK = 7,
//EMU_STEP_MUTE= 8,
//EMU_STEP_SETVOL=9,
//EMU_STEP_GETVOL = 10,
//EMU_STEP_SETTONE= 11,
EMU_STEP_SETLOOP = 14,
EMU_STEP_STOP = 16,
//EMU_STEP_SPECTRUM = 17,
//EMU_STEP_SETSUBT = 19,
EMU_STEP_MENU = 20,
EMU_STEP_EXIT = 21,
//EMU_STEP_ATRACK = 22,
EMU_STEP_GETAVMEDIAINFO = 25,
//EMU_STEP_LISTALLMEDIAID = 27,
} EMU_STEP;
#define SCREEN_SPLITER "***************************************************************************\r\n"
static int amsysfs_set_sysfs_int(const char *path, int val)
{
int fd;
int bytes;
char bcmd[16];
fd = open(path, O_CREAT | O_RDWR | O_TRUNC, 0644);
if (fd >= 0) {
sprintf(bcmd, "%d", val);
bytes = write(fd, bcmd, strlen(bcmd));
close(fd);
return 0;
} else {
printf("unable to open file %s,err: %s\n", path, strerror(errno));
}
return -1;
}
static int amsysfs_set_sysfs_str(const char *path, const char *val)
{
int fd;
int bytes;
fd = open(path, O_CREAT | O_RDWR | O_TRUNC, 0644);
if (fd >= 0) {
bytes = write(fd, val, strlen(val));
close(fd);
return 0;
} else {
printf("unable to open file %s,err: %s\n", path, strerror(errno));
}
return -1;
}
static int amsysfs_get_sysfs_str(const char *path, char *valstr, int size)
{
int fd;
fd = open(path, O_RDONLY);
if (fd >= 0) {
memset(valstr, 0, size);
read(fd, valstr, size - 1);
valstr[strlen(valstr)] = '\0';
close(fd);
} else {
printf("unable to open file %s,err: %s\n", path, strerror(errno));
sprintf(valstr, "%s", "fail");
return -1;
};
//LOGI("get_sysfs_str=%s\n", valstr);
return 0;
}
static int axis[8] = {0};
int update_player_info(int pid, player_info_t * info)
{
printf("pid:%d,status:%x,current pos:%d,total:%d,errcode:%x\n", pid, info->status, info->current_time, info->full_time, ~(info->error_no));
return 0;
}
int _media_info_dump(media_info_t* minfo)
{
int i = 0;
printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
printf("======||file size:%lld\n", minfo->stream_info.file_size);
printf("======||file type:%d\n", minfo->stream_info.type);
printf("======||has internal subtitle?:%s\n", minfo->stream_info.has_sub > 0 ? "YES!" : "NO!");
printf("======||internal subtile counts:%d\n", minfo->stream_info.total_sub_num);
printf("======||has video track?:%s\n", minfo->stream_info.has_video > 0 ? "YES!" : "NO!");
printf("======||has audio track?:%s\n", minfo->stream_info.has_audio > 0 ? "YES!" : "NO!");
printf("======||duration:%d\n", minfo->stream_info.duration);
if (minfo->stream_info.has_video && minfo->stream_info.total_video_num > 0) {
printf("======||video counts:%d\n", minfo->stream_info.total_video_num);
printf("======||video width:%d\n", minfo->video_info[0]->width);
printf("======||video height:%d\n", minfo->video_info[0]->height);
printf("======||video bitrate:%d\n", minfo->video_info[0]->bit_rate);
printf("======||video format:%d\n", minfo->video_info[0]->format);
}
if (minfo->stream_info.has_audio && minfo->stream_info.total_audio_num > 0) {
printf("======||audio counts:%d\n", minfo->stream_info.total_audio_num);
if (NULL != minfo->audio_info[0]->audio_tag) {
printf("======||track title:%s", minfo->audio_info[0]->audio_tag->title);
printf("\n======||track album:%s", minfo->audio_info[0]->audio_tag->album);
printf("\n======||track author:%s\n", minfo->audio_info[0]->audio_tag->author);
printf("\n======||track year:%s\n", minfo->audio_info[0]->audio_tag->year);
printf("\n======||track comment:%s\n", minfo->audio_info[0]->audio_tag->comment);
printf("\n======||track genre:%s\n", minfo->audio_info[0]->audio_tag->genre);
printf("\n======||track copyright:%s\n", minfo->audio_info[0]->audio_tag->copyright);
printf("\n======||track track:%d\n", minfo->audio_info[0]->audio_tag->track);
}
for (i = 0; i < minfo->stream_info.total_audio_num; i++) {
printf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
printf("======||%d 'st audio track codec type:%d\n", i, minfo->audio_info[i]->aformat);
printf("======||%d 'st audio track audio_channel:%d\n", i, minfo->audio_info[i]->channel);
printf("======||%d 'st audio track bit_rate:%d\n", i, minfo->audio_info[i]->bit_rate);
printf("======||%d 'st audio track audio_samplerate:%d\n", i, minfo->audio_info[i]->sample_rate);
printf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
}
}
if (minfo->stream_info.has_sub && minfo->stream_info.total_sub_num > 0) {
for (i = 0; i < minfo->stream_info.total_sub_num; i++) {
if (0 == minfo->sub_info[i]->internal_external) {
printf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
printf("======||%d 'st internal subtitle pid:%d\n", i, minfo->sub_info[i]->id);
printf("======||%d 'st internal subtitle language:%s\n", i, minfo->sub_info[i]->sub_language);
printf("======||%d 'st internal subtitle width:%d\n", i, minfo->sub_info[i]->width);
printf("======||%d 'st internal subtitle height:%d\n", i, minfo->sub_info[i]->height);
printf("======||%d 'st internal subtitle resolution:%d\n", i, minfo->sub_info[i]->resolution);
printf("======||%d 'st internal subtitle subtitle size:%lld\n", i, minfo->sub_info[i]->subtitle_size);
printf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
}
}
}
printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
return 0;
}
static int get_axis(const char *para, int para_num, int *result)
{
char *endp;
const char *startp = para;
int *out = result;
int len = 0, count = 0;
if (!startp) {
return 0;
}
len = strlen(startp);
do {
//filter space out
while (startp && (isspace(*startp) || !isgraph(*startp)) && len) {
startp++;
len--;
}
if (len == 0) {
break;
}
*out++ = strtol(startp, &endp, 0);
len -= endp - startp;
startp = endp;
count++;
} while ((endp) && (count < para_num) && (len > 0));
return count;
}
static int __set_display_axis(int recovery)
{
int fd;
char *path = "/sys/class/display/axis";
char str[128];
int count;
fd = open(path, O_CREAT | O_RDWR | O_TRUNC, 0644);
if (fd >= 0) {
if (!recovery) {
read(fd, str, 128);
printf("read axis %s, length %d\n", str, strlen(str));
count = get_axis(str, 8, axis);
}
if (recovery) {
sprintf(str, "%d %d %d %d %d %d %d %d",
axis[0], axis[1], axis[2], axis[3], axis[4], axis[5], axis[6], axis[7]);
} else {
sprintf(str, "2048 %d %d %d %d %d %d %d",
axis[1], axis[2], axis[3], axis[4], axis[5], axis[6], axis[7]);
}
write(fd, str, strlen(str));
close(fd);
return 0;
}
return -1;
}
static int set_osd_blank(int blank)
{
char *drm_osd_enable = "/sys/class/meson_crtc/enable_osd";
char *path1 = "/sys/class/graphics/fb0/blank";
char *path2 = "/sys/class/graphics/fb1/blank";
char *wl_path0 = "/sys/kernel/debug/dri/0/vpu/blank";
char *wl_path1 = "/sys/kernel/debug/dri/64/vpu/blank";
char *fb_stat0 = "/sys/class/graphics/fb0/osd_status";
char *fb_stat1 = "/sys/class/graphics/fb1/osd_status";
static int fb0_enable = -1;
static int fb1_enable = -1;
static int use_wayland = 0;
char osd_status[128]="";
if (amsysfs_get_sysfs_str(drm_osd_enable, osd_status, sizeof(osd_status)) == 0) {
amsysfs_set_sysfs_str(drm_osd_enable, blank ? "0" : "1");
return 0;
}
if (fb0_enable == -1)
{
osd_status[0]='\0';
if ( !use_wayland && (amsysfs_get_sysfs_str(fb_stat0, osd_status, 128) == 0))
{
if (strstr(osd_status, "enable: 1"))
fb0_enable = 1;
else
fb0_enable = 0;
} else if (amsysfs_get_sysfs_str(wl_path0, osd_status, 128) == 0)
{
use_wayland = 1;
if (strstr(osd_status, "blank_enable: 0"))
fb0_enable = 1;
else
fb0_enable = 0;
}
else
fb0_enable = 1; //In case the osd_status node not exist
}
if (fb1_enable == -1)
{
osd_status[0]='\0';
if (!use_wayland && (amsysfs_get_sysfs_str(fb_stat1, osd_status, 32) == 0))
{
if (strstr(osd_status, "enable: 1"))
fb1_enable = 1;
else
fb1_enable = 0;
} else if (amsysfs_get_sysfs_str(wl_path1, osd_status, 128) == 0)
{
use_wayland = 1;
if (strstr(osd_status, "blank_enable: 0"))
fb0_enable = 1;
else
fb0_enable = 0;
}
else
fb1_enable = 1; //In case the osd_status node not exist
}
if (fb0_enable)
amsysfs_set_sysfs_str(use_wayland ? wl_path0 : path1, blank ? "1" : "0");
if (fb1_enable)
amsysfs_set_sysfs_str(use_wayland ? wl_path1 : path2, blank ? "1" : "0");
return 0;
}
static void set_vfm_path(void)
{
char *vfm_path = "/sys/class/vfm/map";
char *vfm_rm = "rm default";
char *vfm_add = "add default decoder ppmgr deinterlace amvideo";
amsysfs_set_sysfs_str(vfm_path, vfm_rm);
amsysfs_set_sysfs_str(vfm_path, vfm_add);
}
static void signal_handler(int signum)
{
printf("Get signum=%x\n", signum);
// player_progress_exit();
// __set_display_axis(1);
set_black_policy(1);
set_osd_blank(0);
signal(signum, SIG_DFL);
raise(signum);
}
static void set_video_display(int val)
{
char *disable_path = "/sys/class/video/disable_video";
amsysfs_set_sysfs_int(disable_path, val);
}
#define TMP_COMMAND_MAX 512
int main(int argc, char *argv[])
{
play_control_t *pCtrl = NULL;
int pid;
int pos = 0;
int speed = 0;
int tmpneedexit = 0;
int ret = -1;
int flag = 1;
media_info_t minfo;
char tmpcommand[TMP_COMMAND_MAX];
EMU_STEP tmpstep = EMU_STEP_MENU;
pCtrl = (play_control_t*)malloc(sizeof(play_control_t));
memset(pCtrl, 0, sizeof(play_control_t));
memset(&minfo, 0, sizeof(media_info_t));
if (argc < 2) {
printf("usage:player file\n");
return -1;
}
/*set default path for vfm.*/
set_vfm_path();
/*enable video layer*/
set_video_display(2);
player_init();
//__set_display_axis(0); //move osd out of screen to set video layer out
player_register_update_callback(&pCtrl->callback_fn, &update_player_info, 1000);
printf("player callback register....\n");
pCtrl->file_name = strdup(argv[1]);
//pCtrl->nosound = 1; // if disable audio...,must call this api
pCtrl->video_index = -1;// MUST
pCtrl->audio_index = -1;// MUST
pCtrl->sub_index = -1;/// MUST
pCtrl->hassub = 1; // enable subtitle
//just open a buffer,just for p2p,http,etc...
pCtrl->auto_buffing_enable = 1;
pCtrl->buffing_min = 0.001;
pCtrl->buffing_middle = 0.02;
pCtrl->buffing_max = 0.9;
pCtrl->t_pos = -1; // start position, if live streaming, need set to -1
pCtrl->need_start = 0; // if 0,you can omit player_start_play API.just play video/audio immediately. if 1,need call "player_start_play" API;
pid = player_start(pCtrl, 0);
if (pid < 0) {
printf("player start failed!error=%d\n", pid);
return -1;
}
signal(SIGSEGV, signal_handler);
signal(SIGINT, signal_handler);
//SYS_disable_osd0();
set_osd_blank(1);
while ((!tmpneedexit) && (!PLAYER_THREAD_IS_STOPPED(player_get_state(pid)))) {
switch (tmpstep) {
case EMU_STEP_PAUSE:
player_pause(pid);
tmpstep = EMU_STEP_MENU;
break;
case EMU_STEP_RESUME:
player_resume(pid);
tmpstep = EMU_STEP_MENU;
break;
case EMU_STEP_SEEK:
pos = 0;
printf("please input seek pos:");
scanf("%d", &pos);
printf("will seek position: %d\n", pos);
player_timesearch(pid, pos);
tmpstep = EMU_STEP_MENU;
break;
break;
case EMU_STEP_STOP:
player_stop(pid);
tmpstep = EMU_STEP_MENU;
break;
case EMU_STEP_FF:
printf("please input fastforward speed:\n");
speed = 1;
player_forward(pid, speed);
tmpstep = EMU_STEP_MENU;
break;
case EMU_STEP_RR:
printf("please input fastrewind speed:");
speed = 1;
player_backward(pid, speed);
tmpstep = EMU_STEP_MENU;
break;
case EMU_STEP_SETLOOP:
player_loop(pid);
tmpstep = EMU_STEP_MENU;
break;
case EMU_STEP_EXIT:
player_exit(pid);
tmpneedexit = 1;
break;
case EMU_STEP_START:
player_start_play(pid);
//SYS_set_tsync_enable(0);///< f no sound,can set to be 0
tmpstep = EMU_STEP_MENU;
break;
case EMU_STEP_GETAVMEDIAINFO:
if (pid >= 0) {
if (player_get_state(pid) > PLAYER_INITOK) {
ret = player_get_media_info(pid, &minfo);
if (ret == 0) {
_media_info_dump(&minfo);
}
}
}
tmpstep = EMU_STEP_MENU;
break;
case EMU_STEP_MENU:
do {
if (flag) {
printf(SCREEN_SPLITER);
printf(" player benchmark tool for android v2.0\n");
printf(SCREEN_SPLITER);
printf("* Please choose one option *\r\n");
printf("* 0 show main menu *\r\n");
printf("* a start play *\r\n");
printf("* s get media info *\r\n");
printf("* 1 Pause play *\r\n");
printf("* 2 Resume play *\r\n");
printf("* 3 Stop play *\r\n");
printf("* 4 Fastforward *\r\n");
printf("* 5 Fastrewind *\r\n");
printf("* 6 Seek *\r\n");
printf("* 7 Set repeat *\r\n");
printf("* 8 Quit tools *\r\n");
printf(SCREEN_SPLITER);
printf("please input you choice:");
}
flag = 1;
memset(tmpcommand, 0, TMP_COMMAND_MAX);
scanf("%s", tmpcommand);
if (strcmp(tmpcommand, "0") == 0) {
sleep(1);
tmpstep = EMU_STEP_MENU;
} else if (strcmp(tmpcommand, "1") == 0) {
tmpstep = EMU_STEP_PAUSE;
} else if (strcmp(tmpcommand, "2") == 0) {
tmpstep = EMU_STEP_RESUME;
} else if (strcmp(tmpcommand, "3") == 0) {
tmpstep = EMU_STEP_STOP;
} else if (strcmp(tmpcommand, "4") == 0) {
tmpstep = EMU_STEP_FF;
} else if (strcmp(tmpcommand, "5") == 0) {
tmpstep = EMU_STEP_RR;
} else if (strcmp(tmpcommand, "6") == 0) {
tmpstep = EMU_STEP_SEEK;
} else if (strcmp(tmpcommand, "7") == 0) {
tmpstep = EMU_STEP_SETLOOP;
} else if (strcmp(tmpcommand, "8") == 0) {
tmpstep = EMU_STEP_EXIT;
} else if (strcmp(tmpcommand, "a") == 0) {
tmpstep = EMU_STEP_START;
} else if (strcmp(tmpcommand, "s") == 0) {
tmpstep = EMU_STEP_GETAVMEDIAINFO;
} else {
flag = 0;
}
} while (0);
break;
}
usleep(100 * 1000);
signal(SIGCHLD, SIG_IGN);
signal(SIGTSTP, SIG_IGN);
signal(SIGTTOU, SIG_IGN);
signal(SIGTTIN, SIG_IGN);
signal(SIGHUP, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGSEGV, signal_handler);
signal(SIGQUIT, signal_handler);
}
__set_display_axis(1); //recover osd
set_osd_blank(0);
free(pCtrl->file_name);
free(pCtrl);
printf("...........player exit,~,byeybe...........\n");
return 0;
}
+58
View File
@@ -0,0 +1,58 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# 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.
import("//build/ohos.gni")
ohos_prebuilt_shared_library("libamvdec") {
source = "lib/libamvdec.so"
install_images = [ "vendor" ]
subsystem_name = "unionman_products"
part_name = "unionman_products"
}
ohos_executable("ionplayer") {
install_enable = true
sources = [ "samples/ionplayer.c" ]
install_images = [ "vendor" ]
cflags = [
"-fno-rtti",
"-fno-exceptions",
"-fno-common",
"-fstack-protector-strong",
"-Wshadow",
"-FPIC",
"-FS",
"-O2",
"-D_FORTIFY_SOURCE=2",
"-fvisibility=hidden",
"-Wno-error",
"-Wextra",
"-Wformat=2",
"-Wfloat-equal",
"-Wdate-time",
]
deps = [
":libamvdec",
"../libamcodec:libamcodec",
]
include_dirs = [
"include",
"../libamcodec/include",
]
subsystem_name = "unionman_products"
part_name = "unionman_products"
}
+66
View File
@@ -0,0 +1,66 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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 IONMEM_H
#define IONMEM_H
#include <ion/ion.h>
#if defined (__cplusplus)
extern "C" {
#endif
#define ION_IOC_MESON_PHYS_ADDR 8
struct meson_phys_data{
int handle;
unsigned int phys_addr;
unsigned int size;
};
typedef struct IONMEM_AllocParams {
int mIonHnd;
size_t size;
unsigned char *vaddr;
size_t map_len;
} IONMEM_AllocParams;
#define ION_IOC_MAGIC 'I'
#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
#ifdef __DEBUG
#define __D(fmt, args...) fprintf(stderr, "CMEM Debug: " fmt, ## args)
#else
#define __D(fmt, args...)
#endif
#define __E(fmt, args...) fprintf(stderr, "CMEM Error: " fmt, ## args)
int CMEM_init(void);
unsigned long CMEM_alloc(size_t size, IONMEM_AllocParams *params);
int CMEM_getPhyPtr(IONMEM_AllocParams *params, unsigned long *PhyAdrr);
/*void* CMEM_getUsrPtr(unsigned long PhyAdr, int size);*/
int CMEM_free(IONMEM_AllocParams *params);
int CMEM_exit(void);
#if defined (__cplusplus)
}
#endif
#endif
+30
View File
@@ -0,0 +1,30 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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 AMVDEC_PRIV_HEADER__
#define AMVDEC_PRIV_HEADER__
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <linux/videodev2.h>
#define TAG "amvdec"
#define XLOG(V,T,...)
#define LOGI(...)
#define LOGE(...)
#endif
+78
View File
@@ -0,0 +1,78 @@
/*
* Copyright (C) 2014 Amlogic Corporation.
*
* 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 AMVDEC_AMVIDEO_HEADER_SS
#define AMVDEC_AMVIDEO_HEADER_SS
#include <stdlib.h>
#include <stdint.h>
#include <linux/videodev2.h>
//#include "videodev2.h"
#include <stdbool.h>
#define FLAGS_OVERLAY_MODE (1)
#define FLAGS_V4L_MODE (2)
struct amvideo_dev;
typedef struct vframebuf {
char * vbuf;
int fd;
int index;
int offset;
int length;
int64_t pts;
int duration;
int width;
int height;
int error_recovery;
int sync_frame;
uint32_t frame_num;
} vframebuf_t;
struct amvideo_dev_ops {
int (*setparameters)(struct amvideo_dev *dev, int cmd, void*para);
int (*init)(struct amvideo_dev *dev, int flags, int width, int height, int fmt, int buffernum);
int (*release)(struct amvideo_dev *dev);
int (*dequeuebuf)(struct amvideo_dev *dev, vframebuf_t*vf);
int (*queuebuf)(struct amvideo_dev *dev, vframebuf_t*vf);
int (*start)(struct amvideo_dev *dev);
int (*stop)(struct amvideo_dev *dev);
};
#define AMVIDEO_DEV_NAME_SIZE 16
typedef struct amvideo_dev {
char devname[AMVIDEO_DEV_NAME_SIZE];
int mode;
int display_mode;
bool use_frame_mode;
int video_id;
struct amvideo_dev_ops ops;
void *devpriv;//must at last of the struct
} amvideo_dev_t;
typedef struct amvideo {
amvideo_dev_t *dev;
} amvideo_t;
amvideo_dev_t *new_amvideo(int flags);
int amvideo_setparameters(amvideo_dev_t *dev, int cmd, void * parameters);
int amvideo_init(amvideo_dev_t *dev, int flags, int width, int height, int fmt, int buffernum);
int amvideo_start(amvideo_dev_t *dev);
int amvideo_stop(amvideo_dev_t *dev);
int amvideo_release(amvideo_dev_t *dev);
int amlv4l_dequeuebuf(amvideo_dev_t *dev, vframebuf_t*vf);
int amlv4l_queuebuf(amvideo_dev_t *dev, vframebuf_t*vf);
#endif
+44
View File
@@ -0,0 +1,44 @@
/*
* ion.c
*
* Memory Allocator functions for ion
*
* Copyright 2011 Google, Inc
*
* 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 __SYS_CORE_ION_H
#define __SYS_CORE_ION_H
#include <sys/types.h>
#include <linux/ion.h>
#ifdef __cplusplus
extern "C" {
#endif
int ion_open();
int ion_close(int fd);
int ion_alloc(int fd, size_t len, size_t align, enum ion_heap_type heap_type,
int *buffer_fd, unsigned char **vaddr, size_t *map_len);
int ion_free(int fd, int buffer_fd, unsigned char *vaddr, size_t map_len);
#ifdef __cplusplus
}
#endif
#endif /* __SYS_CORE_ION_H */
+127
View File
@@ -0,0 +1,127 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* drivers/staging/android/uapi/ion.h
*
* Copyright (C) 2011 Google, Inc.
*/
#ifndef _UAPI_LINUX_ION_H
#define _UAPI_LINUX_ION_H
#include <linux/ioctl.h>
#include <linux/types.h>
/**
* enum ion_heap_types - list of all possible types of heaps
* @ION_HEAP_TYPE_SYSTEM: memory allocated via vmalloc
* @ION_HEAP_TYPE_SYSTEM_CONTIG: memory allocated via kmalloc
* @ION_HEAP_TYPE_CARVEOUT: memory allocated from a prereserved
* carveout heap, allocations are physically
* contiguous
* @ION_HEAP_TYPE_DMA: memory allocated via DMA API
* @ION_NUM_HEAPS: helper for iterating over heaps, a bit mask
* is used to identify the heaps, so only 32
* total heap types are supported
*/
enum ion_heap_type {
ION_HEAP_TYPE_SYSTEM,
ION_HEAP_TYPE_SYSTEM_CONTIG,
ION_HEAP_TYPE_CARVEOUT,
ION_HEAP_TYPE_CHUNK,
ION_HEAP_TYPE_DMA,
ION_HEAP_TYPE_CUSTOM, /*
* must be last so device specific heaps always
* are at the end of this enum
*/
};
#define ION_NUM_HEAP_IDS (sizeof(unsigned int) * 8)
/**
* allocation flags - the lower 16 bits are used by core ion, the upper 16
* bits are reserved for use by the heaps themselves.
*/
/*
* mappings of this buffer should be cached, ion will do cache maintenance
* when the buffer is mapped for dma
*/
#define ION_FLAG_CACHED 1
/**
* DOC: Ion Userspace API
*
* create a client by opening /dev/ion
* most operations handled via following ioctls
*
*/
/**
* struct ion_allocation_data - metadata passed from userspace for allocations
* @len: size of the allocation
* @heap_id_mask: mask of heap ids to allocate from
* @flags: flags passed to heap
* @handle: pointer that will be populated with a cookie to use to
* refer to this allocation
*
* Provided by userspace as an argument to the ioctl
*/
struct ion_allocation_data {
__u64 len;
__u32 heap_id_mask;
__u32 flags;
__u32 fd;
__u32 unused;
};
#define MAX_HEAP_NAME 32
/**
* struct ion_heap_data - data about a heap
* @name - first 32 characters of the heap name
* @type - heap type
* @heap_id - heap id for the heap
*/
struct ion_heap_data {
char name[MAX_HEAP_NAME];
__u32 type;
__u32 heap_id;
__u32 reserved0;
__u32 reserved1;
__u32 reserved2;
};
/**
* struct ion_heap_query - collection of data about all heaps
* @cnt - total number of heaps to be copied
* @heaps - buffer to copy heap data
*/
struct ion_heap_query {
__u32 cnt; /* Total number of heaps to be copied */
__u32 reserved0; /* align to 64bits */
__u64 heaps; /* buffer to be populated */
__u32 reserved1;
__u32 reserved2;
};
#define ION_IOC_MAGIC 'I'
/**
* DOC: ION_IOC_ALLOC - allocate memory
*
* Takes an ion_allocation_data struct and returns it with the handle field
* populated with the opaque handle for the allocation.
*/
#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \
struct ion_allocation_data)
/**
* DOC: ION_IOC_HEAP_QUERY - information about available heaps
*
* Takes an ion_heap_query structure and populates information about
* available Ion heaps.
*/
#define ION_IOC_HEAP_QUERY _IOWR(ION_IOC_MAGIC, 8, \
struct ion_heap_query)
#endif /* _UAPI_LINUX_ION_H */
+54
View File
@@ -0,0 +1,54 @@
End User License Agreement
THIS END USER LICENSE AGREEMENT (“AGREEMENT”) IS A LEGAL AGREEMENT BETWEEN YOU (EITHER A SINGLE INDIVIDUAL, OR SINGLE LEGAL ENTITY) AND【 Amlogic Technology Co., Ltd. 】 (HERE AFTER REFERRED TO AS"【 Amlogic 】") FOR THE USE OF THE SOFTWARE ACCOMPANYING THIS AGREEMENT. 【 Amlogic 】 IS ONLY WILLING TO LICENSE THE SOFTWARE TO YOU ON CONDITION THAT YOU ACCEPT ALL OF THE TERMS IN THIS AGREEMENT. BY DOWNDOADING OR BY INSTALLING OR OTHERWISE USING OR COPYING THE SOFTWARE YOU INDICATE THAT YOU AGREE TO BE BOUND BY ALL OF THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT,【 Amlogic 】 WILL NOT LICENSE THE SOFTWARE TO YOU AND YOU MAY NOT INSTALL, USE OR COPY THE SOFTWARE, AND YOU SHALL PROMPTLY DESTROY, DELETE, OR RETURN THE SOFTWARE TO YOUR SUPPLIER.
“SOFTWARE” means the software in object code provided under the terms of this Agreement.
【HuiZhou,Guangdong Province, China】 is the signing place of this Agreement.
1.GRANT OF LICENSE
In consideration of your agreement to abide by the following terms, and subject to the terms and conditions of this Agreement, 【 Amlogic 】 hereby grants YOU, a non-transferable, non-exclusive, royalty-free, revocable, worldwide copyright license (without the right to sublicense) to internally use and copy the SOFTWARE to 【usage mode eg.“set up internal development environment with development boards”】 integrating 【 Amlogic 】 【product type of the licensor,eg.“chips”】, solely for the purpose of【purpose of use for the SOFTWARE,eg.“designing, developing or testing your applications”】 .
All rights to the SOFTWARE and all intellectual property rights contained therein are reserved and shall remain the sole and exclusive property of 【 Amlogic 】. The SOFTWARE is licensed but not sold. Except as expressly licensed in Clause 1, in no event shall the license granted in this Clause 1 be construed as granting YOU expressly or by implication, estoppels or otherwise, licenses to any intellectual property rights, including but not limited to patent rights, copyrights, trademark or trade secret in the SOFTWARE.
No right is granted to YOU under this Agreement to manufacture, have manufactured, or sell, supply or distribute any products which use or embody any of the SOFTWARE or any of the intellectual property rights embodied therein.
2.RESTRICTIONS
YOU shall reproduce and not remove or obscure any notice incorporated by 【 Amlogic 】 in the SOFTWARE to protect 【 Amlogic 】’s intellectual property rights embodied therein.
YOU shall not decompile, disassemble, or reverse engineer the SOFTWARE.
YOU shall not distribute the SOFTWARE under an open source license as listed by the Open Source Initiative (a non-profit corporation whose website is www.opensource.org), or other license which requires the source code or object code of the SOFTWARE to be licensed or otherwise shared with any third party.
3.CONFLICT WITH OPEN SOURCE SOFTWARE LICENSE
The SOFTWARE may contain open source software. If the license applied on such open source software has conflict with this Agreement, the license applied on such open source software will prevail and apply to the open source software.
4.FEEDBACK
YOU may choose to provide suggestions, comments, feedback, ideas, modifications or know-how (whether in oral or written form) relating to the use of the SOFTWARE ("Feedback") to 【 Amlogic 】 under the terms of this Agreement. YOU hereby grants to 【 Amlogic 】 and its affiliates, under all of you and your affiliates (as applicable) intellectual property rights, a perpetual, irrevocable, royalty free, non-exclusive, worldwide license to (i) use, copy and modify the Feedback; (ii) sell, supply, or otherwise distribute the Feedback; (iii) design, have designed, manufacture, have manufactured, use, import, sell, and otherwise distribute and dispose of products that incorporate the Feedback; and (iv) sublicense (together with the rights to further sublicense) the rights granted in this paragraph to any third party.
5.NO WARRANTY
YOU AGREE THAT THE SOFTWARE IS PROVIDED BY 【 Amlogic 】 ON AN "AS IS" BASIS. 【 Amlogic 】 MAKES NO WARRANTY, EXPRESSED OR IMPLIED OR STATUTORY, WITH RESPECT TO ANY OF THE SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.
YOU EXPRESSLY ASSUME ALL LIABILITIES AND RISKS, FOR USE OR OPERATION OF THE SOFTWARE, INCLUDING WITHOUT LIMITATION, SOFTWARE APPLICATIONS DESIGNED OR INTENDED FOR MISSION CRITICAL APPLICATIONS, SUCH AS PACEMAKERS, WEAPONRY, AIRCRAFT NAVIGATION, FACTORY CONTROL SYSTEMS, ETC. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
6.NO LIABILITY
PLEASE NOTE THAT YOU SHOULD USE THE SOFTWARE AT YOUR OWN RISK.
IN NO EVENT SHALL 【 Amlogic 】 BE LIABLE FOR ANY DIRECT OR INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHER LEGAL THEORY, EVEN IF 【 Amlogic 】 HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. EVEN IF THE SOFTWARE HAS ANY MATERIAL, VERIFIABLE, AND REPRODUCIBLE PROGRAM ERRORS, 【 Amlogic 】 SHALL HAVE NO LIABILITY TO MODIFY SUCH ERRORS.
NOTWITHSTANDING ANYTHING TO THE CONTRARY CONTAINED IN THIS AGREEMENT, THE MAXIMUM LIABILITY OF 【 Amlogic 】 TO YOU IN AGGREGATE FOR ALL CLAIMS MADE AGAINST 【 Amlogic 】 IN CONTRACT TORT OR OTHERWISE UNDER OR IN CONNECTION WITH THE SUBJECT MATTER OF THIS AGREEMENT SHALL NOT EXCEED THE TOTAL OF SUMS RECEIVED BY 【 Amlogic 】 FROM YOU FOR THIS AGREEMENT. THE EXISTENCE OF MORE THAN ONE CLAIM WILL NOT ENLARGE OR EXTEND THE LIMIT.
7.CONFIDENTIALITY
YOU acknowledge and agree that the SOFTWARE provided under this Agreement contain trade secrets and confidential material of 【 Amlogic 】 and YOU agree to maintain all such information in confidence and apply security measures no less stringent than the measures which YOU apply to protect your own like information, but not less than a reasonable degree of care, to prevent their unauthorized disclosure and use. The period of confidentiality shall be indefinite. YOU agree not to use any such information other than in normal use of the SOFTWARE under the license granted in this Agreement.
8.TERM AND TERMINATION
This Agreement shall remain in force until terminated. 【 Amlogic 】 may terminate this Agreement at any time with or without any cause. Upon termination of this Agreement, YOU shall immediately stop using the SOFTWARE and confidential information and destroy all copies of the SOFTWARE and confidential information in your possession, together with all documentation and related materials. The provisions of clauses 2, 3, 4, 5, 6, 78 and 9 shall survive termination of this Agreement.
9.GENERAL
Any provision of this Agreement which is prohibited or unenforceable in any jurisdiction shall be ineffective to the extent of such prohibition or unenforceability without affecting, impairing or invalidating the remaining provisions hereof.
The failure by 【Amlogic】 to enforce any of the provisions of this Agreement, unless waived in writing, shall not constitute a waiver of 【Amlogic】's rights to enforce such provision or any other provision of this Agreement in the future.
This Agreement shall be governed by and construed in accordance with the laws of Peoples Republic of China, without reference to the principles of conflicts of laws. Any dispute arising out of or relating to this Agreement shall be submitted to 【favorite court of the licensor】and the parties waive all objections to that jurisdiction and venue.
Copyright (C) 【2022】【Amlogic Technology Co., Ltd.】 All rights reserved.
Binary file not shown.
+450
View File
@@ -0,0 +1,450 @@
/*
* Copyright (C) 2017 Amlogic, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*/
/**************************************************
* example based on amcodec
**************************************************/
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <stdbool.h>
#include <ctype.h>
#include <codec.h>
#include <amvideo.h>
#include <IONmem.h>
#define READ_SIZE (64 * 1024)
#define EXTERNAL_PTS (1)
#define SYNC_OUTSIDE (2)
#define UNIT_FREQ 96000
#define PTS_FREQ 90000
#define AV_SYNC_THRESH PTS_FREQ*30
#define MESON_BUFFER_SIZE 4
static codec_para_t v_codec_para;
static codec_para_t *vpcodec;
#ifdef AUDIO_ES
static codec_para_t a_codec_para;
static codec_para_t *apcodec;
#endif
static codec_para_t *pcodec;
static char *filename;
FILE* fp = NULL;
FILE* yuv = NULL;
static int axis[8] = {0};
struct amvideo_dev *amvideo;
struct out_buffer_t {
int index;
int size;
bool own_by_v4l;
void *ptr;
IONMEM_AllocParams buffer;
} vbuffer[MESON_BUFFER_SIZE];
static int amsysfs_set_sysfs_str(const char *path, const char *val)
{
int fd;
int bytes;
fd = open(path, O_CREAT | O_RDWR | O_TRUNC, 0644);
if (fd >= 0) {
bytes = write(fd, val, strlen(val));
close(fd);
return 0;
} else {
printf("unable to open file %s,err: %s\n", path, strerror(errno));
}
return -1;
}
int osd_blank(char *path, int cmd)
{
int fd;
char bcmd[16];
fd = open(path, O_CREAT | O_RDWR | O_TRUNC, 0644);
if (fd >= 0) {
sprintf(bcmd, "%d", cmd);
write(fd, bcmd, strlen(bcmd));
close(fd);
return 0;
}
return -1;
}
int set_tsync_enable(int enable)
{
int fd;
char *path = "/sys/class/tsync/enable";
char bcmd[16];
fd = open(path, O_CREAT | O_RDWR | O_TRUNC, 0644);
if (fd >= 0) {
sprintf(bcmd, "%d", enable);
write(fd, bcmd, strlen(bcmd));
close(fd);
return 0;
}
return -1;
}
int parse_para(const char *para, int para_num, int *result)
{
char *endp;
const char *startp = para;
int *out = result;
int len = 0, count = 0;
if (!startp) {
return 0;
}
len = strlen(startp);
do {
//filter space out
while (startp && (isspace(*startp) || !isgraph(*startp)) && len) {
startp++;
len--;
}
if (len == 0) {
break;
}
*out++ = strtol(startp, &endp, 0);
len -= endp - startp;
startp = endp;
count++;
} while ((endp) && (count < para_num) && (len > 0));
return count;
}
int set_display_axis(int recovery)
{
int fd;
char *path = "/sys/class/display/axis";
char str[128];
int count;
fd = open(path, O_CREAT | O_RDWR | O_TRUNC, 0644);
if (fd >= 0) {
if (!recovery) {
read(fd, str, 128);
printf("read axis %s, length %d\n", str, strlen(str));
count = parse_para(str, 8, axis);
}
if (recovery) {
sprintf(str, "%d %d %d %d %d %d %d %d",
axis[0], axis[1], axis[2], axis[3], axis[4], axis[5], axis[6], axis[7]);
} else {
sprintf(str, "2048 %d %d %d %d %d %d %d",
axis[1], axis[2], axis[3], axis[4], axis[5], axis[6], axis[7]);
}
write(fd, str, strlen(str));
close(fd);
return 0;
}
return -1;
}
static void FreeBuffers()
{
int i;
for (i = 0; i < MESON_BUFFER_SIZE; i++) {
if (vbuffer[i].ptr) {
CMEM_free(&vbuffer[i].buffer);
}
}
}
static int AllocBuffers(int width, int height)
{
int i, size, ret;
CMEM_init();
size = width * height * 3 / 2;
for (i = 0; i < MESON_BUFFER_SIZE; i++) {
ret = CMEM_alloc(size, &vbuffer[i].buffer);
if (ret < 0) {
printf("CMEM_alloc failed\n");
FreeBuffers();
goto fail;
}
vbuffer[i].index = i;
vbuffer[i].size = size;
vbuffer[i].ptr = vbuffer[i].buffer.vaddr;
}
fail:
return ret;
}
static int ionvideo_init(int width, int height)
{
int i, ret;
amsysfs_set_sysfs_str("/sys/class/vfm/map", "rm default");
amsysfs_set_sysfs_str("/sys/class/vfm/map",
"add default decoder ionvideo");
ret = AllocBuffers(width, height);
if (ret < 0) {
printf("AllocBuffers failed\n");
ret = -ENODEV;
goto fail;
}
amvideo = new_amvideo(FLAGS_V4L_MODE);
if (!amvideo) {
printf("amvideo create failed\n");
ret = -ENODEV;
goto fail;
}
amvideo->display_mode = 0;
amvideo->use_frame_mode = 0;
ret = amvideo_init(amvideo, 0, width, height,
V4L2_PIX_FMT_NV12, MESON_BUFFER_SIZE);
if (ret < 0) {
printf("amvideo_init failed\n");
amvideo_release(amvideo);
goto fail;
}
ret = amvideo_start(amvideo);
if (ret < 0) {
amvideo_release(amvideo);
goto fail;
}
for (i = 0; i < MESON_BUFFER_SIZE; i++) {
vframebuf_t vf;
vf.fd = vbuffer[i].buffer.mIonHnd;
vf.length = vbuffer[i].buffer.size;
vf.index = vbuffer[i].index;
ret = amlv4l_queuebuf(amvideo, &vf);
}
fail:
return ret;
}
static void ionvideo_close()
{
amvideo_stop(amvideo);
amvideo_release(amvideo);
}
static void signal_handler(int signum)
{
printf("Get signum=%x\n", signum);
#ifdef AUDIO_ES
codec_close(apcodec);
#endif
codec_close(vpcodec);
fclose(fp);
set_display_axis(1);
signal(signum, SIG_DFL);
raise(signum);
ionvideo_close();
FreeBuffers();
}
int main(int argc, char *argv[])
{
int ret = CODEC_ERROR_NONE;
char buffer[READ_SIZE];
uint32_t Readlen;
uint32_t isize;
struct buf_status vbuf;
if (argc < 6) {
printf("Corret command: ionplayer <filename> <width> <height> <fps> <format(1:mpeg4 2:h264)> [subformat for mpeg4]\n");
return -1;
}
#if 0
if (osd_blank("/sys/class/graphics/fb0/blank", 1) < 0)
osd_blank("/sys/kernel/debug/dri/0/vpu/blank", 1);
if (osd_blank("/sys/class/graphics/fb1/blank", 0) < 0)
osd_blank("/sys/kernel/debug/dri/64/vpu/blank", 1);
#endif
set_display_axis(0);
#ifdef AUDIO_ES
apcodec = &a_codec_para;
memset(apcodec, 0, sizeof(codec_para_t));
#endif
vpcodec = &v_codec_para;
memset(vpcodec, 0, sizeof(codec_para_t));
vpcodec->has_video = 1;
vpcodec->video_type = atoi(argv[5]);
if (vpcodec->video_type == VFORMAT_H264) {
vpcodec->am_sysinfo.format = VIDEO_DEC_FORMAT_H264;
vpcodec->am_sysinfo.param = (void *)(EXTERNAL_PTS | SYNC_OUTSIDE);
} else if (vpcodec->video_type == VFORMAT_MPEG4) {
if (argc < 7) {
printf("No subformat for mpeg4, take the default VIDEO_DEC_FORMAT_MPEG4_5\n");
vpcodec->am_sysinfo.format = VIDEO_DEC_FORMAT_MPEG4_5;
} else {
vpcodec->am_sysinfo.format = atoi(argv[6]);
}
}
vpcodec->stream_type = STREAM_TYPE_ES_VIDEO;
vpcodec->am_sysinfo.rate = 96000 / atoi(argv[4]);
vpcodec->am_sysinfo.height = atoi(argv[3]);
vpcodec->am_sysinfo.width = atoi(argv[2]);
vpcodec->has_audio = 0;
vpcodec->noblock = 0;
#ifdef AUDIO_ES
apcodec->audio_type = AFORMAT_MPEG;
apcodec->stream_type = STREAM_TYPE_ES_AUDIO;
apcodec->audio_pid = 0x1023;
apcodec->has_audio = 1;
apcodec->audio_channels = 2;
apcodec->audio_samplerate = 48000;
apcodec->noblock = 0;
apcodec->audio_info.channels = 2;
apcodec->audio_info.sample_rate = 48000;
#endif
printf("\n*********CODEC PLAYER DEMO************\n\n");
filename = argv[1];
printf("file %s to be played\n", filename);
if ((fp = fopen(filename, "rb")) == NULL) {
printf("open file error!\n");
return -1;
}
if ((yuv = fopen("./yuv.yuv", "wb")) == NULL) {
printf("./yuv.yuv dump open file error!\n");
return -1;
}
ionvideo_init(vpcodec->am_sysinfo.width, vpcodec->am_sysinfo.height);
#ifdef AUDIO_ES
ret = codec_init(apcodec);
if (ret != CODEC_ERROR_NONE) {
printf("codec init failed, ret=-0x%x", -ret);
return -1;
}
#endif
ret = codec_init(vpcodec);
if (ret != CODEC_ERROR_NONE) {
printf("codec init failed, ret=-0x%x", -ret);
return -1;
}
printf("video codec ok!\n");
//codec_set_cntl_avthresh(vpcodec, AV_SYNC_THRESH);
//codec_set_cntl_syncthresh(vpcodec, 0);
set_tsync_enable(0);
pcodec = vpcodec;
while (!feof(fp)) {
Readlen = fread(buffer, 1, READ_SIZE, fp);
printf("Readlen %d\n", Readlen);
if (Readlen <= 0) {
printf("read file error!\n");
rewind(fp);
}
isize = 0;
do {
vframebuf_t vf;
ret = amlv4l_dequeuebuf(amvideo, &vf);
if (ret >= 0) {
printf("vf idx%d pts 0x%llx\n", vf.index, vf.pts);
fwrite(vbuffer[vf.index].ptr, vbuffer[vf.index].size, 1, yuv);
fflush(yuv);
ret = amlv4l_queuebuf(amvideo, &vf);
if (ret < 0) {
printf("amlv4l_queuebuf %d\n", ret);
}
} else {
printf("amlv4l_dequeuebuf %d\n", ret);
}
ret = codec_write(pcodec, buffer + isize, Readlen);
if (ret < 0) {
if (errno != EAGAIN) {
printf("write data failed, errno %d\n", errno);
goto error;
} else {
continue;
}
} else {
isize += ret;
}
printf("ret %d, isize %d\n", ret, isize);
} while (isize < Readlen);
signal(SIGCHLD, SIG_IGN);
signal(SIGTSTP, SIG_IGN);
signal(SIGTTOU, SIG_IGN);
signal(SIGTTIN, SIG_IGN);
signal(SIGHUP, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGSEGV, signal_handler);
signal(SIGINT, signal_handler);
signal(SIGQUIT, signal_handler);
}
do {
vframebuf_t vf;
ret = codec_get_vbuf_state(pcodec, &vbuf);
if (ret != 0) {
printf("codec_get_vbuf_state error: %x\n", -ret);
goto error;
}
ret = amlv4l_dequeuebuf(amvideo, &vf);
if (ret >= 0) {
printf("vf idx%d pts 0x%llx\n", vf.index, vf.pts);
fwrite(vbuffer[vf.index].ptr, vbuffer[vf.index].size, 1, yuv);
fflush(yuv);
ret = amlv4l_queuebuf(amvideo, &vf);
if (ret < 0) {
//printf("amlv4l_queuebuf %d\n", ret);
}
} else {
//printf("amlv4l_dequeuebuf %d\n", ret);
}
} while (vbuf.data_len > 0x100);
error:
#ifdef AUDIO_ES
codec_close(apcodec);
#endif
codec_close(vpcodec);
fclose(fp);
fclose(yuv);
set_display_axis(1);
ionvideo_close();
FreeBuffers();
return 0;
}
+27
View File
@@ -0,0 +1,27 @@
# Copyright (C) 2022 Unionman Technology Co., Ltd.
# 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.
import("//build/ohos.gni")
import("//build/ohos/ndk/ndk.gni")
ohos_prebuilt_shared_library("libvpcodec") {
if (target_cpu == "arm") {
source = "lib/libvpcodec.z.so"
} else if (target_cpu == "arm64") {
source = "lib64/libvpcodec.z.so"
}
install_enable = true
install_images = [ "system" ]
part_name = "unionman_products"
}