summaryrefslogtreecommitdiffstats
path: root/vlc/build/vlc_dts_to_dca_api.patch
blob: edf820ebe13d96702832c9e0fa5a2143559a8d93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
http://svn.pardus.org.tr/pardus/devel/applications/multimedia/vlc/files/dts_to_dca_api.patch

diff -up vlc-0.8.6c/configure.ac.dts_dca vlc-0.8.6c/configure.ac
--- vlc-0.8.6c/configure.ac.dts_dca	2007-11-06 01:07:55.000000000 +0100
+++ vlc-0.8.6c/configure.ac	2007-11-06 01:15:20.000000000 +0100
@@ -3036,69 +3036,52 @@ AC_ARG_WITH(a52-fixed,
 dnl
 dnl DTS Coherent Acoustics decoder plugin
 dnl
-AC_ARG_ENABLE(dts,
-  [  --enable-dts            DTS Coherent Acoustics support with libdca (default enabled)])
-if test "${enable_dts}" != "no"; then
-  AC_ARG_WITH(dts-tree,
-    [    --with-dts-tree=PATH  libdts tree for static linking ],[],[])
-  if test "${with_dts_tree}" != "no" -a -n "${with_dts_tree}"
-  then
-    real_dts_tree="`cd ${with_dts_tree} 2>/dev/null && pwd`"
-    if test -z "${real_dts_tree}"
-    then
+AS_IF([test "x${enable_dts}" != "x"], [
+  AC_MSG_ERROR([--enable-dts is not obsolete. Please use libdca and --enable-dca.])
+])
+AS_IF([test "x${with_dts_tree}" != "x"], [
+  AC_MSG_ERROR([--with-dts-tree is obsolete. Please use libdca and --with-dca-tree.])
+])
+
+AC_ARG_ENABLE(dca,
+  [  --enable-dca            DTS Coherent Acoustics support with libdca (default enabled)])
+AS_IF([test "${enable_dca}" != "no"], [
+  AC_ARG_WITH(dca-tree,
+    [    --with-dca-tree=PATH  libdca tree for static linking],,
+    [with_dca_tree="no"])
+  AS_IF([test "${with_dca_tree}" != "no"], [
+    real_dca_tree="`cd ${with_dca_tree} 2>/dev/null && pwd`"
+    AS_IF([test -z "${real_dca_tree}"], [
       dnl  The given directory can't be found
       AC_MSG_RESULT(no)
-      AC_MSG_ERROR([${with_dts_tree} directory doesn't exist])
-    fi
-    dnl  Use a custom libdts
-    AC_MSG_CHECKING(for dts.h in ${real_dts_tree}/include)
-    if test -f ${real_dts_tree}/include/dts.h
-    then
+      AC_MSG_ERROR([${with_dca_tree} directory doesn't exist])
+    ])
+    dnl  Use a custom libdca
+    AC_MSG_CHECKING(for libdca in ${real_dca_tree})
+    AS_IF([test -f "${real_dca_tree}/libdca/.libs/libdca.a"], [
       AC_MSG_RESULT(yes)
-      VLC_ADD_CPPFLAGS([dtstofloat32],[-I${real_dts_tree}/include])
-      VLC_ADD_LDFLAGS([dtstofloat32],[-L${real_dts_tree}/libdts])
-      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_dtstofloat32}"
-      AC_CHECK_LIB(dts_pic, dts_free, [
-        VLC_ADD_PLUGINS([dtstofloat32])
-        VLC_ADD_LDFLAGS([dtstofloat32],[-ldts_pic])
-        ],[
-        AC_CHECK_LIB(dts, dts_free, [
-          VLC_ADD_BUILTINS([dtstofloat32])
-          VLC_ADD_LDFLAGS([dtstofloat32],[-ldts])
-          ],[
-          if test -f ${real_dts_tree}/libdts/libdts.a
-          then
-            AC_MSG_ERROR([make sure you have at least libdts-0.0.2])
-          else
-            AC_MSG_ERROR([the specified tree hasn't been compiled])
-          fi
-        ])
-      ], [-lm])
-      LDFLAGS="${LDFLAGS_save}"
-    else
+      VLC_ADD_LDFLAGS([dtstofloat32],[${real_dca_tree}/libdca/.libs/libdca.a])
+      AS_IF([test -f "${real_dca_tree}/include/dca.h"], [
+        VLC_ADD_CPPFLAGS([dtstofloat32],[-I${real_dca_tree}/include])
+      ], [
+        VLC_ADD_CPPFLAGS([dtstofloat32],[-I${real_dca_tree}/../include])
+      ])
+    ], [
       AC_MSG_RESULT(no)
-      AC_MSG_ERROR([the specified tree doesn't have dts.h])
-    fi
-  else
-    LDFLAGS="${LDFLAGS_save} ${LDFLAGS_dtstofloat32}"
-    AC_CHECK_HEADERS(dts.h, [
-      AC_CHECK_LIB(dts_pic, dts_free, [
-        VLC_ADD_PLUGINS([dtstofloat32])
-        VLC_ADD_LDFLAGS([dtstofloat32],[-ldts_pic])
-      ],[
-        AC_CHECK_LIB(dts, dts_free, [
-          VLC_ADD_BUILTINS([dtstofloat32])
-          VLC_ADD_LDFLAGS([dtstofloat32],[-ldts])
-        ],[
-          if test "${enable_dts}" = "yes"; then
-            AC_MSG_ERROR([Could not find libdts on your system: you may get it from http://www.videolan.org/dtsdec.html])
-          fi
-        ])
-      ], [-lm])
+      AC_MSG_ERROR([the specified tree doesn't have libdca/.libs/libdca.a])
     ])
-    LDFLAGS="${LDFLAGS_save}"
-  fi
-fi
+  ], [
+    PKG_CHECK_MODULES([DCA], [libdca >= 0.0.5], [
+      VLC_ADD_PLUGINS([dtstofloat32])
+      VLC_ADD_CPPFLAGS([dtstofloat32], [${DCA_CFLAGS}])
+      VLC_ADD_LDFLAGS([dtstofloat32], [${DCA_LIBS}])
+    ], [
+      AS_IF([test "x${enable_dca}" != "x"], [
+        AC_MSG_ERROR([${DCA_PKG_ERRORS}])
+      ])
+    ])
+  ])
+])
 
 dnl
 dnl  Flac plugin
diff -up vlc-0.8.6c/modules/audio_filter/converter/dtstofloat32.c.dts_dca vlc-0.8.6c/modules/audio_filter/converter/dtstofloat32.c
--- vlc-0.8.6c/modules/audio_filter/converter/dtstofloat32.c.dts_dca	2007-06-16 16:25:12.000000000 +0200
+++ vlc-0.8.6c/modules/audio_filter/converter/dtstofloat32.c	2007-11-06 01:06:05.000000000 +0100
@@ -31,7 +31,7 @@
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                              /* strdup() */
 
-#include <dts.h>                                       /* libdca header file */
+#include <dca.h>                                       /* libdca header file */
 
 #include <vlc/decoder.h>
 #include "aout_internal.h"
@@ -66,7 +66,7 @@ static const uint32_t pi_channels_out[] 
  *****************************************************************************/
 struct filter_sys_t
 {
-    dts_state_t * p_libdts; /* libdca internal structure */
+    dca_state_t * p_libdca; /* libdca internal structure */
     vlc_bool_t b_dynrng; /* see below */
     int i_flags; /* libdca flags, see dtsdec/doc/libdts.txt */
     vlc_bool_t b_dontwarn;
@@ -158,50 +158,50 @@ static int Open( vlc_object_t *p_this, f
               || (output.i_original_channels
                    & (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT)) )
         {
-            p_sys->i_flags = DTS_MONO;
+            p_sys->i_flags = DCA_MONO;
         }
         break;
 
     case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT:
         if ( output.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
         {
-            p_sys->i_flags = DTS_DOLBY;
+            p_sys->i_flags = DCA_DOLBY;
         }
         else if ( input.i_original_channels == AOUT_CHAN_CENTER )
         {
-            p_sys->i_flags = DTS_MONO;
+            p_sys->i_flags = DCA_MONO;
         }
         else if ( input.i_original_channels & AOUT_CHAN_DUALMONO )
         {
-            p_sys->i_flags = DTS_CHANNEL;
+            p_sys->i_flags = DCA_CHANNEL;
         }
         else
         {
-            p_sys->i_flags = DTS_STEREO;
+            p_sys->i_flags = DCA_STEREO;
         }
         break;
 
     case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER:
-        p_sys->i_flags = DTS_3F;
+        p_sys->i_flags = DCA_3F;
         break;
 
     case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_REARCENTER:
-        p_sys->i_flags = DTS_2F1R;
+        p_sys->i_flags = DCA_2F1R;
         break;
 
     case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
           | AOUT_CHAN_REARCENTER:
-        p_sys->i_flags = DTS_3F1R;
+        p_sys->i_flags = DCA_3F1R;
         break;
 
     case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT
           | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT:
-        p_sys->i_flags = DTS_2F2R;
+        p_sys->i_flags = DCA_2F2R;
         break;
 
     case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
           | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT:
-        p_sys->i_flags = DTS_3F2R;
+        p_sys->i_flags = DCA_3F2R;
         break;
 
     default:
@@ -211,13 +211,13 @@ static int Open( vlc_object_t *p_this, f
     }
     if ( output.i_physical_channels & AOUT_CHAN_LFE )
     {
-        p_sys->i_flags |= DTS_LFE;
+        p_sys->i_flags |= DCA_LFE;
     }
-    //p_sys->i_flags |= DTS_ADJUST_LEVEL;
+    //p_sys->i_flags |= DCA_ADJUST_LEVEL;
 
     /* Initialize libdca */
-    p_sys->p_libdts = dts_init( 0 );
-    if( p_sys->p_libdts == NULL )
+    p_sys->p_libdca = dca_init( 0 );
+    if( p_sys->p_libdca == NULL )
     {
         msg_Err( p_this, "unable to initialize libdca" );
         return VLC_EGENERIC;
@@ -300,7 +300,7 @@ static void DoWork( aout_instance_t * p_
     /* Needs to be called so the decoder knows which type of bitstream it is
      * dealing with. */
     int i_sample_rate, i_bit_rate, i_frame_length;
-    if( !dts_syncinfo( p_sys->p_libdts, p_in_buf->p_buffer, &i_flags,
+    if( !dca_syncinfo( p_sys->p_libdca, p_in_buf->p_buffer, &i_flags,
                        &i_sample_rate, &i_bit_rate, &i_frame_length ) )
     {
         msg_Warn( p_aout, "libdca couldn't sync on frame" );
@@ -309,38 +309,38 @@ static void DoWork( aout_instance_t * p_
     }
 
     i_flags = p_sys->i_flags;
-    dts_frame( p_sys->p_libdts, p_in_buf->p_buffer,
+    dca_frame( p_sys->p_libdca, p_in_buf->p_buffer,
                &i_flags, &i_sample_level, 0 );
 
-    if ( (i_flags & DTS_CHANNEL_MASK) != (p_sys->i_flags & DTS_CHANNEL_MASK)
+    if ( (i_flags & DCA_CHANNEL_MASK) != (p_sys->i_flags & DCA_CHANNEL_MASK)
           && !p_sys->b_dontwarn )
     {
         msg_Warn( p_aout,
                   "libdca couldn't do the requested downmix 0x%x->0x%x",
-                  p_sys->i_flags  & DTS_CHANNEL_MASK,
-                  i_flags & DTS_CHANNEL_MASK );
+                  p_sys->i_flags  & DCA_CHANNEL_MASK,
+                  i_flags & DCA_CHANNEL_MASK );
 
         p_sys->b_dontwarn = 1;
     }
 
     if( 0)//!p_sys->b_dynrng )
     {
-        dts_dynrng( p_sys->p_libdts, NULL, NULL );
+        dca_dynrng( p_sys->p_libdca, NULL, NULL );
     }
 
-    for ( i = 0; i < dts_blocks_num(p_sys->p_libdts); i++ )
+    for ( i = 0; i < dca_blocks_num(p_sys->p_libdca); i++ )
     {
         sample_t * p_samples;
 
-        if( dts_block( p_sys->p_libdts ) )
+        if( dca_block( p_sys->p_libdca ) )
         {
-            msg_Warn( p_aout, "dts_block failed for block %d", i );
+            msg_Warn( p_aout, "dca_block failed for block %d", i );
             break;
         }
 
-        p_samples = dts_samples( p_sys->p_libdts );
+        p_samples = dca_samples( p_sys->p_libdca );
 
-        if ( (p_sys->i_flags & DTS_CHANNEL_MASK) == DTS_MONO
+        if ( (p_sys->i_flags & DCA_CHANNEL_MASK) == DCA_MONO
               && (p_filter->output.i_physical_channels 
                    & (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT)) )
         {
@@ -373,7 +373,7 @@ static void Destroy( vlc_object_t *p_thi
     aout_filter_t *p_filter = (aout_filter_t *)p_this;
     filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys;
 
-    dts_free( p_sys->p_libdts );
+    dca_free( p_sys->p_libdca );
     free( p_sys );
 }
 
@@ -427,7 +427,7 @@ static void CloseFilter( vlc_object_t *p
     filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys = p_filter->p_sys;
 
-    dts_free( p_sys->p_libdts );
+    dca_free( p_sys->p_libdca );
     free( p_sys );
 }