]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dpxenc.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavcodec / dpxenc.c
index 89548ba0c3240ca1192054eae7645db3ac79fe32..6e06a09c747b8fa19b4b6cee3d8ce644f5b79c15 100644 (file)
@@ -2,20 +2,20 @@
  * DPX (.dpx) image encoder
  * Copyright (c) 2011 Peter Ross <pross@xvid.org>
  *
- * This file is part of Libav.
+ * This file is part of FFmpeg.
  *
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -54,6 +54,12 @@ static av_cold int encode_init(AVCodecContext *avctx)
     case PIX_FMT_RGB48BE:
         s->bits_per_component = avctx->bits_per_raw_sample ? avctx->bits_per_raw_sample : 16;
         break;
+    case PIX_FMT_RGBA64LE:
+        s->big_endian = 0;
+    case PIX_FMT_RGBA64BE:
+        s->descriptor = 51;
+        s->bits_per_component = 16;
+        break;
     default:
         av_log(avctx, AV_LOG_INFO, "unsupported pixel format\n");
         return -1;
@@ -74,8 +80,7 @@ do { \
     else               AV_WL32(p, value); \
 } while(0)
 
-static void encode_rgb48_10bit(AVCodecContext *avctx, const AVPicture *pic,
-                               uint8_t *dst)
+static void encode_rgb48_10bit(AVCodecContext *avctx, const AVPicture *pic, uint8_t *dst)
 {
     DPXContext *s = avctx->priv_data;
     const uint8_t *src = pic->data[0];
@@ -112,10 +117,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         size = avctx->height * avctx->width * 4;
     else
         size = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
-    if ((ret = ff_alloc_packet(pkt, size + HEADER_SIZE)) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+    if ((ret = ff_alloc_packet2(avctx, pkt, size + HEADER_SIZE)) < 0)
         return ret;
-    }
     buf = pkt->data;
 
     memset(buf, 0, HEADER_SIZE);
@@ -145,7 +148,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     write32(buf + 1628, avctx->sample_aspect_ratio.num);
     write32(buf + 1632, avctx->sample_aspect_ratio.den);
 
-    switch (s->bits_per_component) {
+    switch(s->bits_per_component) {
     case 8:
     case 16:
         size = avpicture_layout((const AVPicture*)frame, avctx->pix_fmt,
@@ -184,6 +187,8 @@ AVCodec ff_dpx_encoder = {
         PIX_FMT_RGBA,
         PIX_FMT_RGB48LE,
         PIX_FMT_RGB48BE,
+        PIX_FMT_RGBA64LE,
+        PIX_FMT_RGBA64BE,
         PIX_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("DPX image"),
 };