source: roaraudio/roard/codecfilter.c @ 180:018652804998

Last change on this file since 180:018652804998 was 180:018652804998, checked in by phi, 16 years ago

added some code stolen from driver.c

File size: 1.9 KB
Line 
1//codecfilter.c:
2
3#include "roard.h"
4
5struct roar_codecfilter g_codecfilter[] = {
6 {-1,                     "null", "null codec filter", NULL,                      NULL, NULL, NULL, NULL, NULL, NULL},
7 {ROAR_CODEC_OGG_GENERAL, "cmd",  "ogg123",            "ogg123 -q -d raw -f - -", NULL, NULL, NULL, NULL, NULL, NULL},
8
9 {-1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} // end of list
10};
11
12void print_codecfilterlist (void) {
13 int i;
14
15 for (i = 0; g_codecfilter[i].name != NULL; i++) {
16  printf("  %-8s %-8s - %s (options: %s)\n",
17             roar_codec2str(g_codecfilter[i].codec),
18             g_codecfilter[i].name,
19             g_codecfilter[i].desc,
20             g_codecfilter[i].options);
21 }
22}
23
24int codecfilter_close(CODECFILTER_USERDATA_T   inst, int codecfilter) {
25 ROAR_DBG("codecfilter_close(inst=%p, codecfilter=%i) = ?", inst, codecfilter);
26
27 if ( codecfilter == -1 )
28  return -1;
29
30 if ( g_codecfilter[codecfilter].close )
31  return g_codecfilter[codecfilter].close(inst);
32
33 return 0;
34}
35
36int codecfilter_pause(CODECFILTER_USERDATA_T   inst, int codecfilter, int newstate) {
37 if ( codecfilter == -1 )
38  return -1;
39
40 if ( g_codecfilter[codecfilter].pause )
41  return g_codecfilter[codecfilter].pause(inst, newstate);
42
43 return 0;
44}
45
46int codecfilter_write(CODECFILTER_USERDATA_T   inst, int codecfilter, char * buf, int len) {
47 if ( codecfilter == -1 )
48  return -1;
49
50 if ( g_codecfilter[codecfilter].write )
51  return g_codecfilter[codecfilter].write(inst, buf, len);
52
53 return 0;
54}
55
56int codecfilter_read (CODECFILTER_USERDATA_T   inst, int codecfilter, char * buf, int len) {
57 if ( codecfilter == -1 )
58  return -1;
59
60 if ( g_codecfilter[codecfilter].read )
61  return g_codecfilter[codecfilter].read(inst, buf, len);
62
63 return 0;
64}
65
66int codecfilter_flush(CODECFILTER_USERDATA_T   inst, int codecfilter) {
67 if ( codecfilter == -1 )
68  return -1;
69
70 if ( g_codecfilter[codecfilter].flush )
71  return g_codecfilter[codecfilter].flush(inst);
72
73 return 0;
74}
75
76//ll
Note: See TracBrowser for help on using the repository browser.