1
/*==============================================================================
3
FICHIER : [dvdbackup.c]
5
DATE : 2006/01/0005 20:56:20
10
* encoding UTF8 !-UTF8-!
11
Released under GPL license, see gnu.org
12
================================================================================
14
==============================================================================*/
15
#define __USE_LARGEFILE64
16
#define _LARGEFILE64_SOURCE
30
/* fopen is 64-bit aware on Mac OS X */
31
#define fopen64(A,B) fopen(A,B)
34
#define CTEST(x) /***/
39
#include "dvdformat.h"
44
#include "interface.h"
47
#include "avancement.h"
56
#include "../dvdauthor/libauthor.h"
57
#include "vapcontext.h"
61
static char TitreDvd[128];
63
static CellArray_t CellArray;
64
static TitleArray_t TitleArray;
67
static FILE * OutFpVideo; /* Video file pointer */
68
static long long OutSize;
69
static long long TotalSize;
72
static uint32_t Position;
74
static unsigned char TempBuf[DVD_VIDEO_LB_LEN * 2];
75
static int TempSize = 0;
89
/*@$#[dvd2avi.c] static proto. AutoProtoSigV1.1. date: 2009/01/28 21:19:17 */
95
static int Output PROTO((unsigned char *buffer, int len, char *targetDir));
96
static void MakeRoom PROTO((VapContext_t *c, int size));
97
static uint32_t _FindNextVobu PROTO((VapContext_t *c));
98
static int Readin PROTO((void *parm, unsigned char *buffer, int size));
99
static int OutputFlux PROTO((void *parm, unsigned char *buffer, int size));
100
static int CopyCell PROTO((Cell_t *c, char *targetDir));
101
static void FreeAll PROTO((void));
102
static int _readline PROTO((FILE *fp, char *line, int size));
103
static double GetAspectRatio PROTO((int noPisteVideo));
104
static void GetPictureSizes PROTO((int noPisteVideo, Profile_t *p, int cx, int cy, int *sx, int *sy, int bitrate));
105
static int CropDetection PROTO((char *iFile, char *cropParam));
106
static char *ComputeCmdLine PROTO((Profile_t *profile, EncodingInfos_t *infos, int passNo));
107
static long long GetVobSize PROTO((int noPisteVideo));
111
/*@$% end of AutoProtoSigV1.1 (Dont remove this line) [-I ../include]*/
113
/*------------------------------------------------------------------------------
115
Linux!jef 2006/01/03 21:05:50
116
------------------------------------------------------------------------------*/
118
static int Output( buffer, len, targetDir )
119
unsigned char * buffer;
123
unsigned char * cBuff;
125
if( !TempSize && len == DVD_VIDEO_LB_LEN ) {
130
//!! fprintf(stderr,"Output: len %d TempSize: %d\n", len, TempSize );
131
tc_memcpy( TempBuf + TempSize, buffer, len );
135
if( TempSize >= DVD_VIDEO_LB_LEN ) {
137
if( !isNavPack( cBuff ) ) {
138
Mpeg2Demux( cBuff, DVD_VIDEO_LB_LEN );
140
if( fwrite( cBuff, 1, DVD_VIDEO_LB_LEN, OutFpVideo ) != DVD_VIDEO_LB_LEN ) return( -1 );
141
OutSize += DVD_VIDEO_LB_LEN;
142
TotalSize += DVD_VIDEO_LB_LEN;
143
SetTotalSize( TotalSize );
145
TempSize -= DVD_VIDEO_LB_LEN;
146
if( TempSize > 0 ) tc_memcpy( cBuff, cBuff + DVD_VIDEO_LB_LEN, TempSize );
150
/*------------------------------------------------------------------------------
152
Linux!jef 2006/01/24 22:46:53
153
------------------------------------------------------------------------------*/
155
static void MakeRoom( VapContext_t * c, int size )
157
// DBG('b',fprintf(stderr,"%s: size: %d\n", __FUNCTION__, size ););
159
if( c->bufASize < (c->bufSize + size) ) {
160
if( c->bufPtr != c->buf ) {
161
memmove( c->buf, c->bufPtr, c->bufSize );
164
c->bufASize = c->bufSize + size;
165
c->buf = realloc( c->buf, c->bufASize );
174
/*------------------------------------------------------------------------------
176
Linux!jef 2007/08/16 01:37:18
177
------------------------------------------------------------------------------*/
179
static uint32_t _FindNextVobu( c )
182
vobu_admap_t * vobu_admap;
185
vobu_admap = c->cell->ifo->vts_vobu_admap;
186
length = vobu_admap->last_byte + 1 - VOBU_ADMAP_SIZE;
188
for( i = 0; i < length/sizeof(uint32_t); i++) {
189
// DBG('b',fprintf(stderr,"%s: vobu at sector: %d\n", __FUNCTION__, vobu_admap->vobu_start_sectors[i] ););
190
/* Vobu adress map seems to be ordered */
191
if( vobu_admap->vobu_start_sectors[i] > c->sector) {
192
DBG('b',fprintf(stderr,"%s: returning next vobu at sector: %d\n", __FUNCTION__, vobu_admap->vobu_start_sectors[i] ););
193
return( vobu_admap->vobu_start_sectors[i] );
195
// if( vobu_admap->vobu_start_sectors[i] == c->sector) {
196
// return( vobu_admap->vobu_start_sectors[i+1] );
199
DBG('b',fprintf(stderr,"%s: nextvobu notfound for sector: %d\n", __FUNCTION__, c->sector ););
200
return( SRI_END_OF_CELL );
203
/*------------------------------------------------------------------------------
205
Linux!jef 2006/01/24 22:28:46
206
------------------------------------------------------------------------------*/
208
static int Readin( void * parm, unsigned char * buffer, int size )
210
VapContext_t * c = (VapContext_t *) parm;
217
// DBG('b',fprintf(stderr,"%s: size: %d inBuf: %d\n", __FUNCTION__, size, c->bufSize ););
220
len = MyMin( size, c->bufSize );
222
tc_memcpy( buffer, c->bufPtr, len );
230
// DBG('b',fprintf(stderr,"%s: readed: %d\n", __FUNCTION__, readed ););
234
if( c->dsi_next_vobu == SRI_END_OF_CELL ) {
235
if( readed ) return( readed );
237
// DBG('b',fprintf(stderr,"%s: EOF\n", __FUNCTION__ ););
238
return( 0 ); /* EOF */
242
MakeRoom( c, DVD_VIDEO_LB_LEN );
243
len = MyDVDRead1Block( c->file_handle, c->sector, c->bufPtr );
244
if( len == -1 ) return( -1 );
245
/* parse contained DSI pack */
246
navRead_DSI( &dsi_pack, c->bufPtr + DSI_START_BYTE );
247
if( len == 0 || dsi_pack.dsi_gi.nv_pck_lbn != c->sector ) {
248
CreateDummyNavPack( c->bufPtr, c->sector );
250
c->dsi_next_vobu = _FindNextVobu( c );
253
len = DVD_VIDEO_LB_LEN;
257
if( AvancementUi( NULL ) < 0 ) return( -1 );
259
MakeRoom( c, 1 * DVD_VIDEO_LB_LEN );
260
CreateDummyPack( c->bufPtr + DVD_VIDEO_LB_LEN );
265
unsigned char * cBuff;
267
nsectors = dsi_pack.dsi_gi.vobu_ea;
268
if( !nsectors ) { /* Protected dvd ? */
269
DBG('b',fprintf(stderr,"%s: no sectors in DSI !\n", __FUNCTION__););
270
return( 0 ); /* EOF */
272
c->dsi_next_vobu = dsi_pack.vobu_sri.next_vobu;
274
MakeRoom( c, nsectors*DVD_VIDEO_LB_LEN );
275
cBuff = c->bufPtr + DVD_VIDEO_LB_LEN;
277
for( i = 0; i < nsectors; i++ ) {
278
len = MyDVDRead1Block( c->file_handle, c->sector + 1 + i, cBuff );
279
// fprintf(stderr,"PACK: MyDVDRead1Block(%d)=%d\n", c->sector+1+i, len );
280
if( len == -1 ) return( -1 );
282
CreateDummyPack( cBuff );
286
cBuff += DVD_VIDEO_LB_LEN;
289
len = nsectors * DVD_VIDEO_LB_LEN;
293
if( AvancementUi( NULL ) < 0 ) return( -1 );
295
c->sector = c->dsi_next_vobu;
296
c->dsi_next_vobu = 0;
299
c->sector += (c->dsi_next_vobu & 0x7fffffff);
301
return( readed + Readin( parm, buffer, size ) );
304
/*------------------------------------------------------------------------------
306
Linux!jef 2006/01/24 23:07:28
307
------------------------------------------------------------------------------*/
309
static int OutputFlux( void * parm, unsigned char * buffer, int size )
311
VapContext_t * c = (VapContext_t *) parm;
314
// DBG('b',fprintf(stderr,"%s: size: %d\n", __FUNCTION__, size ););
316
int len = MyMin( size, DVD_VIDEO_LB_LEN );
318
if( Output( buffer, len, c->targetDir ) < 0 ) {
328
/*------------------------------------------------------------------------------
330
Linux!jef 2005/12/28 22:01:08
331
------------------------------------------------------------------------------*/
333
static int CopyCell( Cell_t * c, char * targetDir )
336
dvd_file_t * file_handle;
341
if( !c->selected ) return( 0 );
343
DBG('b',fprintf(stderr,"%s: startSector: %u lastSector: %u vts: %d\n", __FUNCTION__, c->startSector, c->lastSector, c->vts ););
345
size = c->lastSector - c->startSector;
346
DisplayAvancement( _("Copie de la cellule %d (%d secteurs)\n"), c->chapter + 1, size);
347
InitAvancement( size );
348
file_handle = DVDOpenFile( Dvd, c->vts, DVD_READ_TITLE_VOBS);
352
memset( &vc, 0, sizeof(vc));
353
/* Initialize Vaporize context */
354
vc.file_handle = file_handle;
355
vc.sector = c->startSector;
357
vc.targetDir = targetDir;
358
lSize = (long long) size * (long long) DVD_VIDEO_LB_LEN;
359
ret = Vaporize( lSize, &vc );
364
DVDCloseFile( file_handle );
369
/*------------------------------------------------------------------------------
371
Linux!jef 2006/01/16 22:10:25
372
------------------------------------------------------------------------------*/
374
static void FreeAll()
378
if( TitleArray.nbTitles ) {
379
for( i = 0; i < TitleArray.nbTitles; i++ ) {
380
FreeCellArray( &TitleArray.titles[i].ca );
382
free( TitleArray.titles );
383
TitleArray.titles = NULL;
384
TitleArray.nbTitles = 0;
386
FreeCellArray( &CellArray );
388
/*------------------------------------------------------------------------------
390
Linux!jef 2006/02/16 22:58:23
391
------------------------------------------------------------------------------*/
393
static int _readline( FILE * fp, char * line, int size )
401
if( c == EOF ) break;
402
if( c == '\r' ) c = '\n';
406
if( c == '\n' ) break;
411
/*------------------------------------------------------------------------------
413
Linux!jef 2005/12/20 22:17:17
414
------------------------------------------------------------------------------*/
416
int ExecuteFfmpeg( char * sysCmd, int duree )
424
/* re-direct stderr */
425
strcat( sysCmd, " 2>&1" );
426
DBG('c',fprintf(stderr,"%s: executing (%s) duree: %d\n", __FUNCTION__, sysCmd, duree ););
427
fp = my_popen( sysCmd, "r" );
428
if( !fp ) return( -1 );
434
if( !_readline( fp, line, sizeof(line))) break;
435
if( !*line ) continue;
436
// fprintf(stderr,"line(%s)\n", line );
437
p = strstr( line, "time=" );
445
pct = ( where ) / (double) duree;;
446
// fprintf(stderr,"%f/%d = %f%%\n", where, duree, pct );
448
if( AvancementUi2( pct ) < 0 ) { res = -1; break; }
455
res = my_pclose( fp );
456
DBG('c',fprintf(stderr,"%s: result= %d\n", __FUNCTION__, res ););
457
if( res != 0 ) res = -1;
460
/*------------------------------------------------------------------------------
462
Linux!jef 2005/12/20 22:17:17
463
------------------------------------------------------------------------------*/
465
int ExecuteMencoder( char * sysCmd, int duree )
473
/* re-direct stderr */
474
strcat( sysCmd, " 2>&1" );
475
DBG('c',fprintf(stderr,"%s: executing (%s) duree: %d\n", __FUNCTION__, sysCmd, duree ););
476
fp = my_popen( sysCmd, "r" );
477
if( !fp ) return( -1 );
483
if( !_readline( fp, line, sizeof(line))) break;
484
if( !*line ) continue;
485
// fprintf(stderr,"line(%s)\n", line );
486
p = strstr( line, "Pos:" );
492
while( *p == ' ' ) p++;
495
pct = ( where ) / (double) duree;;
496
// fprintf(stderr,"%f/%d = %f%%\n", where, duree, pct );
498
if( AvancementUi2( pct ) < 0 ) { res = -1; break; }
505
res = my_pclose( fp );
506
DBG('c',fprintf(stderr,"%s: result= %d\n", __FUNCTION__, res ););
507
if( res != 0 ) res = -1;
510
/***************************************************************************//**
512
* @date 2009/01/19 22:11:49
518
* @param[in] Pas de detail
519
* @param[out] Pas de detail
520
*******************************************************************************/
522
static double GetAspectRatio( int noPisteVideo )
524
ifo_handle_t * ifo = Ifo[Ifo_zero->tt_srpt->title[noPisteVideo].title_set_nr];
525
vtsi_mat_t *vtsi_mat = ifo->vtsi_mat;
526
video_attr_t *video_attr;
527
char *aspect_ratio[4] = {"4:3", "16:9", "4:3", "16:9"};
529
video_attr = &vtsi_mat->vts_video_attr;
531
if( *aspect_ratio[video_attr->display_aspect_ratio] == '4' )
535
/***************************************************************************//**
537
* @date 2009/01/20 20:49:21
543
* @param[in] Pas de detail
544
* @param[out] Pas de detail
545
*******************************************************************************/
547
static void GetPictureSizes( int noPisteVideo, Profile_t * p, int cx, int cy, int * sx, int * sy, int bitrate )
549
char *aspect_ratio[4] = {"4:3", "16:9", "4:3", "16:9"};
550
double video_height[4] = { 480, 576, 576, 576 };
551
double video_width[4] = { 720, 704, 352, 352};
552
ifo_handle_t * ifo = Ifo[Ifo_zero->tt_srpt->title[noPisteVideo].title_set_nr];
553
vtsi_mat_t *vtsi_mat = ifo->vtsi_mat;
554
video_attr_t *video_attr;
562
video_attr = &vtsi_mat->vts_video_attr;
564
if( *aspect_ratio[video_attr->display_aspect_ratio] == '4' ) {
566
PRdvd = video_width[video_attr->picture_size] / video_height[video_attr->video_format];
570
PRdvd = video_width[video_attr->picture_size] / video_height[video_attr->video_format];
572
ARc = ( (double)cx * ( ARa / PRdvd)) / (double)cy;
573
resY = rint(sqrt( (double)bitrate / 25.0 / ARc / CQ ) / 16.0) * 16.0;
574
resX = rint( resY * ARc / 16.0 ) * 16.0;
575
/* Protect orginal sizes if bigger */
576
if( resX >= cx || resY >= cy ) {
581
DBG( 'b',fprintf(stderr,"%s: ARa=%f\n", __FUNCTION__, ARa ););
582
DBG( 'b',fprintf(stderr,"%s: PRdvd=%f\n", __FUNCTION__, PRdvd ););
583
DBG( 'b',fprintf(stderr,"%s: ARc=%f\n", __FUNCTION__, ARc ););
584
DBG( 'b',fprintf(stderr,"%s: ResX=%f\n", __FUNCTION__, resX ););
585
DBG( 'b',fprintf(stderr,"%s: ResY=%f\n", __FUNCTION__, resY ););
591
/***************************************************************************//**
593
* @date 2009/01/19 22:50:34
599
* @param[in] Pas de detail
600
* @param[out] Pas de detail
601
*******************************************************************************/
603
static int CropDetection( char * iFile, char * cropParam )
612
int frames = duree * 25;
615
sprintf( sysCmd, "mplayer -vo null -ao null -ss %d -frames %d -nosound -speed 100 -vf cropdetect %s", startPos, frames, iFile );
616
strcat( sysCmd, " 2>&1" );
617
DBG('c',fprintf(stderr,"%s: executing (%s)\n", __FUNCTION__, sysCmd ););
618
fp = my_popen( sysCmd, "r" );
619
if( !fp ) return( -1 );
620
DisplayAvancement( _("Détection des bandes noires\n"));
627
if( !_readline( fp, line, sizeof(line))) break;
628
if( !*line ) continue;
629
// fprintf(stderr,"line(%s)\n", line );
630
p = strstr( line, "crop=" );
636
while( *p && *p != ')' ) p++;
639
strcpy( cropParam, pStart );
642
p = strstr( line, "V:" );
648
while( *p == ' ' ) p++;
649
where = atof( p ) - startPos;
651
pct = ( where ) / (double) duree;;
652
// fprintf(stderr,"(%s) %f/%d = %f%%\n", line, where, duree, pct );
653
if( pct >= 0.0 && pct <= 1.0 && pct > lPct ) {
654
if( AvancementUi2( pct ) < 0 ) { res = -1; break; }
659
res = my_pclose( fp );
660
DBG('c',fprintf(stderr,"%s: result= %d\n", __FUNCTION__, res ););
661
if( res != 0 ) res = -1;
664
/***************************************************************************//**
666
* @date 2009/01/19 21:47:44
672
* @param[in] Pas de detail
673
* @param[out] Pas de detail
674
*******************************************************************************/
676
static char * ComputeCmdLine( Profile_t * profile, EncodingInfos_t * infos, int passNo )
678
char * oLine = malloc( 10240 ); /* KK */
683
iLine = profile->pass1Opt;
685
iLine = profile->pass2Opt;
687
strcpy( p, profile->encTool );
692
if( *iLine == '%' ) {
695
sprintf( p, "%d", infos->bitrate );
699
sprintf( p, "%.5f", infos->aspect );
703
strcpy( p, infos->vobFile );
707
strcpy( p, infos->aviFile );
711
strcpy( p, infos->logFile );
715
strcpy( p, infos->cropParam );
719
sprintf( p, "%d", GetNumCpu() );
723
sprintf( p, "%d", infos->scaleX );
727
sprintf( p, "%d", infos->scaleY );
740
/***************************************************************************//**
742
* @date 2009/01/21 20:53:40
748
* @param[in] Pas de detail
749
* @param[out] Pas de detail
750
*******************************************************************************/
752
static long long GetVobSize( int noPisteVideo )
754
int totalSectors = 0;
757
for( i = 0; i < CellArray.nbCells; i++ ) {
758
Cell_t * c = CellArray.cells + i;
760
if( c->selected ) totalSectors += SECTOR_SZ(c);
762
return( (long long)totalSectors * (long long) DVD_BLOCK_LEN );
766
/*------------------------------------------------------------------------------
768
Linux!jef 2005/12/12 22:36:50
769
------------------------------------------------------------------------------*/
771
int DvdToAvi( GtkWidget * forme, int noPisteVideo, AudioMap_t * audioMap, SubMap_t * subMap, int format )
774
char * tmpDir = ConfigGetString( KEY_TEMP, "/tmp" );
775
char * isoDir = ConfigGetString( KEY_ISODIR, "/tmp" );
776
int lastCellF = ConfigGetInt( KEY_GENERIQUE, 0 );
782
char injectionFile[100];
788
Profile_t * profile = GetProfile( format );
794
DBG('b',fprintf(stderr,"%s: format: %d\n", __FUNCTION__, format ););
795
if( !profile ) return(-1);
797
/* Verify we have enought free space to extract */
798
fsize = FsFree( tmpDir ) - GetVobSize( noPisteVideo );
801
MessageBoxError( _("Pas assez de place sur %s\nIl manque %s octets !"), tmpDir, LLSize2Giga( -fsize ) );
804
/* Verify we have enought free space to encode */
805
fsize = FsFree( isoDir ) - profile->fileSize;
808
MessageBoxError( _("Pas assez de place sur %s\nIl manque %s octets !"), isoDir, LLSize2Giga( -fsize ) );
811
/* Verify that we can create a file on isodir */
812
if( CanCreateFile( isoDir ) == 0 ) {
814
MessageBoxError( _("Pas le droit de créer de fichier dans %s !"), isoDir );
817
/* Verify number of audio tracks selected */
818
for( i = 0; i < MAX_AUDIO_TRACK; i++ ) {
819
if( audioMap->audioTracks[i] ) nbAudio++;
823
MessageBoxError( _("Sélectionnez qu'un seule piste audio !") );
827
/* Reprise du titre du DVD */
828
item = lookup_widget(GTK_WIDGET(forme), "titre" );
829
text = gtk_entry_get_text( GTK_ENTRY(item) );
830
strcpy( TitreDvd, text );
832
FreeCellArray( &CellArray );
833
BuildCells( noPisteVideo, &CellArray, lastCellF );
839
CreateAvancement( forme );
841
nbSteps = CountSelectedCells( &CellArray ) + profile->passNb;
842
SetTotalSteps( nbSteps );
844
DisplayAvancement( _("Copie de %d cellules.\n"), CountSelectedCells( &CellArray ) );
845
/* Create empty filesystem tree */
846
DisplayAvancement( _("Effacement des anciens fichiers.\n"));
848
sprintf( injectionFile, "%s/vapinj.%d", tmpDir, getpid());
849
sprintf( targetDir, "%s/%s", tmpDir, TitreDvd );
850
sprintf( aviFile, "%s/%s.%s", isoDir, TitreDvd, profile->extension );
851
sprintf( vobFile, "%s/%s.vob", tmpDir, TitreDvd );
852
sprintf( logFile, "%s/%s.log", tmpDir, TitreDvd );
854
if( FileExist( vobFile ) == 1 ) {
855
res = MessageBoxYesNo( _("Le fichier %s existe. L'utiliser ?"), vobFile );
862
OutFpVideo = fopen64( vobFile, "w" );
865
MessageBoxError( _("Création de %s impossible !"), vobFile );
870
/* Setup vaporizer */
871
if( VaporizeInit( Readin, OutputFlux, 1 ) < 0 ) {
874
/* Setup tracks & factor */
875
for( i = 0; i < MAX_AUDIO_TRACK; i++ ) {
876
if( audioMap->audioTracks[i] ) {
877
int id = GetAudioId( noPisteVideo, i );
879
DBG('b',fprintf(stderr,"%s: VaporizeAudio(%d)\n", __FUNCTION__, id ););
885
VaporizeFactor( 1.0f, 0 );
886
VaporizeInjection( injectionFile );
889
for( i = 0; i < CellArray.nbCells; i++ ) {
890
Cell_t * c = CellArray.cells + i;
892
if( CopyCell( c, targetDir ) < 0 ) {
896
if( c->selected ) NewStep();
905
VaporizeSizes( &vVideoSize, &vAudioSize, &vSubpSize, &vNavSize );
907
DBG( 'b',fprintf(stderr,"VAPORIZE VIDEO SIZE: %lld\n", (long long)vVideoSize * DVD_BLOCK_LEN ););
908
DBG( 'b',fprintf(stderr,"VAPORIZE AUDIO SIZE: %lld\n", (long long)vAudioSize * DVD_BLOCK_LEN ););
909
DBG( 'b',fprintf(stderr,"VAPORIZE SUBP SIZE: %lld\n", (long long)vSubpSize * DVD_BLOCK_LEN ););
910
DBG( 'b',fprintf(stderr,"VAPORIZE NAV SIZE: %lld\n", (long long)vNavSize * DVD_BLOCK_LEN ););
917
if( OutFpVideo ) { fclose( OutFpVideo ); OutFpVideo = NULL; }
923
/* Here calculate bitrate */
929
char cropParam[1024];
931
EncodingInfos_t infos;
935
TotalAudioSize( noPisteVideo, &duree );
936
infos.aspect = GetAspectRatio( noPisteVideo );
938
audioSize = ( (double)profile->audioBitrate * (double)duree ) / 8.0;
939
videoSize = profile->fileSize - audioSize;
940
videoSize -= videoSize * profile->overhead; /* Apply container overhead */
941
bitrate = ( videoSize * 8.0 ) / (double)duree;
943
infos.bitrate = rint(bitrate);
945
DBG( 'b',fprintf(stderr,"Bitrate: %dK\n", infos.bitrate ););
947
CropDetection( vobFile, cropParam );
948
infos.cropParam = cropParam;
949
/* Parse croping params */
950
if( sscanf( cropParam, "%d:%d:%d:%d", &cx,&cy,&dx,&dy ) != 4 ) {
954
GetPictureSizes( noPisteVideo, profile, cx, cy, &infos.scaleX, &infos.scaleY, infos.bitrate );
955
infos.vobFile = vobFile;
956
infos.aviFile = aviFile;
957
infos.logFile = logFile;
960
if( !strcmp( profile->encTool, "ffmpeg" ) ) {
961
cmdLine = ComputeCmdLine( profile, &infos, 1 );
962
DBG( 'b',fprintf(stderr,"COMMANDLINE: %s\n", cmdLine ););
963
DisplayAvancement( _("Encodage\n"));
964
ret = ExecuteFfmpeg( cmdLine, duree );
965
// if( !ret ) FixAvi( aviFile );
968
if( !strcmp( profile->encTool, "mencoder" ) ) {
972
for( i = 0; i < profile->passNb; i++ ) {
973
cmdLine = ComputeCmdLine( profile, &infos, i+1 );
974
DBG( 'b',fprintf(stderr,"COMMANDLINE: %s\n", cmdLine ););
975
DisplayAvancement( _("Encodage passe %d\n"), i+1);
976
res = ExecuteMencoder( cmdLine, duree );
979
if( IsUserStop() && i == 0 && profile->passNb > 1 ) {
980
res = MessageBoxYesNo( _("Continuer en passe 2 ?") );
998
res = MessageBoxYesNo( _("Conserver le fichier vob pour un autre encodage ?") );
999
if( res != 1 ) vobOk = 0;
1001
if( !vobOk ) unlink( vobFile );
1003
if( ret == -1 && aviDone ) {
1004
res = MessageBoxYesNo( _("Conserver le fichier %s ?"), aviFile );
1005
if( res != 1 ) unlink( aviFile );