mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-23 11:19:55 +00:00
parent
8ed95e707c
commit
47f0fbd18d
1
BUILD.gn
1
BUILD.gn
@ -129,6 +129,7 @@ config("ffmpeg_config") {
|
||||
"-DCONFIG_OPUS_PARSER",
|
||||
"-DCONFIG_AV3A_PARSER",
|
||||
"-DOHOS_OPT_COMPAT",
|
||||
"-DOHOS_HDR_VIVID",
|
||||
"-Wno-array-parameter",
|
||||
"-Wno-deprecated-pragma",
|
||||
]
|
||||
|
@ -1177,6 +1177,15 @@ typedef struct AVCodecContext {
|
||||
*/
|
||||
enum AVChromaLocation chroma_sample_location;
|
||||
|
||||
#ifdef OHOS_HDR_VIVID
|
||||
/**
|
||||
* The cuvv configuration of HDR Vivid.
|
||||
*/
|
||||
int cuva_version_map;
|
||||
int terminal_provide_code;
|
||||
int terminal_provide_oriented_code;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Number of slices.
|
||||
* Indicates number of picture subdivisions. Used for parallelized
|
||||
|
@ -115,6 +115,11 @@ int avcodec_parameters_from_context(AVCodecParameters *par,
|
||||
par->chroma_location = codec->chroma_sample_location;
|
||||
par->sample_aspect_ratio = codec->sample_aspect_ratio;
|
||||
par->video_delay = codec->has_b_frames;
|
||||
#ifdef OHOS_HDR_VIVID
|
||||
par->cuva_version_map = codec->cuva_version_map;
|
||||
par->terminal_provide_code = codec->terminal_provide_code;
|
||||
par->terminal_provide_oriented_code = codec->terminal_provide_oriented_code;
|
||||
#endif
|
||||
break;
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
par->format = codec->sample_fmt;
|
||||
@ -170,6 +175,11 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
|
||||
codec->chroma_sample_location = par->chroma_location;
|
||||
codec->sample_aspect_ratio = par->sample_aspect_ratio;
|
||||
codec->has_b_frames = par->video_delay;
|
||||
#ifdef OHOS_HDR_VIVID
|
||||
codec->cuva_version_map = par->cuva_version_map;
|
||||
codec->terminal_provide_code = par->terminal_provide_code;
|
||||
codec->terminal_provide_oriented_code = par->terminal_provide_oriented_code;
|
||||
#endif
|
||||
break;
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
codec->sample_fmt = par->format;
|
||||
|
@ -149,6 +149,15 @@ typedef struct AVCodecParameters {
|
||||
enum AVColorSpace color_space;
|
||||
enum AVChromaLocation chroma_location;
|
||||
|
||||
#ifdef OHOS_HDR_VIVID
|
||||
/**
|
||||
* Video only. Additional cuvv configuration.
|
||||
*/
|
||||
int cuva_version_map;
|
||||
int terminal_provide_code;
|
||||
int terminal_provide_oriented_code;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Video only. Number of delayed frames.
|
||||
*/
|
||||
|
@ -2032,6 +2032,23 @@ static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track, int prefer_icc)
|
||||
return update_size(pb, pos);
|
||||
}
|
||||
|
||||
#ifdef OHOS_HDR_VIVID
|
||||
static int mov_write_cuvv_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "cuvv");
|
||||
avio_wb16(pb, track->par->cuva_version_map);
|
||||
avio_wb16(pb, track->par->terminal_provide_code);
|
||||
avio_wb16(pb, track->par->terminal_provide_oriented_code);
|
||||
avio_wb32(pb, 0); // reserved
|
||||
avio_wb32(pb, 0); // reserved
|
||||
avio_wb32(pb, 0); // reserved
|
||||
avio_wb32(pb, 0); // reserved
|
||||
return update_size(pb, pos);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int mov_write_clli_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
const uint8_t *side_data;
|
||||
@ -2164,6 +2181,12 @@ static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
|
||||
|
||||
/* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */
|
||||
find_compressor(compressor_name, 32, track);
|
||||
#ifdef OHOS_HDR_VIVID
|
||||
if (track->par->cuva_version_map > 0 && track->par->codec_id == AV_CODEC_ID_HEVC) {
|
||||
memset(compressor_name, 0, 32);
|
||||
memcpy(compressor_name, "CUVA HDR Video", 14);
|
||||
}
|
||||
#endif
|
||||
avio_w8(pb, strlen(compressor_name));
|
||||
avio_write(pb, compressor_name, 31);
|
||||
|
||||
@ -2296,6 +2319,12 @@ static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
|
||||
ff_mov_cenc_write_sinf_tag(track, pb, mov->encryption_kid);
|
||||
}
|
||||
|
||||
#ifdef OHOS_HDR_VIVID
|
||||
if (track->par->cuva_version_map > 0 && track->par->codec_id == AV_CODEC_ID_HEVC) {
|
||||
mov_write_cuvv_tag(pb, track);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (track->mode == MODE_MP4 &&
|
||||
((ret = mov_write_btrt_tag(pb, track)) < 0))
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user