summaryrefslogtreecommitdiff
path: root/libavcodec/avcodec.h
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-12-18 16:42:24 +0100
committerAnton Khirnov <anton@khirnov.net>2017-01-12 16:24:15 +0100
commit019ab88a95cb31b698506d90e8ce56695a7f1cc5 (patch)
tree8c4564aff6be5c1270de110e5709cf101bc8ec31 /libavcodec/avcodec.h
parent52627248e49e58eb4b78e4fcda90a64f4c476ea3 (diff)
lavc: add an option for exporting cropping information to the caller
Also, add generic code for handling cropping, so the decoders can export just the cropping size and not bother with the rest.
Diffstat (limited to 'libavcodec/avcodec.h')
-rw-r--r--libavcodec/avcodec.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 95da50b0e7..18721561d5 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3112,6 +3112,33 @@ typedef struct AVCodecContext {
* This field should be set before avcodec_open2() is called.
*/
AVBufferRef *hw_frames_ctx;
+
+ /**
+ * Video decoding only. Certain video codecs support cropping, meaning that
+ * only a sub-rectangle of the decoded frame is intended for display. This
+ * option controls how cropping is handled by libavcodec.
+ *
+ * When set to 1 (the default), libavcodec will apply cropping internally.
+ * I.e. it will modify the output frame width/height fields and offset the
+ * data pointers (only by as much as possible while preserving alignment, or
+ * by the full amount if the AV_CODEC_FLAG_UNALIGNED flag is set) so that
+ * the frames output by the decoder refer only to the cropped area. The
+ * crop_* fields of the output frames will be zero.
+ *
+ * When set to 0, the width/height fields of the output frames will be set
+ * to the coded dimensions and the crop_* fields will describe the cropping
+ * rectangle. Applying the cropping is left to the caller.
+ *
+ * @warning When hardware acceleration with opaque output frames is used,
+ * libavcodec is unable to apply cropping from the top/left border.
+ *
+ * @note when this option is set to zero, the width/height fields of the
+ * AVCodecContext and output AVFrames have different meanings. The codec
+ * context fields store display dimensions (with the coded dimensions in
+ * coded_width/height), while the frame fields store the coded dimensions
+ * (with the display dimensions being determined by the crop_* fields).
+ */
+ int apply_cropping;
} AVCodecContext;
/**