lavc/libopenh264enc: Allow specifying the profile through AVCodecContext
And determine the profile with following priority: 1. s->profile; then 2. avctx->profile; then 3. s->cabac; then 4. a default profile. This seems more natural in case user somehow sets both avctx->profile and s->profile. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
This commit is contained in:
parent
d3a7bdd4ac
commit
e3e2702d40
@ -182,6 +182,21 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
param.iEntropyCodingModeFlag = 0;
|
param.iEntropyCodingModeFlag = 0;
|
||||||
param.iMultipleThreadIdc = avctx->thread_count;
|
param.iMultipleThreadIdc = avctx->thread_count;
|
||||||
|
|
||||||
|
/* Allow specifying the libopenh264 profile through AVCodecContext. */
|
||||||
|
if (FF_PROFILE_UNKNOWN == s->profile &&
|
||||||
|
FF_PROFILE_UNKNOWN != avctx->profile)
|
||||||
|
switch (avctx->profile) {
|
||||||
|
case FF_PROFILE_H264_HIGH:
|
||||||
|
case FF_PROFILE_H264_MAIN:
|
||||||
|
case FF_PROFILE_H264_CONSTRAINED_BASELINE:
|
||||||
|
s->profile = avctx->profile;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
av_log(avctx, AV_LOG_WARNING,
|
||||||
|
"Unsupported avctx->profile: %d.\n", avctx->profile);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (s->profile == FF_PROFILE_UNKNOWN)
|
if (s->profile == FF_PROFILE_UNKNOWN)
|
||||||
s->profile = !s->cabac ? FF_PROFILE_H264_CONSTRAINED_BASELINE :
|
s->profile = !s->cabac ? FF_PROFILE_H264_CONSTRAINED_BASELINE :
|
||||||
#if OPENH264_VER_AT_LEAST(1, 8)
|
#if OPENH264_VER_AT_LEAST(1, 8)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user