* commit '7b3214d0050613bd347a2e41c9f78ffb766da25e': lavc: add a field for passing AVHWFramesContext to encoders
Unified · Split
| @@ -15,6 +15,9 @@ libavutil: 2015-08-28 · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | API changes, most recent first: | 16 | API changes, most recent first: |
| 17 | 17 | ||
| 18 | 2016-xx-xx - lavc 57.25.0 - avcodec.h | ||
| 19 | Add AVCodecContext.hw_frames_ctx. | ||
| 20 | |||
| 18 | 2016-xx-xx - lavfi 6.36.0 - avfilter.h | 21 | 2016-xx-xx - lavfi 6.36.0 - avfilter.h |
| 19 | xxxxxxx avfilter.h - Add AVFilterLink.hw_frames_ctx. | 22 | xxxxxxx avfilter.h - Add AVFilterLink.hw_frames_ctx. |
| 20 | xxxxxxx buffersrc.h - Add AVBufferSrcParameters and functions for handling it. | 23 | xxxxxxx buffersrc.h - Add AVBufferSrcParameters and functions for handling it. |
| @@ -3361,6 +3361,18 @@ typedef struct AVCodecContext { · 3360 unmodified lines | |||
| 3361 | AVPacketSideData *coded_side_data; | 3361 | AVPacketSideData *coded_side_data; |
| 3362 | int nb_coded_side_data; | 3362 | int nb_coded_side_data; |
| 3363 | 3363 | ||
| 3364 | /** | ||
| 3365 | * Encoding only. | ||
| 3366 | * | ||
| 3367 | * For hardware encoders configured to use a hwaccel pixel format, this | ||
| 3368 | * field should be set by the caller to a reference to the AVHWFramesContext | ||
| 3369 | * describing input frames. AVHWFramesContext.format must be equal to | ||
| 3370 | * AVCodecContext.pix_fmt. | ||
| 3371 | * | ||
| 3372 | * This field should be set before avcodec_open2() is called and is | ||
| 3373 | * afterwards owned and managed by libavcodec. | ||
| 3374 | */ | ||
| 3375 | AVBufferRef *hw_frames_ctx; | ||
| 3364 | } AVCodecContext; | 3376 | } AVCodecContext; |
| 3365 | 3377 | ||
| 3366 | AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); | 3378 | AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | |||
| 34 | #include "libavutil/channel_layout.h" | 34 | #include "libavutil/channel_layout.h" |
| 35 | #include "libavutil/crc.h" | 35 | #include "libavutil/crc.h" |
| 36 | #include "libavutil/frame.h" | 36 | #include "libavutil/frame.h" |
| 37 | #include "libavutil/hwcontext.h" | ||
| 37 | #include "libavutil/internal.h" | 38 | #include "libavutil/internal.h" |
| 38 | #include "libavutil/mathematics.h" | 39 | #include "libavutil/mathematics.h" |
| 39 | #include "libavutil/mem_internal.h" | 40 | #include "libavutil/mem_internal.h" |
| @@ -1489,6 +1490,16 @@ FF_ENABLE_DEPRECATION_WARNINGS · 1449 unmodified lines | |||
| 1489 | avctx->time_base.den); | 1490 | avctx->time_base.den); |
| 1490 | goto free_and_end; | 1491 | goto free_and_end; |
| 1491 | } | 1492 | } |
| 1493 | |||
| 1494 | if (avctx->hw_frames_ctx) { | ||
| 1495 | AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; | ||
| 1496 | if (frames_ctx->format != avctx->pix_fmt) { | ||
| 1497 | av_log(avctx, AV_LOG_ERROR, | ||
| 1498 | "Mismatching AVCodecContext.pix_fmt and AVHWFramesContext.format\n"); | ||
| 1499 | ret = AVERROR(EINVAL); | ||
| 1500 | goto free_and_end; | ||
| 1501 | } | ||
| 1502 | } | ||
| 1492 | } | 1503 | } |
| 1493 | 1504 | ||
| 1494 | avctx->pts_correction_num_faulty_pts = | 1505 | avctx->pts_correction_num_faulty_pts = |
| @@ -2564,6 +2575,8 @@ av_cold int avcodec_close(AVCodecContext *avctx) · 1069 unmodified lines | |||
| 2564 | av_freep(&avctx->coded_side_data); | 2575 | av_freep(&avctx->coded_side_data); |
| 2565 | avctx->nb_coded_side_data = 0; | 2576 | avctx->nb_coded_side_data = 0; |
| 2566 | 2577 | ||
| 2578 | av_buffer_unref(&avctx->hw_frames_ctx); | ||
| 2579 | |||
| 2567 | if (avctx->priv_data && avctx->codec && avctx->codec->priv_class) | 2580 | if (avctx->priv_data && avctx->codec && avctx->codec->priv_class) |
| 2568 | av_opt_free(avctx->priv_data); | 2581 | av_opt_free(avctx->priv_data); |
| 2569 | av_opt_free(avctx); | 2582 | av_opt_free(avctx); |
| @@ -29,8 +29,8 @@ · 28 unmodified lines | |||
| 29 | #include "libavutil/version.h" | 29 | #include "libavutil/version.h" |
| 30 | 30 | ||
| 31 | #define LIBAVCODEC_VERSION_MAJOR 57 | 31 | #define LIBAVCODEC_VERSION_MAJOR 57 |
| 32 | #define LIBAVCODEC_VERSION_MINOR 24 | 32 | #define LIBAVCODEC_VERSION_MINOR 25 |
| 33 | #define LIBAVCODEC_VERSION_MICRO 106 | 33 | #define LIBAVCODEC_VERSION_MICRO 100 |
| 34 | 34 | ||
| 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| 36 | LIBAVCODEC_VERSION_MINOR, \ | 36 | LIBAVCODEC_VERSION_MINOR, \ |