add OHOS compile opt

Signed-off-by: Bojack <yangjunhui_job@163.com>
This commit is contained in:
Bojack 2024-04-25 14:18:06 +08:00
parent d943f601eb
commit 5efa348e03
4 changed files with 22 additions and 5 deletions

View File

@ -36,7 +36,9 @@ const AVCodecTag ff_mp4_obj_type[] = {
{ AV_CODEC_ID_MPEG4 , 0x20 },
{ AV_CODEC_ID_H264 , 0x21 },
{ AV_CODEC_ID_HEVC , 0x23 },
#ifdef OHOS_OPT_COMPAT
{ AV_CODEC_ID_VVC , 0x33 },
#endif
{ AV_CODEC_ID_AAC , 0x40 },
{ AV_CODEC_ID_MP4ALS , 0x40 }, /* 14496-3 ALS */
{ AV_CODEC_ID_MPEG2VIDEO , 0x61 }, /* MPEG-2 Main */

View File

@ -120,10 +120,10 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
{ AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1') }, /* HEVC/H.265 which indicates parameter sets shall not be in ES */
{ AV_CODEC_ID_HEVC, MKTAG('d', 'v', 'h', 'e') }, /* HEVC-based Dolby Vision derived from hev1 */
/* dvh1 is handled within mov.c */
#ifdef OHOS_OPT_COMPAT
{ AV_CODEC_ID_VVC, MKTAG('v', 'v', 'i', '1') }, /* VVC/H.266 which indicates parameter sets may be in ES */
{ AV_CODEC_ID_VVC, MKTAG('v', 'v', 'c', '1') }, /* VVC/H.266 which indicates parameter shall not be in ES */
#endif
{ AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
{ AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '2') },
{ AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '3') },

View File

@ -1979,12 +1979,12 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if ((uint64_t)atom.size > (1<<30))
return AVERROR_INVALIDDATA;
#ifdef OHOS_OPT_COMPAT
if (atom.type == MKTAG('v','v','c','C')) {
avio_rb32(pb);
atom.size -= 4;
}
#endif
if (atom.size >= 10) {
// Broken files created by legacy versions of libavformat will
// wrap a whole fiel atom inside of a glbl atom.
@ -2008,9 +2008,10 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
the hvcC extradata box available as specified,
set codec to HEVC */
st->codecpar->codec_id = AV_CODEC_ID_HEVC;
#ifdef OHOS_OPT_COMPAT
if (atom.type == MKTAG('v','v','c','C'))
st->codecpar->codec_id = AV_CODEC_ID_VVC;
#endif
return 0;
}
@ -7169,7 +7170,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG('d','v','c','1'), mov_read_dvc1 },
{ MKTAG('s','b','g','p'), mov_read_sbgp },
{ MKTAG('h','v','c','C'), mov_read_glbl },
#ifdef OHOS_OPT_COMPAT
{ MKTAG('v','v','c','C'), mov_read_glbl },
#endif
{ MKTAG('u','u','i','d'), mov_read_uuid },
{ MKTAG('C','i','n', 0x8e), mov_read_targa_y216 },
{ MKTAG('f','r','e','e'), mov_read_free },

View File

@ -360,7 +360,9 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st,
{ "mp3", AV_CODEC_ID_MP3, AVMEDIA_TYPE_AUDIO },
{ "mpegvideo", AV_CODEC_ID_MPEG2VIDEO, AVMEDIA_TYPE_VIDEO },
{ "truehd", AV_CODEC_ID_TRUEHD, AVMEDIA_TYPE_AUDIO },
#ifdef OHOS_OPT_COMPAT
{ "vvc", AV_CODEC_ID_VVC, AVMEDIA_TYPE_VIDEO },
#endif
{ 0 }
};
int score;
@ -1043,9 +1045,14 @@ static PacketList *get_next_pkt(AVFormatContext *s, AVStream *st, PacketList *pk
}
static int64_t select_from_pts_buffer(AVStream *st, int64_t *pts_buffer, int64_t dts) {
#ifdef OHOS_OPT_COMPAT
int onein_oneout = st->codecpar->codec_id != AV_CODEC_ID_H264 &&
st->codecpar->codec_id != AV_CODEC_ID_HEVC &&
st->codecpar->codec_id != AV_CODEC_ID_VVC;
#else
int onein_oneout = st->codecpar->codec_id != AV_CODEC_ID_H264 &&
st->codecpar->codec_id != AV_CODEC_ID_HEVC;
#endif
if(!onein_oneout) {
int delay = st->internal->avctx->has_b_frames;
@ -1232,9 +1239,14 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
int num, den, presentation_delayed, delay, i;
int64_t offset;
AVRational duration;
#ifdef OHOS_OPT_COMPAT
int onein_oneout = st->codecpar->codec_id != AV_CODEC_ID_H264 &&
st->codecpar->codec_id != AV_CODEC_ID_HEVC &&
st->codecpar->codec_id != AV_CODEC_ID_VVC;
#else
int onein_oneout = st->codecpar->codec_id != AV_CODEC_ID_H264 &&
st->codecpar->codec_id != AV_CODEC_ID_HEVC;
#endif
if (s->flags & AVFMT_FLAG_NOFILLIN)
return;