av: Remove palette support for now
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 4 Dec 2012 17:02:56 +0000 (18:02 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 4 Dec 2012 17:36:37 +0000 (18:36 +0100)
It was never ported to the way how paletted color formats work
in 1.0 anyway and the API changed in libav upstream.

ext/libav/gstavauddec.c
ext/libav/gstavcodecmap.c
ext/libav/gstavviddec.c

index 3b60701..1c084d6 100644 (file)
@@ -166,11 +166,6 @@ gst_ffmpegauddec_close (GstFFMpegAudDec * ffmpegdec)
     gst_ffmpeg_avcodec_close (ffmpegdec->context);
   ffmpegdec->opened = FALSE;
 
-  if (ffmpegdec->context->palctrl) {
-    av_free (ffmpegdec->context->palctrl);
-    ffmpegdec->context->palctrl = NULL;
-  }
-
   if (ffmpegdec->context->extradata) {
     av_free (ffmpegdec->context->extradata);
     ffmpegdec->context->extradata = NULL;
index 3850241..2211c11 100644 (file)
 #include <gst/audio/audio.h>
 #include <gst/pbutils/codec-utils.h>
 
-/*
- * Read a palette from a caps.
- */
-
-static void
-gst_ffmpeg_get_palette (const GstCaps * caps, AVCodecContext * context)
-{
-  GstStructure *str = gst_caps_get_structure (caps, 0);
-  const GValue *palette_v;
-  GstBuffer *palette;
-
-  /* do we have a palette? */
-  if ((palette_v = gst_structure_get_value (str, "palette_data")) && context) {
-    palette = gst_value_get_buffer (palette_v);
-    GST_DEBUG ("got palette data %p", palette);
-    if (gst_buffer_get_size (palette) >= AVPALETTE_SIZE) {
-      if (context->palctrl)
-        av_free (context->palctrl);
-      context->palctrl = av_malloc (sizeof (AVPaletteControl));
-      context->palctrl->palette_changed = 1;
-      gst_buffer_extract (palette, 0, context->palctrl->palette,
-          AVPALETTE_SIZE);
-      GST_DEBUG ("extracted palette data");
-    }
-  }
-}
-
-static void
-gst_ffmpeg_set_palette (GstCaps * caps, AVCodecContext * context)
-{
-  if (context->palctrl) {
-    GstBuffer *palette = gst_buffer_new_and_alloc (AVPALETTE_SIZE);
-
-    gst_buffer_fill (palette, 0, context->palctrl->palette, AVPALETTE_SIZE);
-    gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, palette, NULL);
-  }
-}
-
 /* IMPORTANT: Keep this sorted by the ffmpeg channel masks */
 static const struct
 {
@@ -1743,11 +1705,6 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
       gst_buffer_unref (data);
     }
 
-    /* palette */
-    if (context) {
-      gst_ffmpeg_set_palette (caps, context);
-    }
-
     GST_LOG ("caps for codec_id=%d: %" GST_PTR_FORMAT, codec_id, caps);
 
   } else {
@@ -2039,8 +1996,6 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
         context->sample_aspect_ratio.num);
   }
 
-  gst_ffmpeg_get_palette (caps, context);
-
   if (!raw)
     return;
 
index b7bfaaf..0ddd628 100644 (file)
@@ -284,11 +284,6 @@ gst_ffmpegviddec_close (GstFFMpegVidDec * ffmpegdec)
     gst_ffmpeg_avcodec_close (ffmpegdec->context);
   ffmpegdec->opened = FALSE;
 
-  if (ffmpegdec->context->palctrl) {
-    av_free (ffmpegdec->context->palctrl);
-    ffmpegdec->context->palctrl = NULL;
-  }
-
   if (ffmpegdec->context->extradata) {
     av_free (ffmpegdec->context->extradata);
     ffmpegdec->context->extradata = NULL;
@@ -1062,15 +1057,6 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec,
   /* now decode the frame */
   gst_avpacket_init (&packet, data, size);
 
-  if (ffmpegdec->context->palctrl) {
-    guint8 *pal;
-
-    pal = av_packet_new_side_data (&packet, AV_PKT_DATA_PALETTE,
-        AVPALETTE_SIZE);
-    memcpy (pal, ffmpegdec->context->palctrl->palette, AVPALETTE_SIZE);
-    GST_DEBUG_OBJECT (ffmpegdec, "copy pal %p %p", &packet, pal);
-  }
-
   len = avcodec_decode_video2 (ffmpegdec->context,
       ffmpegdec->picture, &have_data, &packet);