gst-libs/gst/audio/gstringbuffer.c: Make gcc-4.1 happy (part of #327357).

Original commit message from CVS:
* gst-libs/gst/audio/gstringbuffer.c: (build_linear_format):
Make gcc-4.1 happy (part of #327357).
This commit is contained in:
Tim-Philipp Müller 2006-01-28 18:19:18 +00:00
parent ed8f44a90e
commit 27ed152e10
2 changed files with 21 additions and 11 deletions

View file

@ -1,3 +1,8 @@
2006-01-28 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/audio/gstringbuffer.c: (build_linear_format):
Make gcc-4.1 happy (part of #327357).
2006-01-28 Thomas Vander Stichele <thomas at apestaart dot org> 2006-01-28 Thomas Vander Stichele <thomas at apestaart dot org>
* sys/v4l/v4l_calls.c: (gst_v4l_open): * sys/v4l/v4l_calls.c: (gst_v4l_open):

View file

@ -119,7 +119,7 @@ gst_ring_buffer_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT (ringbuffer)); G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT (ringbuffer));
} }
static int linear_formats[4 * 2 * 2] = { static const int linear_formats[4 * 2 * 2] = {
GST_S8, GST_S8,
GST_S8, GST_S8,
GST_U8, GST_U8,
@ -138,7 +138,7 @@ static int linear_formats[4 * 2 * 2] = {
GST_U32_BE GST_U32_BE
}; };
static int linear24_formats[3 * 2 * 2] = { static const int linear24_formats[3 * 2 * 2] = {
GST_S24_3LE, GST_S24_3LE,
GST_S24_3BE, GST_S24_3BE,
GST_U24_3LE, GST_U24_3LE,
@ -156,40 +156,45 @@ static int linear24_formats[3 * 2 * 2] = {
static GstBufferFormat static GstBufferFormat
build_linear_format (int depth, int width, int unsignd, int big_endian) build_linear_format (int depth, int width, int unsignd, int big_endian)
{ {
const gint *formats;
if (width == 24) { if (width == 24) {
switch (depth) { switch (depth) {
case 24: case 24:
depth = 0; formats = &linear24_formats[0];
break; break;
case 20: case 20:
depth = 1; formats = &linear24_formats[4];
break; break;
case 18: case 18:
depth = 2; formats = &linear24_formats[8];
break; break;
default: default:
return GST_UNKNOWN; return GST_UNKNOWN;
} }
return ((int (*)[2][2]) linear24_formats)[depth][!!unsignd][!!big_endian];
} else { } else {
switch (depth) { switch (depth) {
case 8: case 8:
depth = 0; formats = &linear_formats[0];
break; break;
case 16: case 16:
depth = 1; formats = &linear_formats[4];
break; break;
case 24: case 24:
depth = 2; formats = &linear_formats[8];
break; break;
case 32: case 32:
depth = 3; formats = &linear_formats[12];
break; break;
default: default:
return GST_UNKNOWN; return GST_UNKNOWN;
} }
} }
return ((int (*)[2][2]) linear_formats)[depth][!!unsignd][!!big_endian]; if (unsignd)
formats += 2;
if (big_endian)
formats += 1;
return (GstBufferFormat) * formats;
} }
/** /**