Mercurial > audlegacy-plugins
comparison src/filewriter/flac.c @ 993:febbc2c05d33 trunk
[svn]
- A simpler version of flac_write()
author | ertzing |
---|---|
date | Tue, 01 May 2007 08:30:24 -0700 |
parents | a277aaab4525 |
children | 91f9925d88f1 |
comparison
equal
deleted
inserted
replaced
992:a277aaab4525 | 993:febbc2c05d33 |
---|---|
89 return 1; | 89 return 1; |
90 } | 90 } |
91 | 91 |
92 static void flac_write(gpointer data, gint length) | 92 static void flac_write(gpointer data, gint length) |
93 { | 93 { |
94 #if 0 | |
94 FLAC__int32 *encbuffer[2]; | 95 FLAC__int32 *encbuffer[2]; |
95 short int *tmpdata = data; | 96 short int *tmpdata = data; |
96 int i; | 97 int i; |
97 | 98 |
98 encbuffer[0] = g_new0(FLAC__int32, length / input.channels); | 99 encbuffer[0] = g_new0(FLAC__int32, length / input.channels); |
118 FLAC__stream_encoder_process(flac_encoder, encbuffer, length / (input.channels * 2)); | 119 FLAC__stream_encoder_process(flac_encoder, encbuffer, length / (input.channels * 2)); |
119 olen += length; | 120 olen += length; |
120 | 121 |
121 g_free(encbuffer[0]); | 122 g_free(encbuffer[0]); |
122 g_free(encbuffer[1]); | 123 g_free(encbuffer[1]); |
124 #endif | |
125 | |
126 FLAC__int32 *encbuffer; | |
127 gint16_t *tmpdata = data; | |
128 int i; | |
129 | |
130 encbuffer = g_new0(FLAC__int32, length); | |
131 | |
132 for (i=0; i < (length/2); i++) { | |
133 encbuffer[i] = tmpdata[i]; | |
134 } | |
135 | |
136 FLAC__stream_encoder_process_interleaved(flac_encoder, encbuffer, (length/2)); | |
137 olen += length; | |
138 | |
139 g_free(encbuffer); | |
123 } | 140 } |
124 | 141 |
125 static void flac_close(void) | 142 static void flac_close(void) |
126 { | 143 { |
127 FLAC__stream_encoder_finish(flac_encoder); | 144 FLAC__stream_encoder_finish(flac_encoder); |