mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-23 11:19:55 +00:00
av3a增量式修改宏保护
Signed-off-by: liushuai <cqliushuai@outlook.com>
This commit is contained in:
parent
390fcafe67
commit
688ea511f3
1
BUILD.gn
1
BUILD.gn
@ -147,6 +147,7 @@ config("ffmpeg_config") {
|
|||||||
"-DOHOS_SUBTITLE_DEMUXER",
|
"-DOHOS_SUBTITLE_DEMUXER",
|
||||||
"-DOHOS_EXPAND_MP4_INFO",
|
"-DOHOS_EXPAND_MP4_INFO",
|
||||||
"-DOHOS_OPTIMIZE_DELAY",
|
"-DOHOS_OPTIMIZE_DELAY",
|
||||||
|
"-DOHOS_AV3A_DEMUXER",
|
||||||
]
|
]
|
||||||
if (use_musl) {
|
if (use_musl) {
|
||||||
cflags += [ "-Wno-bool-operation" ]
|
cflags += [ "-Wno-bool-operation" ]
|
||||||
|
@ -647,7 +647,9 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
|
|||||||
case AV_CODEC_ID_MP2:
|
case AV_CODEC_ID_MP2:
|
||||||
case AV_CODEC_ID_MUSEPACK7: return 1152;
|
case AV_CODEC_ID_MUSEPACK7: return 1152;
|
||||||
case AV_CODEC_ID_AC3: return 1536;
|
case AV_CODEC_ID_AC3: return 1536;
|
||||||
|
#ifdef DOHOS_AV3A_DEMUXER
|
||||||
case AV_CODEC_ID_AVS3DA: return 1024;
|
case AV_CODEC_ID_AVS3DA: return 1024;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sr > 0) {
|
if (sr > 0) {
|
||||||
|
@ -339,7 +339,9 @@ const AVCodecTag ff_codec_movaudio_tags[] = {
|
|||||||
{ AV_CODEC_ID_TRUEHD, MKTAG('m', 'l', 'p', 'a') }, /* mp4ra.org */
|
{ AV_CODEC_ID_TRUEHD, MKTAG('m', 'l', 'p', 'a') }, /* mp4ra.org */
|
||||||
{ AV_CODEC_ID_OPUS, MKTAG('O', 'p', 'u', 's') }, /* mp4ra.org */
|
{ AV_CODEC_ID_OPUS, MKTAG('O', 'p', 'u', 's') }, /* mp4ra.org */
|
||||||
{ AV_CODEC_ID_MPEGH_3D_AUDIO, MKTAG('m', 'h', 'm', '1') }, /* MPEG-H 3D Audio bitstream */
|
{ AV_CODEC_ID_MPEGH_3D_AUDIO, MKTAG('m', 'h', 'm', '1') }, /* MPEG-H 3D Audio bitstream */
|
||||||
|
#ifdef DOHOS_AV3A_DEMUXER
|
||||||
{ AV_CODEC_ID_AVS3DA, MKTAG('a', 'v', '3', 'a') },
|
{ AV_CODEC_ID_AVS3DA, MKTAG('a', 'v', '3', 'a') },
|
||||||
|
#endif
|
||||||
{ AV_CODEC_ID_NONE, 0 },
|
{ AV_CODEC_ID_NONE, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7923,6 +7923,7 @@ static int mov_read_gnre(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DOHOS_AV3A_DEMUXER
|
||||||
static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -8037,7 +8038,7 @@ static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = nb_channels; i < st->codecpar->ch_layout.nb_channels; i++) {
|
for (i = nb_channels; i < st->codecpar->ch_layout.nb_channels; i++) {
|
||||||
st->codecpar->ch_layout.u.map[i].id = AV3A_CH_AUDIO_OBJECT;
|
st->codecpar->ch_layout.u.map[i].id = AV3A_CH_AUDIO_OBJECT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_AMBISONIC;
|
st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_AMBISONIC;
|
||||||
@ -8046,6 +8047,7 @@ static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static const MOVParseTableEntry mov_default_parse_table[] = {
|
static const MOVParseTableEntry mov_default_parse_table[] = {
|
||||||
{ MKTAG('A','C','L','R'), mov_read_aclr },
|
{ MKTAG('A','C','L','R'), mov_read_aclr },
|
||||||
@ -8162,7 +8164,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
|
|||||||
#ifdef OHOS_TIMED_META_TRACK
|
#ifdef OHOS_TIMED_META_TRACK
|
||||||
{ MKTAG('c','d','s','c'), mov_read_cdsc },
|
{ MKTAG('c','d','s','c'), mov_read_cdsc },
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef DOHOS_AV3A_DEMUXER
|
||||||
{ MKTAG('d','c','a','3'), mov_read_dca3 },
|
{ MKTAG('d','c','a','3'), mov_read_dca3 },
|
||||||
|
#endif
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -900,6 +900,7 @@ static int mov_write_dmlp_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
|
|||||||
return update_size(pb, pos);
|
return update_size(pb, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DOHOS_AV3A_DEMUXER
|
||||||
static int mov_write_dca3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
|
static int mov_write_dca3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
|
||||||
{
|
{
|
||||||
int64_t pos = avio_tell(pb);
|
int64_t pos = avio_tell(pb);
|
||||||
@ -969,6 +970,7 @@ static int mov_write_dca3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
|
|||||||
|
|
||||||
return update_size(pb, pos);
|
return update_size(pb, pos);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int mov_write_chan_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
|
static int mov_write_chan_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
|
||||||
{
|
{
|
||||||
@ -1329,8 +1331,13 @@ static int mov_write_audio_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
|
|||||||
} else { /* reserved for mp4/3gp */
|
} else { /* reserved for mp4/3gp */
|
||||||
if (track->par->codec_id == AV_CODEC_ID_FLAC ||
|
if (track->par->codec_id == AV_CODEC_ID_FLAC ||
|
||||||
track->par->codec_id == AV_CODEC_ID_ALAC ||
|
track->par->codec_id == AV_CODEC_ID_ALAC ||
|
||||||
|
#ifdef DOHOS_AV3A_DEMUXER
|
||||||
track->par->codec_id == AV_CODEC_ID_OPUS ||
|
track->par->codec_id == AV_CODEC_ID_OPUS ||
|
||||||
track->par->codec_id == AV_CODEC_ID_AVS3DA) {
|
track->par->codec_id == AV_CODEC_ID_AVS3DA
|
||||||
|
#else
|
||||||
|
track->par->codec_id == AV_CODEC_ID_OPUS
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
avio_wb16(pb, track->par->ch_layout.nb_channels);
|
avio_wb16(pb, track->par->ch_layout.nb_channels);
|
||||||
} else {
|
} else {
|
||||||
avio_wb16(pb, 2);
|
avio_wb16(pb, 2);
|
||||||
@ -1398,8 +1405,10 @@ static int mov_write_audio_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
|
|||||||
ret = mov_write_dops_tag(s, pb, track);
|
ret = mov_write_dops_tag(s, pb, track);
|
||||||
else if (track->par->codec_id == AV_CODEC_ID_TRUEHD)
|
else if (track->par->codec_id == AV_CODEC_ID_TRUEHD)
|
||||||
ret = mov_write_dmlp_tag(s, pb, track);
|
ret = mov_write_dmlp_tag(s, pb, track);
|
||||||
|
#ifdef DOHOS_AV3A_DEMUXER
|
||||||
else if (track->par->codec_id == AV_CODEC_ID_AVS3DA)
|
else if (track->par->codec_id == AV_CODEC_ID_AVS3DA)
|
||||||
ret = mov_write_dca3_tag(s, pb, track);
|
ret = mov_write_dca3_tag(s, pb, track);
|
||||||
|
#endif
|
||||||
else if (track->vos_len > 0)
|
else if (track->vos_len > 0)
|
||||||
ret = mov_write_glbl_tag(pb, track);
|
ret = mov_write_glbl_tag(pb, track);
|
||||||
|
|
||||||
@ -8351,7 +8360,9 @@ static const AVCodecTag codec_mp4_tags[] = {
|
|||||||
#ifdef OHOS_TIMED_META_TRACK
|
#ifdef OHOS_TIMED_META_TRACK
|
||||||
{ AV_CODEC_ID_FFMETADATA, MKTAG('c', 'd', 's', 'c') },
|
{ AV_CODEC_ID_FFMETADATA, MKTAG('c', 'd', 's', 'c') },
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef DOHOS_AV3A_DEMUXER
|
||||||
{ AV_CODEC_ID_AVS3DA, MKTAG('a', 'v', '3', 'a') },
|
{ AV_CODEC_ID_AVS3DA, MKTAG('a', 'v', '3', 'a') },
|
||||||
|
#endif
|
||||||
{ AV_CODEC_ID_NONE, 0 },
|
{ AV_CODEC_ID_NONE, 0 },
|
||||||
};
|
};
|
||||||
#if CONFIG_MP4_MUXER || CONFIG_PSP_MUXER
|
#if CONFIG_MP4_MUXER || CONFIG_PSP_MUXER
|
||||||
|
@ -1408,7 +1408,9 @@ static const StreamType ISO_types[] = {
|
|||||||
{ 0xd1, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC },
|
{ 0xd1, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC },
|
||||||
{ 0xd2, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS2 },
|
{ 0xd2, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS2 },
|
||||||
{ 0xd4, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS3 },
|
{ 0xd4, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS3 },
|
||||||
|
#ifdef DOHOS_AV3A_DEMUXER
|
||||||
{ 0xd5, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AVS3DA },
|
{ 0xd5, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AVS3DA },
|
||||||
|
#endif
|
||||||
{ 0xea, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1 },
|
{ 0xea, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1 },
|
||||||
{ 0 },
|
{ 0 },
|
||||||
};
|
};
|
||||||
|
@ -433,9 +433,11 @@ static int get_dvb_stream_type(AVFormatContext *s, AVStream *st)
|
|||||||
stream_type = STREAM_TYPE_PRIVATE_DATA;
|
stream_type = STREAM_TYPE_PRIVATE_DATA;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifdef DOHOS_AV3A_DEMUXER
|
||||||
case AV_CODEC_ID_AVS3DA:
|
case AV_CODEC_ID_AVS3DA:
|
||||||
stream_type = STREAM_TYPE_AUDIO_AV3A;
|
stream_type = STREAM_TYPE_AUDIO_AV3A;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
av_log_once(s, AV_LOG_WARNING, AV_LOG_DEBUG, &ts_st->data_st_warning,
|
av_log_once(s, AV_LOG_WARNING, AV_LOG_DEBUG, &ts_st->data_st_warning,
|
||||||
"Stream %d, codec %s, is muxed as a private data stream "
|
"Stream %d, codec %s, is muxed as a private data stream "
|
||||||
|
Loading…
Reference in New Issue
Block a user