Skip to content

Commit 9c1948f

Browse files
author
Clement Champetier
committed
properties: overload operator<< in each class
* Removed print files in properties folder. * Fix #215
1 parent 0c9a2ba commit 9c1948f

25 files changed

+226
-201
lines changed

app/avMeta/avMeta.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#include <AvTranscoder/file/InputFile.hpp>
2-
#include <AvTranscoder/properties/print.hpp>
3-
42
#include <AvTranscoder/progress/NoDisplayProgress.hpp>
53

64
#include <iostream>

src/AvTranscoder/file/InputFile.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,51 @@ void InputFile::setupUnwrapping(const ProfileLoader::Profile& profile)
203203
}
204204
}
205205
}
206+
207+
std::ostream& operator<<(std::ostream& flux, const InputFile& input)
208+
{
209+
// wrapper
210+
flux << input.getProperties();
211+
212+
// video streams
213+
for(size_t videoStreamIndex = 0; videoStreamIndex < input.getProperties().getNbVideoStreams(); ++videoStreamIndex)
214+
{
215+
flux << input.getProperties().getVideoProperties().at(videoStreamIndex);
216+
}
217+
218+
// audio streams
219+
for(size_t audioStreamIndex = 0; audioStreamIndex < input.getProperties().getNbAudioStreams(); ++audioStreamIndex)
220+
{
221+
flux << input.getProperties().getAudioProperties().at(audioStreamIndex);
222+
}
223+
224+
// data streams
225+
for(size_t dataStreamIndex = 0; dataStreamIndex < input.getProperties().getNbDataStreams(); ++dataStreamIndex)
226+
{
227+
flux << input.getProperties().getDataProperties().at(dataStreamIndex);
228+
}
229+
230+
// subtitle streams
231+
for(size_t subtitleStreamIndex = 0; subtitleStreamIndex < input.getProperties().getNbSubtitleStreams();
232+
++subtitleStreamIndex)
233+
{
234+
flux << input.getProperties().getSubtitleProperties().at(subtitleStreamIndex);
235+
}
236+
237+
// attachement streams
238+
for(size_t attachementStreamIndex = 0; attachementStreamIndex < input.getProperties().getNbAttachementStreams();
239+
++attachementStreamIndex)
240+
{
241+
flux << input.getProperties().getAttachementProperties().at(attachementStreamIndex);
242+
}
243+
244+
// unknown streams
245+
for(size_t unknownStreamIndex = 0; unknownStreamIndex < input.getProperties().getNbUnknownStreams();
246+
++unknownStreamIndex)
247+
{
248+
flux << input.getProperties().getUnknownProperties().at(unknownStreamIndex);
249+
}
250+
251+
return flux;
252+
}
206253
}

src/AvTranscoder/file/InputFile.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ class AvExport InputFile
125125
std::string _filename;
126126
std::vector<InputStream*> _inputStreams; ///< Has ownership
127127
};
128+
129+
#ifndef SWIG
130+
AvExport std::ostream& operator<<(std::ostream& flux, const InputFile& input);
131+
#endif
128132
}
129133

130134
#endif
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include "AttachementProperties.hpp"
2+
3+
#include <AvTranscoder/properties/util.hpp>
4+
5+
namespace avtranscoder
6+
{
7+
8+
std::ostream& operator<<(std::ostream& flux, const AttachementProperties& attachementProperties)
9+
{
10+
flux << detail::separator << " Attachement stream " << detail::separator << std::endl;
11+
12+
PropertyVector properties = attachementProperties.asVector();
13+
for(PropertyVector::iterator it = properties.begin(); it != properties.end(); ++it)
14+
{
15+
flux << std::setw(detail::keyWidth) << it->first << ": " << it->second << std::endl;
16+
}
17+
18+
return flux;
19+
}
20+
}

src/AvTranscoder/properties/AttachementProperties.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ class AvExport AttachementProperties : public StreamProperties
1414
{
1515
}
1616
};
17+
18+
#ifndef SWIG
19+
AvExport std::ostream& operator<<(std::ostream& flux, const AttachementProperties& attachementProperties);
20+
#endif
1721
}
1822

1923
#endif

src/AvTranscoder/properties/AudioProperties.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "AudioProperties.hpp"
22

3+
#include <AvTranscoder/properties/util.hpp>
4+
35
extern "C" {
46
#include <libavcodec/avcodec.h>
57
#include <libavformat/avformat.h>
@@ -168,4 +170,18 @@ PropertyVector AudioProperties::asVector() const
168170

169171
return data;
170172
}
173+
174+
std::ostream& operator<<(std::ostream& flux, const AudioProperties& audioProperties)
175+
{
176+
flux << std::left;
177+
flux << detail::separator << " Audio stream " << detail::separator << std::endl;
178+
179+
PropertyVector properties = audioProperties.asVector();
180+
for(PropertyVector::iterator it = properties.begin(); it != properties.end(); ++it)
181+
{
182+
flux << std::setw(detail::keyWidth) << it->first << ": " << it->second << std::endl;
183+
}
184+
185+
return flux;
186+
}
171187
}

src/AvTranscoder/properties/AudioProperties.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ class AvExport AudioProperties : public StreamProperties
4848
}
4949
#endif
5050
};
51+
52+
#ifndef SWIG
53+
AvExport std::ostream& operator<<(std::ostream& flux, const AudioProperties& audioProperties);
54+
#endif
5155
}
5256

5357
#endif

src/AvTranscoder/properties/DataProperties.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "DataProperties.hpp"
22

3+
#include <AvTranscoder/properties/util.hpp>
4+
35
extern "C" {
46
#include <libavcodec/avcodec.h>
57
}
@@ -77,4 +79,17 @@ void DataProperties::detectAncillaryData()
7779
break;
7880
}
7981
}
82+
83+
std::ostream& operator<<(std::ostream& flux, const DataProperties& dataProperties)
84+
{
85+
flux << detail::separator << " Data stream " << detail::separator << std::endl;
86+
87+
PropertyVector properties = dataProperties.asVector();
88+
for(PropertyVector::iterator it = properties.begin(); it != properties.end(); ++it)
89+
{
90+
flux << std::setw(detail::keyWidth) << it->first << ": " << it->second << std::endl;
91+
}
92+
93+
return flux;
94+
}
8095
}

src/AvTranscoder/properties/DataProperties.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ class AvExport DataProperties : public StreamProperties
1717
private:
1818
void detectAncillaryData();
1919
};
20+
21+
#ifndef SWIG
22+
AvExport std::ostream& operator<<(std::ostream& flux, const DataProperties& dataProperties);
23+
#endif
2024
}
2125

2226
#endif

src/AvTranscoder/properties/FileProperties.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "FileProperties.hpp"
22

3+
#include <AvTranscoder/properties/util.hpp>
34
#include <AvTranscoder/properties/JsonWriter.hpp>
45
#include <AvTranscoder/progress/NoDisplayProgress.hpp>
56

@@ -341,4 +342,18 @@ void FileProperties::clearStreamProperties()
341342
_attachementStreams.clear();
342343
_unknownStreams.clear();
343344
}
345+
346+
std::ostream& operator<<(std::ostream& flux, const FileProperties& fileProperties)
347+
{
348+
flux << std::left;
349+
flux << detail::separator << " Wrapper " << detail::separator << std::endl;
350+
351+
PropertyVector properties = fileProperties.asVector();
352+
for(PropertyVector::iterator it = properties.begin(); it != properties.end(); ++it)
353+
{
354+
flux << std::setw(detail::keyWidth) << it->first << ": " << it->second << std::endl;
355+
}
356+
357+
return flux;
358+
}
344359
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy