forked from avTranscoder/avTranscoder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.hpp
More file actions
70 lines (54 loc) · 1.65 KB
/
util.hpp
File metadata and controls
70 lines (54 loc) · 1.65 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef _AV_TRANSCODER_MEDIA_PROPERTY_UTIL_HPP_
#define _AV_TRANSCODER_MEDIA_PROPERTY_UTIL_HPP_
#include <AvTranscoder/common.hpp>
extern "C" {
#include <libavutil/dict.h>
}
#include <vector>
#include <utility>
#include <map>
#include <string>
#include <sstream>
#include <iomanip>
namespace avtranscoder
{
/**
* @brief PropertyVector is a vector of pair, because the order of properties matters to us.
*/
typedef std::vector<std::pair<std::string, std::string> > PropertyVector;
typedef std::map<std::string, std::string> PropertyMap;
namespace detail
{
/**
* Variables to print properties class to the terminal.
*/
const size_t keyWidth = 32;
const std::string separator = "====================";
/**
* If cannot access the property, get this value.
*/
const std::string propertyValueIfError = "null";
template <typename T>
void add(PropertyVector& propertyVector, const std::string& key, const T& value)
{
std::stringstream ss;
ss << value;
add(propertyVector, key, ss.str());
}
template <>
void add(PropertyVector& propertyVector, const std::string& key, const size_t& value);
template <>
void add(PropertyVector& propertyVector, const std::string& key, const float& value);
template <>
void add(PropertyVector& propertyVector, const std::string& key, const std::string& value);
template <>
void add(PropertyVector& propertyVector, const std::string& key, const bool& value);
template <>
void add(PropertyVector& propertyVector, const std::string& key, const Rational& value);
/**
* @brief Fill metadata parameter with the given AVDictionary.
*/
void AvExport fillMetadataDictionnary(AVDictionary* avdictionnary, PropertyVector& metadata);
}
}
#endif