X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fvpcc.c;h=66d0df69e5e3877b29b4195f95a380c43e78449b;hb=8ea8be595166cdae73bf3f8bee2f28bc94f1c988;hp=df08de59a6a520949fa65ecd7422a3c879af491f;hpb=d0f098a5e0bae84d98eb48ea5ba173422e004fe3;p=ffmpeg diff --git a/libavformat/vpcc.c b/libavformat/vpcc.c index df08de59a6a..66d0df69e5e 100644 --- a/libavformat/vpcc.c +++ b/libavformat/vpcc.c @@ -67,8 +67,8 @@ static int get_vpx_video_full_range_flag(enum AVColorRange color_range) return color_range == AVCOL_RANGE_JPEG; } -int ff_isom_write_vpcc(AVFormatContext *s, AVIOContext *pb, - AVCodecParameters *par) +int ff_isom_get_vpcc_features(AVFormatContext *s, AVCodecParameters *par, + VPCC *vpcc) { int profile = par->profile; int level = par->level == FF_LEVEL_UNKNOWN ? 0 : par->level; @@ -90,9 +90,28 @@ int ff_isom_write_vpcc(AVFormatContext *s, AVIOContext *pb, } } - avio_w8(pb, profile); - avio_w8(pb, level); - avio_w8(pb, (bit_depth << 4) | (vpx_chroma_subsampling << 1) | vpx_video_full_range_flag); + vpcc->profile = profile; + vpcc->level = level; + vpcc->bitdepth = bit_depth; + vpcc->chroma_subsampling = vpx_chroma_subsampling; + vpcc->full_range_flag = vpx_video_full_range_flag; + + return 0; +} + +int ff_isom_write_vpcc(AVFormatContext *s, AVIOContext *pb, + AVCodecParameters *par) +{ + VPCC vpcc; + int ret; + + ret = ff_isom_get_vpcc_features(s, par, &vpcc); + if (ret < 0) + return ret; + + avio_w8(pb, vpcc.profile); + avio_w8(pb, vpcc.level); + avio_w8(pb, (vpcc.bitdepth << 4) | (vpcc.chroma_subsampling << 1) | vpcc.full_range_flag); avio_w8(pb, par->color_primaries); avio_w8(pb, par->color_trc); avio_w8(pb, par->color_space);