2
generic interactive controler
3
Copyright (C) 1998 Martin Vogt
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU Library General Public License as published by
7
the Free Software Foundation.
9
For more information look at the file COPYRIGHT in this package
15
// Set for local include
16
#define DIRECT_INCLUDE
18
#include "../yafcore/yaf_control.h"
19
#include "../yafxplayer/inputDecoderYAF.h"
26
// we include our plugin here
27
#include "../../../lib/yuv/yuvPlugin.h"
29
#if defined(HAVE_GETOPT_H)
34
void control_yuv(InputInterface* input,OutputInterface* output,
35
InputDecoder* decoder) {
38
cout<< "Command:0 Msg:protocol yaf-0.1" << endl;
39
cout<< "Command:0 Msg:implements xplayer" << endl;
40
cout<< "Command:0 Msg:decoder yuv Version:0.0.2" << endl;
41
cout<< "Command:0 Msg:mimetypes vide/yuv1;" << endl;
42
cout<< "Command:0 Msg:comment yuv Plugin by Martin Vogt" << endl;
43
cout<< "Command:0 Msg:comment yaf port by mvogt@rhrk.uni-kl.de"<<endl;
44
cout<< "Command:0 Msg:comment enter 'help' " << endl;
48
yaf_control(input,output,decoder);
53
cout << "yaf-yuv is a interactive frontend for the still image decoder"
55
cout << "Usage : yaf-yuv [w:g:y:f:hr:] <file.raw> [url]"<<endl;
57
cout << "-w : width of raw yuv stream in pixel"<<endl;
58
cout << "-g : heigth of raw yuv stream in pixel"<<endl;
59
cout << "-h : help"<<endl;
60
cout << "-y : set image Format:"<<endl;
61
cout << " 1 : yuv lum/Cr/Cb"<<endl;
62
cout << " 2 : yuv lum/Cb/Cr"<<endl;
63
cout << " 3 : rgb 24 BIT"<<endl;
64
cout << " 4 : rgb 24 BIT (flipped)"<<endl;
66
cout << "-f : [1..n] frames per second"<<endl;
69
cout << "THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! " \
70
<< "USE AT YOUR OWN RISK!"<<endl;
72
cout << "for more help type 'help' in interactive mode"<<endl;
76
int readFormat(int* w,int* h,char* filename) {
77
char formatFileName[100];
79
snprintf(formatFileName,100,"%s.format",filename);
80
cout << "open:"<<formatFileName<<endl;
81
file=fopen(formatFileName,"r");
83
cout << "no format file found"<<endl;
87
if (fscanf(file,"Version 0.1\nw:%dh:%d\n",w,h)==2) {
88
cout << "read ! w:"<<*w<<"h:"<<*h<<endl;
93
cout << "format file mismatch"<<endl;
98
int main(int argc, char** argv) {
100
int lInternalAudio=true;
105
pow(6.0,3.0); // fixes bug in __math.h
110
InputInterface* input=new InputInterface();
112
OutputInterface output(&cout);
114
YafOutputStream* yafOutput=new YafOutputStream(input);
116
YUVPlugin* plugin=new YUVPlugin();
118
plugin->setOutputPlugin(yafOutput);
119
InputDecoderYAF decoder(plugin,yafOutput);
124
c = getopt (argc, argv, "w:g:y:hf:");
128
lInternalAudio=false;
132
cout << "query for help"<<endl;
138
printf("setting width:%s\n",width);
144
cout << "wrong fps. must be > 0"<<endl;
151
printf("setting height:%s\n",height);
155
cout << "config:imageType:"<<optarg<<endl;
156
plugin->config("imageType",optarg,NULL);
161
printf ("?? getopt returned character code 0%o ??\n", c);
166
if (optind < argc ) {
168
buffer.append("open ");
169
buffer.append(argv[optind]);
172
input->addInputLine(&buffer);
175
if ((width == NULL) || (height == NULL)) {
178
cout << "automatic try to read a .format file"<<endl;
179
if (readFormat(&w,&h,argv[optind]) == false) {
180
cout << "no format specified"<<endl;
185
snprintf(width,20,"%d",w);
186
snprintf(height,20,"%d",h);
189
char* picPerSec=new char[20];
190
snprintf(picPerSec,20,"%d",fps);
193
plugin->config("picPerSec",picPerSec,NULL);
194
plugin->config("height",height,NULL);
195
plugin->config("width",width,NULL);
198
yafOutput->internalDevice(lInternalAudio);
199
control_yuv(input,&output,&decoder);