/* vim: sw=4 ts=4 expandtab * * Copyright 2007 Darren Smith * All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #define BUILD_TARGET_ARM 1 #define CHANNELS 2 #define SAMPLERATE 44100 #include #include #include "nmsplugin.h" #include "plugin-internals.h" static media_buf_t mbuf; static int playFile(char * fname) { FILE *ifile; int bytes; ifile = fopen(fname, "r"); if (ifile == NULL) { fprintf(stderr,"Could not open pipe!\n"); return 1; } while (1) { while (OutputGetBuffer(&mbuf, 1000, 0) != 0); if (mbuf.abuf.data == NULL) { fprintf(stderr,"Error allocating buffer!\n"); fprintf(stderr, "Sizes: mbuf.abuf.size = %d\n", mbuf.abuf.size); fprintf(stderr, "Sizes: mbuf.vbuf.size = %d\n", mbuf.vbuf.size); break; } bytes = fread(mbuf.abuf.data,1,mbuf.abuf.size,ifile); if (bytes == 0) break; if (bytes == -1) { fprintf(stderr,"Error reading file!\n"); break; } mbuf.abuf.size = bytes; mbuf.curbuf = &mbuf.abuf; OutputWrite(&mbuf); } fclose(ifile); return 0; } int main(int argc, char ** argv) { media_desc_t mdesc = { .adesc = { .audio_type = NMS_AC_PCM, .num_channels = CHANNELS, .sample_rate = SAMPLERATE, .bitrate = CHANNELS * SAMPLERATE * 16, .wma_encode_opt = 0, .wma_block_align = 0, }, .vdesc = { .video_type = NMS_VC_NO_VIDEO, .width = 0, .height = 0, .frame_rate = 0, .iframe_rate = 0, .capture_port = 0, .brand = 0, }, .sdesc = { .subtitle_type = NMS_SC_NO_SUBTITLE, }, }; int i; if (argc == 1 || argv[1][0] == '-') { fprintf(stderr,"USAGE: %s [filename]...\n", argv[0]); return 1; } PluginLoad(); if (OutputSelect(NMS_PLUGIN_MULTIMEDIA)) { fprintf(stderr,"Error selecting multimedia plugin!\n"); return 1; } if (OutputInit(&mdesc, 0)) { fprintf(stderr,"Error opening output device!\n"); return 1; } OutputStart(); for(i=1; i