]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/pamenc.c
lavc: Add spherical packet side data API
[ffmpeg] / libavcodec / pamenc.c
index 483089afc115f4a40d9679344ce8e27fa159f19d..2b63af986e12794e2fa7269ea5ce93e3c3d20353 100644 (file)
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/imgutils.h"
+
 #include "avcodec.h"
 #include "bytestream.h"
 #include "internal.h"
@@ -31,10 +33,10 @@ static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     int i, h, w, n, linesize, depth, maxval, ret;
     const char *tuple_type;
     uint8_t *ptr;
+    int size = av_image_get_buffer_size(avctx->pix_fmt,
+                                        avctx->width, avctx->height, 1);
 
-    if ((ret = ff_alloc_packet(pkt, avpicture_get_size(avctx->pix_fmt,
-                                                       avctx->width,
-                                                       avctx->height) + 200)) < 0) {
+    if ((ret = ff_alloc_packet(pkt, size + 200)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
         return ret;
     }
@@ -109,8 +111,12 @@ static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
 
 static av_cold int pam_encode_init(AVCodecContext *avctx)
 {
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
     avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
     avctx->coded_frame->key_frame = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 
     return 0;
 }