forked from VarolOkan/spatial-media
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathparser.cpp
executable file
·130 lines (113 loc) · 4.6 KB
/
parser.cpp
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/* *******************************************************************************
** usage: spatialmedia [options] [files...]
**
** By default prints out spatial media metadata from specified files.
**
** positional arguments:
** file input/output files
**
** optional arguments:
** -h, --help show this help message and exit
** -i, --inject injects spatial media metadata into the first file
** specified (.mp4 or .mov) and saves the result to the
** second file specified
**
** Spherical Video:
** -s STEREO-MODE, --stereo STEREO-MODE
** stereo mode (none | top-bottom | left-right)
** -c CROP, --crop CROP crop region. Must specify 6 integers in the form of
** "w:h:f_w:f_h:x:y" where w=CroppedAreaImageWidthPixels
** h=CroppedAreaImageHeightPixels f_w=FullPanoWidthPixels
** f_h=FullPanoHeightPixels x=CroppedAreaLeftPixels
** y=CroppedAreaTopPixels
**
** Spatial Audio:
** -a, --spatial-audio spatial audio. First-order periphonic ambisonics with
** ACN channel ordering and SN3D normalization
**
*********************************************************************************/
#include <algorithm>
#include <iostream>
#include <getopt.h>
#include "parser.h"
using namespace std;
namespace SpatialMedia
{
Parser::Parser ( )
{
m_bInject = true;
m_StereoMode = SM_NONE;
for ( int t=0; t<6; t++ )
m_crop[t] = 0;
m_bSpatialAudio = false;
}
Parser::~Parser ( )
{
}
void Parser::printHelp ( )
{
cout << "usage: spatialmedia [options] [files...]" << endl;
cout << endl;
cout << "By default prints out spatial media metadata from specified files." << endl;
cout << endl;
cout << "positional arguments:" << endl;
cout << " file input/output files" << endl;
cout << endl;
cout << "optional arguments:" << endl;
cout << " -h, --help show this help message and exit" << endl;
cout << " -i, --inject injects spatial media metadata into the first file" << endl;
cout << " specified (.mp4 or .mov) and saves the result to the" << endl;
cout << " second file specified" << endl;
cout << endl;
cout << "Spherical Video:" << endl;
cout << " -s STEREO-MODE, --stereo STEREO-MODE" << endl;
cout << " stereo mode (none | top-bottom | left-right)" << endl;
cout << " \"none\": Mono frame layout." << endl;
cout << " \"top-bottom\": Top half contains the left eye and bottom half contains the right eye." << endl;
cout << " \"left-right\": Left half contains the left eye and right half contains the right eye." << endl;
cout << " ( RFC: https://github.com/google/spatial-media/tree/master/docs/spherical-video-rfc.md )" << endl;
cout << endl;
cout << " -c CROP, --crop CROP crop region. Must specify 6 integers in the form of" << endl;
cout << " \"w:h:f_w:f_h:x:y\" where w=CroppedAreaImageWidthPixels" << endl;
cout << " h=CroppedAreaImageHeightPixels f_w=FullPanoWidthPixels" << endl;
cout << " f_h=FullPanoHeightPixels x=CroppedAreaLeftPixels" << endl;
cout << " y=CroppedAreaTopPixels" << endl;
cout << endl;
cout << "Spatial Audio:" << endl;
cout << " -a, --spatial-audio spatial audio. First-order periphonic ambisonics with" << endl;
cout << " ACN channel ordering and SN3D normalization" << endl;
cout << " Enables injection of spatial audio metadata. If enabled, the file must contain a" << endl;
cout << " 4-channel first-order ambisonics audio track with ACN channel ordering and SN3D" << endl;
cout << " normalization; see the [Spatial Audio RFC](../docs/spatial-audio-rfc.md) for" << endl;
cout << " more information." << endl;
}
std::string &Parser::getInFile ( )
{
return m_strInFile;
}
std::string &Parser::getOutFile ( )
{
return m_strOutFile;
}
bool Parser::getInject ( )
{
return m_bInject;
}
Parser::enMode Parser::getStereoMode ( )
{
return m_StereoMode;
}
int *Parser::getCrop ( )
{
// return NULL if no croping was specified.
for ( int t=0; t<6; t++ ) {
if ( m_crop[t] != 0 )
return m_crop;
}
return NULL;
}
bool Parser::getSpatialAudio ( )
{
return m_bSpatialAudio;
}
}; // nd of namespace SpatialMedia