[FFmpeg-cvslog] Merge commit 'b1f01e85a92d401a9b29c79f23db36b7685e8c09'

Derek Buitenhuis git at videolan.org
Thu Apr 14 14:38:32 CEST 2016


ffmpeg | branch: master | Derek Buitenhuis <derek.buitenhuis at gmail.com> | Thu Apr 14 13:33:37 2016 +0100| [afccfaf26ac8fae3257302a74110b40615dfa05d] | committer: Derek Buitenhuis

Merge commit 'b1f01e85a92d401a9b29c79f23db36b7685e8c09'

* commit 'b1f01e85a92d401a9b29c79f23db36b7685e8c09':
  lavu: add a way to query hwcontext frame constraints

Merged-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=afccfaf26ac8fae3257302a74110b40615dfa05d
---

 doc/APIchanges                 |    3 ++
 libavutil/hwcontext.c          |   45 ++++++++++++++++++++++++++
 libavutil/hwcontext.h          |   69 ++++++++++++++++++++++++++++++++++++++++
 libavutil/hwcontext_internal.h |   10 ++++++
 libavutil/version.h            |    2 +-
 5 files changed, 128 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index cc73528..626fe18 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil:     2015-08-28
 
 API changes, most recent first:
 
+2016-xx-xx - xxxxxxx - lavu 55.21.0 - hwcontext.h
+  Add AVHWFramesConstraints and associated API.
+
 2016-04-11 - xxxxxxx - lavf 57.33.0 - avformat.h
   Add AVStream.codecpar, deprecate AVStream.codec.
 
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index 3eada29..4dfec2c 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -400,3 +400,48 @@ int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
 
     return 0;
 }
+
+void *av_hwdevice_hwconfig_alloc(AVBufferRef *ref)
+{
+    AVHWDeviceContext *ctx = (AVHWDeviceContext*)ref->data;
+    const HWContextType  *hw_type = ctx->internal->hw_type;
+
+    if (hw_type->device_hwconfig_size == 0)
+        return NULL;
+
+    return av_mallocz(hw_type->device_hwconfig_size);
+}
+
+AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref,
+                                                           const void *hwconfig)
+{
+    AVHWDeviceContext *ctx = (AVHWDeviceContext*)ref->data;
+    const HWContextType  *hw_type = ctx->internal->hw_type;
+    AVHWFramesConstraints *constraints;
+
+    if (!hw_type->frames_get_constraints)
+        return NULL;
+
+    constraints = av_mallocz(sizeof(*constraints));
+    if (!constraints)
+        return NULL;
+
+    constraints->min_width = constraints->min_height = 0;
+    constraints->max_width = constraints->max_height = INT_MAX;
+
+    if (hw_type->frames_get_constraints(ctx, hwconfig, constraints) >= 0) {
+        return constraints;
+    } else {
+        av_hwframe_constraints_free(&constraints);
+        return NULL;
+    }
+}
+
+void av_hwframe_constraints_free(AVHWFramesConstraints **constraints)
+{
+    if (*constraints) {
+        av_freep(&(*constraints)->valid_hw_formats);
+        av_freep(&(*constraints)->valid_sw_formats);
+    }
+    av_freep(constraints);
+}
diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
index f46a39f..ee0f1df 100644
--- a/libavutil/hwcontext.h
+++ b/libavutil/hwcontext.h
@@ -326,4 +326,73 @@ int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ctx,
                                     enum AVPixelFormat **formats, int flags);
 
 
