+
+ job->list_work = hb_list_init();
+
+ hb_log( "starting job" );
+
+ if( job->anamorphic.mode )
+ {
+ hb_set_anamorphic_size(job, &job->width, &job->height, &job->anamorphic.par_width, &job->anamorphic.par_height);
+
+ if( job->vcodec == HB_VCODEC_FFMPEG )
+ {
+ /* Just to make working with ffmpeg even more fun,
+ lavc's MPEG-4 encoder can't handle PAR values >= 255,
+ even though AVRational does. Adjusting downwards
+ distorts the display aspect slightly, but such is life. */
+ while ((job->anamorphic.par_width & ~0xFF) ||
+ (job->anamorphic.par_height & ~0xFF))
+ {
+ job->anamorphic.par_width >>= 1;
+ job->anamorphic.par_height >>= 1;
+ }
+ }
+ }
+
+ /* Keep width and height within these boundaries,
+ but ignore for anamorphic. For "loose" anamorphic encodes,
+ this stuff is covered in the pixel_ratio section above. */
+ if ( job->maxHeight && ( job->height > job->maxHeight ) && ( !job->anamorphic.mode ) )
+ {
+ job->height = job->maxHeight;
+ hb_fix_aspect( job, HB_KEEP_HEIGHT );
+ hb_log( "Height out of bounds, scaling down to %i", job->maxHeight );
+ hb_log( "New dimensions %i * %i", job->width, job->height );
+ }
+ if ( job->maxWidth && ( job->width > job->maxWidth ) && ( !job->anamorphic.mode ) )
+ {
+ job->width = job->maxWidth;
+ hb_fix_aspect( job, HB_KEEP_WIDTH );
+ hb_log( "Width out of bounds, scaling down to %i", job->maxWidth );
+ hb_log( "New dimensions %i * %i", job->width, job->height );
+ }
+
+ if( job->mux & HB_MUX_AVI )
+ {
+ // The concept of variable frame rate video was a bit too advanced
+ // for Microsoft so AVI doesn't support it. Since almost all dvd
+ // video is VFR we have to convert it to constant frame rate to
+ // put it in an AVI container. So duplicate, drop and
+ // otherwise trash video frames to appease the gods of Redmond.
+ job->cfr = 1;
+ }
+
+ if ( job->cfr == 0 )