blob: a393699663cb1e8f7e6ad54bb62c29147b9f26d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/*
* Simple program to grab images from VDR Recording
*
* Copyright (c) 2015 Andreas Brachold
*
* This code is distributed under the terms and conditions of the
* GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
*
*/
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include "ffm.h"
#ifndef FFMPEG_BIN
#define FFMPEG_BIN "ffmpeg"
#endif
bool decode (const char* szMPVfile,
const char* szTmpMask,
int width, int height)
{
#if 0
std::cerr << "szMPVfile:" << szMPVfile << std::endl;
std::cerr << "szTmpMask:" << szTmpMask << std::endl;
std::cerr << "width:" << width << std::endl;
std::cerr << "height:" << height << std::endl;
#endif
std::stringstream ss;
ss << FFMPEG_BIN;
ss << " -loglevel ";
#ifdef DEBUG
ss << "verbose -report";
#else
ss << "error";
#endif
ss << " -an -i '" << szMPVfile << "'";
if(width > 0 && height > 0) {
ss << " -vf 'scale=" << width << ":ih*" << height << "/iw'";
} else if(height > 0) { // Nur Höhe wurde definiert
ss << " -vf 'scale=iw*trunc(oh*a/2)*2/ih:" << height << "'";
} else if(width > 0) { // Nur Weite wurde definiert
ss << " -vf 'scale=" << width << ":ih*trunc(ow/a/2)*2/iw'";
}
ss << " '" << szTmpMask << "'";
#ifdef DEBUG
std::cerr << ss.str() << std::endl;
#endif
return (0 == system(ss.str().c_str()));
}
|