gst-plugins-base: use upstream fix for ivorbis plugin build fail
[packages.git] / multimedia / gst-plugins-base / patches / 004-vorbisdec-support_modern_Tremor_versions.patch
1 From 787e896bdeb6c67d13a918ec55d3826fa010fb90 Mon Sep 17 00:00:00 2001
2 From: Peter Korsgaard <jacmet@sunsite.dk>
3 Date: Wed, 25 Jan 2012 22:53:04 +0000
4 Subject: vorbisdec: support modern Tremor versions
5
6 Tremor changed to use standard libogg rather than its own incompatible
7 copy back in Aug 2010 (r17375), causing gst-plugin-base build to fail.
8
9 Tremolo so far unfortunately hasn't been updated. Restructure
10 vorbisdeclib.h so the int/float logic is seperate from the ogg handling,
11 and only use the legacy _ogg_packet_wrapper code for Tremolo.
12
13 https://bugzilla.gnome.org/show_bug.cgi?id=668726
14 ---
15 (limited to 'ext/vorbis/gstvorbisdeclib.h')
16
17 --- a/ext/vorbis/gstvorbisdeclib.h
18 +++ b/ext/vorbis/gstvorbisdeclib.h
19 @@ -29,11 +29,6 @@
20  
21  #ifndef TREMOR
22  
23 -#include <vorbis/codec.h>
24 -
25 -typedef float                          vorbis_sample_t;
26 -typedef ogg_packet                     ogg_packet_wrapper;
27 -
28  #define GST_VORBIS_DEC_DESCRIPTION "decode raw vorbis streams to float audio"
29  
30  #define GST_VORBIS_DEC_SRC_CAPS \
31 @@ -47,6 +42,42 @@ typedef ogg_packet                     o
32  
33  #define GST_VORBIS_DEC_GLIB_TYPE_NAME      GstVorbisDec
34  
35 +#else /* TREMOR */
36 +
37 +#define GST_VORBIS_DEC_DESCRIPTION "decode raw vorbis streams to integer audio"
38 +
39 +#define GST_VORBIS_DEC_SRC_CAPS \
40 +    GST_STATIC_CAPS ("audio/x-raw-int, "   \
41 +        "rate = (int) [ 1, MAX ], "        \
42 +        "channels = (int) [ 1, 6 ], "      \
43 +        "endianness = (int) BYTE_ORDER, "  \
44 +        "width = (int) { 16, 32 }, "       \
45 +        "depth = (int) 16, "               \
46 +        "signed = (boolean) true")
47 +
48 +#define GST_VORBIS_DEC_DEFAULT_SAMPLE_WIDTH           (16)
49 +
50 +/* we need a different type name here */
51 +#define GST_VORBIS_DEC_GLIB_TYPE_NAME      GstIVorbisDec
52 +
53 +/* and still have it compile */
54 +typedef struct _GstVorbisDec               GstIVorbisDec;
55 +typedef struct _GstVorbisDecClass          GstIVorbisDecClass;
56 +
57 +#endif /* TREMOR */
58 +
59 +#ifndef USE_TREMOLO
60 +
61 +#ifdef TREMOR
62 + #include <tremor/ivorbiscodec.h>
63 + typedef ogg_int32_t                    vorbis_sample_t;
64 +#else
65 + #include <vorbis/codec.h>
66 + typedef float                          vorbis_sample_t;
67 +#endif
68 +
69 +typedef ogg_packet                     ogg_packet_wrapper;
70 +
71  static inline guint8 *
72  gst_ogg_packet_data (ogg_packet * p)
73  {
74 @@ -72,17 +103,11 @@ gst_ogg_packet_from_wrapper (ogg_packet_
75    return packet;
76  }
77  
78 -#else
79 -
80 -#ifdef USE_TREMOLO
81 -  #include <Tremolo/ivorbiscodec.h>
82 -  #include <Tremolo/codec_internal.h>
83 -  typedef ogg_int16_t                    vorbis_sample_t;
84 -#else
85 -  #include <tremor/ivorbiscodec.h>
86 -  typedef ogg_int32_t                    vorbis_sample_t;
87 -#endif
88 +#else /* USE_TREMOLO */
89  
90 +#include <Tremolo/ivorbiscodec.h>
91 +#include <Tremolo/codec_internal.h>
92 +typedef ogg_int16_t                    vorbis_sample_t;
93  typedef struct _ogg_packet_wrapper     ogg_packet_wrapper;
94  
95  struct _ogg_packet_wrapper {
96 @@ -91,26 +116,6 @@ struct _ogg_packet_wrapper {
97    ogg_buffer          buf;
98  };
99  
100 -#define GST_VORBIS_DEC_DESCRIPTION "decode raw vorbis streams to integer audio"
101 -
102 -#define GST_VORBIS_DEC_SRC_CAPS \
103 -    GST_STATIC_CAPS ("audio/x-raw-int, "   \
104 -        "rate = (int) [ 1, MAX ], "        \
105 -        "channels = (int) [ 1, 6 ], "      \
106 -        "endianness = (int) BYTE_ORDER, "  \
107 -        "width = (int) { 16, 32 }, "       \
108 -        "depth = (int) 16, "               \
109 -        "signed = (boolean) true")
110 -
111 -#define GST_VORBIS_DEC_DEFAULT_SAMPLE_WIDTH           (16)
112 -
113 -/* we need a different type name here */
114 -#define GST_VORBIS_DEC_GLIB_TYPE_NAME      GstIVorbisDec
115 -
116 -/* and still have it compile */
117 -typedef struct _GstVorbisDec               GstIVorbisDec;
118 -typedef struct _GstVorbisDecClass          GstIVorbisDecClass;
119 -
120  /* compensate minor variation */
121  #define vorbis_synthesis(a, b)             vorbis_synthesis (a, b, 1)
122  
123 @@ -154,7 +159,7 @@ gst_ogg_packet_from_wrapper (ogg_packet_
124    return &(packet->packet);
125  }
126  
127 -#endif
128 +#endif /* USE_TREMOLO */
129  
130  typedef void (*CopySampleFunc)(vorbis_sample_t *out, vorbis_sample_t **in,
131                             guint samples, gint channels, gint width);