~oah-dev/oah/gst-plugins-bad

« back to all changes in this revision

Viewing changes to gst/flacparse/gstbytereader.c

  • Committer: Haakon Sporsheim
  • Date: 2009-03-16 08:59:45 UTC
  • Revision ID: haakon.sporsheim@tandberg.com-20090316085945-lk2uur4q6topxinp
Apply patches for aacparse, amrparse, flacparse, deinterlace, librfb and scaletempo

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 * 32 and 64 bits.
38
38
 */
39
39
 
40
 
 
41
 
/* Copied from gst/floatcast/floatcast.h as this is in gst-plugins-base */
42
 
 
43
 
inline static gdouble
44
 
GDOUBLE_SWAP_LE_BE (gdouble in)
45
 
{
46
 
  union
47
 
  {
48
 
    guint64 i;
49
 
    gdouble d;
50
 
  } u;
51
 
 
52
 
  u.d = in;
53
 
  u.i = GUINT64_SWAP_LE_BE (u.i);
54
 
  return u.d;
55
 
}
56
 
 
57
 
inline static gfloat
58
 
GFLOAT_SWAP_LE_BE (gfloat in)
59
 
{
60
 
  union
61
 
  {
62
 
    guint32 i;
63
 
    gfloat f;
64
 
  } u;
65
 
 
66
 
  u.f = in;
67
 
  u.i = GUINT32_SWAP_LE_BE (u.i);
68
 
  return u.f;
69
 
}
70
 
 
71
 
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
72
 
#define GFLOAT_TO_LE(val)    ((gfloat) (val))
73
 
#define GFLOAT_TO_BE(val)    (GFLOAT_SWAP_LE_BE (val))
74
 
#define GDOUBLE_TO_LE(val)   ((gdouble) (val))
75
 
#define GDOUBLE_TO_BE(val)   (GDOUBLE_SWAP_LE_BE (val))
76
 
 
77
 
#elif G_BYTE_ORDER == G_BIG_ENDIAN
78
 
#define GFLOAT_TO_LE(val)    (GFLOAT_SWAP_LE_BE (val))
79
 
#define GFLOAT_TO_BE(val)    ((gfloat) (val))
80
 
#define GDOUBLE_TO_LE(val)   (GDOUBLE_SWAP_LE_BE (val))
81
 
#define GDOUBLE_TO_BE(val)   ((gdouble) (val))
82
 
 
83
 
#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
84
 
#error unknown ENDIAN type
85
 
#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
86
 
 
87
 
#define GFLOAT_FROM_LE(val)  (GFLOAT_TO_LE (val))
88
 
#define GFLOAT_FROM_BE(val)  (GFLOAT_TO_BE (val))
89
 
#define GDOUBLE_FROM_LE(val) (GDOUBLE_TO_LE (val))
90
 
#define GDOUBLE_FROM_BE(val) (GDOUBLE_TO_BE (val))
91
 
 
92
 
 
93
40
/**
94
41
 * gst_byte_reader_new:
95
42
 * @data: Data from which the #GstByteReader should read