Skip to content

Commit b68d306

Browse files
committed
hevc : add hevc profile
1 parent 088f2eb commit b68d306

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

libavcodec/avcodec.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2814,6 +2814,11 @@ typedef struct AVCodecContext {
28142814
#define FF_PROFILE_JPEG2000_DCINEMA_2K 3
28152815
#define FF_PROFILE_JPEG2000_DCINEMA_4K 4
28162816

2817+
2818+
#define FF_PROFILE_HEVC_MAIN 1
2819+
#define FF_PROFILE_HEVC_MAIN_10 2
2820+
#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3
2821+
28172822
/**
28182823
* level
28192824
* - encoding: Set by user.

libavcodec/hevc.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,9 @@ static int hls_slice_header(HEVCContext *s)
374374
s->max_ra = INT_MAX;
375375
}
376376

377+
s->avctx->profile = s->sps->ptl.general_PTL.profile_idc;
378+
s->avctx->level = s->sps->ptl.general_PTL.level_idc;
379+
377380
sh->dependent_slice_segment_flag = 0;
378381
if (!sh->first_slice_in_pic_flag) {
379382
int slice_address_length;
@@ -2926,6 +2929,14 @@ static void hevc_decode_flush(AVCodecContext *avctx)
29262929

29272930
#define OFFSET(x) offsetof(HEVCContext, x)
29282931
#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
2932+
2933+
static const AVProfile profiles[] = {
2934+
{ FF_PROFILE_HEVC_MAIN, "Main" },
2935+
{ FF_PROFILE_HEVC_MAIN_10, "Main10" },
2936+
{ FF_PROFILE_HEVC_MAIN_STILL_PICTURE, "MainStillPicture" },
2937+
{ FF_PROFILE_UNKNOWN },
2938+
};
2939+
29292940
static const AVOption options[] = {
29302941
{ "apply_defdispwin", "Apply default display window from VUI", OFFSET(apply_defdispwin),
29312942
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, PAR },
@@ -2956,4 +2967,5 @@ AVCodec ff_hevc_decoder = {
29562967
.init_thread_copy = hevc_init_thread_copy,
29572968
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY |
29582969
CODEC_CAP_SLICE_THREADS | CODEC_CAP_FRAME_THREADS,
2970+
.profiles = NULL_IF_CONFIG_SMALL(profiles),
29592971
};

0 commit comments

Comments
 (0)