Mercurial > audlegacy-plugins
comparison src/flac113/plugin.c @ 516:522acbb51ecc trunk
[svn] - flac 113 plugin: get rid of http.c and http.h stuff in flac 113 as well
| author | giacomo |
|---|---|
| date | Mon, 22 Jan 2007 09:08:16 -0800 |
| parents | 31d21ad70903 |
| children | 5d05cefbf7ae |
comparison
equal
deleted
inserted
replaced
| 515:4e3a09ba3f0b | 516:522acbb51ecc |
|---|---|
| 45 #include "grabbag.h" | 45 #include "grabbag.h" |
| 46 #include "replaygain_synthesis.h" | 46 #include "replaygain_synthesis.h" |
| 47 #include "configure.h" | 47 #include "configure.h" |
| 48 #include "charset.h" | 48 #include "charset.h" |
| 49 #include "tag.h" | 49 #include "tag.h" |
| 50 #include "http.h" | |
| 51 | 50 |
| 52 #ifdef min | 51 #ifdef min |
| 53 #undef min | 52 #undef min |
| 54 #endif | 53 #endif |
| 55 #define min(x,y) ((x)<(y)?(x):(y)) | 54 #define min(x,y) ((x)<(y)?(x):(y)) |
| 57 extern void FLAC_XMMS__file_info_box(char *filename); | 56 extern void FLAC_XMMS__file_info_box(char *filename); |
| 58 | 57 |
| 59 typedef struct { | 58 typedef struct { |
| 60 FLAC__bool abort_flag; | 59 FLAC__bool abort_flag; |
| 61 FLAC__bool is_playing; | 60 FLAC__bool is_playing; |
| 62 FLAC__bool is_http_source; | |
| 63 FLAC__bool eof; | 61 FLAC__bool eof; |
| 64 FLAC__bool play_thread_open; /* if true, is_playing must also be true */ | 62 FLAC__bool play_thread_open; /* if true, is_playing must also be true */ |
| 65 FLAC__uint64 total_samples; | 63 FLAC__uint64 total_samples; |
| 66 unsigned bits_per_sample; | 64 unsigned bits_per_sample; |
| 67 unsigned channels; | 65 unsigned channels; |
| 187 endpwent(); | 185 endpwent(); |
| 188 } | 186 } |
| 189 return result; | 187 return result; |
| 190 } | 188 } |
| 191 | 189 |
| 192 static FLAC__bool is_http_source(const char *source) | |
| 193 { | |
| 194 return 0 == strncasecmp(source, "http://", 7); | |
| 195 } | |
| 196 | |
| 197 void FLAC_XMMS__init() | 190 void FLAC_XMMS__init() |
| 198 { | 191 { |
| 199 ConfigDb *db; | 192 ConfigDb *db; |
| 200 FLAC__uint32 test = 1; | 193 FLAC__uint32 test = 1; |
| 201 gchar *tmp = NULL; | 194 gchar *tmp = NULL; |
| 272 if(!bmp_cfg_db_get_string(db, NULL, "proxy_user", &flac_cfg.stream.proxy_user)) | 265 if(!bmp_cfg_db_get_string(db, NULL, "proxy_user", &flac_cfg.stream.proxy_user)) |
| 273 flac_cfg.stream.proxy_user = NULL; | 266 flac_cfg.stream.proxy_user = NULL; |
| 274 if(!bmp_cfg_db_get_string(db, NULL, "proxy_pass", &flac_cfg.stream.proxy_pass)) | 267 if(!bmp_cfg_db_get_string(db, NULL, "proxy_pass", &flac_cfg.stream.proxy_pass)) |
| 275 flac_cfg.stream.proxy_pass = NULL; | 268 flac_cfg.stream.proxy_pass = NULL; |
| 276 | 269 |
| 270 bmp_cfg_db_close(db); | |
| 277 decoder_ = FLAC__stream_decoder_new(); | 271 decoder_ = FLAC__stream_decoder_new(); |
| 278 bmp_cfg_db_close(db); | |
| 279 | 272 |
| 280 stream_data_.vfsfile = NULL; | 273 stream_data_.vfsfile = NULL; |
| 281 } | 274 } |
| 282 | 275 |
| 283 int FLAC_XMMS__is_our_file_from_vfs( gchar * filename , VFSFile * vfsfile ) | 276 int FLAC_XMMS__is_our_file_from_vfs( gchar * filename , VFSFile * vfsfile ) |
| 316 { | 309 { |
| 317 sample_buffer_first_ = sample_buffer_last_ = 0; | 310 sample_buffer_first_ = sample_buffer_last_ = 0; |
| 318 audio_error_ = false; | 311 audio_error_ = false; |
| 319 stream_data_.abort_flag = false; | 312 stream_data_.abort_flag = false; |
| 320 stream_data_.is_playing = false; | 313 stream_data_.is_playing = false; |
| 321 stream_data_.is_http_source = is_http_source(filename); | |
| 322 stream_data_.eof = false; | 314 stream_data_.eof = false; |
| 323 stream_data_.play_thread_open = false; | 315 stream_data_.play_thread_open = false; |
| 324 stream_data_.has_replaygain = false; | 316 stream_data_.has_replaygain = false; |
| 325 | 317 |
| 326 if(decoder_ == 0) | 318 if(decoder_ == 0) |
| 467 } | 459 } |
| 468 | 460 |
| 469 if(!FLAC__metadata_get_streaminfo(filename, &streaminfo)) { | 461 if(!FLAC__metadata_get_streaminfo(filename, &streaminfo)) { |
| 470 /* @@@ how to report the error? */ | 462 /* @@@ how to report the error? */ |
| 471 if(title) { | 463 if(title) { |
| 472 if (!is_http_source(filename)) { | 464 static const char *errtitle = "Invalid FLAC File: "; |
| 473 static const char *errtitle = "Invalid FLAC File: "; | 465 *title = g_malloc(strlen(errtitle) + 1 + strlen(filename) + 1 + 1); |
| 474 *title = g_malloc(strlen(errtitle) + 1 + strlen(filename) + 1 + 1); | 466 sprintf(*title, "%s\"%s\"", errtitle, filename); |
| 475 sprintf(*title, "%s\"%s\"", errtitle, filename); | |
| 476 } else { | |
| 477 *title = NULL; | |
| 478 } | |
| 479 } | 467 } |
| 480 if(length_in_msec) | 468 if(length_in_msec) |
| 481 *length_in_msec = -1; | 469 *length_in_msec = -1; |
| 482 return; | 470 return; |
| 483 } | 471 } |
