本文整理汇总了C++中AVDMGenericVideoStream类的典型用法代码示例。如果您正苦于以下问题:C++ AVDMGenericVideoStream类的具体用法?C++ AVDMGenericVideoStream怎么用?C++ AVDMGenericVideoStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AVDMGenericVideoStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPicSize
uint32_t getPicSize(void)
{
uint32_t size;
AVDMGenericVideoStream *last;
last=getLastVideoFilter();
size=last->getInfo()->width*last->getInfo()->height;
return size;
}
示例2: getPicSize
uint32_t getPicSize(void)
{
#warning FIXME
return 720*576;
#if 0
uint32_t size;
AVDMGenericVideoStream *last;
last=getLastVideoFilter();
size=last->getInfo()->width*last->getInfo()->height;
return size;
#endif
}
示例3: printf
/**
\fn filtermainWindow::partial( bool b)
\brief Partialize one filter
*/
void filtermainWindow::partial( bool b)
{
printf("partial\n");
QListWidgetItem *item=activeList->currentItem();
if(!item)
{
printf("No selection\n");
return;
}
int itag=item->type();
ADM_assert(itag>ACTIVE_FILTER_BASE);
itag-=ACTIVE_FILTER_BASE;
/* Filter 0 is the decoder ...*/
printf("Rank : %d\n",itag);
ADM_assert(itag);
AVDMGenericVideoStream *replace;
CONFcouple *conf;
conf = videofilters[itag].conf;
if (videofilters[itag].tag == VF_PARTIAL_FILTER) // cannot recurse
{
GUI_Error_HIG (QT_TR_NOOP("The filter is already partial"), NULL);
return;
}
replace =new ADMVideoPartial (videofilters[itag - 1].
filter,
videofilters[itag].tag,
conf);
if(replace->configure (videofilters[itag - 1].filter))
{
delete videofilters[itag].filter;
if (conf) delete conf;
videofilters[itag].filter = replace;
replace->getCoupledConf (&conf);
videofilters[itag].conf = conf;
videofilters[itag].tag = VF_PARTIAL_FILTER;
getFirstVideoFilter ();
buildActiveFilterList ();
setSelected(itag);
}
else delete replace;
}
示例4: DIA_particle
uint8_t DIA_particle (AVDMGenericVideoStream *in,
ADMVideoParticle * particlep,
PARTICLE_PARAM * param,
const MenuMapping * menu_mapping,
uint32_t menu_mapping_count)
{
// Allocate space for preview video
uint32_t width = in->getInfo()->width;
uint32_t height = in->getInfo()->height;
dialog = create_particle_dialog();
gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_register_dialog (dialog);
gtk_window_set_title (GTK_WINDOW (dialog),
QT_TR_NOOP("Particle Analysis Configuration"));
gtk_widget_show (dialog);
// Fix up a bunch of things that Glade can't do. This is less efficient
// than just editing the Glade output, but it's not that big a deal and
// doing it this way makes it MUCH easier to use Glade to tweak the layout
// later.
// actually, nothing to fix up in this one. But if there ever is, this is
// the place to do it...
flyParticle * myDialog
= new flyParticle (width, height, in,
WID(previewVideo), WID(previewSlider),
GTK_DIALOG(dialog), particlep, param,
menu_mapping, menu_mapping_count);
g_signal_connect (GTK_OBJECT (WID(previewVideo)), "configure-event",
GTK_SIGNAL_FUNC (preview_video_configured),
gpointer (myDialog));
myDialog->upload();
myDialog->sliderChanged();
g_signal_connect (GTK_OBJECT(WID(outputFileBrowseButton)), "clicked",
GTK_SIGNAL_FUNC(browse_button_clicked),
gpointer(myDialog));
// update things when settings are changed
#define CNX(_widg,_signame) \
g_signal_connect (GTK_OBJECT(WID(_widg)), _signame, \
GTK_SIGNAL_FUNC(gui_update), gpointer(myDialog));
CNX (minAreaSpinButton, "value_changed");
CNX (maxAreaSpinButton, "value_changed");
CNX (leftCropSpinButton, "value_changed");
CNX (rightCropSpinButton, "value_changed");
CNX (topCropSpinButton, "value_changed");
CNX (bottomCropSpinButton, "value_changed");
g_signal_connect (GTK_OBJECT(WID(previewSlider)), "value_changed",
GTK_SIGNAL_FUNC(frame_changed), gpointer(myDialog));
g_signal_connect (GTK_OBJECT(WID(previewVideo)), "expose_event",
GTK_SIGNAL_FUNC(gui_draw), gpointer(myDialog));
g_signal_connect (GTK_OBJECT(WID(previewVideo)), "button_press_event",
GTK_SIGNAL_FUNC(previewButtonEvent),
gpointer(myDialog));
#if 0
g_signal_connect (GTK_OBJECT(WID(previewVideo)), "motion_notify_event",
GTK_SIGNAL_FUNC(previewMotionEvent),
gpointer(myDialog));
#endif
GtkWidget * previewOutputMenu = WID(previewOutputMenu);
uint32_t filter_count;
FILTER * filters = getCurrentVideoFilterList (&filter_count);
int32_t active = -1;
// The " + (active < 0)" below is a bit of a hack. We know that in
// on_action() in gui_filtermanager.cpp, case A_ADD, the new filter-to-be
// is added to the filter list without incrementing nb_active_filter yet.
// So if we get to the end of the list and haven't yet found the filter
// that we're configuring, we know it's a new one and therefore that it is
// one past the apparent end of the list. It's not a clean solution, but
// it seems like the cleanEST solution.
for (uint32_t i = 0; i < filter_count + (active < 0); i++)
{
const char * name
= (i == 0) ? "(input)" : filterGetNameFromTag (filters [i].tag);
bool free_name = false;
FILTER * filter = filters + i;
AVDMGenericVideoStream * source = filter->filter;
uint32_t w = source->getInfo()->width;
uint32_t h = source->getInfo()->height;
if (w != width || h != height)
{
name = g_strconcat ("XX ", name, " XX", NULL);
free_name = true;
}
//.........这里部分代码省略.........
示例5: on_action
//
// One of the button of the main dialog was pressed
// Retrieve also the associated filter and handle
// the action
//______________________________________________________
void on_action (gui_act action)
{
uint32_t action_parameter;
VF_FILTERS tag = VF_INVALID;
action_parameter = 0;
if (nb_active_filter > 1)
if (getSelectionNumber(nb_active_filter - 1,
WID(treeview0),
stores[0],
&action_parameter))
action_parameter++;
switch (action)
{
case A_ADD:
tag = getFilterFromSelection();
if (tag == VF_INVALID) break;
CONFcouple *coup;
videofilters[nb_active_filter].filter =
filterCreateFromTag (tag, NULL, videofilters[nb_active_filter - 1].filter);
videofilters[nb_active_filter].tag = tag;
if(!videofilters[nb_active_filter].filter->
configure (videofilters[nb_active_filter - 1].filter))
{
delete videofilters[nb_active_filter].filter;
break;
}
videofilters[nb_active_filter].filter->getCoupledConf (&coup);
videofilters[nb_active_filter].conf = coup;
nb_active_filter++;
updateFilterList ();
setSelectionNumber(nb_active_filter-1, WID(treeview0), stores[0], nb_active_filter-2);
break;
case A_VCD:
setVCD ();
updateFilterList ();
setSelectionNumber(nb_active_filter-1, WID(treeview0), stores[0], nb_active_filter-2);
break;
case A_SVCD:
setSVCD ();
updateFilterList ();
setSelectionNumber(nb_active_filter-1, WID(treeview0), stores[0], nb_active_filter-2);
break;
case A_DVD:
setDVD ();
updateFilterList ();
setSelectionNumber(nb_active_filter-1, WID(treeview0), stores[0], nb_active_filter-2);
break;
case A_HALFD1:
setHalfD1 ();
updateFilterList ();
setSelectionNumber(nb_active_filter-1, WID(treeview0), stores[0], nb_active_filter-2);
break;
default:
case A_DOUBLECLICK:
printf ("Double clicked..");
case A_CONFIGURE:
if(!action_parameter) break;
if(!videofilters[action_parameter].filter->
configure (videofilters[action_parameter - 1].filter)) break;
CONFcouple *couple;
videofilters[action_parameter].filter->getCoupledConf (&couple);
videofilters[action_parameter].conf = couple;
getFirstVideoFilter ();
updateFilterList ();
setSelectionNumber(nb_active_filter-1, WID(treeview0), stores[0], action_parameter-1);
break;
case A_PARTIAL:
if (!action_parameter) break;
AVDMGenericVideoStream *replace;
CONFcouple *conf;
conf = videofilters[action_parameter].conf;
if (videofilters[action_parameter].tag == VF_PARTIAL_FILTER) // cannot recurse
{
GUI_Error_HIG (QT_TR_NOOP("The filter is already partial"), NULL);
break;
}
replace =
new ADMVideoPartial (videofilters[action_parameter - 1].
filter,
videofilters[action_parameter].tag,
conf);
if(replace->configure (videofilters[action_parameter - 1].filter))
{
delete videofilters[action_parameter].filter;
if (conf) delete conf;
videofilters[action_parameter].filter = replace;
//.........这里部分代码省略.........
示例6: getLastVideoFilter
/*--------------------------------------------------------------------*/
uint8_t mpegWritter::dopass2(char *name,char *statname,uint32_t final_size,uint32_t bitrate,
ADM_MPEGTYPE mpegtype,int matrix,uint8_t interlaced,
uint8_t bff, // WLA
uint8_t widescreen)
{
int intra,q;
uint32_t size;
AVDMGenericVideoStream *incoming;
FILE *fd=NULL;
uint64_t total_size=0;
uint32_t len,flags,type,outquant;
incoming = getLastVideoFilter (frameStart,frameEnd-frameStart);
if(!_audio)
{
fd=fopen(name,"wb");
if(!fd)
{
GUI_Alert("Problem opening file!");
return 0;
}
}
// if(!init(name,mpegtype,interlaced,widescreen))
if(!init(name,mpegtype,interlaced,bff,widescreen)) // WLA
{
printf("Mpeg2 init failed\n");
return 0;
}
printf("\n mpeg2enc init done \n");
assert( _buffer);
assert( _buffer_out);
encoding->reset();
encoding->setFrame (0, _total);
/*-------------------- Pass 1 over, go to pass 2 --------------------------------*/
total_size=0;
memset(&mpegvbr,0,sizeof(mpegvbr));
if(0> vbrSetDefaults(&mpegvbr))
{
printf("set default failed\n");
return 0;
}
mpegvbr.fps=_fps1000/1000.;
mpegvbr.mode=VBR_MODE_2PASS_2;
mpegvbr.desired_size=final_size*1024*1024;
mpegvbr.debug=0;
mpegvbr.filename=statname; //XvidInternal2pass_statfile;
float br;
uint32_t avg;
br=mpegvbr.desired_size*8;
br=br/_total; // bit / frame
br=br*mpegvbr.fps;
mpegvbr.desired_bitrate= (int)floor(br);
avg=(uint32_t)floor(br/1000.);
printf("average bitrate : %lu\n",avg);
//mpegvbr.maxAllowedBitrate=(2500*1000)>>3;
// enable stuff in xvid
//mpegvbr.twopass_max_bitrate=2500*1000;
//mpegvbr.alt_curve_high_dist=10;
//mpegvbr.alt_curve_low_dist=30;
//mpegvbr.alt_curve_type=VBR_ALT_CURVE_AGGRESIVE;
if(0>vbrInit(&mpegvbr))
{
GUI_Alert("Error initializing 2 pass!");
return 0;
}
encoding->setPhasis("2nd Pass");
q=2;
//mpegvbr.maxAllowedBitrate=(bitrate*1000)>>3;//(bitrate*1000)>>3;
//mpegvbr.maxAllowedBitrate=(9000*1000)>>3; // enable stuff in xvid
//->
switch(mpegtype)
{
case ADM_SVCD:
Mpeg2encSVCD *dec;
dec=new Mpeg2encSVCD(_w,_h);
dec->setMatrix(matrix);
// dec->init(q,bitrate,_fps1000,interlaced,widescreen);
dec->init(q,bitrate,_fps1000,interlaced,bff,widescreen); // WLA
_codec=dec;
encoding->setCodec("SVCD");
printf("Svcd max bitrate : %d\n",bitrate);
break;
case ADM_DVD:
{
//.........这里部分代码省略.........
示例7: save_dualpass
/*-------------------------------------------------------------------------------------------------------------------*/
uint8_t mpegWritter::save_dualpass(char *name,uint32_t final_size,uint32_t bitrate,ADM_MPEGTYPE mpegtype,
int matrix,uint8_t interlaced,
uint8_t bff, // WLA
uint8_t widescreen)
{
AVDMGenericVideoStream *incoming;
char *statname;
incoming = getLastVideoFilter (frameStart,frameEnd-frameStart);
_w=incoming->getInfo()->width;
_h=incoming->getInfo()->height;
_page=_w*_h;
_page+=_page>>1;
_fps1000=incoming->getInfo()->fps1000;
_total=incoming->getInfo()->nb_frames;
if(!_total) return 0;
_buffer =new uint8_t[_w*_h*2];
_buffer_out=new uint8_t[_w*_h*2];
statname=new char[strlen(name)+4+1];
strcpy(statname,name);
strcat(statname,".st");
printf("Matrix : %d\n\n",matrix);
encoding=new DIA_encoding(_fps1000);
encoding->setPhasis("Encoding");
// check if stat file exists ?
FILE *fd;
uint8_t reuse=0;
fd=fopen(statname,"rt");
if(fd)
{
fclose(fd);
if(GUI_Question("Reuse log file ?")) reuse=1;
}
#if 1
if(!reuse)
// if(!dopass1(name,statname,final_size,bitrate,mpegtype,matrix,interlaced,widescreen))
if(!dopass1(name,statname,final_size,bitrate,mpegtype,matrix,interlaced,bff,widescreen))
// WLA
{
delete encoding;
GUI_Alert("Error in pass 1");
delete [] statname;
return 0;
}
#endif
// if(!dopass2(name,statname,final_size,bitrate,mpegtype,matrix,interlaced,widescreen))
if(!dopass2(name,statname,final_size,bitrate,mpegtype,matrix,interlaced,bff,widescreen))
// WLA
{
delete encoding;
GUI_Alert("Error in pass 2");
delete [] statname;
return 0;
}
delete encoding;
delete [] statname;
return 1;
}
示例8: getLastVideoFilter
unsigned int calculatorDialog::getPictureSize(void)
{
AVDMGenericVideoStream *last = getLastVideoFilter();
return last->getInfo()->width * last->getInfo()->height;
}
示例9: memset
//****************************************************************
uint8_t
mpegWritter::dopass2 (const char *name, char *statname, uint32_t final_size, uint32_t bitrate, ADM_MPEGTYPE mpegtype, int matrix, uint8_t interlaced, uint8_t bff, // WLA
uint8_t widescreen)
{
int intra, q;
uint32_t size;
AVDMGenericVideoStream *incoming;
FILE *fd = NULL;
uint64_t total_size = 0;
uint32_t len, flags, type, outquant, audiolen;
uint32_t sample_target = 0;
double sample_time;
ADMBitstream bitstream;
memset (quantstat, 0, 32);
incoming = getLastVideoFilter (frameStart, frameEnd - frameStart);
if (!_audio)
{
if (!(fd = qfopen (name, "wb")))
return 0;
}
// if(!init(name,mpegtype,interlaced,widescreen))
if (!init (name, mpegtype, interlaced, bff, widescreen)) // WLA
{
printf ("Mpeg2 init failed\n");
return 0;
}
printf ("\n mpeg2enc init done \n");
ADM_assert (aImage);
ADM_assert (_buffer_out);
encoding->reset ();
encoding->setFrame (0, _total);
/*-------------------- Pass 1 over, go to pass 2 --------------------------------*/
ADM_assert (_ratecontrol->startPass2 (final_size, _total));
encoding->setPhasis ("2nd Pass");
q = 2;
//mpegvbr.maxAllowedBitrate=(bitrate*1000)>>3;//(bitrate*1000)>>3;
//mpegvbr.maxAllowedBitrate=(9000*1000)>>3; // enable stuff in xvid
//->
switch (mpegtype)
{
case ADM_SVCD:
Mpeg2encSVCD * dec;
dec = new Mpeg2encSVCD (_w, _h);
dec->setMatrix (matrix);
// dec->init(q,bitrate,_fps1000,interlaced,widescreen);
dec->init (q, bitrate, _fps1000, interlaced, bff, widescreen, 0); // WLA
_codec = dec;
encoding->setCodec ("SVCD");
printf ("Svcd max bitrate : %d\n", bitrate);
break;
case ADM_DVD:
{
Mpeg2encDVD *dec;
dec = new Mpeg2encDVD (_w, _h);
dec->setMatrix (matrix);
// dec->init(q,bitrate,_fps1000,interlaced,widescreen);
dec->init (q, bitrate, _fps1000, interlaced, bff, widescreen, 0); // WLA
_codec = dec;
printf ("DVD max bitrate : %d\n", bitrate);
encoding->setCodec ("DVD");
}
break;
default:
ADM_assert (0);
break;
}
encoding->setPhasis ("2nd Pass");
if (_muxer)
{
encoding->
setAudioCodec (getStrFromAudioCodec (_audio->getInfo ()->encoding));
sample_time = _total;
sample_time *= 1000;
sample_time /= _fps1000; // target_time in second
sample_time *= _audio->getInfo ()->frequency;
sample_target = (uint32_t) floor (sample_time);
}
bitstream.data = _buffer_out;
for (uint32_t i = 0; i < _total; i++)
{
if (!incoming->getFrameNumberNoAlloc (i, &size, aImage, &flags))
{
GUI_Error_HIG (_("Encoding error"), NULL);
if (!_audio)
qfclose (fd);
end ();
//.........这里部分代码省略.........
示例10: getLastVideoFilter
/*-------------------------------------------------------------------------------------------------------*/
uint8_t
mpegWritter::dopass1 (const char *name, char *statname, uint32_t final_size, uint32_t bitrate, ADM_MPEGTYPE mpegtype, int matrix, uint8_t interlaced, uint8_t bff, // WLA
uint8_t widescreen)
{
uint32_t size;
AVDMGenericVideoStream *incoming;
FILE *fd;
uint64_t total_size = 0;
//uint32_t len,flags,type,outquant;
float br;
uint32_t avg, flags;
int intra, q;
ADMBitstream bitstream;
incoming = getLastVideoFilter (frameStart, frameEnd - frameStart);
// if(!init(name,mpegtype,interlaced,widescreen)) return 0;
if (!init (name, mpegtype, interlaced, bff, widescreen))
return 0; // WLA
printf ("\n mpeg2enc init done \n");
ADM_assert (aImage);
ADM_assert (_buffer_out);
q = 2; // q=2
encoding->setPhasis ("1st Pass");
bitrate = 0; // we dont care in pass 1 ...
ADM_assert (_ratecontrol->startPass1 ());
switch (mpegtype)
{
case ADM_SVCD:
Mpeg2encSVCD * dec;
dec = new Mpeg2encSVCD (_w, _h);
dec->setMatrix (matrix);
#ifdef ADM_1PASS_CBR
dec->disablePadding ();
//dec->init(qz,bitrate,_fps1000,interlaced,widescreen);
// dec->init(0,avg*1000,_fps1000,interlaced,widescreen);
dec->init (0, avg * 1000, _fps1000, interlaced, bff, widescreen, 1); // WLA
#else
// dec->init(q,0,_fps1000,interlaced,widescreen);
dec->init (q, 0, _fps1000, interlaced, bff, widescreen, 1); // WLA
#endif
// 6 Megabits should be enough
//dec->init(0,avg,_fps1000); // 6 Megabits should be enough
_codec = dec;
encoding->setCodec ("SVCD");
break;
case ADM_DVD:
{
Mpeg2encDVD *dec;
dec = new Mpeg2encDVD (_w, _h);
dec->setMatrix (matrix);
#ifdef ADM_1PASS_CBR
dec->disablePadding ();
// dec->init(0,avg*1000,_fps1000,interlaced,widescreen);
dec->init (0, avg * 1000, _fps1000, interlaced, bff, widescreen, 1); // WLA
#else
// dec->init(q,0,_fps1000,interlaced,widescreen);
dec->init (q, 0, _fps1000, interlaced, bff, widescreen, 1); // WLA
#endif
_codec = dec;
encoding->setCodec ("DVD");;
}
break;
default:
ADM_assert (0);
break;
}
encoding->setFrame (0, _total);
bitstream.data = _buffer_out;
for (uint32_t i = 0; i < _total; i++)
{
if (!incoming->getFrameNumberNoAlloc (i, &size, aImage, &flags))
{
GUI_Error_HIG (_("Encoding error"), NULL);
end ();
return 0;
}
if (i < MPEG_PREFILL)
{
bitstream.cleanup (i);
bitstream.in_quantizer=q;
_codec->encode (aImage, &bitstream);
//_buffer_out , &len,&flags,&outquant);
continue;
}
//.........这里部分代码省略.........
示例11: GUI_PlayAvi
//static uint8_t Vbuffer[7.0*5.6*3];
//AVDMGenericVideoStream *getFirstVideoFilter( void)
//
//_____________________________________________________________
void GUI_PlayAvi(void)
{
uint32_t time_e, time_a = 0;
uint32_t err = 0, acc = 0;
uint32_t max;
uint32_t framelen,flags;
AVDMGenericVideoStream *filter;
ADMImage *buffer=NULL;
vids = 0, auds = 0, dauds = 0;
// check we got everything...
if (!avifileinfo)
return;
if((curframe+1)>= avifileinfo->nb_frames-1)
{
printf("No frame left\n");
return;
}
if (avifileinfo->fps1000 == 0)
return;
if (playing)
{
stop_req = 1;
return;
}
uint32_t played_frame=0;
uint32_t remaining=avifileinfo->nb_frames-curframe;
if(guiOutputDisplay)
{
filter=getLastVideoFilter(curframe,remaining);
if(mode_preview)
{
editorKillPreview ();
UI_setPreviewToggleStatus( 0 );
mode_preview=0;
}
}
else
{
filter=getFirstVideoFilter(curframe,remaining );
}
max=filter->getInfo()->nb_frames;
// compute how much a frame lasts in ms
one_frame = (uint32_t) floor(1000.*1000.*10. / filter->getInfo()->fps1000);
err = one_frame % 10;
one_frame /= 10; // Duration of a frame in ms, err =leftover in 1/10 ms
buffer=new ADMImage(filter->getInfo()->width,filter->getInfo()->height);
// go to RealTime...
printf(" One frame : %lu, err=%lu ms\n", one_frame, err);
// read frame in chunk
if(!filter->getFrameNumberNoAlloc(1,&framelen,buffer,&flags))
{
printf("\n cannot read frame!\n");
goto abort_play;
}
curframe++;
played_frame++;
// prepare 1st frame
stop_req = 0;
playing = 1;
#ifdef HAVE_AUDIO
ComputePreload();
#endif
renderResize(filter->getInfo()->width,filter->getInfo()->height,currentZoom);
renderStartPlaying();
// reset timer reference
resetTime();
do
{
vids++;
renderUpdateImage(buffer->data);
if(mode_preview&&!guiOutputDisplay)
{
editorUpdatePreview(played_frame);
}
update_status_bar(buffer);
if (time_a == 0)
time_a = getTime(0);
// mark !
//printf("\n Rendering %lu frame\n",curframe);
// read frame in chunk
if((played_frame)>=(max-1))
{
printf("\n End met (%lu / %lu )\n",played_frame,max);
goto abort_play;
}
if(!filter->getFrameNumberNoAlloc(played_frame+1,&framelen,buffer,&flags))
{
printf("\n cannot read frame!\n");
//.........这里部分代码省略.........
示例12: GUI_PlayAvi
//static uint8_t Vbuffer[7.0*5.6*3];
//AVDMGenericVideoStream *getFirstVideoFilter( void)
//
//_____________________________________________________________
void GUI_PlayAvi(bool forceStop)
{
uint32_t time_e, time_a = 0;
uint32_t err = 0, acc = 0;
uint32_t max;
uint32_t framelen,flags;
AVDMGenericVideoStream *filter;
vids = 0, auds = 0, dauds = 0;
// check we got everything...
if (!avifileinfo)
return;
if((curframe+1)>= avifileinfo->nb_frames-1)
{
printf("No frame left\n");
return;
}
if (avifileinfo->fps1000 == 0)
return;
if (playing || forceStop)
{
stop_req = 1;
return;
}
uint32_t priorityLevel;
originalPriority = getpriority(PRIO_PROCESS, 0);
prefs->get(PRIORITY_PLAYBACK,&priorityLevel);
setpriority(PRIO_PROCESS, 0, ADM_getNiceValue(priorityLevel));
uint32_t played_frame=0;
uint32_t remaining=avifileinfo->nb_frames-curframe;
if(getPreviewMode()==ADM_PREVIEW_OUTPUT)
{
filter=getLastVideoFilter(curframe,remaining);
}
else
{
filter=getFirstVideoFilter(curframe,remaining );
}
max=filter->getInfo()->nb_frames;
// compute how much a frame lasts in ms
one_frame = (uint32_t) floor(1000.*1000.*10. / filter->getInfo()->fps1000);
err = one_frame % 10;
one_frame /= 10; // Duration of a frame in ms, err =leftover in 1/10 ms
// go to RealTime...
printf("One frame : %lu, err=%lu ms\n", one_frame, err);
// prepare 1st frame
stop_req = 0;
playing = 1;
#ifdef HAVE_AUDIO
ComputePreload();
#endif
//renderStartPlaying();
// reset timer reference
resetTime();
admPreview::deferDisplay(1,curframe);
admPreview::update(played_frame);
do
{
vids++;
admPreview::displayNow(played_frame);;
update_status_bar();
if (time_a == 0)
time_a = getTime(0);
// mark !
//printf("\n Rendering %lu frame\n",curframe);
// read frame in chunk
if((played_frame)>=(max-1))
{
printf("\nEnd met (%lu / %lu )\n",played_frame,max);
goto abort_play;
}
admPreview::update(played_frame+1);;
curframe++;
played_frame++;
#ifdef HAVE_AUDIO
FillAudio();
#endif
time_e = getTime(1);
//.........这里部分代码省略.........
示例13: DIA_threshold
uint8_t DIA_threshold (AVDMGenericVideoStream *in,
ADMVideoThreshold * thresholdp,
THRESHOLD_PARAM * param)
{
// Allocate space for preview video
uint32_t width = in->getInfo()->width;
uint32_t height = in->getInfo()->height;
dialog = create_threshold_dialog();
gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_register_dialog(dialog);
gtk_window_set_title (GTK_WINDOW (dialog),
QT_TR_NOOP("Threshold Configuration"));
gtk_widget_show(dialog);
myDialog = new flyThreshold (width, height, in,
WID(previewVideo), WID(previewSlider),
thresholdp, param);
g_signal_connect (GTK_OBJECT (WID(previewVideo)), "configure-event",
GTK_SIGNAL_FUNC (preview_video_configured),
gpointer (myDialog));
myDialog->upload();
myDialog->sliderChanged();
// update things when settings are changed
#define CNX(_widg,_signame) \
g_signal_connect(GTK_OBJECT(WID(_widg)), _signame, \
GTK_SIGNAL_FUNC(gui_update), (void *) (1));
// CNX (minValueSlider, "drag_data_received");
CNX (minValueSpinner, "value_changed");
// CNX (maxValueSlider, "drag_data_received");
CNX (maxValueSpinner, "value_changed");
CNX (outputValuesMenu, "changed");
g_signal_connect(GTK_OBJECT(WID(previewSlider)), "value_changed",
GTK_SIGNAL_FUNC(frame_changed), 0);
g_signal_connect(GTK_OBJECT(WID(previewVideo)), "expose_event",
GTK_SIGNAL_FUNC(gui_draw), 0);
g_signal_connect(GTK_OBJECT(WID(previewVideo)), "button_press_event",
GTK_SIGNAL_FUNC(previewButtonEvent),
gpointer(myDialog));
#if 0
g_signal_connect(GTK_OBJECT(WID(previewVideo)), "motion_notify_event",
GTK_SIGNAL_FUNC(previewMotionEvent),
gpointer(myDialog));
#endif
GtkWidget * previewOutputMenu = WID(previewOutputMenu);
uint32_t filter_count;
FILTER * filters = getCurrentVideoFilterList (&filter_count);
int32_t active = -1;
// The " + (active < 0)" below is a bit of a hack. We know that in
// on_action() in gui_filtermanager.cpp, case A_ADD, the new filter-to-be
// is added to the filter list without incrementing nb_active_filter yet.
// So if we get to the end of the list and haven't yet found the filter
// that we're configuring, we know it's a new one and therefore that it is
// one past the apparent end of the list. It's not a clean solution, but
// it seems like the cleanEST solution.
for (uint32_t i = 0; i < filter_count + (active < 0); i++)
{
const char * name
= (i == 0) ? "(input)" : filterGetNameFromTag (filters [i].tag);
bool free_name = false;
FILTER * filter = filters + i;
AVDMGenericVideoStream * source = filter->filter;
uint32_t w = source->getInfo()->width;
uint32_t h = source->getInfo()->height;
if (w != width || h != height)
{
name = g_strconcat ("XX ", name, " XX", NULL);
free_name = true;
}
printf ("filter [%d] = %s (%d) @ %p; %dx%d\n",
i, name, filter->tag, source, w, h);
gtk_combo_box_append_text (GTK_COMBO_BOX (previewOutputMenu), name);
if (filter->filter == myDialog->getSource())
{
gtk_combo_box_set_active (GTK_COMBO_BOX (previewOutputMenu), i);
printf ("\tfilter [%d] is being configured now\n", i);
active = i;
}
if (free_name)
g_free (const_cast <char *> (name));
}
//.........这里部分代码省略.........
示例14: save_regular
/*
Save as with the external mpeg2enc
*/
uint8_t mpegWritter::save_regular(char *name, ADM_MPEGTYPE mpegtype, int qz, int bitrate,int matrix,
uint8_t interlaced,
uint8_t bff, // WLA
uint8_t widescreen)
{
uint32_t size;
AVDMGenericVideoStream *incoming;
FILE *fd=NULL;
uint64_t total_size=0;
uint32_t len,flags;
uint32_t outquant;
DIA_encoding *encoding;
incoming = getLastVideoFilter (frameStart,frameEnd-frameStart);
_total=incoming->getInfo()->nb_frames;
_fps1000=incoming->getInfo()->fps1000;
if(!_total) return 0;
printf("Br:%d, qz:%d\n",bitrate,qz);
if(!_audio)
{
fd=fopen(name,"wb");
if(!fd)
{
GUI_Alert("Problem opening file!");
return 0;
}
}
else
{
assert(_audioOneFrame);
assert(_audioBuffer);
assert(_audioFifo);
assert(_videoFifo);
}
_w=incoming->getInfo()->width;
_h=incoming->getInfo()->height;
_page=_w*_h;
_page+=_page>>1;
// if(!init(name,ADM_VCD,interlaced,widescreen)) return 0;
if(!init(name,ADM_VCD,interlaced,bff,widescreen)) return 0; //WLA
printf("\n mpeg2enc init done \n");
_buffer =new uint8_t[_w*_h*2];
_buffer_out=new uint8_t[_w*_h*2];
assert( _buffer);
assert( _buffer_out);
encoding=new DIA_encoding(_fps1000);
encoding->setPhasis("Encoding.");
encoding->setFrame(0,_total);
// printf("Br:%d, qz:%d\n",bitrate,qz);
switch(mpegtype)
{
case ADM_VCD:
{
encoding->setCodec("VCD.");
Mpeg2encVCD *dec;
dec=new Mpeg2encVCD(_w,_h);
// dec->init(1,0,_fps1000,interlaced,widescreen);
dec->init(1,0,_fps1000,interlaced,bff,widescreen); // WLA
_codec=dec;
}
break;
case ADM_SVCD:
Mpeg2encSVCD *dec;
dec=new Mpeg2encSVCD(_w,_h);
dec->setMatrix(matrix);
// dec->init(qz,bitrate,_fps1000,interlaced,widescreen);
dec->init(qz,bitrate,_fps1000,interlaced,bff,widescreen);
// WLA
_codec=dec;
encoding->setCodec("SVCD.");
break;
case ADM_DVD:
{
Mpeg2encDVD *dec;
dec=new Mpeg2encDVD(_w,_h);
dec->setMatrix(matrix);
// dec->init(qz,bitrate,_fps1000,interlaced,widescreen);
dec->init(qz,bitrate,_fps1000,interlaced,bff,widescreen);
//.........这里部分代码省略.........
示例15: getFrameNumberNoAlloc
uint8_t ADMVideoFlipV::getFrameNumberNoAlloc(uint32_t frame,
uint32_t *len,
ADMImage *data,
uint32_t *flags)
{
if (frame>= _info.nb_frames)
return 0;
// read uncompressed frame
if (!_in->getFrameNumberNoAlloc(frame, len, _uncompressed, flags))
return 0;
uint8_t *in, *out;
uint32_t stride=_info.width;
uint32_t h=_info.height;
uint32_t page, qpage;
page=stride*h;
qpage=page>>2;
in=YPLANE(_uncompressed);
out=YPLANE(data)+(h-1)*stride;
// flip y
for (uint32_t y=h; y>0; y--)
{
memcpy(out,in,stride);
in+=stride;
out-=stride;
}
// Flip U & V
stride>>=1;
in=UPLANE(_uncompressed);
out=UPLANE(data)+qpage-stride;
// flip u
for (uint32_t y=h>>1; y>0; y--)
{
memcpy(out,in,stride);
in+=stride;
out-=stride;
}
in=VPLANE(_uncompressed);
out=VPLANE(data)+qpage-stride;
// flip u
for (uint32_t y=h>>1; y>0; y--)
{
memcpy(out,in,stride);
in+=stride;
out-=stride;
}
data->copyInfo(_uncompressed);
return 1;
}