History

Merge commit '7b3214d0050613bd347a2e41c9f78ffb766da25e'

* commit '7b3214d0050613bd347a2e41c9f78ffb766da25e': lavc: add a field for passing AVHWFramesContext to encoders

Derek Buitenhuis committed 10 years ago

Commit 7e49cdd2 parents ef9915a 7b3214d4 files · +30 −2Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavcodec/avcodec.h +12 −0
  3. libavcodec/utils.c +13 −0
  4. libavcodec/version.h +2 −2
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2015-08-28 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2016-xx-xx - lavc 57.25.0 - avcodec.h
19+ Add AVCodecContext.hw_frames_ctx.
20+
1821 2016-xx-xx - lavfi 6.36.0 - avfilter.h
1922 xxxxxxx avfilter.h - Add AVFilterLink.hw_frames_ctx.
2023 xxxxxxx buffersrc.h - Add AVBufferSrcParameters and functions for handling it.
libavcodec/avcodec.h+12−0
@@ -3361,6 +3361,18 @@ typedef struct AVCodecContext { · 3360 unmodified lines
33613361 AVPacketSideData *coded_side_data;
33623362 int nb_coded_side_data;
33633363
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;
33643376 } AVCodecContext;
33653377
33663378 AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
libavcodec/utils.c+13−0
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #include "libavutil/channel_layout.h"
3535 #include "libavutil/crc.h"
3636 #include "libavutil/frame.h"
37+#include "libavutil/hwcontext.h"
3738 #include "libavutil/internal.h"
3839 #include "libavutil/mathematics.h"
3940 #include "libavutil/mem_internal.h"
@@ -1489,6 +1490,16 @@ FF_ENABLE_DEPRECATION_WARNINGS · 1449 unmodified lines
14891490 avctx->time_base.den);
14901491 goto free_and_end;
14911492 }
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+ }
14921503 }
14931504
14941505 avctx->pts_correction_num_faulty_pts =
@@ -2564,6 +2575,8 @@ av_cold int avcodec_close(AVCodecContext *avctx) · 1069 unmodified lines
25642575 av_freep(&avctx->coded_side_data);
25652576 avctx->nb_coded_side_data = 0;
25662577
2578+ av_buffer_unref(&avctx->hw_frames_ctx);
2579+
25672580 if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)
25682581 av_opt_free(avctx->priv_data);
25692582 av_opt_free(avctx);
libavcodec/version.h+2−2
@@ -29,8 +29,8 @@ · 28 unmodified lines
2929 #include "libavutil/version.h"
3030
3131 #define LIBAVCODEC_VERSION_MAJOR 57
32−#define LIBAVCODEC_VERSION_MINOR 24
33−#define LIBAVCODEC_VERSION_MICRO 106
32+#define LIBAVCODEC_VERSION_MINOR 25
33+#define LIBAVCODEC_VERSION_MICRO 100
3434
3535 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
3636 LIBAVCODEC_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t