summaryrefslogtreecommitdiffstats
path: root/mpeglib/example/mpgplay
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch)
tree9047cf9e6b5c43878d5bf82660adae77ceee097a /mpeglib/example/mpgplay
downloadtdemultimedia-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/mpgplay')
-rw-r--r--mpeglib/example/mpgplay/Makefile.am32
-rw-r--r--mpeglib/example/mpgplay/mpgplay.cpp74
2 files changed, 106 insertions, 0 deletions
diff --git a/mpeglib/example/mpgplay/Makefile.am b/mpeglib/example/mpgplay/Makefile.am
new file mode 100644
index 00000000..c76bd4d1
--- /dev/null
+++ b/mpeglib/example/mpgplay/Makefile.am
@@ -0,0 +1,32 @@
+# mpegplay-yaf - Makefile.am
+
+INCLUDES = $(all_includes)
+
+EXTRA_DIST =
+
+noinst_PROGRAMS = mpgplay
+
+mpgplay_SOURCES = mpgplay.cpp
+
+noinst_HEADERS =
+
+mpgplay_LDFLAGS = $(all_libraries)
+
+mpgplay_LDADD = ../../lib/libmpeg.la \
+ $(THIS_LIB_LIBS)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mpeglib/example/mpgplay/mpgplay.cpp b/mpeglib/example/mpgplay/mpgplay.cpp
new file mode 100644
index 00000000..c5c1d82c
--- /dev/null
+++ b/mpeglib/example/mpgplay/mpgplay.cpp
@@ -0,0 +1,74 @@
+/*
+ * main.c --
+ *
+ * Example program for mpegplay library.
+
+
+ */
+
+#include "../../lib/decoder/mpgPlugin.h"
+#include "../../lib/util/timeWrapper.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!
+
+ MpgPlugin* plugin=new MpgPlugin();
+ OutputStream* out=OutPlugin::createOutputStream(_OUTPUT_LOCAL,true);
+ InputStream* in=InputPlugin::createInputStream(argv[1],true);
+
+
+
+ // The plugin does not do "open"
+ in->open(argv[1]);
+
+
+
+
+
+ // watch the order!
+ plugin->setOutputPlugin(out);
+ plugin->setInputPlugin(in);
+ //plugin->seek(1950);
+ cout << "hello 1 -s"<<endl;
+
+
+ plugin->play();
+ cout << "hello 1 -e"<<endl;
+
+
+ while(1) {
+ if (plugin->getStreamState() != _STREAM_STATE_EOF) {
+ cout << "******* plugin->getStreamState() continue"<<endl;
+ TimeWrapper::sleep(3);
+ continue;
+ }
+ break;
+ }
+ cout << "********************plugin eof"<<endl;
+ plugin->close();
+
+ delete plugin;
+ delete in;
+ delete out;
+ return(0);
+}
+