summaryrefslogtreecommitdiffstats
path: root/mpeglib/example/yaf/yafmpgplay
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/yaf/yafmpgplay
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/yaf/yafmpgplay')
-rw-r--r--mpeglib/example/yaf/yafmpgplay/Makefile.am34
-rw-r--r--mpeglib/example/yaf/yafmpgplay/mpg_control.cpp197
-rw-r--r--mpeglib/example/yaf/yafmpgplay/stresstest24
3 files changed, 255 insertions, 0 deletions
diff --git a/mpeglib/example/yaf/yafmpgplay/Makefile.am b/mpeglib/example/yaf/yafmpgplay/Makefile.am
new file mode 100644
index 00000000..c9fd9b55
--- /dev/null
+++ b/mpeglib/example/yaf/yafmpgplay/Makefile.am
@@ -0,0 +1,34 @@
+# mpegplay-yaf - Makefile.am
+
+INCLUDES = -I../../include $(all_includes)
+
+EXTRA_DIST = stresstest
+
+bin_PROGRAMS = yaf-mpgplay
+
+yaf_mpgplay_SOURCES = mpg_control.cpp
+
+noinst_HEADERS =
+
+
+yaf_mpgplay_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+
+
+yaf_mpgplay_LDADD = ../yafcore/libyafcore.la \
+ ../yafxplayer/libyafxplayer.la \
+ ../../../lib/libmpeg.la \
+ $(THIS_LIB_LIBS)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mpeglib/example/yaf/yafmpgplay/mpg_control.cpp b/mpeglib/example/yaf/yafmpgplay/mpg_control.cpp
new file mode 100644
index 00000000..ee080a73
--- /dev/null
+++ b/mpeglib/example/yaf/yafmpgplay/mpg_control.cpp
@@ -0,0 +1,197 @@
+/*
+ generic interactive controller
+ Copyright (C) 1998 Martin Vogt
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation.
+
+ For more information look at the file COPYRIGHT in this package
+
+ */
+
+
+
+
+// Set for local include
+#define DIRECT_INCLUDE
+
+#include "../yafcore/yaf_control.h"
+#include "../yafxplayer/inputDecoderYAF.h"
+
+
+
+
+#include <iostream>
+using namespace std;
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#if defined(HAVE_GETOPT_H)
+#include <getopt.h>
+#endif
+
+// we include our plugin here
+#include "../../../lib/decoder/mpgPlugin.h"
+
+#if defined(HAVE_GETOPT_H)
+#include <getopt.h>
+#endif
+
+
+
+
+
+void control_mpgplay(InputInterface* input,OutputInterface* output,
+ InputDecoder* decoder) {
+
+
+ cout<< "Command:0 Msg:protocol yaf-0.1" << endl;
+ cout<< "Command:0 Msg:implements xplayer" << endl;
+ cout<< "Command:0 Msg:decoder splay Version:0.8.2" << endl;
+ cout<< "Command:0 Msg:decoder mpeg_play Version:2.4.0" << endl;
+ cout<< "Command:0 Msg:mimetypes video/mpeg;" << endl;
+ cout<< "Command:0 Msg:comment splay by Woo-jae Jung" << endl;
+ cout<< "Command:0 Msg:comment mpeg_play by University of California" << endl;
+ cout<< "Command:0 Msg:comment yaf port by mvogt@rhrk.uni-kl.de"<<endl;
+ cout<< "Command:0 Msg:comment based on sources from mpeg_play and splay"<<endl;
+ cout<< "Command:0 Msg:comment enter 'help' " << endl;
+
+
+
+
+
+ yaf_control(input,output,decoder);
+}
+
+
+void usage() {
+ cout << "yaf-mpgplay is a interactive frontend for the mpeg I decoder"<<endl;
+ cout << "Usage : yaf-mpgplay [2al:L:scb:mhpywd:] [url]"<<endl;
+ cout << endl;
+ cout << "-2 : playing with half frequency."<<endl;
+ cout << "-m : force to mono."<<endl;
+ cout << "-a : no internal audio device"<<endl;
+ cout << "-c : no time calculation"<<endl;
+ cout << "-s : no audio/video sync"<<endl;
+ cout << "-b : audio buffer delay (bytes)[65535 byte]"<<endl;
+ cout << "-p : measure performance (audio is decoded, but not played)"<<endl;
+ cout << "-l : select audio Layer [0]"<<endl;
+ cout << "-L : select video Layer [0]"<<endl;
+ cout << "-w : write streams to disk [demultiplex]"<<endl;
+ cout << "-y : autoplay off"<<endl;
+ cout << "-d : [1..2] dump yuv images 1: single images 2: as stream"<<endl;
+ cout << endl;
+ cout << "THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! " \
+ << "USE AT YOUR OWN RISK!"<<endl;
+ cout << endl;
+ cout << "for more help type 'help' in interactive mode"<<endl;
+}
+
+
+
+
+int main(int argc, char** argv) {
+ int c;
+ int lInternalAudio=true;
+
+ pow(6.0,3.0); // fixes bug in __math.h
+ InputInterface input;
+ OutputInterface output(&cout);
+
+
+
+
+
+ YafOutputStream* yafOutput=new YafOutputStream(&input);
+ MpgPlugin* plugin=new MpgPlugin();
+
+ plugin->setOutputPlugin(yafOutput);
+ InputDecoderYAF decoder(plugin,yafOutput);
+
+
+
+ while(1) {
+ c = getopt (argc, argv, "2al:L:scb:mhpywd:");
+ if (c == -1) break;
+ switch(c) {
+ case 'a': {
+ lInternalAudio=false;
+ break;
+ }
+ case 'h': {
+ usage();
+ exit(0);
+ }
+ case 'y': {
+ decoder.setAutoPlay(false);
+ break;
+ }
+ case '2': {
+ plugin->config("-2","true",NULL);
+ break;
+ }
+ case 'm': {
+ plugin->config("-m","true",NULL);
+ break;
+ }
+ case 'c': {
+ plugin->config("-c","true",NULL);
+ break;
+ }
+ case 'w': {
+ plugin->config("-w","true",NULL);
+ break;
+ }
+ case 's': {
+ yafOutput->config("-s","true",NULL);
+ break;
+ }
+ case 'b': {
+ yafOutput->config("-b",optarg,NULL);
+ break;
+ }
+ case 'd': {
+ yafOutput->config("yufDump",optarg,NULL);
+ break;
+ }
+ case 'p': {
+ yafOutput->config("-p",optarg,NULL);
+ break;
+ }
+ case 'l': {
+ plugin->config("AudioLayer",optarg,NULL);
+ cout << "trying to configure" << endl;
+ break;
+ }
+ case 'L': {
+ plugin->config("VideoLayer",optarg,NULL);
+ break;
+ }
+
+
+ default:
+ printf ("?? getopt returned character code 0%o ??\n", c);
+ usage();
+ exit(-1);
+ }
+ }
+
+ if (optind < argc ) {
+ Buffer buffer(300);
+ buffer.append("open ");
+ buffer.append(argv[optind]);
+ buffer.append("\n");
+ input.addInputLine(&buffer);
+
+ }
+ yafOutput->internalDevice(lInternalAudio);
+ control_mpgplay(&input,&output,&decoder);
+ delete plugin;
+ delete yafOutput;
+
+}
+
+
diff --git a/mpeglib/example/yaf/yafmpgplay/stresstest b/mpeglib/example/yaf/yafmpgplay/stresstest
new file mode 100644
index 00000000..1d73ad92
--- /dev/null
+++ b/mpeglib/example/yaf/yafmpgplay/stresstest
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+declare -i zahl=100
+declare -i zahl1=3
+rm -f jumptable
+echo "sleep 5" >>jumptable
+
+while [ 0 -le $zahl ] ; do
+ echo "j $zahl" >>jumptable
+ echo "sleep 0" >>jumptable
+ echo "j $zahl1" >>jumptable
+ echo "sleep 0" >>jumptable
+
+ zahl=$[zahl-7]
+ zahl1=$[zahl1+7]
+done
+echo "sleep 20" >>jumptable
+echo "quit" >>jumptable
+
+for i in "/mnt/diskD/mpeg"/* ; do
+ echo "open $i" >yaf.script
+ ./yaf-mpgplay <jumptable
+ sleep 5
+done