annotate src/filewriter/flac.c @ 1569:25ea2127eefa

filewriter: fix symbol collisions
author William Pitcock <nenolod@atheme.org>
date Sun, 02 Sep 2007 22:01:45 -0500
parents 1b52e7eacd4c
children d158ce84fda7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
1 /* FileWriter FLAC Plugin
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
2 * Copyright (c) 2007 William Pitcock <nenolod@sacredspiral.co.uk>
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
3 *
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
4 * Partially derived from Og(g)re - Ogg-Output-Plugin:
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
5 * Copyright (c) 2002 Lars Siebold <khandha5@gmx.net>
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
6 *
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
10 * (at your option) any later version.
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
11 *
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
15 * GNU General Public License for more details.
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
16 *
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
20 */
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
21
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
22 #include "plugins.h"
1002
ad29227009f6 [svn] ifdef filewriter/flac.c out completely if FILEWRITER_FLAC isn't defined
js
parents: 996
diff changeset
23
ad29227009f6 [svn] ifdef filewriter/flac.c out completely if FILEWRITER_FLAC isn't defined
js
parents: 996
diff changeset
24 #ifdef FILEWRITER_FLAC
ad29227009f6 [svn] ifdef filewriter/flac.c out completely if FILEWRITER_FLAC isn't defined
js
parents: 996
diff changeset
25
995
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
26 #include <FLAC/all.h>
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
27 #include <stdlib.h>
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
28
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
29 static gint flac_open(void);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
30 static void flac_write(gpointer data, gint length);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
31 static void flac_close(void);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
32 static gint flac_free(void);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
33 static gint flac_playing(void);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
34 static gint flac_get_written_time(void);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
35
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
36 FileWriter flac_plugin =
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
37 {
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
38 NULL,
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
39 NULL,
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
40 flac_open,
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
41 flac_write,
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
42 flac_close,
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
43 flac_free,
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
44 flac_playing,
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
45 flac_get_written_time
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
46 };
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
47
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
48 static FLAC__StreamEncoder *flac_encoder;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
49 static guint64 olen = 0;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
50
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
51 static FLAC__StreamEncoderWriteStatus flac_write_cb(const FLAC__StreamEncoder *encoder,
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
52 const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, gpointer data)
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
53 {
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
54 written += vfs_fwrite(buffer, bytes, 1, (VFSFile *) data);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
55
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
56 return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
57 }
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
58
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
59 static FLAC__StreamEncoderSeekStatus flac_seek_cb(const FLAC__StreamEncoder *encoder,
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
60 FLAC__uint64 absolute_byte_offset, gpointer data)
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
61 {
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
62 VFSFile *file = (VFSFile *) data;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
63
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
64 if (vfs_fseek(file, absolute_byte_offset, SEEK_SET) < 0)
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
65 return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
66
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
67 return FLAC__STREAM_ENCODER_SEEK_STATUS_OK;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
68 }
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
69
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
70 static FLAC__StreamEncoderTellStatus flac_tell_cb(const FLAC__StreamEncoder *encoder,
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
71 FLAC__uint64 *absolute_byte_offset, gpointer data)
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
72 {
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
73 VFSFile *file = (VFSFile *) data;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
74
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
75 *absolute_byte_offset = vfs_ftell(file);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
76
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
77 return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
78 }
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
79
995
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
80 #define INSERT_VORBIS_COMMENT(t, keyword) \
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
81 if (t) \
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
82 { \
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
83 gchar *scratch = g_strdup_printf(keyword, t); \
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
84 comment_entry.length = strlen(scratch); \
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
85 comment_entry.entry = (guchar *) scratch; \
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
86 FLAC__metadata_object_vorbiscomment_insert_comment(meta, \
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
87 meta->data.vorbis_comment.num_comments, comment_entry, TRUE); \
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
88 g_free(scratch); \
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
89 }
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
90
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
91 static gint flac_open(void)
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
92 {
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
93 written = 0;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
94 olen = 0;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
95
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
96 flac_encoder = FLAC__stream_encoder_new();
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
97
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
98 FLAC__stream_encoder_set_channels(flac_encoder, input.channels);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
99 FLAC__stream_encoder_set_sample_rate(flac_encoder, input.frequency);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
100 FLAC__stream_encoder_init_stream(flac_encoder, flac_write_cb, flac_seek_cb, flac_tell_cb,
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
101 NULL, output_file);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
102
995
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
103 if (tuple)
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
104 {
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
105 FLAC__StreamMetadata *meta;
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
106 FLAC__StreamMetadata_VorbisComment_Entry comment_entry;
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
107
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
108 meta = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT);
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
109
1441
1b52e7eacd4c filewriter: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents: 1269
diff changeset
110 INSERT_VORBIS_COMMENT(tuple_get_string(tuple, "title"), "title=%s");
1b52e7eacd4c filewriter: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents: 1269
diff changeset
111 INSERT_VORBIS_COMMENT(tuple_get_string(tuple, "artist"), "artist=%s");
1b52e7eacd4c filewriter: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents: 1269
diff changeset
112 INSERT_VORBIS_COMMENT(tuple_get_string(tuple, "album"), "album=%s");
1b52e7eacd4c filewriter: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents: 1269
diff changeset
113 INSERT_VORBIS_COMMENT(tuple_get_string(tuple, "genre"), "genre=%s");
1b52e7eacd4c filewriter: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents: 1269
diff changeset
114 INSERT_VORBIS_COMMENT(tuple_get_string(tuple, "comment"), "comment=%s");
1b52e7eacd4c filewriter: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents: 1269
diff changeset
115 INSERT_VORBIS_COMMENT(tuple_get_string(tuple, "date"), "date=%s");
1b52e7eacd4c filewriter: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents: 1269
diff changeset
116 INSERT_VORBIS_COMMENT(tuple_get_int(tuple, "year"), "year=%d");
1b52e7eacd4c filewriter: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents: 1269
diff changeset
117 INSERT_VORBIS_COMMENT(tuple_get_int(tuple, "track-number"), "tracknumber=%d");
995
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
118
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
119 FLAC__stream_encoder_set_metadata(flac_encoder, &meta, 1);
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
120 }
73f5e44d20d2 [svn] - add tuple handling, but i don't think i'm doing it right...
nenolod
parents: 994
diff changeset
121
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
122 return 1;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
123 }
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
124
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
125 static void flac_write(gpointer data, gint length)
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
126 {
994
91f9925d88f1 [svn] - use my version for now as r2126 does not work
nenolod
parents: 993
diff changeset
127 #if 1
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
128 FLAC__int32 *encbuffer[2];
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
129 short int *tmpdata = data;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
130 int i;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
131
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
132 encbuffer[0] = g_new0(FLAC__int32, length / input.channels);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
133 encbuffer[1] = g_new0(FLAC__int32, length / input.channels);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
134
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
135 if (input.channels == 1)
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
136 {
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
137 for (i = 0; i < (length / 2); i++)
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
138 {
992
a277aaab4525 [svn] - remove the padding, flac starts working.
nenolod
parents: 991
diff changeset
139 encbuffer[0][i] = tmpdata[i];
a277aaab4525 [svn] - remove the padding, flac starts working.
nenolod
parents: 991
diff changeset
140 encbuffer[1][i] = tmpdata[i];
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
141 }
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
142 }
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
143 else
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
144 {
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
145 for (i = 0; i < (length / 4); i++)
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
146 {
992
a277aaab4525 [svn] - remove the padding, flac starts working.
nenolod
parents: 991
diff changeset
147 encbuffer[0][i] = tmpdata[2 * i];
a277aaab4525 [svn] - remove the padding, flac starts working.
nenolod
parents: 991
diff changeset
148 encbuffer[1][i] = tmpdata[2 * i + 1];
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
149 }
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
150 }
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
151
1044
b1128efde471 [svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents: 1002
diff changeset
152 FLAC__stream_encoder_process(flac_encoder, (const FLAC__int32 **)encbuffer, length / (input.channels * 2));
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
153 olen += length;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
154
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
155 g_free(encbuffer[0]);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
156 g_free(encbuffer[1]);
994
91f9925d88f1 [svn] - use my version for now as r2126 does not work
nenolod
parents: 993
diff changeset
157 #else
993
ertzing
parents: 992
diff changeset
158 FLAC__int32 *encbuffer;
994
91f9925d88f1 [svn] - use my version for now as r2126 does not work
nenolod
parents: 993
diff changeset
159 gint16 *tmpdata = data;
993
ertzing
parents: 992
diff changeset
160 int i;
ertzing
parents: 992
diff changeset
161
ertzing
parents: 992
diff changeset
162 encbuffer = g_new0(FLAC__int32, length);
ertzing
parents: 992
diff changeset
163
996
ertzing
parents: 995
diff changeset
164 for (i=0; i < length; i++) {
993
ertzing
parents: 992
diff changeset
165 encbuffer[i] = tmpdata[i];
ertzing
parents: 992
diff changeset
166 }
ertzing
parents: 992
diff changeset
167
996
ertzing
parents: 995
diff changeset
168 FLAC__stream_encoder_process_interleaved(flac_encoder, encbuffer, length);
993
ertzing
parents: 992
diff changeset
169 olen += length;
ertzing
parents: 992
diff changeset
170
ertzing
parents: 992
diff changeset
171 g_free(encbuffer);
994
91f9925d88f1 [svn] - use my version for now as r2126 does not work
nenolod
parents: 993
diff changeset
172 #endif
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
173 }
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
174
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
175 static void flac_close(void)
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
176 {
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
177 FLAC__stream_encoder_finish(flac_encoder);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
178 FLAC__stream_encoder_delete(flac_encoder);
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
179 }
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
180
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
181 static gint flac_free(void)
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
182 {
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
183 return 1000000;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
184 }
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
185
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
186 static gint flac_playing(void)
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
187 {
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
188 return 0;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
189 }
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
190
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
191 static gint flac_get_written_time(void)
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
192 {
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
193 if (input.frequency && input.channels)
1269
0e160bafce1c - adapt filewriter for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1044
diff changeset
194 return (gint) ((olen * 1000) / (input.frequency * 2 * input.channels) + offset);
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
195
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
196 return 0;
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents:
diff changeset
197 }
1002
ad29227009f6 [svn] ifdef filewriter/flac.c out completely if FILEWRITER_FLAC isn't defined
js
parents: 996
diff changeset
198
ad29227009f6 [svn] ifdef filewriter/flac.c out completely if FILEWRITER_FLAC isn't defined
js
parents: 996
diff changeset
199 #endif