+/**
+ * This struct describes the constraints on hardware frames attached to
+ * a given device with a hardware-specific configuration.  This is returned
+ * by av_hwdevice_get_hwframe_constraints() and must be freed by
+ * av_hwframe_constraints_free() after use.
+ */
+typedef struct AVHWFramesConstraints {
+    /**
+     * A list of possible values for format in the hw_frames_ctx,
+     * terminated by AV_PIX_FMT_NONE.  This member will always be filled.
+     */
+    enum AVPixelFormat *valid_hw_formats;
+
+    /**
+     * A list of possible values for sw_format in the hw_frames_ctx,
+     * terminated by AV_PIX_FMT_NONE.  Can be NULL if this information is
+     * not known.
+     */
+    enum AVPixelFormat *valid_sw_formats;
+
+    /**
+     * The minimum size of frames in this hw_frames_ctx.
+     * (Zero if not known.)
+     */
+    int min_width;
+    int min_height;
+
+    /**
+     * The maximum size of frames in this hw_frames_ctx.
+     * (INT_MAX if not known / no limit.)
+     */
+    int max_width;
+    int max_height;
+} AVHWFramesConstraints;
+
+/**
+ * Allocate a HW-specific configuration structure for a given HW device.
+ * After use, the user must free all members as required by the specific
+ * hardware structure being used, then free the structure itself with
+ * av_free().
+ *
+ * @param device_ctx a reference to the associated AVHWDeviceContext.
+ * @return The newly created HW-specific configuration structure on
+ *         success or NULL on failure.
+ */
+void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx);
+
+/**
+ * Get the constraints on HW frames given a device and the HW-specific
+ * configuration to be used with that device.  If no HW-specific
+ * confgiuration is provided, returns the maximum possible capabilities
+ * of the device.
+ *
+ * @param device_ctx a reference to the associated AVHWDeviceContext.
+ * @param hwconfig a filled HW-specific configuration structure, or NULL
+ *        to return the maximum possible capabilities of the device.
+ * @return AVHWFramesConstraints structure describing the constraints
+ *         on the device, or NULL if not available.
+ */
+AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref,
+                                                           const void *hwconfig);
+
+/**
+ * Free an AVHWFrameConstraints structure.
+ *
+ * @param constraints The (filled or unfilled) AVHWFrameConstraints structure.
+ */
+void av_hwframe_constraints_free(AVHWFramesConstraints **constraints);
+
 #endif /* AVUTIL_HWCONTEXT_H */
diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h
index cf24ce5..0ea04f8 100644
--- a/libavutil/hwcontext_internal.h
+++ b/libavutil/hwcontext_internal.h
@@ -48,6 +48,12 @@ typedef struct HWContextType {
     size_t             device_priv_size;
 
     /**
+     * Size of the hardware-specific device configuration.
+     * (Used to query hwframe constraints.)
+     */
+    size_t             device_hwconfig_size;
+
+    /**
      * size of the public frame pool hardware-specific context,
      * i.e. AVHWFramesContext.hwctx
      */
@@ -61,6 +67,10 @@ typedef struct HWContextType {
     int              (*device_init)(AVHWDeviceContext *ctx);
     void             (*device_uninit)(AVHWDeviceContext *ctx);
 
+    int              (*frames_get_constraints)(AVHWDeviceContext *ctx,
+                                               const void *hwconfig,
+                                               AVHWFramesConstraints *constraints);
+
     int              (*frames_init)(AVHWFramesContext *ctx);
     void             (*frames_uninit)(AVHWFramesContext *ctx);
 
diff --git a/libavutil/version.h b/libavutil/version.h
index f1e9e40..7d8fdb3 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -64,7 +64,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  55
-#define LIBAVUTIL_VERSION_MINOR  20
+#define LIBAVUTIL_VERSION_MINOR  21
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \


======================================================================

diff --cc doc/APIchanges
index cc73528,759816b..626fe18
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@@ -15,108 -13,53 +15,111 @@@ libavutil:     2015-08-2
  
  API changes, most recent first:
  
 -2016-xx-xx - xxxxxxx - lavu 55.7.0 - hwcontext.h
++2016-xx-xx - xxxxxxx - lavu 55.21.0 - hwcontext.h
+   Add AVHWFramesConstraints and associated API.
+ 
 -2016-02-23 - 9200514 - lavf 57.5.0 - avformat.h
 +2016-04-11 - xxxxxxx - lavf 57.33.0 - avformat.h
    Add AVStream.codecpar, deprecate AVStream.codec.
  
 -2016-xx-xx - lavc 57.14.0 - avcodec.h
 -  998e1b8 - Add AVCodecParameters and its related API.
 -  a806834 - Add av_get_audio_frame_duration2().
 +2016-04-02 - xxxxxxx - lavu 55.20.100 - base64.h
 +  Add AV_BASE64_DECODE_SIZE(x) macro.
 +
 +2016-xx-xx - lavc 57.33.0 - avcodec.h
 +  xxxxxxx - Add AVCodecParameters and its related API.
 +  xxxxxxx - Add av_get_audio_frame_duration2().
 +
 +2016-03-11 - xxxxxxx - lavf/lavc 57.28.101
 +  Add requirement to bitstream filtering API that returned packets with
 +  size == 0 and side_data_elems == 0 are to be skipped by the caller.
 +
 +2016-XX-XX - xxxxxxx - lavf 57.28.100
 +  Add protocol blacklisting API
 +
 +2016-02-28 - xxxxxxx - lavc 57.27.101
 +  Validate AVFrame returned by get_buffer2 to have required
 +  planes not NULL and unused planes set to NULL as crashes
 +  and buffer overflow are possible with certain streams if
 +  that is not the case.
 +
 +2016-xx-xx - xxxxxxx - lavc 57.27.100 - avcodec.h
 +  "flags2" decoding option now allows the flag "ass_ro_flush_noop" preventing
 +  the reset of the ASS ReadOrder field on flush. This affects the content of
 +  AVSubtitles.rects[N]->ass when "sub_text_format" is set to "ass" (see
 +  previous entry).
 +
 +2016-xx-xx - xxxxxxx - lavc 57.26.100 - avcodec.h
 +  Add a "sub_text_format" subtitles decoding option allowing the values "ass"
 +  (recommended) and "ass_with_timings" (not recommended, deprecated, default).
 +  The default value for this option will change to "ass" at the next major
 +  libavcodec version bump.
 +
 +  The current default is "ass_with_timings" for compatibility. This means that
 +  all subtitles text decoders currently still output ASS with timings printed
 +  as strings in the AVSubtitles.rects[N]->ass fields.
 +
 +  Setting "sub_text_format" to "ass" allows a better timing accuracy (ASS
 +  timing is limited to a 1/100 time base, so this is relevant for any subtitles
 +  format needing a bigger one), ease timing adjustments, and prevents the need
 +  of removing the timing from the decoded string yourself. This form is also
 +  known as "the Matroska form". The timing information (start time, duration)
 +  can be found in the AVSubtitles fields.
 +
 +2016-xx-xx - lavc 57.25.0 - avcodec.h
 +  Add AVCodecContext.hw_frames_ctx.
  
 -2016-02-22 - ec4c483 - lavf 57.4.0 - avformat.h
 -  Add AVFormatContext.protocol_whitelist and protocol_blacklist.
 -  Add 'protocol_whitelist' and 'protocol_blacklist' private options for
 -  avio_open2().
 +2016-xx-xx - lavfi 6.36.0 - avfilter.h
 +  xxxxxxx avfilter.h - Add AVFilterLink.hw_frames_ctx.
 +  xxxxxxx buffersrc.h - Add AVBufferSrcParameters and functions for handling it.
  
 -2016-02-14 - 7b3214d0 - lavc 57.13.0 - avcodec.h
 -  Add AVCodecContext.hw_frames_ctx.
 +2016-02-xx - xxxxxxx - lavc 57.25.100
 +  Add AV_PKT_DATA_MPEGTS_STREAM_ID for exporting the MPEGTS stream ID.
  
 -2016-02-14 - lavfi 6.2.0 - avfilter.h
 -  b3dd30d avfilter.h - Add AVFilterLink.hw_frames_ctx.
 -          buffersrc.h - Add AVBufferSrcParameters and functions for handling it.
 +2016-xx-xx - lavu 55.18.100
 +  xxxxxxx audio_fifo.h - Add av_audio_fifo_peek_at().
  
 -2016-02-14 - lavu 55.6.0
 -  721a4ef buffer.h - Add av_buffer_pool_init2().
 -  89923e4 hwcontext.h - Add a new installed header hwcontext.h with a new API
 +2016-xx-xx - lavu 55.18.0
 +  xxxxxxx buffer.h - Add av_buffer_pool_init2().
 +  xxxxxxx hwcontext.h - Add a new installed header hwcontext.h with a new API
                          for handling hwaccel frames.
 -  ad884d1 hwcontext_cuda.h - Add a new installed header hwcontext_cuda.h with
 +  xxxxxxx hwcontext_cuda.h - Add a new installed header hwcontext_cuda.h with
                               CUDA-specific hwcontext definitions.
 -  a001ce3 hwcontext_vdpau.h - Add a new installed header hwcontext_vdpau.h with
 +  xxxxxxx hwcontext_vdpau.h - Add a new installed header hwcontext_vdpau.h with
                                VDPAU-specific hwcontext definitions.
 -  7bc780c pixfmt.h - Add AV_PIX_FMT_CUDA.
 +  xxxxxxx pixfmt.h - Add AV_PIX_FMT_CUDA.
 +
 +-------- 8< --------- FFmpeg 3.0 was cut here -------- 8< ---------
  
 -2016-01-24 - 9f61abc - lavf 57.3.0 - avformat.h
 +2016-02-10 - bc9a596 / 9f61abc - lavf 57.25.100 / 57.3.0 - avformat.h
    Add AVFormatContext.opaque, io_open and io_close, allowing custom IO
 -  for muxers and demuxers that open additional files.
  
 -2015-12-12 - 2c68113 - lavc 57.12.0 - avcodec.h
 +2016-02-01 - 1dba837 - lavf 57.24.100 - avformat.h, avio.h
 +  Add protocol_whitelist to AVFormatContext, AVIOContext
 +
 +2016-01-31 - 66e9d2f - lavu 55.17.100 - frame.h
 +  Add AV_FRAME_DATA_GOP_TIMECODE for exporting MPEG1/2 GOP timecodes.
 +
 +2016-01-01 - 5e8b053 / 2c68113 - lavc 57.21.100 / 57.12.0 - avcodec.h
    Add AVCodecDescriptor.profiles and avcodec_profile_name().
  
 -2015-12-06 - lavc 57.11.0 - avcodec.h dirac.h
 -  31c51f7 - Add av_packet_add_side_data().
 -  84adab3 - Add AVCodecContext.coded_side_data.
 -  f0b769c - Add AVCPBProperties API.
 -  e02de9d - Add a new public header dirac.h containing
 +2015-12-28 - 1f9139b - lavf 57.21.100 - avformat.h
 +  Add automatic bitstream filtering; add av_apply_bitstream_filters()
 +
 +2015-12-22 - 39a09e9 - lavfi 6.21.101 - avfilter.h
 +  Deprecate avfilter_link_set_closed().
 +  Applications are not supposed to mess with links,
 +  they should close the sinks.
 +
 +2015-12-17 - lavc 57.18.100 / 57.11.0 - avcodec.h dirac.h
 +  xxxxxxx - Add av_packet_add_side_data().
 +  xxxxxxx - Add AVCodecContext.coded_side_data.
 +  xxxxxxx - Add AVCPBProperties API.
 +  xxxxxxx - Add a new public header dirac.h containing
              av_dirac_parse_sequence_header()
  
 -2015-11-20 - 462a54e - lavc 57.9.1 - avcodec.h
 +2015-12-11 - 676a93f - lavf 57.20.100 - avformat.h
 +  Add av_program_add_stream_index()
 +
 +2015-11-29 - 93fb4a4 - lavc 57.16.101 - avcodec.h
    Deprecate rtp_callback without replacement, i.e. it won't be possible to
    get image slices before the full frame is encoded any more. The libavformat
    rtpenc muxer can still be used for RFC-2190 packetization.
diff --cc libavutil/version.h
index f1e9e40,b102e93..7d8fdb3
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@@ -63,9 -53,9 +63,9 @@@
   * @{
   */
  
 -#define LIBAVUTIL_VERSION_MAJOR 55
 -#define LIBAVUTIL_VERSION_MINOR  7
 -#define LIBAVUTIL_VERSION_MICRO  0
 +#define LIBAVUTIL_VERSION_MAJOR  55
- #define LIBAVUTIL_VERSION_MINOR  20
++#define LIBAVUTIL_VERSION_MINOR  21
 +#define LIBAVUTIL_VERSION_MICRO 100
  
  #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
                                                 LIBAVUTIL_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list