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 75-83
Link Here
|
75 |
Dvd = false; |
83 |
Dvd = false; |
76 |
|
84 |
|
77 |
// detect vdr-data |
85 |
// detect vdr-data |
78 |
setLengthVDR(); |
|
|
79 |
queryMpValuesVDR(); |
86 |
queryMpValuesVDR(); |
80 |
queryAudioDataVDR(); |
87 |
queryAudioDataVDR(); |
|
|
88 |
setLengthVDR(); |
89 |
setMarksVDR(); |
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 |
|
366 |
void cMovie::setCodecs(int v, int a) { |
417 |
void cMovie::setCodecs(int v, int a) { |
367 |
// validate video codec |
418 |
// validate video codec |
368 |
if (v >= 0 && v < C->getNumVCodecs()) {VCodec = v; |
419 |
if (v >= 0 && v < C->getNumVCodecs()) {VCodec = v; |
Lines 383-394
Link Here
|
383 |
ACodec = C->getNumACodec("copy"); |
434 |
ACodec = C->getNumACodec("copy"); |
384 |
} |
435 |
} |
385 |
|
436 |
|
386 |
// set audio bitrates |
437 |
// set bitrates |
387 |
if (ACodec == C->getNumACodec("copy")) { |
438 |
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 |
} |
439 |
} |
393 |
|
440 |
|
394 |
void cMovie::setBpp(int i) { |
441 |
void cMovie::setBpp(int i) { |
Lines 429-435
Link Here
|
429 |
int cMovie::getCropPosY() {return CropPosY;} |
476 |
int cMovie::getCropPosY() {return CropPosY;} |
430 |
|
477 |
|
431 |
double cMovie::getResBpp() { |
478 |
double cMovie::getResBpp() { |
432 |
return (double)BitrateVideo * 1024. / (double)ScaleWidth / (double)ScaleHeight / Fps;} |
479 |
return (double)BitrateVideo * 1024. / (double)ScaleWidth / (double)ScaleHeight / Fps; |
|
|
480 |
} |
433 |
|
481 |
|
434 |
double cMovie::getBpp() {return (double)Bpp;} |
482 |
double cMovie::getBpp() {return (double)Bpp;} |
435 |
|
483 |
|
Lines 491-500
Link Here
|
491 |
} |
539 |
} |
492 |
|
540 |
|
493 |
|
541 |
|
|
|
542 |
void cMovie::setMarksVDR() { |
543 |
Frames = StartByte = -1; |
544 |
cMarks *vdrmarks = new cMarks(); |
545 |
vdrmarks->Load(Dir); |
546 |
|
547 |
if (vdrmarks->GetNext(StartByte)) StartByte = vdrmarks->GetNext(0)->position; |
548 |
if (vdrmarks->GetNext(StartByte)) Frames = vdrmarks->GetNext(StartByte)->position - StartByte; |
549 |
FREE(vdrmarks); |
550 |
|
551 |
if (Frames > -1) { |
552 |
asprintf(&Marks, "%s - %s", |
553 |
(const char*) IndexToHMSF(StartByte, true), |
554 |
(const char*) IndexToHMSF(Frames, true) |
555 |
); |
556 |
|
557 |
isyslog("[vdrrip] found two valid marks: encoding from %s..", Marks); |
558 |
|
559 |
/* If the index is not OK, we simply encode Frames number of frames, |
560 |
* since we do not need the index to compute this value for mplayer. */ |
561 |
cIndexFile *vdrindex = new cIndexFile(Dir, false); |
562 |
if (vdrindex->Ok()) { |
563 |
uchar fnum = 0; |
564 |
int foff = 0; |
565 |
|
566 |
if (vdrindex->Get(StartByte, &fnum, &foff)) { |
567 |
Frames -= StartByte; // will be mplayer endpos |
568 |
StartByte = (fnum-1)*MAXVIDEOFILESIZE*1024LL*1024LL + (long long)(foff); |
569 |
} else { StartByte = 0 ; } |
570 |
} else { StartByte = 0 ; } |
571 |
|
572 |
/* Update Length for Bitrate, Filesize computation.. fps must be known for this*/ |
573 |
Length = Frames / Fps ; |
574 |
} else { |
575 |
FREE(Marks); |
576 |
Marks = NULL; |
577 |
} |
578 |
} |
579 |
|
580 |
|
494 |
void cMovie::queryMpValuesVDR() { |
581 |
void cMovie::queryMpValuesVDR() { |
495 |
char *cmd = NULL, *s = NULL; |
582 |
char *cmd = NULL, *s = NULL; |
496 |
|
583 |
|
497 |
asprintf(&cmd, IDENTCMD, MPlayer, Dir, "/001.vdr"); |
584 |
asprintf(&cmd, VDRIDENT, MPlayer, Dir, "/001.vdr"); |
498 |
FILE *p = popen(cmd, "r"); |
585 |
FILE *p = popen(cmd, "r"); |
499 |
if (p) { |
586 |
if (p) { |
500 |
s = strcol(strgrep("ID_VIDEO_WIDTH", p), "=", 2); |
587 |
s = strcol(strgrep("ID_VIDEO_WIDTH", p), "=", 2); |
Lines 515-525
Link Here
|
515 |
} else {Fps = -1;} |
602 |
} else {Fps = -1;} |
516 |
FREE(s); |
603 |
FREE(s); |
517 |
|
604 |
|
518 |
s = strcol(strgrep("ID_VIDEO_ASPECT", p), "=", 2); |
605 |
Aspect = -1; |
519 |
if (s) { |
606 |
while(s = strcol(strgrep("ID_VIDEO_ASPECT", p), "=", 2)){ |
520 |
Aspect = atof(s); |
607 |
Aspect = atof(s); |
521 |
} else {Aspect = -1;} |
608 |
if (Aspect != 0) break; |
522 |
|
609 |
} |
|
|
610 |
if (Aspect == 0) {Aspect = 1.333333;} |
523 |
CalcAspect = Aspect; |
611 |
CalcAspect = Aspect; |
524 |
|
612 |
|
525 |
pclose(p); |
613 |
pclose(p); |
Lines 538-544
Link Here
|
538 |
bool next = true; |
626 |
bool next = true; |
539 |
|
627 |
|
540 |
while (next) { |
628 |
while (next) { |
541 |
asprintf(&cmd, AUDIOCMD, MPlayer, Dir, c); |
629 |
asprintf(&cmd, VDRAUDIO, MPlayer, Dir, c); |
542 |
FILE *p = popen(cmd, "r"); |
630 |
FILE *p = popen(cmd, "r"); |
543 |
if (p) { |
631 |
if (p) { |
544 |
if (getline(&buf, &i, p) != -1) { |
632 |
if (getline(&buf, &i, p) != -1) { |
Lines 630-640
Link Here
|
630 |
|
718 |
|
631 |
FILE *f = fopen(file,"w"); |
719 |
FILE *f = fopen(file,"w"); |
632 |
if (f) { |
720 |
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", |
721 |
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, |
722 |
Name, FileSize, FileNumbers, Bitrate, C->getVCodec(VCodec), BitrateVideo, |
635 |
CropWidth, CropHeight, CropPosX, CropPosY, ScaleType, ScaleWidth, |
723 |
CropWidth, CropHeight, CropPosX, CropPosY, ScaleType, ScaleWidth, |
636 |
ScaleHeight, Bpp, C->getACodec(ACodec), BitrateAudio, AudioID, PPValues, |
724 |
ScaleHeight, Bpp, C->getACodec(ACodec), BitrateAudio, AudioID, PPValues, |
637 |
T->getName(NumTemplate), C->getContainer(Container), |
725 |
T->getName(NumTemplate), C->getContainer(Container), StartByte, Frames, |
638 |
#ifdef VDRRIP_DVD |
726 |
#ifdef VDRRIP_DVD |
639 |
Dvd ? Title : 0 |
727 |
Dvd ? Title : 0 |
640 |
#else |
728 |
#else |
Lines 661-672
Link Here
|
661 |
FILE *f = fopen(file,"r"); |
749 |
FILE *f = fopen(file,"r"); |
662 |
if (f) { |
750 |
if (f) { |
663 |
if (getline(&buf, &i, f) != -1) { |
751 |
if (getline(&buf, &i, f) != -1) { |
|
|
752 |
fclose(f); |
753 |
|
664 |
Name = strcol(buf, ";", 1); |
754 |
Name = strcol(buf, ";", 1); |
665 |
FileSize = atoi(strcol(buf, ";", 2)); |
755 |
FileSize = atoi(strcol(buf, ";", 2)); |
666 |
FileNumbers = atoi(strcol(buf, ";", 3)); |
756 |
FileNumbers = atoi(strcol(buf, ";", 3)); |
667 |
Bitrate = atoi( strcol(buf, ";", 4)); |
|
|
668 |
vcodec = strcol(buf, ";", 5); |
757 |
vcodec = strcol(buf, ";", 5); |
669 |
BitrateVideo = atoi(strcol(buf, ";", 6)); |
|
|
670 |
CropWidth = atoi(strcol(buf, ";", 7)); |
758 |
CropWidth = atoi(strcol(buf, ";", 7)); |
671 |
CropHeight = atoi(strcol(buf, ";", 8)); |
759 |
CropHeight = atoi(strcol(buf, ";", 8)); |
672 |
CropPosX = atoi(strcol(buf, ";", 9)); |
760 |
CropPosX = atoi(strcol(buf, ";", 9)); |
Lines 676-682
Link Here
|
676 |
ScaleHeight = atoi(strcol(buf, ";", 13)); |
764 |
ScaleHeight = atoi(strcol(buf, ";", 13)); |
677 |
Bpp = atoi(strcol(buf, ";", 14)); |
765 |
Bpp = atoi(strcol(buf, ";", 14)); |
678 |
acodec = strcol(buf, ";", 15); |
766 |
acodec = strcol(buf, ";", 15); |
679 |
BitrateAudio = atoi(strcol(buf, ";", 16)); |
|
|
680 |
AudioID = atoi(strcol(buf, ";", 17)); |
767 |
AudioID = atoi(strcol(buf, ";", 17)); |
681 |
PPValues = strcol(buf, ";", 18); |
768 |
PPValues = strcol(buf, ";", 18); |
682 |
if (strcmp(PPValues, "(null)") == 0) PPValues = NULL; |
769 |
if (strcmp(PPValues, "(null)") == 0) PPValues = NULL; |
Lines 684-701
Link Here
|
684 |
// migrate from version 0.1.1 |
771 |
// migrate from version 0.1.1 |
685 |
container = strcol(buf, ";", 20); |
772 |
container = strcol(buf, ";", 20); |
686 |
if (! container) container = strdup("avi"); |
773 |
if (! container) container = strdup("avi"); |
|
|
774 |
StartByte = atoll(strcol(buf, ";", 21)); |
775 |
Frames = atoll(strcol(buf, ";", 22)); |
687 |
#ifdef VDRRIP_DVD |
776 |
#ifdef VDRRIP_DVD |
688 |
// migrate from version 0.2.0a |
777 |
// migrate from version 0.2.0a |
689 |
if (Dvd) Title = atoi(strcol(buf, ";", 21)); |
778 |
if (Dvd) Title = atoi(strcol(buf, ";", 23)); |
690 |
#endif //VDRRIP_DVD |
779 |
#endif //VDRRIP_DVD |
691 |
|
780 |
|
692 |
FREE(buf); |
|
|
693 |
|
694 |
fclose(f); |
695 |
isyslog("[vdrrip] restored data from file %s !", file); |
696 |
|
697 |
// validate some values: |
781 |
// validate some values: |
698 |
if (! Dvd) setCropValues(CropWidth, CropHeight); |
782 |
if (! Dvd) setCropValues(CropWidth, CropHeight, CropPosX, CropPosY); |
699 |
|
783 |
|
700 |
NumTemplate = T->getNumTemplate(tname); |
784 |
NumTemplate = T->getNumTemplate(tname); |
701 |
if (NumTemplate == -1) { |
785 |
if (NumTemplate == -1) { |
Lines 716-722
Link Here
|
716 |
FREE(acodec); |
800 |
FREE(acodec); |
717 |
|
801 |
|
718 |
setAudioID(AudioID); |
802 |
setAudioID(AudioID); |
|
|
803 |
setBitrate(atoi(strcol(buf, ";", 6)), atoi(strcol(buf, ";", 16))); |
804 |
setMarksVDR(); |
719 |
|
805 |
|
|
|
806 |
isyslog("[vdrrip] restored data from file %s !", file); |
807 |
FREE(buf); |
720 |
} else { |
808 |
} else { |
721 |
dsyslog("[vdrrip] could not read data from file %s !", file); |
809 |
dsyslog("[vdrrip] could not read data from file %s !", file); |
722 |
FREE(file); |
810 |
FREE(file); |
Lines 951-957
Link Here
|
951 |
size_t i = 0; |
1039 |
size_t i = 0; |
952 |
int b = 0; |
1040 |
int b = 0; |
953 |
|
1041 |
|
954 |
asprintf(&cmd, AUDIOCMDDVD, MPlayer, Dir, c); |
1042 |
asprintf(&cmd, DVDAUDIO, MPlayer, Dir, c); |
955 |
FILE *p = popen(cmd, "r"); |
1043 |
FILE *p = popen(cmd, "r"); |
956 |
if (p) { |
1044 |
if (p) { |
957 |
if (getline(&buf, &i, p) != -1) { |
1045 |
if (getline(&buf, &i, p) != -1) { |