]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/frame.c
frame: allow align=0 (meaning automatic) for av_frame_get_buffer()
[ffmpeg] / libavutil / frame.c
index 542215a16bc1c81e80c6fec1b74df412a8cfc381..aa5820c0e95ce7d0471f0258825d77307c219ce9 100644 (file)
@@ -1,5 +1,4 @@
 /*
- *
  * This file is part of Libav.
  *
  * Libav is free software; you can redistribute it and/or
@@ -20,6 +19,7 @@
 #include "channel_layout.h"
 #include "buffer.h"
 #include "common.h"
+#include "cpu.h"
 #include "dict.h"
 #include "frame.h"
 #include "imgutils.h"
@@ -104,6 +104,9 @@ static int get_video_buffer(AVFrame *frame, int align)
         if (ret < 0)
             return ret;
 
+        if (align <= 0)
+            align = av_cpu_max_align();
+
         for (i = 0; i < 4 && frame->linesize[i]; i++)
             frame->linesize[i] = FFALIGN(frame->linesize[i], align);
     }
@@ -391,6 +394,10 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
     dst->key_frame              = src->key_frame;
     dst->pict_type              = src->pict_type;
     dst->sample_aspect_ratio    = src->sample_aspect_ratio;
+    dst->crop_top               = src->crop_top;
+    dst->crop_bottom            = src->crop_bottom;
+    dst->crop_left              = src->crop_left;
+    dst->crop_right             = src->crop_right;
     dst->pts                    = src->pts;
     dst->repeat_pict            = src->repeat_pict;
     dst->interlaced_frame       = src->interlaced_frame;
@@ -398,7 +405,11 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
     dst->palette_has_changed    = src->palette_has_changed;
     dst->sample_rate            = src->sample_rate;
     dst->opaque                 = src->opaque;
+#if FF_API_PKT_PTS
+FF_DISABLE_DEPRECATION_WARNINGS
     dst->pkt_pts                = src->pkt_pts;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
     dst->pkt_dts                = src->pkt_dts;
     dst->reordered_opaque       = src->reordered_opaque;
     dst->quality                = src->quality;