1
1
/* CorePlayer.cpp - Core player object, most of the hacking is done here!
2
2
* Copyright (C) 1998-2003 Andy Lo A Foe <andy@alsaplayer.org>
4
* This program is free software; you can redistribute it and/or modify
4
* This file is part of AlsaPlayer.
6
* AlsaPlayer is free software; you can redistribute it and/or modify
5
7
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
8
* the Free Software Foundation; either version 3 of the License, or
7
9
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
11
* AlsaPlayer is distributed in the hope that it will be useful,
10
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
14
* GNU General Public License for more details.
14
16
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
* $Id: CorePlayer.cpp 1114 2007-05-19 10:22:25Z dominique_libre $
17
* along with this program; if not, see <http://www.gnu.org/licenses/>.
19
* $Id: CorePlayer.cpp 1267 2007-07-09 20:14:22Z dominique_libre $
339
343
int error_count = 0;
340
344
input_plugin *tmp;
346
if (the_plugin->name == NULL) {
347
alsaplayer_error("No name");
350
if (the_plugin->author == NULL) {
351
alsaplayer_error("No author");
354
if (the_plugin->init == NULL) {
355
alsaplayer_error("No init function");
358
if (the_plugin->can_handle == NULL) {
359
alsaplayer_error("No can_handle function");
362
if (the_plugin->open == NULL) {
363
alsaplayer_error("No open function");
366
if (the_plugin->close == NULL) {
367
alsaplayer_error("No close function");
370
if (the_plugin->play_frame == NULL) {
371
alsaplayer_error("No play_frame function");
374
if (the_plugin->frame_seek == NULL) {
375
alsaplayer_error("No frame_seek function");
379
if (the_plugin->nr_frames == NULL) {
380
alsaplayer_error("No nr_frames function");
383
if (the_plugin->frame_size == NULL) {
384
alsaplayer_error("No frame_size function");
387
if (the_plugin->channels == NULL) {
388
alsaplayer_error("No channels function");
391
if (the_plugin->stream_info == NULL) {
392
alsaplayer_error("No stream_info function");
395
if (the_plugin->shutdown == NULL) {
396
alsaplayer_error("No shutdown function");
400
alsaplayer_error("At least %d error(s) were detected", error_count);
342
404
tmp = &plugins[plugin_count];
343
405
tmp->version = the_plugin->version;
344
406
if (tmp->version) {
346
408
alsaplayer_error("Wrong version number on plugin (v%d, wanted v%d)",
347
409
version - INPUT_PLUGIN_BASE_VERSION,
348
410
INPUT_PLUGIN_VERSION - INPUT_PLUGIN_BASE_VERSION);
411
// this is a minor error actually
412
// no need to stop there
352
417
tmp->name = the_plugin->name;
353
418
tmp->author = the_plugin->author;
354
419
tmp->init = the_plugin->init;
366
431
tmp->shutdown = the_plugin->shutdown;
367
432
tmp->nr_tracks = the_plugin->nr_tracks;
368
433
tmp->track_seek = the_plugin->track_seek;
369
if (tmp->name == NULL) {
370
alsaplayer_error("No name");
373
if (tmp->author == NULL) {
374
alsaplayer_error("No author");
377
if (tmp->init == NULL) {
378
alsaplayer_error("No init function");
381
if (tmp->can_handle == NULL) {
382
alsaplayer_error("No can_handle function");
385
if (tmp->open == NULL) {
386
alsaplayer_error("No open function");
389
if (tmp->close == NULL) {
390
alsaplayer_error("No close function");
393
if (tmp->play_frame == NULL) {
394
alsaplayer_error("No play_frame function");
397
if (tmp->frame_seek == NULL) {
398
alsaplayer_error("No frame_seek function");
402
if (tmp->nr_frames == NULL) {
403
alsaplayer_error("No nr_frames function");
406
if (tmp->frame_size == NULL) {
407
alsaplayer_error("No frame_size function");
410
if (tmp->channels == NULL) {
411
alsaplayer_error("No channels function");
414
if (tmp->stream_info == NULL) {
415
alsaplayer_error("No stream_info function");
418
if (tmp->shutdown == NULL) {
419
alsaplayer_error("No shutdown function");
423
alsaplayer_error("At least %d error(s) were detected", error_count);
427
435
if (!tmp->init()) {
428
alsaplayer_error("Plugin failed to initialize (\"%s\")",
436
alsaplayer_error("Plugin failed to initialize (\"%s\")", tmp->name);
433
if (plugin_count == 1) { // First so assign plugin
436
441
if (global_verbose)
437
442
alsaplayer_error("Loading Input plugin: %s", tmp->name);
753
758
if (repitched) { // Pitch was changed so return this instead
754
759
return pitch_point;
756
return (read_direction == DIR_FORWARD ? pitch : -pitch);
761
float ret_pitch = pitch / pitch_multi;
762
return (read_direction == DIR_FORWARD ? ret_pitch : -ret_pitch);