mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-07 12:21:17 +00:00
ext/ffmpeg/gstffmpegcodecmap.c: Use AVPALETTE_SIZE macro instead of magic value for clarity.
Original commit message from CVS: * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette), (gst_ffmpeg_set_palette): Use AVPALETTE_SIZE macro instead of magic value for clarity. * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame): In GStreamer, the size of the palette is not part of GST_BUFFER_SIZE, so adjust buffer size of outgoing buffers accordingly if there's a palette (fixes #327028, based on patch by: Fabrizio Gennari).
This commit is contained in:
parent
d12d448009
commit
a3a4d8ef12
3 changed files with 19 additions and 3 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2006-02-24 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette),
|
||||
(gst_ffmpeg_set_palette):
|
||||
Use AVPALETTE_SIZE macro instead of magic value for clarity.
|
||||
|
||||
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame):
|
||||
In GStreamer, the size of the palette is not part of
|
||||
GST_BUFFER_SIZE, so adjust buffer size of outgoing buffers
|
||||
accordingly if there's a palette (fixes #327028, based on
|
||||
patch by: Fabrizio Gennari).
|
||||
|
||||
2006-02-21 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
|
||||
|
|
|
@ -48,7 +48,7 @@ gst_ffmpeg_get_palette (const GstCaps *caps, AVCodecContext *context)
|
|||
if ((palette_v = gst_structure_get_value (str,
|
||||
"palette_data")) && context) {
|
||||
palette = gst_value_get_buffer (palette_v);
|
||||
if (GST_BUFFER_SIZE (palette) >= 256 * 4) {
|
||||
if (GST_BUFFER_SIZE (palette) >= AVPALETTE_SIZE) {
|
||||
if (context->palctrl)
|
||||
av_free (context->palctrl);
|
||||
context->palctrl = av_malloc (sizeof (AVPaletteControl));
|
||||
|
@ -63,7 +63,7 @@ static void
|
|||
gst_ffmpeg_set_palette (GstCaps *caps, AVCodecContext *context)
|
||||
{
|
||||
if (context->palctrl) {
|
||||
GstBuffer *palette = gst_buffer_new_and_alloc (256 * 4);
|
||||
GstBuffer *palette = gst_buffer_new_and_alloc (AVPALETTE_SIZE);
|
||||
|
||||
memcpy (GST_BUFFER_DATA (palette), context->palctrl->palette,
|
||||
AVPALETTE_SIZE);
|
||||
|
|
|
@ -984,8 +984,12 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
|
|||
ffmpegdec->next_ts = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
}
|
||||
/* palette is not part of raw video frame in gst and the size
|
||||
* of the outgoing buffer needs to be adjusted accordingly */
|
||||
if (ffmpegdec->context->palctrl != NULL)
|
||||
GST_BUFFER_SIZE (outbuf) -= AVPALETTE_SIZE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case CODEC_TYPE_AUDIO:
|
||||
if (!ffmpegdec->last_buffer)
|
||||
outbuf = gst_buffer_new_and_alloc (AVCODEC_MAX_AUDIO_FRAME_SIZE);
|
||||
|
|
Loading…
Reference in a new issue