Debian Codegraph @

samples/qtvidcap/vidconf.cpp

raw
1 #include "vidconf.h"
2 #include "vidconf.moc"
3
4 #include "v4lwindow.h"
5 #include "capproc.h"
6 #include "codecdialog.h"
7
8 #include <avm_fourcc.h>
9 #include <utils.h>
10 #include <avm_cpuinfo.h>
11 #include <avm_creators.h>
12 #define DECLARE_REGISTRY_SHORTCUT
13 #include <configfile.h>
14 #undef DECLARE_REGISTRY_SHORTCUT
15
16 #include <qcheckbox.h>
17 #include <qcombobox.h>
18 #include <qfiledialog.h>
19 #include <qhgroupbox.h>
20 #include <qlabel.h>
21 #include <qlayout.h>
22 #include <qlineedit.h>
23 #include <qlistview.h>
24 #include <qmessagebox.h>
25 #include <qpushbutton.h>
26 #include <qradiobutton.h>
27 #include <qspinbox.h>
28 #include <qtabwidget.h>
29 #include <qvbuttongroup.h>
30 #include <qvgroupbox.h>
31
32 #include <stdio.h>
33 #include <stdlib.h> // atof
34
35 #include "v4lxif.h"
36
37 static const struct restab {
38 int id;
39 int w,h;
40 const char* lname;
41 const char* sname;
42 } cv_dimensions[] = {
43 { 0, 160, 120, "160 x 120 (1/4 NTSC)", "160 x 120" },
44 { 1, 192, 144, "192 x 144 (1/4 PAL)" , "192 x 144" },
45 { 2, 320, 240, "320 x 240 (1/2 NTSC)", "320 x 240" },
46 { 3, 384, 288, "384 x 288 (1/2 PAL)" , "384 x 288" },
47 { 4, 400, 300, "400 x 300 (default)" , "400 x 300" },
48 { 5, 512, 384, "512 x 384 (3/4 NTSC)", "512 x 384" },
49 { 6, 576, 432, "576 x 432 (3/4 PAL)" , "576 x 432" },
50 { 7, 640, 480, "640 x 480 (NTSC)" , "640 x 480" },
51 { 8, 768, 576, "768 x 576 (PAL)" , "768 x 576" },
52 { -1, 0, 5, NULL }, /* do not channge anything below */
53 { -1, 0, 5, NULL },
54 { -1, 0, 5, NULL },
55 };
56
57
58 /*
59 * Constructs a VidConfig which is a child of 'parent', with the
60 * name 'name' and widget flags set to 'f'
61 *
62 * The dialog will by default be modeless, unless you set 'modal' to
63 * TRUE to construct a modal dialog.
64 */
65 VidConfig::VidConfig( QWidget* parent, v4lxif* v4l, V4LWindow* w)
66 : VidcapConfigDialog( parent, "Configure QtVidcap", true, 0 ), m_pV4lWin(w)
67 {
68 _savename="";
69 _regnumber=-1;
70
71 _CapDevice->setText( RS("CaptureDevice", "/dev/video") );
72 _AudDevice->setText( RS("AudioDevice", "/dev/dsp") );
73 //ask hw
74 //fixme
75 for (int i = 0; cv_dimensions[i].id >= 0; i++)
76 _Resolution->insertItem(cv_dimensions[i].lname);
77
78 _Resolution->setCurrentItem( RI("Resolution", 0) );
79 _VideoColorMode->setCurrentItem( RI("ColorMode", 0) );
80
81 _VideoChannel->clear();
82 if (v4l)
83 for(int j = 0; j < v4l->capCapChannelC(); j++)
84 _VideoChannel->insertItem(v4l->capChannelName(j));
85 _VideoChannel->setCurrentItem( RI("Channel", 1) );
86 _Colorspace->setCurrentItem( RI("Colorspace", 0) );
87 _FileName->setText( RS("FileName", "./movie.avi") );
88
89 cb_never_overwrite->setChecked(RI("NeverOverwriteFiles",0));
90
91 QString regname = QString().sprintf("DirPool-%02d-Path", 0);
92 QString pathname=RS(regname,"NONE");
93 for (int i = 0; pathname!="NONE";)
94 {
95 regname=QString().sprintf("DirPool-%02d-KeepFree",i);
96 int keepfree=RI(regname,500);
97
98 regname=QString().sprintf("DirPool-%02d-Active",i);
99 int ison=RI(regname,1);
100
101 DirPoolItem *new_item=new DirPoolItem(lv_dirpool,pathname,keepfree);
102 new_item->setOn(ison);
103 new_item->updateSpaceLeft();
104
105 i++;
106 regname=QString().sprintf("DirPool-%02d-Path",i);
107 pathname=RS(regname,"NONE");
108 }
109
110 _SegmentSize->setText( QString().sprintf("%d", RI("SegmentSize", 1000*1000)) );
111 _HaveSegmented->setChecked( RI("IsSegmented", 1) );
112 _HaveAudio->setChecked( RI("HaveAudio", 1) );
113 _listChan->setCurrentItem( RI("SndChannels", 0) );
114 _listFreq->setCurrentItem( RI("Frequency", 0) );
115 _listSamp->setCurrentItem( RI("SampleSize", 0) );
116
117 _info.compressor = RI("Compressor", fccDIV3);
118 _info.cname = RS("Codec", "select");
119 _info.quality = RI("Quality", 9500);
120 _info.keyfreq = RI("Keyframe", 250);
121
122 named_codecs_cb->setEditable(false);
123 {
124 int i=0;
125
126 QString regname=QString().sprintf("NamedCodecs-%02d-Savename",i);
127 QString nc_savename=RS(regname,"NONE");
128
129 while(nc_savename!="NONE"){
130 //named_codecs_cb->insertItem(nc_savename);
131
132 i++;
133
134 regname=QString().sprintf("NamedCodecs-%02d-Savename",i);
135 nc_savename=RS(regname,"NONE");
136 }
137
138 QString named_codecs_current=RS("NamedCodecsCurrent","");
139
140 if(named_codecs_current==""){
141 _savename="";
142 _regnumber=-1;
143 }
144 else{
145 for(int j=0;j<named_codecs_cb->count();j++){
146 if(named_codecs_cb->text(j)==named_codecs_current){
147 named_codecs_cb->setCurrentItem(j);
148 _regnumber=j-1;
149 _savename=named_codecs_current;
150 }
151 }
152 printf("regnumber=%d, named_codecs_current=%s\n",_regnumber,named_codecs_current.latin1());
153 }
154 }
155
156 updateCodecName();
157
158 _chkTime->setChecked( RI("LimitTime", 0) );
159 _chkFileSize->setChecked( RI("LimitSize", 0) );
160 _sizeLimit->setText( QString().sprintf("%d", RI("SizeLimit", 2000000)) );
161 _timeLimit->setText( QString().sprintf("%d", RI("TimeLimit", 3600)) );
162 _fps->setEditText( QString().sprintf("%2.3f", RI("FPS", 25000) / 1000.0) );
163
164 int shutdown_mode = RI("ShutdownMode",0);
165 //cb_allow_shutdown->setChecked(RI("ShutdownAllow",0));
166
167 switch (shutdown_mode)
168 {
169 case 0:
170 rb_shutdown_never->setChecked(true);
171 break;
172 case 1:
173 rb_shutdown_last->setChecked(true);
174 break;
175 case 2:
176 rb_shutdown_inbetween->setChecked(true);
177 break;
178 default:
179 printf("ShutdownMode invalid value\n");
180 rb_shutdown_never->setChecked(true);
181 break;
182 }
183
184 sb_min_timespan->setValue( RI("ShutdownMinTimespan",20) );
185 sb_reboot_timespan->setValue( RI("ShutdownRebootTimespan",5) );
186 sb_shutdown_grace->setValue( RI("ShutdownGraceTime",5) );
187
188 cb_log->setChecked( RI("LogToFile",0) );
189
190 if (RI("Password-Locked",0))
191 bt_password_lock->setText(tr("press to unlock"));
192 else
193 bt_password_lock->setText(tr("press to lock"));
194
195 connect(bt_password_set,SIGNAL(pressed()),this,SLOT(set_password()));
196 connect(bt_password_lock,SIGNAL(pressed()),this,SLOT(lock_password()));
197
198 connect(named_codecs_cb,SIGNAL(activated(int)),this,SLOT(changed_named_codec(int)));
199 }
200
201 /*
202 * Destroys the object and frees any allocated resources
203 */
204 VidConfig::~VidConfig()
205 {
206 // no need to delete child widgets, Qt does it all for us
207 }
208
209
210 void VidConfig::accept()
211 {
212 savePage(0);
213 savePage(1);
214 savePage(2);
215 savePage(3);
216 savePage(4);
217 savePage(5);
218
219 // save only when OK, not APPLY
220 avm::RegSave();
221
222 if (m_pV4lWin) m_pV4lWin->setupDevice();
223 QDialog::accept();
224 }
225
226 void VidConfig::apply()
227 {
228 #if QT_VERSION>=219
229 savePage(tabWidget->currentPageIndex());
230 #else
231 savePage(0);
232 savePage(1);
233 savePage(2);
234 savePage(3);
235 savePage(4);
236 savePage(5);
237 #endif
238 if (m_pV4lWin) m_pV4lWin->setupDevice();
239 }
240
241 void VidConfig::savePage(int page)
242 {
243 switch(page)
244 {
245 case 0:
246 WS("CaptureDevice", _CapDevice->text());
247 WS("AudioDevice", _AudDevice->text());
248 WI("Resolution", _Resolution->currentItem());
249 WI("Channel", _VideoChannel->currentItem());
250 WI("ColorMode", _VideoColorMode->currentItem());
251 WI("Colorspace", _Colorspace->currentItem());
252 break;
253 case 1:
254 WS("FileName", _FileName->text());
255 WI("NeverOverwriteFiles",cb_never_overwrite->isChecked());
256 WI("SegmentSize", _SegmentSize->text());
257 WI("IsSegmented", _HaveSegmented->isChecked());
258 WI("FPS", int(atof(_fps->currentText()) * 1000));
259
260 {
261 DirPoolItem *item=(DirPoolItem *)lv_dirpool->firstChild();
262 int i=0;
263
264 QString regname;
265 while(item!=NULL){
266 regname=QString().sprintf("DirPool-%02d-Path",i);
267 WS(regname,item->getPath());
268
269 regname=QString().sprintf("DirPool-%02d-KeepFree",i);
270 WI(regname,item->getKeepFree());
271
272 regname=QString().sprintf("DirPool-%02d-Active",i);
273 WI(regname,item->isOn());
274
275 i++;
276 item=(DirPoolItem *)item->nextSibling();
277 }
278
279 regname=QString().sprintf("DirPool-%02d-Path",i);
280 WS(regname,"NONE");
281 }
282
283 break;
284 case 2:
285 WI("Compressor", _info.compressor);
286 WS("Codec", _info.cname.c_str());
287 WI("Quality", _info.quality);
288 WI("Keyframe", _info.keyfreq);
289 WI("HaveAudio", _HaveAudio->isChecked());
290 WI("SampleSize", _listSamp->currentItem());
291 WI("Frequency", _listFreq->currentItem());
292 WI("SndChannels", _listChan->currentItem());
293 {
294 WS("NamedCodecsCurrent",_savename.c_str());
295 //WS("NamedCodecsCurrent-Compressor",_
296
297 }
298 break;
299 case 3:
300 WI("TimeLimit", _timeLimit->text());
301 WI("SizeLimit", _sizeLimit->text());
302 WI("LimitTime", _chkTime->isChecked());
303 WI("LimitSize", _chkFileSize->isChecked());
304 break;
305 case 4:
306 {
307 int shutdown_mode=rb_buttons->id(rb_buttons->selected());
308 printf("shutdown_mode =%d\n",shutdown_mode);
309
310 WI("ShutdownMode",shutdown_mode);
311 WI("ShutdownMinTimespan",sb_min_timespan->value());
312 WI("ShutdownRebootTimespan",sb_reboot_timespan->value());
313 WI("ShutdownGraceTime",sb_shutdown_grace->value());
314 }
315 break;
316 case 5:
317 WI("LogToFile",cb_log->isChecked());
318 break;
319 }
320
321 }
322 /*
323 * public slot
324 */
325 void VidConfig::change_filename()
326 {
327 QString str = QFileDialog::getOpenFileName( _FileName->text(),
328 tr( "*.avi;*.AVI" ),
329 0, 0
330 #if QT_VERSION > 220
331 , tr( "Select destination file" )
332 #endif
333 );
334 if (!str.isNull())
335 _FileName->setText(str);
336 }
337 /*
338 * public slot
339 */
340 void VidConfig::change_codec()
341 {
342 int bpp;
343 int w = 768;
344 int h = 576;
345
346 switch(_Colorspace->currentItem())
347 {
348 case cspYV12:
349 bpp = fccYV12;
350 break;
351 case cspYUY2:
352 bpp = fccYUY2;
353 break;
354 case cspI420:
355 bpp = fccI420;
356 break;
357 case cspRGB15:
358 bpp = 15;
359 break;
360 case cspRGB24:
361 bpp = 24;
362 break;
363 case cspRGB32:
364 bpp = 32;
365 break;
366 default:
367 bpp = 0;
368 }
369
370 int i = _Resolution->currentItem();
371 if (i >= 0 && i < 9)
372 {
373 w = cv_dimensions[i++].w;
374 h = cv_dimensions[i++].h;
375 }
376
377
378 QString savename=named_codecs_cb->currentText();
379 int cin=named_codecs_cb->currentItem();
380 printf("current item nr is %d\n",cin);
381 // if(named_codecs_cb->text(cin)!=savename){
382 //printf("new???\n");
383 int regnumber=-1;
384 if(cin>0){
385
386 regnumber=0;
387 {
388
389 QString regname=QString().sprintf("NamedCodecs-%02d-Savename",regnumber);
390 QString nc_savename=RS(regname,"NONE");
391
392 while(!(savename==nc_savename || nc_savename=="NONE")){
393 regnumber++;
394
395 regname=QString().sprintf("NamedCodecs-%02d-Savename",regnumber);
396 nc_savename=RS(regname,"NONE");
397
398 }
399
400
401
402
403 if(nc_savename=="NONE"){
404 WS(regname,savename);
405
406 //WS("NamedCodecsCurrent",savename);
407 named_codecs_cb->insertItem(savename);
408 int newcount=named_codecs_cb->count();
409 named_codecs_cb->setCurrentItem(newcount-1);
410 }
411 }
412 }
413 avm::string mycname;
414 if(savename=="-Default-"){
415 _savename="";
416 mycname=_info.cname;
417 }
418 else{
419 _savename=savename;
420 mycname=RS(QString().sprintf("NamedCodecs-%02d-Codec",regnumber),"select");
421 }
422
423 printf("vidconfig: regnum=%d savename=%s mycname=%s\n",regnumber,_savename.c_str(),mycname.c_str());
424
425 BITMAPINFOHEADER bih;
426 bih.biCompression = 0xffffffff;
427 // just to fill video_codecs list
428 avm::CreateDecoderVideo(bih, 0, 0);
429
430 // Select those codecs which accepts give format
431 avm::BitmapInfo bi(w, h, bpp);
432 avm::vector<const avm::CodecInfo*> codecs;
433 avm::vector<avm::CodecInfo>::const_iterator it;
434 int sel = 0;
435 i = 0;
436 for (it = video_codecs.begin(); it != video_codecs.end(); it++)
437 {
438 //printf("CHECKING %s %x\n", it->GetName(), bpp);
439 if (!(it->direction & avm::CodecInfo::Encode))
440 continue;
441 avm::IVideoEncoder* enc = avm::CreateEncoderVideo(*it, bi);
442 if (!enc)
443 continue;
444 // checking if this code is the one we have asked for...
445 bool ok = (strcmp(it->GetName(), enc->GetCodecInfo().GetName()) == 0);
446 //printf("OK CHEK %d %s %s\n", ok, it->GetName(), enc->GetCodecInfo().GetName());
447 avm::FreeEncoderVideo(enc);
448 if (!ok)
449 continue;
450 codecs.push_back(it);
451 if (mycname == it->GetName())
452 sel = i;
453 i++;
454 }
455
456 // ListCodecs(codecs);
457
458 //printf("SEL %d\n", sel);
459 QavmCodecDialog conf(this, codecs);
460 conf.setCurrent(sel);
461
462 int gx = RI("CodecGeometryX", conf.x());
463 int gy = RI("CodecGeometryY", conf.y());
464 int gw = RI("CodecGeometryWidth", conf.width());
465 int gh = RI("CodecGeometryHeight", conf.height());
466 int gm = RI("CodecGeometryMaximized", 0);
467
468 conf.resize( gw, gh );
469 conf.move( gx, gy);
470 if (gm)
471 conf.showMaximized();
472
473 if (conf.exec() == QDialog::Accepted)
474 {
475 WI("CodecGeometryX", conf.x());
476 WI("CodecGeometryY", conf.y());
477 WI("CodecGeometryWidth", conf.width());
478 WI("CodecGeometryHeight", conf.height());
479 #if QT_VERSION > 220
480 WI("CodecGeometryMaximized", conf.isMaximized());
481 #endif
482
483 if(regnumber>=0){
484 _named_info=conf.getInfo();
485
486
487 QString regname=QString().sprintf("NamedCodecs-%02d-Compressor",regnumber);
488 WI(regname,_named_info.compressor);
489
490 regname=QString().sprintf("NamedCodecs-%02d-Codec",regnumber);
491 WS(regname,_named_info.cname.c_str());
492
493 regname=QString().sprintf("NamedCodecs-%02d-Quality",regnumber);
494 WI(regname,_named_info.quality);
495
496 regname=QString().sprintf("NamedCodecs-%02d-Keyframe",regnumber);
497 WI(regname,_named_info.keyfreq);
498
499 _regnumber=regnumber;
500 printf("setting named compressor regnumber=%d to %s\n",regnumber,_named_info.cname.c_str());
501 // _savename=
502 }
503 else{
504 _info = conf.getInfo();
505 printf("normal\n");
506 //_savename="";
507 }
508 updateCodecName();
509
510 }
511 }
512
513 void VidConfig::updateCodecName()
514 {
515 char ft[4];
516 char str[256];
517
518 printf("_savename=%s\n",_savename.c_str());
519 if(_savename==""){
520 sprintf(str, "%s: %.4s", _info.cname.c_str(),
521 avm_set_le32(ft, _info.compressor));
522 }
523 else{
524
525 int regnumber=0;
526 QString regname=QString().sprintf("NamedCodecs-%02d-Savename",regnumber);
527 QString nc_savename=RS(regname,"NONE");
528
529 while(!(QString(_savename.c_str())==nc_savename || nc_savename=="NONE")){
530 regnumber++;
531
532 regname=QString().sprintf("NamedCodecs-%02d-Savename",regnumber);
533 nc_savename=RS(regname,"NONE");
534 }
535
536 if(nc_savename=="NONE"){
537 sprintf(str,"error - unknown");
538 }
539 else{
540 printf("found regnumber: %d\n",regnumber);
541 avm::string cname=RS(QString().sprintf("NamedCodecs-%02d-Codec",regnumber),"select");
542 int compressor=RI(QString().sprintf("NamedCodecs-%02d-Compressor",regnumber),fccDIV3);
543 sprintf(str, "%s: %.4s", cname.c_str(),
544 avm_set_le32(ft, compressor));
545 }
546
547 }
548 _codecName->setText(str);
549 }
550 /*
551 * public slot
552 */
553 void VidConfig::toggle_audio(bool res)
554 {
555 _listSamp->setEnabled(res);
556 _listFreq->setEnabled(res);
557 _listChan->setEnabled(res);
558 }
559 /*
560 * public slot
561 */
562 void VidConfig::toggle_segmented(bool res)
563 {
564 _SegmentSize->setEnabled(res);
565 }
566
567 void VidConfig::toggle_limitsize(bool res)
568 {
569 _sizeLimit->setEnabled(res);
570 }
571
572 void VidConfig::toggle_limittime(bool res)
573 {
574 _timeLimit->setEnabled(res);
575 }
576
577 void VidConfig::dirpool_add(){
578 QString path=le_dirpool_name->text();
579 int keepfree=qs_dirpool_minfree->value();
580
581 if(path[0]=='/'){
582 DirPoolItem *new_item=new DirPoolItem(lv_dirpool,path,keepfree);
583 int df=new_item->updateSpaceLeft();
584 }
585 else{
586 printf("only absolute paths");
587 }
588 }
589
590
591 void VidConfig::dirpool_rem(){
592 DirPoolItem *item=(DirPoolItem *)lv_dirpool->selectedItem();
593
594 if(item){
595 lv_dirpool->takeItem(item);
596 delete item;
597 }
598 }
599
600 void VidConfig::lock_password(){
601 QString password = RS("Password-Password","NONE");
602 if (password == "NONE")
603 return;
604
605 int locked = RI("Password-Locked",0);
606 if (locked)
607 {
608 //unlock now
609
610 QMessageBox *pwd_dia=new QMessageBox(0);
611 QVBoxLayout *lay=new QVBoxLayout(pwd_dia);
612 lay->setAutoAdd(true);
613
614 QVGroupBox *pwd_win=new QVGroupBox("Get Password",pwd_dia);
615 QLineEdit *pwd_edit1=new QLineEdit(pwd_win);
616 pwd_edit1->setEchoMode(QLineEdit::Password);
617
618 pwd_dia->show();
619 int res=pwd_dia->exec();
620
621 if(pwd_edit1->text()==RS("Password-Password","NONE")){
622 //now unlock
623 WI("Password-Locked",0);
624 bt_password_lock->setText("press to lock");
625 }
626
627 delete pwd_edit1;
628 delete pwd_win;
629 delete pwd_dia;
630 }
631 else
632 {
633 //now lock
634 WI("Password-Locked",1);
635 bt_password_lock->setText("press to unlock");
636 }
637
638 m_pV4lWin->lock(RI("Password-Locked",0));
639
640 bt_password_lock->setOn(false);
641 bt_password_lock->setDown(false);
642 }
643
644
645 void VidConfig::set_password()
646 {
647 QMessageBox *pwd_dia=new QMessageBox(0);
648 QVBoxLayout *lay=new QVBoxLayout(pwd_dia);
649 lay->setAutoAdd(true);
650
651 QVGroupBox *pwd_win=new QVGroupBox("Set Password",pwd_dia);
652 // pwd_dia->setExtension(pwd_win);
653 //lay->addWidget(pwd_dia);
654
655 QLineEdit *pwd_edit1=new QLineEdit(pwd_win);
656 QLineEdit *pwd_edit2=new QLineEdit(pwd_win);
657 pwd_edit1->setEchoMode(QLineEdit::Password);
658 pwd_edit2->setEchoMode(QLineEdit::Password);
659
660 do{
661 pwd_dia->show();
662 int res=pwd_dia->exec();
663 }while(pwd_edit1->text()!=pwd_edit2->text());
664
665 WS("Password-Password",pwd_edit1->text());
666
667 delete pwd_edit1;
668 delete pwd_edit2;
669 delete pwd_win;
670 delete pwd_dia;
671
672 bt_password_set->setOn(false);
673 bt_password_set->setDown(false);
674 }
675
676 void VidConfig::changed_named_codec(int nr){
677 _savename=named_codecs_cb->text(nr);
678 if(_savename=="-Default-"){
679 _savename="";
680 }
681 else{
682 _savename=QString(_savename.c_str());
683 }
684 _regnumber=nr-1;
685
686 updateCodecName();
687
688
689 // printf("changed codec to %s\n",global_savename.c_str());
690 }
691
692
693 void VidConfig::ListCodecs(avm::vector<avm::CodecInfo>& codec_list)
694 {
695 avm::vector<avm::CodecInfo>::iterator it;
696 int i=0;
697 int sel=0;
698
699 for (it = codec_list.begin(); it != codec_list.end(); it++)
700 {
701 if ( it->kind == avm::CodecInfo::DShow_Dec)
702 continue; //probably not a usable codec..
703
704 if(!(it->direction & avm::CodecInfo::Encode))
705 continue;
706
707 printf("%s\n", it->GetName());
708
709 avm::vector<avm::AttributeInfo> encinfo = it->encoder_info;
710 avm::vector<avm::AttributeInfo>::const_iterator inf_it;
711
712 for(inf_it = encinfo.begin(); inf_it != encinfo.end(); inf_it++)
713 {
714 switch(inf_it->kind)
715 {
716 case avm::AttributeInfo::Integer:
717 {
718 int defval=0;
719 if (avm::CodecGetAttr(*it, inf_it->GetName(), &defval) == 0)
720 printf(" %s=%d\n", inf_it->GetName(), defval);
721 else
722 printf(" %s=(no default)\n", inf_it->GetName());
723
724 //avm::RegWriteInt("trala-"+_savename,inf_it->GetName(),defval);
725 }
726 break;
727 case avm::AttributeInfo::Select:
728 {
729 int defval;
730 avm::vector<avm::string>::const_iterator sit;
731 avm::CodecGetAttr(*it, inf_it->GetName(), &defval);
732 printf(" %s = ", inf_it->GetName());
733 printf(" %s ", (defval < (int)inf_it->options.size()) ?
734 inf_it->options[defval].c_str() : "unknown");
735
736 printf(" (");
737 for (sit = (inf_it->options).begin(); sit != (inf_it->options).end(); sit++)
738 printf("%s ", sit->c_str());
739
740 printf(")\n");
741 }
742 break;
743 case avm::AttributeInfo::String:
744 {
745 const char* def_str;
746 avm::CodecGetAttr(*it, it->GetName(), &def_str);
747 printf(" %s = '%s'\n", inf_it->GetName(), def_str);
748 }
749 break;
750 }
751 }
752
753 i++;
754 }
755 }