~ubuntu-branches/ubuntu/hardy/avidemux/hardy

« back to all changes in this revision

Viewing changes to avidemux/ADM_userInterfaces/ADM_QT4/ADM_filters/Q_mainfilter.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Matvey Kozhev
  • Date: 2007-12-18 13:53:04 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20071218135304-cdqec2lg2bglyz15
Tags: 1:2.4~preview3-0.0ubuntu1
* Upload to Ubuntu. (LP: #163287, LP: #126572)
* debian/changelog: re-added Ubuntu releases.
* debian/control:
  - Require debhelper >= 5.0.51 (for dh_icons) and imagemagick.
  - Build-depend on libsdl1.2-dev instead of libsdl-dev.
  - Build against newer libx264-dev. (LP: #138854)
  - Removed libamrnb-dev, not in Ubuntu yet.
* debian/rules:
  - Install all icon sizes, using convert (upstream installs none).
  - Added missing calls to dh_installmenu, dh_installman, dh_icons and
    dh_desktop.
* debian/menu, debian/avidemux-qt.menu:
  - Corrected package and executable names.
* debian/avidemux-common.install: Install icons.
* debian/avidemux.common.manpages: Install man/avidemux.1.
* debian/links, debian/avidemux-cli.links, debian/avidemux-gtk.links:
  - Link manpages to avidemux.1.gz.
* debian/install, debian/avidemux-qt.install, debian/avidemux-gtk.desktop,
  debian/avidemux-qt.desktop: Install desktop files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    copyright            : (C) 2007 by mean
 
3
    email                : fixounet@free.fr
 
4
    
 
5
    * We hide some info the the "type"
 
6
    * I.e.
 
7
    0--1000 : QT4 internal
 
8
    2000-3000: Filters
 
9
    3000-4000  filterFamilyClick Filter
 
10
    8000-9000  Active Filter
 
11
    
 
12
    
 
13
 ***************************************************************************/
 
14
 
 
15
/***************************************************************************
 
16
 *                                                                         *
 
17
 *   This program is free software; you can redistribute it and/or modify  *
 
18
 *   it under the terms of the GNU General Public License as published by  *
 
19
 *   the Free Software Foundation; either version 2 of the License, or     *
 
20
 *   (at your option) any later version.                                   *
 
21
 *                                                                         *
 
22
 ***************************************************************************/
 
23
 
 
24
#include "config.h"
 
25
#include <stdio.h>
 
26
#include <stdlib.h>
 
27
#include <math.h>
 
28
#include <sys/types.h>
 
29
#include <sys/stat.h>
 
30
#include <unistd.h>
 
31
#include <vector>
 
32
 
 
33
#define Ui_Dialog Ui_mainFilterDialog
 
34
#include "ui_mainfilter.h"
 
35
#undef Ui_Dialog
 
36
#include "QStringListModel" 
 
37
#include "QColor" 
 
38
#include "default.h"
 
39
#include "ADM_toolkit/filesel.h"
 
40
 
 
41
# include "prefs.h"
 
42
#include "ADM_audiodevice/audio_out.h"
 
43
#include "ADM_audio/ADM_audiodef.h"
 
44
 
 
45
#include "ADM_assert.h"
 
46
#include "GUI_render.h"
 
47
#include "ADM_osSupport/ADM_cpuCap.h"
 
48
#include "ADM_toolkit/toolkit.hxx"
 
49
#include "ADM_editor/ADM_edit.hxx"
 
50
#include "ADM_video/ADM_genvideo.hxx"
 
51
#include "ADM_filter/video_filters.h"
 
52
#include "ADM_video/ADM_vidPartial.h"
 
53
#include "ADM_filter/vidVCD.h"
 
54
#include "ADM_userInterfaces/ADM_commonUI/DIA_factory.h"
 
55
/*******************************************************/
 
56
#define NB_TREE 8
 
57
#define myFg 0xFF
 
58
#define myBg 0xF0
 
59
static int max=0;
 
60
/******************************************************/
 
61
#define ALL_FILTER_BASE       1000
 
62
#define EXTERNAL_FILTER_BASE  2000
 
63
#define ACTIVE_FILTER_BASE    3000
 
64
/******************************************************/
 
65
extern FILTER videofilters[MAX_FILTER];
 
66
extern uint32_t nb_active_filter;
 
67
extern std::vector <FILTER_ENTRY> allfilters;
 
68
 
 
69
extern const char  *filterGetNameFromTag(VF_FILTERS tag);
 
70
extern ADM_Composer *video_body;
 
71
extern AVDMGenericVideoStream *filterCreateFromTag(VF_FILTERS tag,CONFcouple *conf, AVDMGenericVideoStream *in) ;
 
72
/*******************************************************/
 
73
class filtermainWindow : public QDialog
 
74
{
 
75
     Q_OBJECT
 
76
 
 
77
 public:
 
78
     filtermainWindow();
 
79
 //    virtual ~filtermainWindow();
 
80
     void             buildActiveFilterList(void);
 
81
     Ui_mainFilterDialog ui;
 
82
     
 
83
     
 
84
     
 
85
     QListWidget      *availableList;
 
86
     QListWidget      *activeList;
 
87
     
 
88
     
 
89
     
 
90
 public slots:
 
91
        void VCD(bool b);
 
92
        void DVD(bool b);
 
93
        void SVCD(bool b);
 
94
        void halfD1(bool b);
 
95
        void add(bool b);
 
96
        void up(bool b);
 
97
        void down(bool b);
 
98
        void remove(bool b);
 
99
        void configure(bool b);
 
100
        void partial(bool b);
 
101
        void activeDoubleClick( QListWidgetItem  *item);
 
102
        void allDoubleClick( QListWidgetItem  *item);
 
103
        void filterFamilyClick(QListWidgetItem *item);
 
104
        void filterFamilyClick(int  item);
 
105
 private slots:
 
106
 private:
 
107
        int startFilter[NB_TREE];
 
108
        int filterSize[NB_TREE];
 
109
        void setSelected(int sel);
 
110
        void displayFamily(uint32_t family);
 
111
        void setupFilters(void);
 
112
};
 
113
/**
 
114
        \fn     void setSelected(int sel)
 
115
        \brief  Set the sel line as selected in the active filter window
 
116
*/
 
117
void filtermainWindow::setSelected( int sel)
 
118
{
 
119
  if(!sel) return;
 
120
  activeList->setCurrentRow(sel-1);
 
121
}
 
122
 
 
123
/**
 
124
        \fn     add( bool b)
 
125
        \brief  Retrieve the selected filter and add it to the active filters
 
126
*/
 
127
void filtermainWindow::add( bool b)
 
128
{
 
129
  /* Now that we have the tab, get the selection */
 
130
   QListWidgetItem *item=availableList->currentItem();
 
131
   VF_FILTERS tag;
 
132
   if(item)
 
133
   {
 
134
     int itag=item->type();
 
135
     if(itag>=ALL_FILTER_BASE && itag < EXTERNAL_FILTER_BASE)
 
136
     {
 
137
       tag=allfilters[itag-ALL_FILTER_BASE].tag;
 
138
       
 
139
     }else
 
140
     {
 
141
        ADM_assert(0); 
 
142
     }
 
143
      printf("Tag : %d\n",itag);
 
144
      
 
145
      // Create our filter...
 
146
      
 
147
       CONFcouple *coup;
 
148
        videofilters[nb_active_filter].filter = filterCreateFromTag (tag, NULL, videofilters[nb_active_filter - 1].filter);
 
149
        if(!videofilters[nb_active_filter].filter->    configure (videofilters[nb_active_filter - 1].filter))
 
150
        {
 
151
            delete videofilters[nb_active_filter].filter;
 
152
            return;
 
153
        }
 
154
        videofilters[nb_active_filter].filter->getCoupledConf (&coup);
 
155
        videofilters[nb_active_filter].tag = tag;
 
156
        videofilters[nb_active_filter].conf = coup;
 
157
        nb_active_filter++;
 
158
        setSelected(nb_active_filter);
 
159
        buildActiveFilterList();
 
160
   }
 
161
 
 
162
}
 
163
/**
 
164
        \fn     remove( bool b)
 
165
        \brief  Remove selected filters from the active window list
 
166
*/
 
167
void filtermainWindow::remove( bool b)
 
168
{
 
169
   /* Get selection if any */
 
170
  /* Now that we have the tab, get the selection */
 
171
   QListWidgetItem *item=activeList->currentItem();
 
172
   if(!item)
 
173
   {
 
174
      printf("No selection\n");
 
175
      return;
 
176
   }
 
177
    
 
178
     int itag=item->type();
 
179
     ADM_assert(itag>ACTIVE_FILTER_BASE);
 
180
     itag-=ACTIVE_FILTER_BASE;
 
181
     /* Filter 0 is the decoder ...*/
 
182
      printf("Rank : %d\n",itag); 
 
183
     ADM_assert(itag);
 
184
     /**/
 
185
      if (videofilters[itag].conf)
 
186
            {
 
187
                    delete videofilters[itag].conf;
 
188
                    videofilters[itag].conf = NULL;
 
189
            }
 
190
        // recreate derivated filters
 
191
        for (uint32_t i = itag ; i < nb_active_filter-1; i++)
 
192
        {
 
193
                    delete videofilters[i ].filter;
 
194
                    videofilters[i ].filter = filterCreateFromTag(videofilters[i+1].tag,
 
195
                                                    videofilters[i+1].conf,
 
196
                                                    videofilters[i - 1].filter);
 
197
                    videofilters[i ].conf = videofilters[i+1].conf;
 
198
                    videofilters[i ].tag = videofilters[i+1].tag;
 
199
        }
 
200
        /* Delete last filter which is now at last filter -1 */
 
201
            delete videofilters[nb_active_filter - 1].filter;
 
202
            videofilters[nb_active_filter - 1].filter = NULL;
 
203
            nb_active_filter--;
 
204
            buildActiveFilterList ();
 
205
            if(nb_active_filter>1)
 
206
            {
 
207
              if(itag<nb_active_filter-1)
 
208
                  setSelected(itag);
 
209
              else
 
210
                  setSelected(nb_active_filter-1);
 
211
            }
 
212
  
 
213
}
 
214
#define MAKE_BUTTON(button,call) \
 
215
void filtermainWindow::button( bool b) \
 
216
{ \
 
217
    call(); \
 
218
    getFirstVideoFilter (); \
 
219
    buildActiveFilterList ();  \
 
220
}
 
221
MAKE_BUTTON(DVD,setDVD)
 
222
MAKE_BUTTON(VCD,setVCD)
 
223
MAKE_BUTTON(SVCD,setSVCD)
 
224
MAKE_BUTTON(halfD1,setHalfD1)
 
225
/**
 
226
        \fn     configure( bool b)
 
227
        \brief  Configure the selected active filter
 
228
*/
 
229
void filtermainWindow::configure( bool b)
 
230
{
 
231
   /* Get selection if any */
 
232
  /* Now that we have the tab, get the selection */
 
233
   QListWidgetItem *item=activeList->currentItem();
 
234
   if(!item)
 
235
   {
 
236
      printf("No selection\n");
 
237
      return;
 
238
   }
 
239
    
 
240
     int itag=item->type();
 
241
     ADM_assert(itag>ACTIVE_FILTER_BASE);
 
242
     itag-=ACTIVE_FILTER_BASE;
 
243
     /* Filter 0 is the decoder ...*/
 
244
      printf("Rank : %d\n",itag); 
 
245
     ADM_assert(itag);
 
246
     /**/
 
247
     
 
248
        if(!videofilters[itag].filter->configure (videofilters[itag - 1].filter)) return;
 
249
        /* Recreate chain if needed , config has changed */
 
250
        CONFcouple *couple;
 
251
        videofilters[itag].filter->getCoupledConf (&couple);
 
252
        videofilters[itag].conf = couple;
 
253
        getFirstVideoFilter ();
 
254
        buildActiveFilterList ();
 
255
}
 
256
/**
 
257
        \fn     up( bool b)
 
258
        \brief  Move selected filter one place up
 
259
*/
 
260
void filtermainWindow::up( bool b)
 
261
{
 
262
   QListWidgetItem *item=activeList->currentItem();
 
263
   if(!item)
 
264
   {
 
265
      printf("No selection\n");
 
266
      return;
 
267
   }
 
268
    
 
269
     int itag=item->type();
 
270
     ADM_assert(itag>ACTIVE_FILTER_BASE);
 
271
     itag-=ACTIVE_FILTER_BASE;
 
272
     /* Filter 0 is the decoder ...*/
 
273
      printf("Rank : %d\n",itag); 
 
274
     ADM_assert(itag);
 
275
     
 
276
     if (itag < 2) return;
 
277
        // swap action parameter & action parameter -1
 
278
        FILTER tmp;
 
279
        memcpy (&tmp, &videofilters[itag - 1], sizeof (FILTER));
 
280
        memcpy (&videofilters[itag - 1],
 
281
            &videofilters[itag], sizeof (FILTER));
 
282
        memcpy (&videofilters[itag], &tmp, sizeof (FILTER));
 
283
        getFirstVideoFilter ();
 
284
        buildActiveFilterList ();
 
285
        setSelected(itag-1);
 
286
}
 
287
/**
 
288
        \fn     down( bool b)
 
289
        \brief  Move selected filter one place down
 
290
*/
 
291
void filtermainWindow::down( bool b)
 
292
{
 
293
   QListWidgetItem *item=activeList->currentItem();
 
294
   if(!item)
 
295
   {
 
296
      printf("No selection\n");
 
297
      return;
 
298
   }
 
299
    
 
300
     int itag=item->type();
 
301
     ADM_assert(itag>ACTIVE_FILTER_BASE);
 
302
     itag-=ACTIVE_FILTER_BASE;
 
303
     /* Filter 0 is the decoder ...*/
 
304
      printf("Rank : %d\n",itag); 
 
305
     ADM_assert(itag);
 
306
     
 
307
    if (((int) itag < (int) (nb_active_filter - 1)) && (itag))
 
308
        {
 
309
            // swap action parameter & action parameter -1
 
310
            FILTER tmp;
 
311
            memcpy (&tmp, &videofilters[itag + 1], sizeof (FILTER));
 
312
            memcpy (&videofilters[itag + 1],
 
313
                        &videofilters[itag], sizeof (FILTER));
 
314
            memcpy (&videofilters[itag], &tmp, sizeof (FILTER));
 
315
            getFirstVideoFilter ();
 
316
            buildActiveFilterList ();
 
317
            setSelected(itag+1);
 
318
        }
 
319
}
 
320
/**
 
321
        \fn     filtermainWindow::filterFamilyClick( QListWidgetItem  *item)
 
322
        \brief  Select family among color etc... 
 
323
*/
 
324
 
 
325
void filtermainWindow::filterFamilyClick(QListWidgetItem *item)
 
326
{
 
327
    int family= ui.listFilterCategory->currentRow();
 
328
    if(family>=0)
 
329
        displayFamily(family);
 
330
}
 
331
void filtermainWindow::filterFamilyClick(int  m)
 
332
{
 
333
        if(m>=0)
 
334
                displayFamily(m);
 
335
}
 
336
void filtermainWindow::displayFamily(uint32_t family)
 
337
{
 
338
  printf("Family :%u\n",family);
 
339
  
 
340
  availableList->clear();
 
341
  QColor colorgrey;
 
342
  colorgrey.setRgb(myBg,myBg,myBg);
 
343
  QBrush brush(colorgrey);
 
344
  QSize sz;
 
345
  
 
346
  for (uint32_t i = 0; i < filterSize[family]; i++)
 
347
    {
 
348
      int r=startFilter[family]+i;
 
349
 
 
350
      if (allfilters[r].viewable==1)
 
351
        {
 
352
          QString str; //="<b>";
 
353
          str+=allfilters[r].name;
 
354
         
 
355
          QListWidgetItem *item;
 
356
          if(family==NB_TREE-1)
 
357
                item=new QListWidgetItem(str,availableList,EXTERNAL_FILTER_BASE+i);
 
358
          else
 
359
                item=new QListWidgetItem(str,availableList,ALL_FILTER_BASE+r);
 
360
          item->setToolTip(allfilters[r].description);
 
361
          if(i&1) item->setBackground(brush);
 
362
          availableList->addItem(item);
 
363
          
 
364
        }
 
365
     }
 
366
   
 
367
}
 
368
 
 
369
/**
 
370
        \fn     filtermainWindow::activeDoubleClick( QListWidgetItem  *item)
 
371
        \brief  One of the active window has been double clicked, call configure
 
372
*/
 
373
void filtermainWindow::activeDoubleClick( QListWidgetItem  *item)
 
374
{
 
375
  
 
376
    configure(0);
 
377
}
 
378
/**
 
379
        \fn     filtermainWindow::activeDoubleClick( QListWidgetItem  *item)
 
380
        \brief  One of the active window has been double clicked, call configure
 
381
*/
 
382
void filtermainWindow::allDoubleClick( QListWidgetItem  *item)
 
383
{
 
384
  
 
385
    add(0);
 
386
}
 
387
/**
 
388
        \fn     filtermainWindow::partial( bool b)
 
389
        \brief  Partialize one filter
 
390
*/
 
391
void filtermainWindow::partial( bool b)
 
392
{
 
393
  printf("partial\n"); 
 
394
   QListWidgetItem *item=activeList->currentItem();
 
395
   if(!item)
 
396
   {
 
397
      printf("No selection\n");
 
398
      return;
 
399
   }
 
400
    
 
401
     int itag=item->type();
 
402
     ADM_assert(itag>ACTIVE_FILTER_BASE);
 
403
     itag-=ACTIVE_FILTER_BASE;
 
404
     /* Filter 0 is the decoder ...*/
 
405
      printf("Rank : %d\n",itag); 
 
406
      ADM_assert(itag);
 
407
     
 
408
        AVDMGenericVideoStream *replace;
 
409
        CONFcouple *conf;
 
410
        conf = videofilters[itag].conf;
 
411
        if (videofilters[itag].tag == VF_PARTIAL)       // cannot recurse
 
412
        {
 
413
            GUI_Error_HIG (QT_TR_NOOP("The filter is already partial"), NULL);
 
414
            return;
 
415
        }
 
416
        replace =new ADMVideoPartial (videofilters[itag - 1].
 
417
                                      filter,
 
418
                                      videofilters[itag].tag,
 
419
                                      conf);
 
420
        if(replace->configure (videofilters[itag - 1].filter))
 
421
        {
 
422
            delete videofilters[itag].filter;
 
423
            if (conf) delete conf;
 
424
            videofilters[itag].filter = replace;
 
425
            replace->getCoupledConf (&conf);
 
426
            videofilters[itag].conf = conf;
 
427
            videofilters[itag].tag = VF_PARTIAL;
 
428
            getFirstVideoFilter ();
 
429
            buildActiveFilterList ();   
 
430
        }
 
431
        else delete replace;
 
432
}
 
433
/**
 
434
        \fn setup
 
435
        \brief Prepare 
 
436
*/
 
437
void filtermainWindow::setupFilters(void)
 
438
{
 
439
  int current_tree=-1;
 
440
  int current_raw=0;;
 
441
  
 
442
  max=0;
 
443
  
 
444
  for (uint32_t i = 0; i < allfilters.size(); i++)
 
445
    {
 
446
      if (allfilters[i].viewable==1)
 
447
        {
 
448
          current_raw++;
 
449
          
 
450
        }else 
 
451
        {
 
452
                current_tree++;
 
453
                if(current_tree) filterSize[current_tree-1]=current_raw;
 
454
                if(current_tree>=NB_TREE) break;
 
455
                startFilter[current_tree]=i+1;
 
456
                current_raw=0;
 
457
                
 
458
        }
 
459
    }
 
460
    ADM_assert(NB_TREE==8);
 
461
    startFilter[NB_TREE-1]=2000;
 
462
    filterSize[NB_TREE-1]=0;
 
463
    for(int i=0;i<NB_TREE;i++)
 
464
    {
 
465
             printf("%d Start at %d size :%d\n",i,startFilter[i],filterSize[i]);
 
466
    }
 
467
}
 
468
 
 
469
/**
 
470
        \fn     buildActiveFilterList(void)
 
471
        \brief  Build and display all active filters (may be empty)
 
472
*/
 
473
void filtermainWindow::buildActiveFilterList(void)
 
474
{
 
475
  VF_FILTERS fil;
 
476
  
 
477
  
 
478
  activeList->clear();
 
479
  QColor colorGrey,colorWhite;
 
480
  colorGrey.setRgb(myBg,myBg,myBg);
 
481
  colorWhite.setRgb(myFg,myFg,myFg);
 
482
  QBrush brush(colorGrey);
 
483
  QBrush brushW(colorWhite);
 
484
 
 
485
  for (uint32_t i = 1; i < nb_active_filter; i++)
 
486
    {
 
487
                QString str;
 
488
                fil=videofilters[i].tag;
 
489
 
 
490
                 str =filterGetNameFromTag(fil);
 
491
                 str+= videofilters[i].filter->printConf ();
 
492
                 QListWidgetItem *item=new QListWidgetItem(str,activeList,ACTIVE_FILTER_BASE+i);
 
493
                 if(i&1) item->setBackground(brush);
 
494
                        else item->setBackground(brushW);
 
495
                 activeList->addItem(item);
 
496
    }
 
497
    
 
498
 
 
499
}
 
500
  /**
 
501
  */
 
502
filtermainWindow::filtermainWindow()     : QDialog()
 
503
 {
 
504
        memset( startFilter,0,sizeof(int)*NB_TREE);
 
505
        memset( filterSize,0,sizeof(int)*NB_TREE);
 
506
 
 
507
    ui.setupUi(this);
 
508
    setupFilters();  
 
509
      
 
510
    availableList=ui.listWidgetAvailable;
 
511
    activeList=ui.listWidgetActive;
 
512
    connect(ui.listFilterCategory,SIGNAL(itemDoubleClicked(QListWidgetItem *)),
 
513
                this,SLOT(filterFamilyClick(QListWidgetItem *)));
 
514
    connect(ui.listFilterCategory,SIGNAL(itemClicked(QListWidgetItem *)),
 
515
                this,SLOT(filterFamilyClick(QListWidgetItem *)));
 
516
 
 
517
    connect(activeList,SIGNAL(itemDoubleClicked(QListWidgetItem *)),this,SLOT(activeDoubleClick(QListWidgetItem *)));
 
518
    connect(availableList,SIGNAL(itemDoubleClicked(QListWidgetItem *)),this,SLOT(allDoubleClick(QListWidgetItem *)));
 
519
    
 
520
    connect((ui.toolButtonConfigure),SIGNAL(clicked(bool)),this,SLOT(configure(bool)));
 
521
    connect((ui.toolButtonAdd),SIGNAL(clicked(bool)),this,SLOT(add(bool)));
 
522
    connect((ui.pushButtonRemove),SIGNAL(clicked(bool)),this,SLOT(remove(bool)));
 
523
    connect((ui.toolButtonUp),SIGNAL(clicked(bool)),this,SLOT(up(bool)));
 
524
    connect((ui.toolButtonDown),SIGNAL(clicked(bool)),this,SLOT(down(bool)));
 
525
    connect((ui.toolButtonPartial),SIGNAL(clicked(bool)),this,SLOT(partial(bool)));
 
526
    connect(ui.buttonClose, SIGNAL(clicked(bool)), this, SLOT(accept()));
 
527
    connect(ui.pushButtonDVD, SIGNAL(clicked(bool)), this, SLOT(DVD(bool)));
 
528
    connect(ui.pushButtonVCD, SIGNAL(clicked(bool)), this, SLOT(VCD(bool)));
 
529
    connect(ui.pushButtonSVCD, SIGNAL(clicked(bool)), this, SLOT(SVCD(bool)));
 
530
    connect(ui.pushButtonHalfDVD, SIGNAL(clicked(bool)), this, SLOT(halfD1(bool)));
 
531
   
 
532
    displayFamily(0);
 
533
    buildActiveFilterList(); 
 
534
 }
 
535
/*******************************************************/
 
536
 
 
537
int GUI_handleVFilter(void);
 
538
static void updateFilterList (filtermainWindow *dialog);
 
539
 
 
540
/**
 
541
      \fn     GUI_handleVFilter(void)
 
542
      \brief  Show the main filter window allowing user to add/remove/configure video filters
 
543
 
 
544
 
 
545
*/
 
546
int GUI_handleVFilter(void)
 
547
{
 
548
        filtermainWindow dialog;
 
549
        if(QDialog::Accepted==dialog.exec())
 
550
        {
 
551
        }
 
552
        return 0;
 
553
}
 
554
/** 
 
555
    \fn partialCb
 
556
    \brief Partial callback to configure the swallowed filter
 
557
    
 
558
*/
 
559
static void partialCb(void *cookie);
 
560
void partialCb(void *cookie)
 
561
{
 
562
  void **params=(void **)cookie;
 
563
  AVDMGenericVideoStream *son=(AVDMGenericVideoStream *)params[0];
 
564
  AVDMGenericVideoStream *previous=(AVDMGenericVideoStream *)params[1];
 
565
  son->configure(previous);
 
566
}
 
567
/** 
 
568
    \fn DIA_getPartial
 
569
    \brief Partial dialog
 
570
    
 
571
*/
 
572
 
 
573
uint8_t DIA_getPartial(PARTIAL_CONFIG *param,AVDMGenericVideoStream *son,AVDMGenericVideoStream *previous)
 
574
{
 
575
#define PX(x) &(param->x)
 
576
  void *params[2]={son,previous};
 
577
         uint32_t fmax=previous->getInfo()->nb_frames;
 
578
         if(fmax) fmax--;
 
579
         
 
580
         diaElemUInteger  start(PX(_start),QT_TR_NOOP("Partial Start Frame:"),0,fmax);
 
581
         diaElemUInteger  end(PX(_end),QT_TR_NOOP("Partial End Frame:"),0,fmax);
 
582
         diaElemButton    button(QT_TR_NOOP("Configure child"), partialCb,params);
 
583
         
 
584
         diaElem *tabs[]={&start,&end,&button};
 
585
        return diaFactoryRun(QT_TR_NOOP("Partial Video Filter"),3,tabs);
 
586
}
 
587
//EOF
 
588