| 1 |
/* |
| 2 |
dummy: dummy audio output |
| 3 |
|
| 4 |
copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 |
| 5 |
see COPYING and AUTHORS files in distribution or http://mpg123.org |
| 6 |
*/ |
| 7 |
|
| 8 |
#include "../out123_int.h" |
| 9 |
#include "../../common/debug.h" |
| 10 |
|
| 11 |
static int open_dummy(out123_handle *ao) |
| 12 |
{ |
| 13 |
debug("open_dummy()"); |
| 14 |
if(ao->format < 0) |
| 15 |
{ |
| 16 |
ao->rate = 44100; |
| 17 |
ao->channels = 2; |
| 18 |
ao->format = MPG123_ENC_SIGNED_16; |
| 19 |
} |
| 20 |
return 0; |
| 21 |
} |
| 22 |
|
| 23 |
static int get_formats_dummy(out123_handle *ao) |
| 24 |
{ |
| 25 |
debug("get_formats_dummy()"); |
| 26 |
return MPG123_ENC_ANY; |
| 27 |
} |
| 28 |
|
| 29 |
static int write_dummy(out123_handle *ao,unsigned char *buf,int len) |
| 30 |
{ |
| 31 |
debug("write_dummy()"); |
| 32 |
return len; |
| 33 |
} |
| 34 |
|
| 35 |
static void flush_dummy(out123_handle *ao) |
| 36 |
{ |
| 37 |
debug("flush_dummy()"); |
| 38 |
} |
| 39 |
|
| 40 |
static int close_dummy(out123_handle *ao) |
| 41 |
{ |
| 42 |
debug("close_dummy()"); |
| 43 |
return 0; |
| 44 |
} |
| 45 |
|
| 46 |
static void deinit_dummy(out123_handle *ao) |
| 47 |
{ |
| 48 |
debug("deinit_dummy()"); |
| 49 |
} |
| 50 |
|
| 51 |
static int enumerate_dummy( out123_handle *ao, int (*store_device)(void *devlist |
| 52 |
, const char *name, const char *description), void *devlist) |
| 53 |
{ |
| 54 |
if(store_device(devlist, "foo", "some dummy device")) |
| 55 |
return -1; |
| 56 |
if(store_device(devlist, "bar", "some other dummy device")) |
| 57 |
return -1; |
| 58 |
return 0; |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
static int init_dummy(out123_handle* ao) |
| 63 |
{ |
| 64 |
if (ao==NULL) return -1; |
| 65 |
debug("init_dummy()"); |
| 66 |
|
| 67 |
/* Set callbacks */ |
| 68 |
ao->open = open_dummy; |
| 69 |
ao->flush = flush_dummy; |
| 70 |
ao->write = write_dummy; |
| 71 |
ao->get_formats = get_formats_dummy; |
| 72 |
ao->close = close_dummy; |
| 73 |
ao->deinit = deinit_dummy; |
| 74 |
ao->enumerate = enumerate_dummy; |
| 75 |
|
| 76 |
/* Success */ |
| 77 |
return 0; |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
/* |
| 83 |
Module information data structure |
| 84 |
*/ |
| 85 |
mpg123_module_t mpg123_output_module_info = { |
| 86 |
/* api_version */ MPG123_MODULE_API_VERSION, |
| 87 |
/* name */ "dummy", |
| 88 |
/* description */ "Dummy audio output - does not output audio.", |
| 89 |
/* revision */ "$Rev:$", |
| 90 |
/* handle */ NULL, |
| 91 |
|
| 92 |
/* init_output */ init_dummy, |
| 93 |
}; |
| 94 |
|