mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-07-16 11:28:36 +00:00
av: Remove palette support for now
It was never ported to the way how paletted color formats work in 1.0 anyway and the API changed in libav upstream.
This commit is contained in:
parent
169825a28e
commit
0f206124b6
|
@ -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;
|
||||
|
|
|
@ -36,44 +36,6 @@
|
|||
#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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue