|
Lines 6-17
Link Here
|
| 6 |
#include <stdlib.h> |
6 |
#include <stdlib.h> |
| 7 |
#include <string.h> |
7 |
#include <string.h> |
| 8 |
#include <math.h> |
8 |
#include <math.h> |
|
|
9 |
#include <sys/types.h> |
| 10 |
#include <sys/stat.h> |
| 11 |
#include <unistd.h> |
| 9 |
|
12 |
|
| 10 |
#ifdef VDRRIP_DVD |
13 |
#ifdef VDRRIP_DVD |
| 11 |
#include <dvdnav/ifo_read.h> |
14 |
#include <dvdnav/ifo_read.h> |
| 12 |
#endif //VDRRIP_DVD |
15 |
#endif //VDRRIP_DVD |
| 13 |
|
16 |
|
| 14 |
#include <vdr/plugin.h> |
17 |
#include <vdr/plugin.h> |
|
|
18 |
#include <vdr/recording.h> |
| 15 |
|
19 |
|
| 16 |
#include "movie.h" |
20 |
#include "movie.h" |
| 17 |
#include "menu-vdrrip.h" |
21 |
#include "menu-vdrrip.h" |
|
Lines 21-30
Link Here
|
| 21 |
|
25 |
|
| 22 |
#define SAVEFILE "save.vdrrip" |
26 |
#define SAVEFILE "save.vdrrip" |
| 23 |
|
27 |
|
| 24 |
#define IDENTCMD "%s \'%s\'%s -identify -frames 0 2>/dev/null | sed -e \'s/[`\\!$\"]/\\&/g\'" |
28 |
#define DVDIDENT "%s \'%s\'%s -identify -vo null -ao null -frames 1 2>/dev/null | sed -e \'s/[`\\!$\"]/\\&/g\'" |
| 25 |
#define CROPCMD "%s \'%s\'%s -vo null -ao null -really-quiet -ss %i -frames %i -vop cropdetect 2>/dev/null | grep \"crop=\" | sed \"s/.*crop\\(.*\\)).*/\\1/\" | sort | uniq -c | sort -r" |
29 |
#define DVDCROP "%s \'%s\'%s -vo null -ao null -quiet -ss %i -frames %i -vf cropdetect 2>/dev/null | sed -ne \'/crop=/ s/.*crop\\(=.*\\)).*/\\1/p\' | sort | uniq -c | sort -nr" |
| 26 |
#define AUDIOCMD "%s \'%s/001.vdr\' -vo null -ao null -frames 0 -aid %i 2>/dev/null | grep AUDIO" |
30 |
#define DVDAUDIO "%s %s -vo null -ao null -frames 0 -aid %i 2>/dev/null | grep AUDIO" |
| 27 |
#define AUDIOCMDDVD "%s %s -vo null -ao null -frames 0 -aid %i 2>/dev/null | grep AUDIO" |
31 |
|
|
|
32 |
#define VDRIDENT "%s \'%s\'%s -identify -vo null -ao null -frames 1 2>/dev/null | sed -e \'s/[`\\!$\"]/\\&/g\'" |
| 33 |
#define VDRCROP "%s \'%s\'%s -vo null -ao null -quiet -sb %lld -frames %i -vf cropdetect 2>/dev/null | sed -ne \'/crop=/ s/.*crop\\(=.*\\)).*/\\1/p\' | sort | uniq -c | sort -nr" |
| 34 |
#define VDRAUDIO "%s \'%s/001.vdr\' -vo null -ao null -frames 0 -aid %i 2>/dev/null | grep AUDIO" |
| 35 |
|
| 28 |
#define MENCCMD "%s %s help 2>/dev/null" |
36 |
#define MENCCMD "%s %s help 2>/dev/null" |
| 29 |
|
37 |
|
| 30 |
// --- cMovie ------------------------------------------------------------ |
38 |
// --- cMovie ------------------------------------------------------------ |
|
Lines 38-44
Link Here
|
| 38 |
StrTitles = NULL; |
46 |
StrTitles = NULL; |
| 39 |
#endif //VDRRIP_DVD |
47 |
#endif //VDRRIP_DVD |
| 40 |
|
48 |
|
| 41 |
Dir = OrigName = Name = PPValues = NULL; |
49 |
Dir = Marks = Name = OrigName = PPValues = NULL; |
| 42 |
A = NULL; |
50 |
A = NULL; |
| 43 |
StrAudioData = StrAudioData2 = NULL; |
51 |
StrAudioData = StrAudioData2 = NULL; |
| 44 |
|
52 |
|
|
Lines 78-83
Link Here
|
| 78 |
setLengthVDR(); |
86 |
setLengthVDR(); |
| 79 |
queryMpValuesVDR(); |
87 |
queryMpValuesVDR(); |
| 80 |
queryAudioDataVDR(); |
88 |
queryAudioDataVDR(); |
|
|
89 |
setMarks(); |
| 81 |
|
90 |
|
| 82 |
if (! restoreMovieData()) { |
91 |
if (! restoreMovieData()) { |
| 83 |
// set to default template |
92 |
// set to default template |
|
Lines 167-174
Link Here
|
| 167 |
int cMovie::getFileNumbers() {return FileNumbers;} |
176 |
int cMovie::getFileNumbers() {return FileNumbers;} |
| 168 |
|
177 |
|
| 169 |
void cMovie::setBitrate(int v, int a) { |
178 |
void cMovie::setBitrate(int v, int a) { |
| 170 |
// avoid BitrateAudio < 32 |
179 |
// set audio bitrates and avoid BitrateAudio < 32 |
| 171 |
if (a < 32 && strcmp(C->getACodec(ACodec), "copy") != 0) {a = 32;} |
180 |
if (ACodec == C->getNumACodec("copy")) { a = A[AudioID].Bitrate; } |
|
|
181 |
else { if (a < 32) {a = 32;} } |
| 172 |
BitrateAudio = a; |
182 |
BitrateAudio = a; |
| 173 |
|
183 |
|
| 174 |
if (v == -1) { |
184 |
if (v == -1) { |
|
Lines 259-265
Link Here
|
| 259 |
ScaleHeight = height; |
269 |
ScaleHeight = height; |
| 260 |
} |
270 |
} |
| 261 |
|
271 |
|
|
|
272 |
void cMovie::setCropValues(int width, int height, int posx, int posy) { |
| 273 |
setCropValues(width, height); |
| 274 |
|
| 275 |
if (posx > Width - CropWidth) { CropPosX = Width - CropWidth; } |
| 276 |
else if (posx < 0) { CropPosX = 0; } |
| 277 |
else { CropPosX = posx; } |
| 278 |
|
| 279 |
if (posy > Height - CropHeight) { CropPosY = Height - CropHeight; } |
| 280 |
else if (posy < 0) { CropPosY = 0; } |
| 281 |
else { CropPosY = posy; } |
| 282 |
} |
| 283 |
|
| 262 |
void cMovie::setCropValues(int width, int height) { |
284 |
void cMovie::setCropValues(int width, int height) { |
|
|
285 |
CalcAspect = Aspect; |
| 286 |
|
| 263 |
CropWidth = width; |
287 |
CropWidth = width; |
| 264 |
if (CropWidth > Width) CropWidth = Width; |
288 |
if (CropWidth > Width) CropWidth = Width; |
| 265 |
|
289 |
|
|
Lines 267-280
Link Here
|
| 267 |
if (CropHeight > Height) CropHeight = Height; |
291 |
if (CropHeight > Height) CropHeight = Height; |
| 268 |
|
292 |
|
| 269 |
if (CropWidth == -1) CropPosX = -1; |
293 |
if (CropWidth == -1) CropPosX = -1; |
| 270 |
else CropPosX = (Width - CropWidth) / 2; |
294 |
else { |
|
|
295 |
CropPosX = (Width - CropWidth) / 2; |
| 296 |
CalcAspect = CropWidth * CalcAspect / Width; |
| 297 |
} |
| 271 |
|
298 |
|
| 272 |
if (CropHeight == -1) { |
299 |
if (CropHeight == -1) {CropPosY = -1;} |
| 273 |
CropPosY = -1; |
300 |
else { |
| 274 |
CalcAspect = Aspect; |
|
|
| 275 |
} else { |
| 276 |
CropPosY = (Height - CropHeight) / 2; |
301 |
CropPosY = (Height - CropHeight) / 2; |
| 277 |
CalcAspect = Height * Aspect / CropHeight; |
302 |
CalcAspect = Height * CalcAspect / CropHeight; |
| 278 |
} |
303 |
} |
| 279 |
|
304 |
|
| 280 |
setScale(); |
305 |
setScale(); |
|
Lines 285-356
Link Here
|
| 285 |
char *cmd = NULL, *buf = NULL; |
310 |
char *cmd = NULL, *buf = NULL; |
| 286 |
bool ret = true; |
311 |
bool ret = true; |
| 287 |
|
312 |
|
| 288 |
size_t i = 0; |
313 |
off_t skipbytes = 0; |
| 289 |
int l = 0; |
314 |
int skipseconds = 0; |
| 290 |
int l1; |
315 |
int frames_to_inspect; |
| 291 |
|
316 |
|
| 292 |
if (Dvd) {asprintf(&cmd, IDENTCMD, MPlayer, Dir, ""); |
317 |
FILE *p = NULL; |
| 293 |
} else {asprintf(&cmd, IDENTCMD, MPlayer, Dir, "/001.vdr");} |
|
|
| 294 |
|
318 |
|
| 295 |
FILE *p = popen(cmd, "r"); |
319 |
if (Dvd) { |
| 296 |
if (p) { |
320 |
asprintf(&cmd, DVDIDENT, MPlayer, Dir, ""); |
| 297 |
char *s = NULL; |
321 |
|
| 298 |
s = strcol(strgrep("ID_LENGTH", p), "=", 2); |
322 |
p = popen(cmd, "r"); |
| 299 |
if (s) {l = atoi(s);} |
323 |
if (p) { |
| 300 |
FREE(s); |
324 |
char *s = NULL; |
|
|
325 |
s = strcol(strgrep("ID_LENGTH", p), "=", 2); |
| 326 |
if (s) {skipseconds = atoi(s)/2;} |
| 327 |
FREE(s); |
| 328 |
} else { |
| 329 |
dsyslog("[vdrrip] could not open pipe to %s !", cmd); |
| 330 |
} |
| 331 |
pclose(p); |
| 332 |
FREE(cmd); |
| 301 |
} else { |
333 |
} else { |
| 302 |
dsyslog("[vdrrip] could not open pipe to %s !", cmd); |
334 |
asprintf(&cmd, "%s%s", Dir, "/001.vdr"); //lazy and safe strcat |
| 303 |
} |
|
|
| 304 |
pclose(p); |
| 305 |
FREE(cmd); |
| 306 |
|
335 |
|
|
|
336 |
/* skip to the middle of 001.vdr - there are cases where -ss option of |
| 337 |
* mplayer does not work to seek a vdr file, so use -sb instead |
| 338 |
*/ |
| 339 |
struct stat *vdrstat = (struct stat *) malloc(sizeof(struct stat)); |
| 340 |
if (0 == stat(cmd, vdrstat)) { |
| 341 |
skipbytes = (vdrstat->st_size) >> 1; // divide filesize by 2 |
| 342 |
} else { |
| 343 |
dsyslog("[vdrrip] could not stat %s to determine filesize!", cmd); |
| 344 |
} |
| 345 |
|
| 346 |
FREE(vdrstat); |
| 347 |
FREE(cmd); |
| 348 |
} |
| 307 |
|
349 |
|
| 308 |
l1 = VdrripSetup.CropLength * (int)Fps; |
350 |
frames_to_inspect = VdrripSetup.CropLength * (int)Fps; |
| 309 |
if (Dvd) { |
351 |
if (Dvd) { |
| 310 |
asprintf(&cmd, CROPCMD, MPlayer, Dir, "", l/2, l1); |
352 |
asprintf(&cmd, DVDCROP, MPlayer, Dir, "", skipseconds, frames_to_inspect); |
| 311 |
isyslog("[vdrrip] detecting crop values in %s", Dir); |
353 |
isyslog("[vdrrip] detecting crop values in %s", Dir); |
| 312 |
} else { |
354 |
} else { |
| 313 |
asprintf(&cmd, CROPCMD, MPlayer, Dir, "/001.vdr", l/2, l1); |
355 |
asprintf(&cmd, VDRCROP, MPlayer, Dir, "/001.vdr", (long long) skipbytes, frames_to_inspect); |
| 314 |
isyslog("[vdrrip] detecting crop values in %s/001.vdr", Dir); |
356 |
isyslog("[vdrrip] detecting crop values in %s/001.vdr", Dir); |
|
|
357 |
isyslog("[vdrrip] mplayer command used: %s", cmd); |
| 315 |
} |
358 |
} |
| 316 |
p = popen(cmd, "r"); |
359 |
p = popen(cmd, "r"); |
| 317 |
FREE(cmd); |
360 |
FREE(cmd); |
| 318 |
|
361 |
|
| 319 |
if (p) { |
362 |
if (p) { |
| 320 |
// get first line |
363 |
/* get first line only - shows most occurences of identically detected crop parameters |
|
|
364 |
* within frames_to_inspect starting from skipseconds/skipbytes |
| 365 |
*/ |
| 366 |
size_t i; |
| 321 |
if (getline(&buf, &i, p) != -1) { |
367 |
if (getline(&buf, &i, p) != -1) { |
| 322 |
char *s = NULL; |
368 |
char *s = NULL; |
| 323 |
|
369 |
|
| 324 |
s = strcol(buf, "=", 2); |
370 |
s = strcol(buf, "=", 2); |
| 325 |
CropWidth = roundValue(atoi(strcol(s, ":", 1)), 16); |
371 |
CropHeight = atoi(strcol(s, ":", 2)); |
| 326 |
if (CropWidth > Width || CropWidth < 0) { |
372 |
CropPosY = atoi(strcol(s, ":", 4)); |
| 327 |
ret = false; |
373 |
if (CropHeight > Height || CropHeight < 8) {ret = false;} |
| 328 |
CropWidth = Width; |
374 |
if (CropPosY > Height - CropHeight || CropPosY < 0) {ret = false;} |
| 329 |
} |
375 |
|
| 330 |
|
376 |
// crop width only if desired |
| 331 |
CropHeight = roundValue(atoi(strcol(s, ":", 2)), 16); |
377 |
if (VdrripSetup.CropMode == 1) { |
| 332 |
if (CropHeight > Height || CropHeight < 0) { |
378 |
CropWidth = Width; |
| 333 |
ret = false; |
379 |
CropPosX = 0; |
| 334 |
CropHeight = Height; |
380 |
} else { |
|
|
381 |
CropWidth = atoi(strcol(s, ":", 1)); |
| 382 |
CropPosX = atoi(strcol(s, ":", 3)); |
| 383 |
if (CropWidth > Width || CropWidth < 8) {ret = false;} |
| 384 |
if (CropPosX > Width - CropWidth || CropPosX < 0) {ret = false;} |
| 335 |
} |
385 |
} |
| 336 |
|
386 |
|
| 337 |
if (VdrripSetup.CropMode == 1) {CropWidth = Width;} |
387 |
// CalcAspect is changed now |
| 338 |
CropPosX = (Width - CropWidth) / 2; |
388 |
if (ret) { |
| 339 |
CropPosY = (Height - CropHeight) / 2; |
389 |
CalcAspect = Height * Aspect / CropHeight; |
| 340 |
// CalcAspect is changed now: |
390 |
setScale(); |
| 341 |
CalcAspect = Height * Aspect / CropHeight; |
391 |
} |
| 342 |
setScale(); |
|
|
| 343 |
|
392 |
|
| 344 |
FREE(s); |
393 |
FREE(s); |
| 345 |
FREE(buf); |
394 |
FREE(buf); |
| 346 |
} else { |
|
|
| 347 |
ret = false; |
| 348 |
} |
395 |
} |
| 349 |
|
396 |
|
| 350 |
pclose(p); |
397 |
pclose(p); |
| 351 |
} else ret = false; |
398 |
} |
| 352 |
|
399 |
|
| 353 |
if (! ret) initCropValues(); |
400 |
if (!ret) initCropValues(); |
| 354 |
|
401 |
|
| 355 |
return ret; |
402 |
return ret; |
| 356 |
} |
403 |
} |
|
Lines 363-368
Link Here
|
| 363 |
CalcAspect = Aspect; |
410 |
CalcAspect = Aspect; |
| 364 |
} |
411 |
} |
| 365 |
|
412 |
|
|
|
413 |
long long cMovie::getStartByte() { return StartByte; } |
| 414 |
int cMovie::getFrames() { return Frames; } |
| 415 |
char *cMovie::getMarks() { return Marks; } |
| 416 |
|
| 417 |
void cMovie::setMarks() { |
| 418 |
Frames = StartByte = -1; |
| 419 |
cMarks *vdrmarks = new cMarks(); |
| 420 |
vdrmarks->Load(Dir); |
| 421 |
|
| 422 |
if (vdrmarks->GetNext(StartByte)) StartByte = vdrmarks->GetNext(0)->position; |
| 423 |
if (vdrmarks->GetNext(StartByte)) Frames = vdrmarks->GetNext(StartByte)->position - StartByte; |
| 424 |
FREE(vdrmarks); |
| 425 |
|
| 426 |
if (Frames > -1) { |
| 427 |
asprintf(&Marks, "%s - %s", |
| 428 |
(const char*) IndexToHMSF(StartByte, true), |
| 429 |
(const char*) IndexToHMSF(Frames, true) |
| 430 |
); |
| 431 |
|
| 432 |
isyslog("[vdrrip] found two valid marks: encoding from %s..", Marks); |
| 433 |
|
| 434 |
/* If the index is not OK, we simply encode Frames number of frames, |
| 435 |
* since we do not need the index to compute this value for mplayer. */ |
| 436 |
cIndexFile *vdrindex = new cIndexFile(Dir, false); |
| 437 |
if (vdrindex->Ok()) { |
| 438 |
uchar fnum = 0; |
| 439 |
int foff = 0; |
| 440 |
|
| 441 |
if (vdrindex->Get(StartByte, &fnum, &foff)) { |
| 442 |
Frames -= StartByte; // will be mplayer endpos |
| 443 |
StartByte = (fnum-1)*MAXVIDEOFILESIZE*1024LL*1024LL + (long long)(foff); |
| 444 |
} else { StartByte = 0 ; } |
| 445 |
} else { StartByte = 0 ; } |
| 446 |
} else { |
| 447 |
FREE(Marks); |
| 448 |
Marks = NULL; |
| 449 |
} |
| 450 |
} |
| 451 |
|
| 366 |
void cMovie::setCodecs(int v, int a) { |
452 |
void cMovie::setCodecs(int v, int a) { |
| 367 |
// validate video codec |
453 |
// validate video codec |
| 368 |
if (v >= 0 && v < C->getNumVCodecs()) {VCodec = v; |
454 |
if (v >= 0 && v < C->getNumVCodecs()) {VCodec = v; |
|
Lines 383-394
Link Here
|
| 383 |
ACodec = C->getNumACodec("copy"); |
469 |
ACodec = C->getNumACodec("copy"); |
| 384 |
} |
470 |
} |
| 385 |
|
471 |
|
| 386 |
// set audio bitrates |
472 |
// set bitrates |
| 387 |
if (ACodec == C->getNumACodec("copy")) { |
473 |
setBitrate(T->getBitrateVideo(NumTemplate), T->getBitrateAudio(NumTemplate)); |
| 388 |
setBitrate(T->getBitrateVideo(NumTemplate), A[AudioID].Bitrate); |
|
|
| 389 |
} else { |
| 390 |
setBitrate(T->getBitrateVideo(NumTemplate), T->getBitrateAudio(NumTemplate)); |
| 391 |
} |
| 392 |
} |
474 |
} |
| 393 |
|
475 |
|
| 394 |
void cMovie::setBpp(int i) { |
476 |
void cMovie::setBpp(int i) { |
|
Lines 400-406
Link Here
|
| 400 |
|
482 |
|
| 401 |
int cMovie::getBitrateVideo() {return BitrateVideo;} |
483 |
int cMovie::getBitrateVideo() {return BitrateVideo;} |
| 402 |
|
484 |
|
| 403 |
int cMovie::getLength() {return Length;} |
485 |
int cMovie::getLength() { |
|
|
486 |
if (Frames>0) { return Frames; } |
| 487 |
else { return Length; } |
| 488 |
} |
| 404 |
|
489 |
|
| 405 |
int cMovie::getWidth() {return Width;} |
490 |
int cMovie::getWidth() {return Width;} |
| 406 |
|
491 |
|
|
Lines 429-435
Link Here
|
| 429 |
int cMovie::getCropPosY() {return CropPosY;} |
514 |
int cMovie::getCropPosY() {return CropPosY;} |
| 430 |
|
515 |
|
| 431 |
double cMovie::getResBpp() { |
516 |
double cMovie::getResBpp() { |
| 432 |
return (double)BitrateVideo * 1024. / (double)ScaleWidth / (double)ScaleHeight / Fps;} |
517 |
return (double)BitrateVideo * 1024. / (double)ScaleWidth / (double)ScaleHeight / Fps; |
|
|
518 |
} |
| 433 |
|
519 |
|
| 434 |
double cMovie::getBpp() {return (double)Bpp;} |
520 |
double cMovie::getBpp() {return (double)Bpp;} |
| 435 |
|
521 |
|
|
Lines 494-500
Link Here
|
| 494 |
void cMovie::queryMpValuesVDR() { |
580 |
void cMovie::queryMpValuesVDR() { |
| 495 |
char *cmd = NULL, *s = NULL; |
581 |
char *cmd = NULL, *s = NULL; |
| 496 |
|
582 |
|
| 497 |
asprintf(&cmd, IDENTCMD, MPlayer, Dir, "/001.vdr"); |
583 |
asprintf(&cmd, VDRIDENT, MPlayer, Dir, "/001.vdr"); |
| 498 |
FILE *p = popen(cmd, "r"); |
584 |
FILE *p = popen(cmd, "r"); |
| 499 |
if (p) { |
585 |
if (p) { |
| 500 |
s = strcol(strgrep("ID_VIDEO_WIDTH", p), "=", 2); |
586 |
s = strcol(strgrep("ID_VIDEO_WIDTH", p), "=", 2); |
|
Lines 515-525
Link Here
|
| 515 |
} else {Fps = -1;} |
601 |
} else {Fps = -1;} |
| 516 |
FREE(s); |
602 |
FREE(s); |
| 517 |
|
603 |
|
| 518 |
s = strcol(strgrep("ID_VIDEO_ASPECT", p), "=", 2); |
604 |
Aspect = -1; |
| 519 |
if (s) { |
605 |
while(s = strcol(strgrep("ID_VIDEO_ASPECT", p), "=", 2)){ |
| 520 |
Aspect = atof(s); |
606 |
Aspect = atof(s); |
| 521 |
} else {Aspect = -1;} |
607 |
if (Aspect != 0) break; |
| 522 |
|
608 |
} |
|
|
609 |
if (Aspect == 0) {Aspect = 1.333333;} |
| 523 |
CalcAspect = Aspect; |
610 |
CalcAspect = Aspect; |
| 524 |
|
611 |
|
| 525 |
pclose(p); |
612 |
pclose(p); |
|
Lines 538-544
Link Here
|
| 538 |
bool next = true; |
625 |
bool next = true; |
| 539 |
|
626 |
|
| 540 |
while (next) { |
627 |
while (next) { |
| 541 |
asprintf(&cmd, AUDIOCMD, MPlayer, Dir, c); |
628 |
asprintf(&cmd, VDRAUDIO, MPlayer, Dir, c); |
| 542 |
FILE *p = popen(cmd, "r"); |
629 |
FILE *p = popen(cmd, "r"); |
| 543 |
if (p) { |
630 |
if (p) { |
| 544 |
if (getline(&buf, &i, p) != -1) { |
631 |
if (getline(&buf, &i, p) != -1) { |
|
Lines 630-640
Link Here
|
| 630 |
|
717 |
|
| 631 |
FILE *f = fopen(file,"w"); |
718 |
FILE *f = fopen(file,"w"); |
| 632 |
if (f) { |
719 |
if (f) { |
| 633 |
fprintf(f,"%s;%i;%i;%i;%s;%i;%i;%i;%i;%i;%i;%i;%i;%i;%s;%i;%i;%s;%s;%s;%d\n", |
720 |
fprintf(f,"%s;%i;%i;%i;%s;%i;%i;%i;%i;%i;%i;%i;%i;%i;%s;%i;%i;%s;%s;%s;%lld;%lld;%d\n", |
| 634 |
Name, FileSize, FileNumbers, Bitrate, C->getVCodec(VCodec), BitrateVideo, |
721 |
Name, FileSize, FileNumbers, Bitrate, C->getVCodec(VCodec), BitrateVideo, |
| 635 |
CropWidth, CropHeight, CropPosX, CropPosY, ScaleType, ScaleWidth, |
722 |
CropWidth, CropHeight, CropPosX, CropPosY, ScaleType, ScaleWidth, |
| 636 |
ScaleHeight, Bpp, C->getACodec(ACodec), BitrateAudio, AudioID, PPValues, |
723 |
ScaleHeight, Bpp, C->getACodec(ACodec), BitrateAudio, AudioID, PPValues, |
| 637 |
T->getName(NumTemplate), C->getContainer(Container), |
724 |
T->getName(NumTemplate), C->getContainer(Container), StartByte, Frames, |
| 638 |
#ifdef VDRRIP_DVD |
725 |
#ifdef VDRRIP_DVD |
| 639 |
Dvd ? Title : 0 |
726 |
Dvd ? Title : 0 |
| 640 |
#else |
727 |
#else |
|
Lines 661-672
Link Here
|
| 661 |
FILE *f = fopen(file,"r"); |
748 |
FILE *f = fopen(file,"r"); |
| 662 |
if (f) { |
749 |
if (f) { |
| 663 |
if (getline(&buf, &i, f) != -1) { |
750 |
if (getline(&buf, &i, f) != -1) { |
|
|
751 |
fclose(f); |
| 752 |
|
| 664 |
Name = strcol(buf, ";", 1); |
753 |
Name = strcol(buf, ";", 1); |
| 665 |
FileSize = atoi(strcol(buf, ";", 2)); |
754 |
FileSize = atoi(strcol(buf, ";", 2)); |
| 666 |
FileNumbers = atoi(strcol(buf, ";", 3)); |
755 |
FileNumbers = atoi(strcol(buf, ";", 3)); |
| 667 |
Bitrate = atoi( strcol(buf, ";", 4)); |
|
|
| 668 |
vcodec = strcol(buf, ";", 5); |
756 |
vcodec = strcol(buf, ";", 5); |
| 669 |
BitrateVideo = atoi(strcol(buf, ";", 6)); |
|
|
| 670 |
CropWidth = atoi(strcol(buf, ";", 7)); |
757 |
CropWidth = atoi(strcol(buf, ";", 7)); |
| 671 |
CropHeight = atoi(strcol(buf, ";", 8)); |
758 |
CropHeight = atoi(strcol(buf, ";", 8)); |
| 672 |
CropPosX = atoi(strcol(buf, ";", 9)); |
759 |
CropPosX = atoi(strcol(buf, ";", 9)); |
|
Lines 676-682
Link Here
|
| 676 |
ScaleHeight = atoi(strcol(buf, ";", 13)); |
763 |
ScaleHeight = atoi(strcol(buf, ";", 13)); |
| 677 |
Bpp = atoi(strcol(buf, ";", 14)); |
764 |
Bpp = atoi(strcol(buf, ";", 14)); |
| 678 |
acodec = strcol(buf, ";", 15); |
765 |
acodec = strcol(buf, ";", 15); |
| 679 |
BitrateAudio = atoi(strcol(buf, ";", 16)); |
|
|
| 680 |
AudioID = atoi(strcol(buf, ";", 17)); |
766 |
AudioID = atoi(strcol(buf, ";", 17)); |
| 681 |
PPValues = strcol(buf, ";", 18); |
767 |
PPValues = strcol(buf, ";", 18); |
| 682 |
if (strcmp(PPValues, "(null)") == 0) PPValues = NULL; |
768 |
if (strcmp(PPValues, "(null)") == 0) PPValues = NULL; |
|
Lines 684-701
Link Here
|
| 684 |
// migrate from version 0.1.1 |
770 |
// migrate from version 0.1.1 |
| 685 |
container = strcol(buf, ";", 20); |
771 |
container = strcol(buf, ";", 20); |
| 686 |
if (! container) container = strdup("avi"); |
772 |
if (! container) container = strdup("avi"); |
|
|
773 |
StartByte = atoll(strcol(buf, ";", 21)); |
| 774 |
Frames = atoll(strcol(buf, ";", 22)); |
| 687 |
#ifdef VDRRIP_DVD |
775 |
#ifdef VDRRIP_DVD |
| 688 |
// migrate from version 0.2.0a |
776 |
// migrate from version 0.2.0a |
| 689 |
if (Dvd) Title = atoi(strcol(buf, ";", 21)); |
777 |
if (Dvd) Title = atoi(strcol(buf, ";", 23)); |
| 690 |
#endif //VDRRIP_DVD |
778 |
#endif //VDRRIP_DVD |
| 691 |
|
779 |
|
| 692 |
FREE(buf); |
|
|
| 693 |
|
| 694 |
fclose(f); |
| 695 |
isyslog("[vdrrip] restored data from file %s !", file); |
| 696 |
|
| 697 |
// validate some values: |
780 |
// validate some values: |
| 698 |
if (! Dvd) setCropValues(CropWidth, CropHeight); |
781 |
if (! Dvd) setCropValues(CropWidth, CropHeight, CropPosX, CropPosY); |
| 699 |
|
782 |
|
| 700 |
NumTemplate = T->getNumTemplate(tname); |
783 |
NumTemplate = T->getNumTemplate(tname); |
| 701 |
if (NumTemplate == -1) { |
784 |
if (NumTemplate == -1) { |
|
Lines 716-722
Link Here
|
| 716 |
FREE(acodec); |
799 |
FREE(acodec); |
| 717 |
|
800 |
|
| 718 |
setAudioID(AudioID); |
801 |
setAudioID(AudioID); |
|
|
802 |
setBitrate(atoi(strcol(buf, ";", 6)), atoi(strcol(buf, ";", 16))); |
| 803 |
setMarks(); |
| 719 |
|
804 |
|
|
|
805 |
isyslog("[vdrrip] restored data from file %s !", file); |
| 806 |
FREE(buf); |
| 720 |
} else { |
807 |
} else { |
| 721 |
dsyslog("[vdrrip] could not read data from file %s !", file); |
808 |
dsyslog("[vdrrip] could not read data from file %s !", file); |
| 722 |
FREE(file); |
809 |
FREE(file); |
|
Lines 951-957
Link Here
|
| 951 |
size_t i = 0; |
1038 |
size_t i = 0; |
| 952 |
int b = 0; |
1039 |
int b = 0; |
| 953 |
|
1040 |
|
| 954 |
asprintf(&cmd, AUDIOCMDDVD, MPlayer, Dir, c); |
1041 |
asprintf(&cmd, DVDAUDIO, MPlayer, Dir, c); |
| 955 |
FILE *p = popen(cmd, "r"); |
1042 |
FILE *p = popen(cmd, "r"); |
| 956 |
if (p) { |
1043 |
if (p) { |
| 957 |
if (getline(&buf, &i, p) != -1) { |
1044 |
if (getline(&buf, &i, p) != -1) { |