X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Flibx264.c;h=a54743e4b452a248f3769cd766ceccd867ac4b3f;hb=194dd155582d5b71fc3bb78ef77ce64d3f6c521d;hp=5da816ef064d6a89f7e48a3c7dfdb7c2675e2c1b;hpb=77c3908d5cd076d343554d0f73360a00b5fc90ab;p=ffmpeg diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 5da816ef064..a54743e4b45 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -82,6 +82,7 @@ typedef struct X264Context { int nal_hrd; int avcintra_class; int motion_est; + int forced_idr; char *x264_params; } X264Context; @@ -270,7 +271,8 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, x4->pic.i_pts = frame->pts; x4->pic.i_type = - frame->pict_type == AV_PICTURE_TYPE_I ? X264_TYPE_KEYFRAME : + frame->pict_type == AV_PICTURE_TYPE_I ? + (x4->forced_idr >= 0 ? X264_TYPE_IDR : X264_TYPE_KEYFRAME) : frame->pict_type == AV_PICTURE_TYPE_P ? X264_TYPE_P : frame->pict_type == AV_PICTURE_TYPE_B ? X264_TYPE_B : X264_TYPE_AUTO; @@ -381,6 +383,9 @@ static int convert_pix_fmt(enum AVPixelFormat pix_fmt) case AV_PIX_FMT_NV12: return X264_CSP_NV12; case AV_PIX_FMT_NV16: case AV_PIX_FMT_NV20: return X264_CSP_NV16; +#ifdef X264_CSP_NV21 + case AV_PIX_FMT_NV21: return X264_CSP_NV21; +#endif }; return 0; } @@ -770,6 +775,9 @@ static const enum AVPixelFormat pix_fmts_8bit[] = { AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_NV12, AV_PIX_FMT_NV16, +#ifdef X264_CSP_NV21 + AV_PIX_FMT_NV21, +#endif AV_PIX_FMT_NONE }; static const enum AVPixelFormat pix_fmts_9bit[] = { @@ -869,6 +877,7 @@ static const AVOption options[] = { { "umh", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_UMH }, INT_MIN, INT_MAX, VE, "motion-est" }, { "esa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_ESA }, INT_MIN, INT_MAX, VE, "motion-est" }, { "tesa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_TESA }, INT_MIN, INT_MAX, VE, "motion-est" }, + { "forced-idr", "If forcing keyframes, force them as IDR frames.", OFFSET(forced_idr), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, { "x264-params", "Override the x264 configuration using a :-separated list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { NULL }, };