Mercurial > audlegacy-plugins
annotate src/flac113/plugin.c @ 486:3e41d8efe752 trunk
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
| author | giacomo |
|---|---|
| date | Sun, 21 Jan 2007 10:40:40 -0800 |
| parents | a157306caf03 |
| children | 5e375eca97da |
| rev | line source |
|---|---|
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 /* libxmms-flac - XMMS FLAC input plugin |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
2 * Copyright (C) 2000,2001,2002,2003,2004,2005,2006 Josh Coalson |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
3 * |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 * modify it under the terms of the GNU General Public License |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 * as published by the Free Software Foundation; either version 2 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
7 * of the License, or (at your option) any later version. |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 * |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
12 * GNU General Public License for more details. |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 * |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 * along with this program; if not, write to the Free Software |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
17 */ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
19 #include <limits.h> |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
20 #include <stdlib.h> |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
21 #include <string.h> |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
22 #include <stdio.h> |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
23 #include <glib.h> |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
24 #include <pwd.h> |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 #include <sys/types.h> |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 #include <unistd.h> |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
28 #include <audacious/plugin.h> |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
29 #include <audacious/output.h> |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
30 #include <audacious/util.h> |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
31 #include <audacious/configdb.h> |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
32 #include <audacious/titlestring.h> |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
33 #include <audacious/vfs.h> |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 #ifdef HAVE_CONFIG_H |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 #include <config.h> |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 #endif |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 #ifdef HAVE_LANGINFO_CODESET |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
40 #include <langinfo.h> |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
41 #endif |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
43 #include "FLAC/all.h" |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
44 #include "plugin_common/all.h" |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
45 #include "grabbag.h" |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
46 #include "replaygain_synthesis.h" |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
47 #include "configure.h" |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 #include "charset.h" |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
49 #include "tag.h" |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
50 #include "http.h" |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
51 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
52 #ifdef min |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
53 #undef min |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
54 #endif |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
55 #define min(x,y) ((x)<(y)?(x):(y)) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
56 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
57 extern void FLAC_XMMS__file_info_box(char *filename); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
58 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
59 typedef struct { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
60 FLAC__bool abort_flag; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
61 FLAC__bool is_playing; |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
62 FLAC__bool is_http_source; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
63 FLAC__bool eof; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
64 FLAC__bool play_thread_open; /* if true, is_playing must also be true */ |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
65 FLAC__uint64 total_samples; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
66 unsigned bits_per_sample; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
67 unsigned channels; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
68 unsigned sample_rate; |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
69 int length_in_msec; /* int (instead of FLAC__uint64) only because that's what XMMS uses; seeking won't work right if this maxes out */ |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
70 gchar *title; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 AFormat sample_format; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
72 unsigned sample_format_bytes_per_sample; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
73 int seek_to_in_sec; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
74 FLAC__bool has_replaygain; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
75 double replay_scale; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
76 DitherContext dither_context; |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
77 VFSFile *vfsfile; |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
78 } stream_data_struct; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
79 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
80 static void FLAC_XMMS__init(); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 static int FLAC_XMMS__is_our_file(char *filename); |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
82 static int FLAC_XMMS__is_our_file_from_vfs(char *filename, VFSFile *vfsfile); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 static void FLAC_XMMS__play_file(char *filename); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
84 static void FLAC_XMMS__stop(); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 static void FLAC_XMMS__pause(short p); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
86 static void FLAC_XMMS__seek(int time); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
87 static int FLAC_XMMS__get_time(); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
88 static void FLAC_XMMS__cleanup(); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
89 static void FLAC_XMMS__get_song_info(char *filename, char **title, int *length); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
90 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
91 static void *play_loop_(void *arg); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
92 |
| 97 | 93 static FLAC__bool safe_decoder_init_(char *filename, FLAC__StreamDecoder *decoder); |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
94 static void safe_decoder_finish_(FLAC__StreamDecoder *decoder); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
95 static void safe_decoder_delete_(FLAC__StreamDecoder *decoder); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
96 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
97 static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
98 static void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
99 static void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
100 static FLAC__StreamDecoderReadStatus read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data); |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
101 static FLAC__StreamDecoderSeekStatus seek_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data); |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
102 static FLAC__StreamDecoderTellStatus tell_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data); |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
103 static FLAC__StreamDecoderLengthStatus length_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data); |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
104 static FLAC__bool eof_callback_(const FLAC__StreamDecoder *decoder, void *client_data); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
105 |
|
372
a157306caf03
[svn] - finalize the plugin-side of the extension-assist ABI
nenolod
parents:
368
diff
changeset
|
106 gchar *flac_fmts[] = { "flac", NULL }; |
|
a157306caf03
[svn] - finalize the plugin-side of the extension-assist ABI
nenolod
parents:
368
diff
changeset
|
107 |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
108 InputPlugin flac_ip = |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
109 { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
110 NULL, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
111 NULL, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
112 NULL, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
113 FLAC_XMMS__init, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
114 FLAC_XMMS__aboutbox, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
115 FLAC_XMMS__configure, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
116 FLAC_XMMS__is_our_file, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
117 NULL, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
118 FLAC_XMMS__play_file, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
119 FLAC_XMMS__stop, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
120 FLAC_XMMS__pause, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
121 FLAC_XMMS__seek, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
122 NULL, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
123 FLAC_XMMS__get_time, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
124 NULL, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
125 NULL, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
126 FLAC_XMMS__cleanup, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
127 NULL, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
128 NULL, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
129 NULL, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
130 NULL, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
131 FLAC_XMMS__get_song_info, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
132 FLAC_XMMS__file_info_box, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
133 NULL, |
|
372
a157306caf03
[svn] - finalize the plugin-side of the extension-assist ABI
nenolod
parents:
368
diff
changeset
|
134 flac_get_tuple, |
|
a157306caf03
[svn] - finalize the plugin-side of the extension-assist ABI
nenolod
parents:
368
diff
changeset
|
135 NULL, // set tuple |
|
368
c812e846b84e
[svn] - add support for extension probing to many plugins.
nenolod
parents:
285
diff
changeset
|
136 NULL, |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
137 FLAC_XMMS__is_our_file_from_vfs, |
|
372
a157306caf03
[svn] - finalize the plugin-side of the extension-assist ABI
nenolod
parents:
368
diff
changeset
|
138 flac_fmts, |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
139 }; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
140 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
141 #define SAMPLES_PER_WRITE 512 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
142 #define SAMPLE_BUFFER_SIZE ((FLAC__MAX_BLOCK_SIZE + SAMPLES_PER_WRITE) * FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS * (24/8)) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
143 static FLAC__byte sample_buffer_[SAMPLE_BUFFER_SIZE]; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
144 static unsigned sample_buffer_first_, sample_buffer_last_; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
145 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
146 static FLAC__StreamDecoder *decoder_ = 0, *decoder2 = 0; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
147 static stream_data_struct stream_data_; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
148 static GThread *decode_thread_; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
149 static FLAC__bool audio_error_ = false; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
150 static FLAC__bool is_big_endian_host_; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
151 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
152 #define BITRATE_HIST_SEGMENT_MSEC 500 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
153 /* 500ms * 50 = 25s should be enough */ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
154 #define BITRATE_HIST_SIZE 50 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
155 static unsigned bitrate_history_[BITRATE_HIST_SIZE]; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
156 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
157 #ifdef SUPPORT_ATTRIBUTE_VISIBILITY |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
158 InputPlugin *get_iplugin_info() __attribute__((visibility("default"))); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
159 #endif |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
160 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
161 InputPlugin *get_iplugin_info() |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
162 { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
163 flac_ip.description = g_strdup_printf(_("FLAC Audio Plugin")); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
164 return &flac_ip; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
165 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
166 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
167 void set_track_info(const char* title, int length_in_msec) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
168 { |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
169 if (stream_data_.is_playing) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
170 flac_ip.set_info((char*) title, length_in_msec, stream_data_.sample_rate * stream_data_.channels * stream_data_.bits_per_sample, stream_data_.sample_rate, stream_data_.channels); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
171 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
172 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
173 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
174 static gchar* homedir() |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
175 { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
176 gchar *result; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
177 char *env_home = getenv("HOME"); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
178 if (env_home) { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
179 result = g_strdup (env_home); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
180 } else { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
181 uid_t uid = getuid(); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
182 struct passwd *pwent; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
183 do { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
184 pwent = getpwent(); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
185 } while (pwent && pwent->pw_uid != uid); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
186 result = pwent ? g_strdup (pwent->pw_dir) : NULL; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
187 endpwent(); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
188 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
189 return result; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
190 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
191 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
192 static FLAC__bool is_http_source(const char *source) |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
193 { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
194 return 0 == strncasecmp(source, "http://", 7); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
195 } |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
196 |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
197 void FLAC_XMMS__init() |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
198 { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
199 ConfigDb *db; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
200 FLAC__uint32 test = 1; |
| 285 | 201 gchar *tmp = NULL; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
202 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
203 is_big_endian_host_ = (*((FLAC__byte*)(&test)))? false : true; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
204 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
205 flac_cfg.title.tag_override = FALSE; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
206 if (flac_cfg.title.tag_format) |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
207 g_free(flac_cfg.title.tag_format); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
208 flac_cfg.title.convert_char_set = FALSE; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
209 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
210 db = bmp_cfg_db_open(); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
211 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
212 /* title */ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
213 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
214 bmp_cfg_db_get_bool(db, "flac", "title.tag_override", &flac_cfg.title.tag_override); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
215 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
216 if(!bmp_cfg_db_get_string(db, "flac", "title.tag_format", &flac_cfg.title.tag_format)) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
217 flac_cfg.title.tag_format = g_strdup("%p - %t"); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
219 bmp_cfg_db_get_bool(db, "flac", "title.convert_char_set", &flac_cfg.title.convert_char_set); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
220 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
221 if(!bmp_cfg_db_get_string(db, "flac", "title.user_char_set", &flac_cfg.title.user_char_set)) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
222 flac_cfg.title.user_char_set = FLAC_plugin__charset_get_current(); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
223 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
224 /* replaygain */ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
225 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
226 bmp_cfg_db_get_bool(db, "flac", "output.replaygain.enable", &flac_cfg.output.replaygain.enable); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
227 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
228 bmp_cfg_db_get_bool(db, "flac", "output.replaygain.album_mode", &flac_cfg.output.replaygain.album_mode); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
229 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
230 if(!bmp_cfg_db_get_int(db, "flac", "output.replaygain.preamp", &flac_cfg.output.replaygain.preamp)) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
231 flac_cfg.output.replaygain.preamp = 0; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
232 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
233 bmp_cfg_db_get_bool(db, "flac", "output.replaygain.hard_limit", &flac_cfg.output.replaygain.hard_limit); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
234 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
235 bmp_cfg_db_get_bool(db, "flac", "output.resolution.normal.dither_24_to_16", &flac_cfg.output.resolution.normal.dither_24_to_16); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
236 bmp_cfg_db_get_bool(db, "flac", "output.resolution.replaygain.dither", &flac_cfg.output.resolution.replaygain.dither); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
237 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 if(!bmp_cfg_db_get_int(db, "flac", "output.resolution.replaygain.noise_shaping", &flac_cfg.output.resolution.replaygain.noise_shaping)) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
239 flac_cfg.output.resolution.replaygain.noise_shaping = 1; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
240 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
241 if(!bmp_cfg_db_get_int(db, "flac", "output.resolution.replaygain.bps_out", &flac_cfg.output.resolution.replaygain.bps_out)) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
242 flac_cfg.output.resolution.replaygain.bps_out = 16; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
243 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
244 /* stream */ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
245 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
246 bmp_cfg_db_get_int(db, "flac", "stream.http_buffer_size", &flac_cfg.stream.http_buffer_size); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
247 bmp_cfg_db_get_int(db, "flac", "stream.http_prebuffer", &flac_cfg.stream.http_prebuffer); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
248 bmp_cfg_db_get_bool(db, "flac", "stream.save_http_stream", &flac_cfg.stream.save_http_stream); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
249 if (!bmp_cfg_db_get_string(db, "flac", "stream.save_http_path", &flac_cfg.stream.save_http_path) || |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 ! *flac_cfg.stream.save_http_path) { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 /* TODO: Is this a memory leak ?? */ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 /* |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
253 if (flac_cfg.stream.save_http_path) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 g_free (flac_cfg.stream.save_http_path); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
255 */ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 flac_cfg.stream.save_http_path = homedir(); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
257 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
258 bmp_cfg_db_get_bool(db, "flac", "stream.cast_title_streaming", &flac_cfg.stream.cast_title_streaming); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
259 bmp_cfg_db_get_bool(db, "flac", "stream.use_udp_channel", &flac_cfg.stream.use_udp_channel); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 bmp_cfg_db_get_bool(db, NULL, "use_proxy", &flac_cfg.stream.use_proxy); |
|
207
063e31ae8f92
[svn] Properly zero out proxy configuration strings if no value is retrieved, otherwise we crash and burn on shutdown.
chainsaw
parents:
103
diff
changeset
|
262 if(!bmp_cfg_db_get_string(db, NULL, "proxy_host", &flac_cfg.stream.proxy_host)) |
|
063e31ae8f92
[svn] Properly zero out proxy configuration strings if no value is retrieved, otherwise we crash and burn on shutdown.
chainsaw
parents:
103
diff
changeset
|
263 flac_cfg.stream.proxy_host = NULL; |
|
063e31ae8f92
[svn] Properly zero out proxy configuration strings if no value is retrieved, otherwise we crash and burn on shutdown.
chainsaw
parents:
103
diff
changeset
|
264 |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
265 bmp_cfg_db_get_string(db, NULL, "proxy_port", &tmp); |
|
207
063e31ae8f92
[svn] Properly zero out proxy configuration strings if no value is retrieved, otherwise we crash and burn on shutdown.
chainsaw
parents:
103
diff
changeset
|
266 if (tmp != NULL) |
|
063e31ae8f92
[svn] Properly zero out proxy configuration strings if no value is retrieved, otherwise we crash and burn on shutdown.
chainsaw
parents:
103
diff
changeset
|
267 flac_cfg.stream.proxy_port = atoi(tmp); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
268 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
269 bmp_cfg_db_get_bool(db, NULL, "proxy_use_auth", &flac_cfg.stream.proxy_use_auth); |
|
207
063e31ae8f92
[svn] Properly zero out proxy configuration strings if no value is retrieved, otherwise we crash and burn on shutdown.
chainsaw
parents:
103
diff
changeset
|
270 if(!bmp_cfg_db_get_string(db, NULL, "proxy_user", &flac_cfg.stream.proxy_user)) |
|
063e31ae8f92
[svn] Properly zero out proxy configuration strings if no value is retrieved, otherwise we crash and burn on shutdown.
chainsaw
parents:
103
diff
changeset
|
271 flac_cfg.stream.proxy_user = NULL; |
|
063e31ae8f92
[svn] Properly zero out proxy configuration strings if no value is retrieved, otherwise we crash and burn on shutdown.
chainsaw
parents:
103
diff
changeset
|
272 if(!bmp_cfg_db_get_string(db, NULL, "proxy_pass", &flac_cfg.stream.proxy_pass)) |
|
063e31ae8f92
[svn] Properly zero out proxy configuration strings if no value is retrieved, otherwise we crash and burn on shutdown.
chainsaw
parents:
103
diff
changeset
|
273 flac_cfg.stream.proxy_pass = NULL; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
274 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
275 decoder_ = FLAC__stream_decoder_new(); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
276 bmp_cfg_db_close(db); |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
277 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
278 stream_data_.vfsfile = NULL; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
279 } |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
280 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
281 int FLAC_XMMS__is_our_file_from_vfs( gchar * filename , VFSFile * vfsfile ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
282 { |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
283 gchar magic_bytes[4]; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
284 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
285 if ( vfsfile == NULL ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
286 return 0; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
287 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
288 if ( vfs_fread( magic_bytes , 1 , 4 , vfsfile ) != 4 ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
289 return 0; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
290 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
291 if ( !strncmp( magic_bytes , "fLaC" , 4 ) ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
292 return 1; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
293 else |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
294 return 0; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
296 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
297 int FLAC_XMMS__is_our_file(char *filename) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
298 { |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
299 VFSFile *vfsfile; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
300 gint result = 0; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
301 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
302 vfsfile = vfs_fopen( filename , "rb" ); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
303 |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
304 if ( vfsfile == NULL ) return 0; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
305 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
306 result = FLAC_XMMS__is_our_file_from_vfs( filename , vfsfile ); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
307 |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
308 vfs_fclose( vfsfile ); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
309 |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
310 return result; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
311 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
312 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
313 void FLAC_XMMS__play_file(char *filename) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
314 { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 sample_buffer_first_ = sample_buffer_last_ = 0; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 audio_error_ = false; |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
317 stream_data_.abort_flag = false; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
318 stream_data_.is_playing = false; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
319 stream_data_.is_http_source = is_http_source(filename); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
320 stream_data_.eof = false; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
321 stream_data_.play_thread_open = false; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
322 stream_data_.has_replaygain = false; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
323 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 if(decoder_ == 0) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 return; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
326 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
327 if(!safe_decoder_init_(filename, decoder_)) |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
328 return; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
329 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
330 if(stream_data_.has_replaygain && flac_cfg.output.replaygain.enable) { |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 if(flac_cfg.output.resolution.replaygain.bps_out == 8) { |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
332 stream_data_.sample_format = FMT_U8; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
333 stream_data_.sample_format_bytes_per_sample = 1; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
334 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
335 else if(flac_cfg.output.resolution.replaygain.bps_out == 16) { |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
336 stream_data_.sample_format = (is_big_endian_host_) ? FMT_S16_BE : FMT_S16_LE; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
337 stream_data_.sample_format_bytes_per_sample = 2; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
339 else { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
340 /*@@@ need some error here like wa2: MessageBox(mod_.hMainWindow, "ERROR: plugin can only handle 8/16-bit samples\n", "ERROR: plugin can only handle 8/16-bit samples", 0); */ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
341 fprintf(stderr, "libxmms-flac: can't handle %d bit output\n", flac_cfg.output.resolution.replaygain.bps_out); |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
342 safe_decoder_finish_(decoder_); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
343 return; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
344 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
345 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
346 else { |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
347 if(stream_data_.bits_per_sample == 8) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
348 stream_data_.sample_format = FMT_U8; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
349 stream_data_.sample_format_bytes_per_sample = 1; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
350 } |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
351 else if(stream_data_.bits_per_sample == 16 || (stream_data_.bits_per_sample == 24 && flac_cfg.output.resolution.normal.dither_24_to_16)) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
352 stream_data_.sample_format = (is_big_endian_host_) ? FMT_S16_BE : FMT_S16_LE; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
353 stream_data_.sample_format_bytes_per_sample = 2; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
354 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
355 else { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
356 /*@@@ need some error here like wa2: MessageBox(mod_.hMainWindow, "ERROR: plugin can only handle 8/16-bit samples\n", "ERROR: plugin can only handle 8/16-bit samples", 0); */ |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
357 fprintf(stderr, "libxmms-flac: can't handle %d bit output\n", stream_data_.bits_per_sample); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
358 safe_decoder_finish_(decoder_); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
359 return; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
360 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
361 } |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
362 FLAC__replaygain_synthesis__init_dither_context(&stream_data_.dither_context, stream_data_.sample_format_bytes_per_sample * 8, flac_cfg.output.resolution.replaygain.noise_shaping); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
363 stream_data_.is_playing = true; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
364 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
365 if(flac_ip.output->open_audio(stream_data_.sample_format, stream_data_.sample_rate, stream_data_.channels) == 0) { |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
366 audio_error_ = true; |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
367 safe_decoder_finish_(decoder_); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
368 return; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
369 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
370 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
371 stream_data_.title = flac_format_song_title(filename); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
372 flac_ip.set_info(stream_data_.title, stream_data_.length_in_msec, stream_data_.sample_rate * stream_data_.channels * stream_data_.bits_per_sample, stream_data_.sample_rate, stream_data_.channels); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
373 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
374 stream_data_.seek_to_in_sec = -1; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
375 stream_data_.play_thread_open = true; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
376 decode_thread_ = g_thread_create((GThreadFunc)play_loop_, NULL, TRUE, NULL); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
377 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
378 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
379 void FLAC_XMMS__stop() |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
380 { |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
381 if(stream_data_.is_playing) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
382 stream_data_.is_playing = false; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
383 if(stream_data_.play_thread_open) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
384 stream_data_.play_thread_open = false; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
385 g_thread_join(decode_thread_); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
386 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
387 flac_ip.output->close_audio(); |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
388 safe_decoder_finish_(decoder_); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
389 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
390 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
391 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
392 void FLAC_XMMS__pause(short p) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
393 { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
394 flac_ip.output->pause(p); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
395 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
396 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
397 void FLAC_XMMS__seek(int time) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
398 { |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
399 if(!stream_data_.is_http_source) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
400 stream_data_.seek_to_in_sec = time; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
401 stream_data_.eof = false; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
402 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
403 while(stream_data_.seek_to_in_sec != -1) |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
404 xmms_usleep(10000); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
405 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
406 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
407 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
408 int FLAC_XMMS__get_time() |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
409 { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
410 if(audio_error_) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
411 return -2; |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
412 if(!stream_data_.is_playing || (stream_data_.eof && !flac_ip.output->buffer_playing())) |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
413 return -1; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
414 else |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
415 return flac_ip.output->output_time(); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
416 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
417 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
418 void FLAC_XMMS__cleanup() |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
419 { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
420 g_free(flac_ip.description); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
421 flac_ip.description = NULL; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
422 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
423 if (flac_cfg.title.tag_format) { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
424 free(flac_cfg.title.tag_format); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
425 flac_cfg.title.tag_format = NULL; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
426 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
427 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
428 if (flac_cfg.title.user_char_set) { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
429 free(flac_cfg.title.user_char_set); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
430 flac_cfg.title.user_char_set = NULL; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
431 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
432 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
433 if (flac_cfg.stream.proxy_host) { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
434 free(flac_cfg.stream.proxy_host); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
435 flac_cfg.stream.proxy_host = NULL; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
436 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
437 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
438 if (flac_cfg.stream.proxy_user) { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
439 free(flac_cfg.stream.proxy_user); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
440 flac_cfg.stream.proxy_user = NULL; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
441 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
442 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
443 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
444 if (flac_cfg.stream.proxy_pass) { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
445 free(flac_cfg.stream.proxy_pass); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
446 flac_cfg.stream.proxy_pass = NULL; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
447 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
448 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
449 safe_decoder_delete_(decoder_); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
450 decoder_ = 0; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
451 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
452 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
453 void FLAC_XMMS__get_song_info(char *filename, char **title, int *length_in_msec) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
454 { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
455 FLAC__StreamMetadata streaminfo; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
456 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
457 if(0 == filename) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
458 filename = ""; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
459 |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
460 /* NOTE vfs is not used here, so only try |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
461 to pick tags if you can do it with flac library stdio */ |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
462 if ( strncmp(filename,"/",1) ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
463 { |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
464 *title = g_strdup(filename); |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
465 *length_in_msec = -1; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
466 return; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
467 } |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
468 |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
469 if(!FLAC__metadata_get_streaminfo(filename, &streaminfo)) { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
470 /* @@@ how to report the error? */ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 if(title) { |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
472 if (!is_http_source(filename)) { |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
473 static const char *errtitle = "Invalid FLAC File: "; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
474 *title = g_malloc(strlen(errtitle) + 1 + strlen(filename) + 1 + 1); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 sprintf(*title, "%s\"%s\"", errtitle, filename); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
476 } else { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
477 *title = NULL; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
478 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
479 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
480 if(length_in_msec) |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
481 *length_in_msec = -1; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
482 return; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
483 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
484 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
485 if(title) { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
486 *title = flac_format_song_title(filename); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
487 } |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
488 if(length_in_msec) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
489 FLAC__uint64 l = (FLAC__uint64)((double)streaminfo.data.stream_info.total_samples / (double)streaminfo.data.stream_info.sample_rate * 1000.0 + 0.5); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
490 if (l > INT_MAX) |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
491 l = INT_MAX; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
492 *length_in_msec = (int)l; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
493 } |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
494 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
495 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
496 /*********************************************************************** |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
497 * local routines |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
498 **********************************************************************/ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
499 |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
500 static void *play_loop_(void *arg) |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
501 { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
502 unsigned written_time_last = 0, bh_index_last_w = 0, bh_index_last_o = BITRATE_HIST_SIZE, blocksize = 1; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
503 FLAC__uint64 decode_position_last = 0, decode_position_frame_last = 0, decode_position_frame = 0; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
504 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
505 (void)arg; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
506 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
507 while(stream_data_.is_playing) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
508 if(!stream_data_.eof) { |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
509 while(sample_buffer_last_ - sample_buffer_first_ < SAMPLES_PER_WRITE) { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
510 unsigned s; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
511 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
512 s = sample_buffer_last_ - sample_buffer_first_; |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
513 if(FLAC__stream_decoder_get_state(decoder_) == FLAC__STREAM_DECODER_END_OF_STREAM) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
514 stream_data_.eof = true; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
515 break; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
516 } |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
517 else if(!FLAC__stream_decoder_process_single(decoder_)) { |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
518 /*@@@ this should probably be a dialog */ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
519 fprintf(stderr, "libxmms-flac: READ ERROR processing frame\n"); |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
520 stream_data_.eof = true; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
521 break; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
522 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
523 blocksize = sample_buffer_last_ - sample_buffer_first_ - s; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
524 decode_position_frame_last = decode_position_frame; |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
525 if(stream_data_.is_http_source || !FLAC__stream_decoder_get_decode_position(decoder_, &decode_position_frame)) |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
526 decode_position_frame = 0; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
527 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
528 if(sample_buffer_last_ - sample_buffer_first_ > 0) { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
529 const unsigned n = min(sample_buffer_last_ - sample_buffer_first_, SAMPLES_PER_WRITE); |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
530 int bytes = n * stream_data_.channels * stream_data_.sample_format_bytes_per_sample; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
531 FLAC__byte *sample_buffer_start = sample_buffer_ + sample_buffer_first_ * stream_data_.channels * stream_data_.sample_format_bytes_per_sample; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
532 unsigned written_time, bh_index_w; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
533 FLAC__uint64 decode_position; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
534 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
535 sample_buffer_first_ += n; |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
536 while(flac_ip.output->buffer_free() < (int)bytes && stream_data_.is_playing && stream_data_.seek_to_in_sec == -1) |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
537 xmms_usleep(10000); |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
538 if(stream_data_.is_playing && stream_data_.seek_to_in_sec == -1) |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
539 produce_audio(flac_ip.output->written_time(), stream_data_.sample_format, |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
540 stream_data_.channels, bytes, sample_buffer_start, NULL); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
541 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
542 /* compute current bitrate */ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
543 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
544 written_time = flac_ip.output->written_time(); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
545 bh_index_w = written_time / BITRATE_HIST_SEGMENT_MSEC % BITRATE_HIST_SIZE; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
546 if(bh_index_w != bh_index_last_w) { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
547 bh_index_last_w = bh_index_w; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
548 decode_position = decode_position_frame - (double)(sample_buffer_last_ - sample_buffer_first_) * (double)(decode_position_frame - decode_position_frame_last) / (double)blocksize; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
549 bitrate_history_[(bh_index_w + BITRATE_HIST_SIZE - 1) % BITRATE_HIST_SIZE] = |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
550 decode_position > decode_position_last && written_time > written_time_last ? |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
551 8000 * (decode_position - decode_position_last) / (written_time - written_time_last) : |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
552 stream_data_.sample_rate * stream_data_.channels * stream_data_.bits_per_sample; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
553 decode_position_last = decode_position; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
554 written_time_last = written_time; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
555 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
556 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
557 else { |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
558 stream_data_.eof = true; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
559 xmms_usleep(10000); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
560 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
561 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
562 else |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
563 xmms_usleep(10000); |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
564 if(!stream_data_.is_http_source && stream_data_.seek_to_in_sec != -1) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
565 const double distance = (double)stream_data_.seek_to_in_sec * 1000.0 / (double)stream_data_.length_in_msec; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
566 FLAC__uint64 target_sample = (FLAC__uint64)(distance * (double)stream_data_.total_samples); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
567 if(stream_data_.total_samples > 0 && target_sample >= stream_data_.total_samples) |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
568 target_sample = stream_data_.total_samples - 1; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
569 if(FLAC__stream_decoder_seek_absolute(decoder_, target_sample)) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
570 flac_ip.output->flush(stream_data_.seek_to_in_sec * 1000); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
571 bh_index_last_w = bh_index_last_o = flac_ip.output->output_time() / BITRATE_HIST_SEGMENT_MSEC % BITRATE_HIST_SIZE; |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
572 if(!FLAC__stream_decoder_get_decode_position(decoder_, &decode_position_frame)) |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
573 decode_position_frame = 0; |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
574 stream_data_.eof = false; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
575 sample_buffer_first_ = sample_buffer_last_ = 0; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
576 } |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
577 else if(FLAC__stream_decoder_get_state(decoder_) == FLAC__STREAM_DECODER_SEEK_ERROR) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
578 /*@@@ this should probably be a dialog */ |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
579 fprintf(stderr, "libxmms-flac: SEEK ERROR\n"); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
580 FLAC__stream_decoder_flush(decoder_); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
581 stream_data_.eof = false; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
582 sample_buffer_first_ = sample_buffer_last_ = 0; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
583 } |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
584 stream_data_.seek_to_in_sec = -1; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
585 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
586 else { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
587 /* display the right bitrate from history */ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
588 unsigned bh_index_o = flac_ip.output->output_time() / BITRATE_HIST_SEGMENT_MSEC % BITRATE_HIST_SIZE; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
589 if(bh_index_o != bh_index_last_o && bh_index_o != bh_index_last_w && bh_index_o != (bh_index_last_w + 1) % BITRATE_HIST_SIZE) { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
590 bh_index_last_o = bh_index_o; |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
591 flac_ip.set_info(stream_data_.title, stream_data_.length_in_msec, bitrate_history_[bh_index_o], stream_data_.sample_rate, stream_data_.channels); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
592 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
593 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
594 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
595 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
596 safe_decoder_finish_(decoder_); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
597 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
598 /* are these two calls necessary? */ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
599 flac_ip.output->buffer_free(); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
600 flac_ip.output->buffer_free(); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
601 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
602 g_free(stream_data_.title); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
603 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
604 g_thread_exit(NULL); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
605 return 0; /* to silence the compiler warning about not returning a value */ |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
606 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
607 |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
608 static FLAC__bool safe_decoder_init_(char *filename, FLAC__StreamDecoder *decoder) |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
609 { |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
610 if(decoder == 0) |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
611 return false; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
612 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
613 safe_decoder_finish_(decoder); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
614 |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
615 if ( ( stream_data_.vfsfile = vfs_fopen( filename , "rb" ) ) == NULL ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
616 return false; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
617 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
618 FLAC__stream_decoder_set_md5_checking(decoder, false); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
619 FLAC__stream_decoder_set_metadata_ignore_all(decoder); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
620 FLAC__stream_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_STREAMINFO); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
621 FLAC__stream_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT); |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
622 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
623 if ( FLAC__stream_decoder_init_stream(decoder, read_callback_, seek_callback_, |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
624 tell_callback_, length_callback_, eof_callback_, write_callback_, metadata_callback_, |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
625 error_callback_, /*client_data=*/&stream_data_) != FLAC__STREAM_DECODER_INIT_STATUS_OK ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
626 return false; |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
627 |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
628 if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder)) |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
629 return false; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
630 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
631 return true; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
632 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
633 |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
634 static void safe_decoder_finish_(FLAC__StreamDecoder *decoder) |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
635 { |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
636 if ( stream_data_.vfsfile != NULL ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
637 { |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
638 vfs_fclose( stream_data_.vfsfile ); |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
639 stream_data_.vfsfile = NULL; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
640 } |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
641 if(decoder && FLAC__stream_decoder_get_state(decoder) != FLAC__STREAM_DECODER_UNINITIALIZED) |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
642 FLAC__stream_decoder_finish(decoder); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
643 } |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
644 |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
645 static void safe_decoder_delete_(FLAC__StreamDecoder *decoder) |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
646 { |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
647 if(decoder) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
648 safe_decoder_finish_(decoder); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
649 FLAC__stream_decoder_delete(decoder); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
650 } |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
651 } |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
652 |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
653 FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
654 { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
655 stream_data_struct *stream_data = (stream_data_struct *)client_data; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
656 const unsigned channels = stream_data->channels, wide_samples = frame->header.blocksize; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
657 const unsigned bits_per_sample = stream_data->bits_per_sample; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
658 FLAC__byte *sample_buffer_start; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
659 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
660 (void)decoder; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
661 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
662 if(stream_data->abort_flag) |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
663 return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
664 |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
665 if((sample_buffer_last_ + wide_samples) > (SAMPLE_BUFFER_SIZE / (channels * stream_data->sample_format_bytes_per_sample))) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
666 memmove(sample_buffer_, sample_buffer_ + sample_buffer_first_ * channels * stream_data->sample_format_bytes_per_sample, (sample_buffer_last_ - sample_buffer_first_) * channels * stream_data->sample_format_bytes_per_sample); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
667 sample_buffer_last_ -= sample_buffer_first_; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
668 sample_buffer_first_ = 0; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
669 } |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
670 sample_buffer_start = sample_buffer_ + sample_buffer_last_ * channels * stream_data->sample_format_bytes_per_sample; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
671 if(stream_data->has_replaygain && flac_cfg.output.replaygain.enable) { |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
672 FLAC__replaygain_synthesis__apply_gain( |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
673 sample_buffer_start, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
674 !is_big_endian_host_, |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
675 stream_data->sample_format_bytes_per_sample == 1, /* unsigned_data_out */ |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
676 buffer, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
677 wide_samples, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
678 channels, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
679 bits_per_sample, |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
680 stream_data->sample_format_bytes_per_sample * 8, |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
681 stream_data->replay_scale, |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
682 flac_cfg.output.replaygain.hard_limit, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
683 flac_cfg.output.resolution.replaygain.dither, |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
684 &stream_data->dither_context |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
685 ); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
686 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
687 else if(is_big_endian_host_) { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
688 FLAC__plugin_common__pack_pcm_signed_big_endian( |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
689 sample_buffer_start, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
690 buffer, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
691 wide_samples, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
692 channels, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
693 bits_per_sample, |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
694 stream_data->sample_format_bytes_per_sample * 8 |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
695 ); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
696 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
697 else { |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
698 FLAC__plugin_common__pack_pcm_signed_little_endian( |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
699 sample_buffer_start, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
700 buffer, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
701 wide_samples, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
702 channels, |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
703 bits_per_sample, |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
704 stream_data->sample_format_bytes_per_sample * 8 |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
705 ); |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
706 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
707 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
708 sample_buffer_last_ += wide_samples; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
709 |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
710 return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
711 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
712 |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
713 static void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
714 { |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
715 stream_data_struct *stream_data = (stream_data_struct *)client_data; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
716 (void)decoder; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
717 if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
718 stream_data->total_samples = metadata->data.stream_info.total_samples; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
719 stream_data->bits_per_sample = metadata->data.stream_info.bits_per_sample; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
720 stream_data->channels = metadata->data.stream_info.channels; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
721 stream_data->sample_rate = metadata->data.stream_info.sample_rate; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
722 { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
723 FLAC__uint64 l = (FLAC__uint64)((double)stream_data->total_samples / (double)stream_data->sample_rate * 1000.0 + 0.5); |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
724 if (l > INT_MAX) |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
725 l = INT_MAX; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
726 stream_data->length_in_msec = (int)l; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
727 } |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
728 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
729 else if(metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
730 double reference, gain, peak; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
731 if(grabbag__replaygain_load_from_vorbiscomment(metadata, flac_cfg.output.replaygain.album_mode, /*strict=*/false, &reference, &gain, &peak)) { |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
732 stream_data->has_replaygain = true; |
|
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
733 stream_data->replay_scale = grabbag__replaygain_compute_scale_factor(peak, gain, (double)flac_cfg.output.replaygain.preamp, /*prevent_clipping=*/!flac_cfg.output.replaygain.hard_limit); |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
734 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
735 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
736 } |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
737 |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
738 static void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
739 { |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
740 stream_data_struct *stream_data = (stream_data_struct *)client_data; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
741 (void)decoder; |
|
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
742 if(status != FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC) |
|
96
63bde7ca7ad0
[svn] First attempt at porting our FLAC plugin to API 1.1.3 (completely incompatible, as usual!). Needs more work and a version-sensitize FLAC checker.
chainsaw
parents:
12
diff
changeset
|
743 stream_data->abort_flag = true; |
|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
744 } |
|
486
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
745 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
746 static FLAC__StreamDecoderReadStatus read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
747 { |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
748 stream_data_struct *stream_data = (stream_data_struct *)client_data; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
749 (void)decoder; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
750 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
751 if( *bytes > 0 ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
752 { |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
753 *bytes = vfs_fread( buffer , sizeof(FLAC__byte) , *bytes , stream_data->vfsfile ); |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
754 if ( *bytes == 0 ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
755 return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
756 else |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
757 return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
758 } |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
759 else |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
760 return FLAC__STREAM_DECODER_READ_STATUS_ABORT; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
761 } |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
762 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
763 static FLAC__StreamDecoderSeekStatus seek_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
764 { |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
765 stream_data_struct *stream_data = (stream_data_struct *)client_data; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
766 (void)decoder; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
767 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
768 if ( stream_data->is_http_source ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
769 return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
770 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
771 if ( vfs_fseek( stream_data->vfsfile , (glong)absolute_byte_offset , SEEK_SET ) < 0 ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
772 return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
773 else |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
774 return FLAC__STREAM_DECODER_SEEK_STATUS_OK; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
775 } |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
776 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
777 static FLAC__StreamDecoderTellStatus tell_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
778 { |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
779 stream_data_struct *stream_data = (stream_data_struct *)client_data; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
780 glong pos; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
781 (void)decoder; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
782 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
783 if ( stream_data->is_http_source ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
784 return FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
785 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
786 if ( (pos = vfs_ftell(stream_data->vfsfile)) < 0 ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
787 return FLAC__STREAM_DECODER_TELL_STATUS_ERROR; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
788 else |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
789 { |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
790 *absolute_byte_offset = (FLAC__uint64)pos; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
791 return FLAC__STREAM_DECODER_TELL_STATUS_OK; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
792 } |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
793 } |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
794 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
795 static FLAC__StreamDecoderLengthStatus length_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
796 { |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
797 stream_data_struct *stream_data = (stream_data_struct *)client_data; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
798 glong current_pos = 0; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
799 glong length = 0; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
800 (void)decoder; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
801 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
802 if ( stream_data->is_http_source ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
803 return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
804 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
805 current_pos = vfs_ftell(stream_data->vfsfile); |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
806 if ( current_pos < 0 ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
807 return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
808 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
809 if ( vfs_fseek( stream_data->vfsfile , 0 , SEEK_END ) < 0 ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
810 return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
811 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
812 length = vfs_ftell(stream_data->vfsfile); |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
813 if ( length < 0 ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
814 return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
815 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
816 /* put back stream position */ |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
817 if ( vfs_fseek( stream_data->vfsfile , current_pos , SEEK_SET ) < 0 ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
818 return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
819 else |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
820 { |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
821 *stream_length = (FLAC__uint64)length; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
822 return FLAC__STREAM_DECODER_LENGTH_STATUS_OK; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
823 } |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
824 } |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
825 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
826 static FLAC__bool eof_callback_(const FLAC__StreamDecoder *decoder, void *client_data) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
827 { |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
828 stream_data_struct *stream_data = (stream_data_struct *)client_data; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
829 (void)decoder; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
830 |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
831 if ( stream_data->is_http_source ) |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
832 return FALSE; |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
833 else |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
834 return vfs_feof( stream_data->vfsfile ); |
|
3e41d8efe752
[svn] - flac 113 plugin: moved to vfs for file detection and playback; plays http files as well, but it does not use flac/http.c code to do it, so there's no metadata parsing and flac http options are ignored; flac tags are still read directly from stdio, with checks that prevents tag reading if file is not stdio-readable
giacomo
parents:
372
diff
changeset
|
835 } |
