diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 06579a5..ed5bcf9 100644
|
a
|
b
|
static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx)
|
| 1166 | 1166 | || vui->videoFormat != 5 |
| 1167 | 1167 | || vui->videoFullRangeFlag != 0); |
| 1168 | 1168 | |
| 1169 | | h264->sliceMode = 3; |
| 1170 | | h264->sliceModeData = avctx->slices > 0 ? avctx->slices : 1; |
| | 1169 | if (ctx->max_slice_size > 0) { |
| | 1170 | h264->sliceMode = 1; |
| | 1171 | h264->sliceModeData = ctx->max_slice_size; |
| | 1172 | } else { |
| | 1173 | h264->sliceMode = 3; |
| | 1174 | h264->sliceModeData = avctx->slices > 0 ? avctx->slices : 1; |
| | 1175 | } |
| 1171 | 1176 | |
| 1172 | 1177 | if (ctx->intra_refresh) { |
| 1173 | 1178 | h264->enableIntraRefresh = 1; |
| … |
… |
static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx)
|
| 1290 | 1295 | || vui->videoFormat != 5 |
| 1291 | 1296 | || vui->videoFullRangeFlag != 0); |
| 1292 | 1297 | |
| 1293 | | hevc->sliceMode = 3; |
| 1294 | | hevc->sliceModeData = avctx->slices > 0 ? avctx->slices : 1; |
| | 1298 | if (ctx->max_slice_size > 0) { |
| | 1299 | hevc->sliceMode = 1; |
| | 1300 | hevc->sliceModeData = ctx->max_slice_size; |
| | 1301 | } else { |
| | 1302 | hevc->sliceMode = 3; |
| | 1303 | hevc->sliceModeData = avctx->slices > 0 ? avctx->slices : 1; |
| | 1304 | } |
| 1295 | 1305 | |
| 1296 | 1306 | if (ctx->intra_refresh) { |
| 1297 | 1307 | hevc->enableIntraRefresh = 1; |
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index 3a4b456..cf0e8e5 100644
|
a
|
b
|
typedef struct NvencContext
|
| 262 | 262 | int udu_sei; |
| 263 | 263 | int timing_info; |
| 264 | 264 | int highbitdepth; |
| | 265 | int max_slice_size; |
| 265 | 266 | } NvencContext; |
| 266 | 267 | |
| 267 | 268 | int ff_nvenc_encode_init(AVCodecContext *avctx); |
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index a998609..4440e49 100644
|
a
|
b
|
static const AVOption options[] = {
|
| 206 | 206 | OFFSET(intra_refresh),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, |
| 207 | 207 | { "single-slice-intra-refresh", "Use single slice intra refresh", |
| 208 | 208 | OFFSET(single_slice_intra_refresh), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, |
| | 209 | { "max_slice_size", "Maximum encoded slice size in bytes", |
| | 210 | OFFSET(max_slice_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, |
| 209 | 211 | { "constrained-encoding", "Enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices", |
| 210 | 212 | OFFSET(constrained_encoding), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, |
| 211 | 213 | { NULL } |
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index a02f277..e606655 100644
|
a
|
b
|
static const AVOption options[] = {
|
| 187 | 187 | OFFSET(intra_refresh),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, |
| 188 | 188 | { "single-slice-intra-refresh", "Use single slice intra refresh", |
| 189 | 189 | OFFSET(single_slice_intra_refresh), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, |
| | 190 | { "max_slice_size", "Maximum encoded slice size in bytes", |
| | 191 | OFFSET(max_slice_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, |
| 190 | 192 | { "constrained-encoding", "Enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices", |
| 191 | 193 | OFFSET(constrained_encoding), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, |
| 192 | 194 | { NULL } |