diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | e2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch) | |
tree | 9047cf9e6b5c43878d5bf82660adae77ceee097a /mpeglib/example/splay/splay.cpp | |
download | tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'mpeglib/example/splay/splay.cpp')
-rw-r--r-- | mpeglib/example/splay/splay.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/mpeglib/example/splay/splay.cpp b/mpeglib/example/splay/splay.cpp new file mode 100644 index 00000000..75254360 --- /dev/null +++ b/mpeglib/example/splay/splay.cpp @@ -0,0 +1,64 @@ +/* + + Example how the plugin interface works.(LINUX Open Sound System only!) + + + */ + + +#include "../../lib/decoder/splayPlugin.h" +#include "../../lib/decoder/tplayPlugin.h" +#include "../../lib/decoder/vorbisPlugin.h" +#include "../../lib/input/bufferInputStream.h" +#include "../../lib/output/avSyncer.h" + +#include <iostream> + +using namespace std; + +int main(int argc, char** argv) { + + + + if (argc <= 1) { + printf("Usage:\n\n"); + printf("%s filename\n\n",argv[0]); + exit(0); + } + + // + // The order is important !!!! + // 1. construct + // 2. set Output + // 3. open input + // 4. set input + // + // you cannot set the input _before_ the output + // in fact you can, but this gives you a segfault! + + SplayPlugin* plugin=new SplayPlugin(); + OutputStream* out=OutPlugin::createOutputStream(_OUTPUT_LOCAL,true); + InputStream* in=InputPlugin::createInputStream(argv[1],true); + + in->open(argv[1]); + // watch the order! + plugin->setOutputPlugin(out); + plugin->setInputPlugin(in); + plugin->play(); + + while(plugin->getStreamState() != _STREAM_STATE_EOF) { + cout << "check state"<<endl; + TimeWrapper::sleep(1); + + } + + cout << "****************plugin eof"<<endl; + //out->audioClose(); + plugin->close(); + + delete plugin; + delete in; + delete out; + return(0); +} + |