This ISO_VARARGS macro is more consistant with the others.
[platform/upstream/gstreamer.git] / gst-libs / gst / riff / riffutil.c
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20
21 #include <riff.h>
22
23 /*#define debug(format,args...) g_print(format,##args) */
24
25 #ifdef G_HAVE_ISO_VARARGS
26
27 #define debug(...)
28
29 #elif defined(G_HAVE_GNUC_VARARGS)
30
31 #define debug(format,args...)
32
33 #endif
34
35 gulong gst_riff_fourcc_to_id(gchar *fourcc) {
36   g_return_val_if_fail(fourcc != NULL, 0);
37
38   return GUINT32_FROM_LE((gulong)(fourcc[0] << 0) | (fourcc[1] << 8) |
39          (fourcc[2] << 16) | (fourcc[3] << 24));
40 }
41
42 gchar *gst_riff_id_to_fourcc(gulong id) {
43   static gchar fourcc[5];
44
45   g_return_val_if_fail(fourcc != NULL, NULL);
46
47   id = GUINT32_FROM_LE(id);
48   fourcc[0] = (id >> 0) & 0xff;
49   fourcc[1] = (id >> 8) & 0xff;
50   fourcc[2] = (id >> 16) & 0xff;
51   fourcc[3] = (id >> 24) & 0xff;
52   fourcc[4] = 0;
53
54   return fourcc;
55 }