#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "libavutil/opt.h"
+#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
int max_nal_size;
int skip_frames;
int skipped;
+ int cabac;
} SVCContext;
#define OPENH264_VER_AT_LEAST(maj, min) \
{ "dyn", "Dynamic slicing", 0, AV_OPT_TYPE_CONST, { .i64 = SM_DYN_SLICE }, 0, 0, VE, "slice_mode" },
{ "loopfilter", "enable loop filter", OFFSET(loopfilter), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
{ "profile", "set profile restrictions", OFFSET(profile), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, VE },
- { "max_nal_size", "Set maximum NAL size in bytes", OFFSET(max_nal_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
- { "allow_skip_frames", "Allow skipping frames to hit the target bitrate", OFFSET(skip_frames), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+ { "max_nal_size", "set maximum NAL size in bytes", OFFSET(max_nal_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
+ { "allow_skip_frames", "allow skipping frames to hit the target bitrate", OFFSET(skip_frames), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+ { "cabac", "Enable cabac", OFFSET(cabac), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
{ NULL }
};
int err = AVERROR_UNKNOWN;
int log_level;
WelsTraceCallback callback_function;
+ AVCPBProperties *props;
// Mingw GCC < 4.7 on x86_32 uses an incorrect/buggy ABI for the WelsGetCodecVersion
// function (for functions returning larger structs), thus skip the check in those
(*s->encoder)->GetDefaultParams(s->encoder, ¶m);
+#if FF_API_CODER_TYPE
+FF_DISABLE_DEPRECATION_WARNINGS
+ if (!s->cabac)
+ s->cabac = avctx->coder_type == FF_CODER_TYPE_AC;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
param.fMaxFrameRate = 1/av_q2d(avctx->time_base);
param.iPicWidth = avctx->width;
param.iPicHeight = avctx->height;
param.iMultipleThreadIdc = avctx->thread_count;
if (s->profile && !strcmp(s->profile, "main"))
param.iEntropyCodingModeFlag = 1;
- else if (!s->profile && avctx->coder_type == FF_CODER_TYPE_AC)
+ else if (!s->profile && s->cabac)
param.iEntropyCodingModeFlag = 1;
param.sSpatialLayers[0].iVideoWidth = param.iPicWidth;
memcpy(avctx->extradata, fbi.sLayerInfo[0].pBsBuf, size);
}
+ props = ff_add_cpb_side_data(avctx);
+ if (!props) {
+ err = AVERROR(ENOMEM);
+ goto fail;
+ }
+ props->max_bitrate = param.iMaxBitrate;
+ props->avg_bitrate = param.iTargetBitrate;
+
return 0;
fail: