History

frame: add a cropping rectangle to AVFrame

Extend the width/height doxy to clarify that it should store coded values.

Anton Khirnov committed 9 years ago

Commit 52627241 parent b68e3534 files · +36 −2Browse files

Unified · Split

4 files
  1. doc/APIchanges +4 −0
  2. libavutil/frame.c +4 −0
  3. libavutil/frame.h +27 −1
  4. libavutil/version.h +1 −1
doc/APIchanges+4−0
@@ -13,6 +13,10 @@ libavutil: 2015-08-28 · 12 unmodified lines
1313
1414 API changes, most recent first:
1515
16+2016-xx-xx - xxxxxxx - lavu 55.30.0 - frame.h
17+ Add AVFrame.crop_left/right/top/bottom fields for attaching cropping
18+ information to video frames.
19+
1620 2016-xx-xx - xxxxxxx
1721 Change av_sha_update() and av_md5_sum()/av_md5_update() length
1822 parameter type to size_t at next major bump.
libavutil/frame.c+4−0
@@ -390,6 +390,10 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src) · 389 unmodified lines
390390 dst->key_frame = src->key_frame;
391391 dst->pict_type = src->pict_type;
392392 dst->sample_aspect_ratio = src->sample_aspect_ratio;
393+ dst->crop_top = src->crop_top;
394+ dst->crop_bottom = src->crop_bottom;
395+ dst->crop_left = src->crop_left;
396+ dst->crop_right = src->crop_right;
393397 dst->pts = src->pts;
394398 dst->repeat_pict = src->repeat_pict;
395399 dst->interlaced_frame = src->interlaced_frame;
libavutil/frame.h+27−1
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #ifndef AVUTIL_FRAME_H
2626 #define AVUTIL_FRAME_H
2727
28+#include <stddef.h>
2829 #include <stdint.h>
2930
3031 #include "avutil.h"
@@ -180,9 +181,18 @@ typedef struct AVFrame { · 149 unmodified lines
180181 uint8_t **extended_data;
181182
182183 /**
183− * width and height of the video frame
184+ * @name Video dimensions
185+ * Video frames only. The coded dimensions (in pixels) of the video frame,
186+ * i.e. the size of the rectangle that contains some well-defined values.
187+ *
188+ * @note The part of the frame intended for display/presentation is further
189+ * restricted by the @ref cropping "Cropping rectangle".
190+ * @{
184191 */
185192 int width, height;
193+ /**
194+ * @}
195+ */
186196
187197 /**
188198 * number of audio samples (per channel) described by this frame
@@ -369,6 +379,22 @@ typedef struct AVFrame { · 180 unmodified lines
369379 * AVHWFramesContext describing the frame.
370380 */
371381 AVBufferRef *hw_frames_ctx;
382+
383+ /**
384+ * @anchor cropping
385+ * @name Cropping
386+ * Video frames only. The number of pixels to discard from the the
387+ * top/bottom/left/right border of the frame to obtain the sub-rectangle of
388+ * the frame intended for presentation.
389+ * @{
390+ */
391+ size_t crop_top;
392+ size_t crop_bottom;
393+ size_t crop_left;
394+ size_t crop_right;
395+ /**
396+ * @}
397+ */
372398 } AVFrame;
373399
374400 /**
libavutil/version.h+1−1
@@ -54,7 +54,7 @@ · 53 unmodified lines
5454 */
5555
5656 #define LIBAVUTIL_VERSION_MAJOR 55
57−#define LIBAVUTIL_VERSION_MINOR 29
57+#define LIBAVUTIL_VERSION_MINOR 30
5858 #define LIBAVUTIL_VERSION_MICRO 0
5959
6060 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

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