Skip to content

Commit 8c95f63

Browse files
author
Clement Champetier
committed
Moved InputStreamDesc struct to a separate file
1 parent 33723c8 commit 8c95f63

File tree

5 files changed

+91
-61
lines changed

5 files changed

+91
-61
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include "InputStreamDesc.hpp"
2+
3+
namespace avtranscoder
4+
{
5+
6+
std::ostream& operator<<(std::ostream& flux, const InputStreamDesc& inputStreamDesc)
7+
{
8+
flux << "input stream description: " << std::endl;
9+
flux << "- filename: " << inputStreamDesc._filename << std::endl;
10+
flux << "- stream index: " << inputStreamDesc._streamIndex << std::endl;
11+
if(inputStreamDesc.demultiplexing())
12+
{
13+
flux << "- channels index: ";
14+
for(size_t c = 0; c < inputStreamDesc._channelIndexArray.size(); ++c)
15+
{
16+
flux << inputStreamDesc._channelIndexArray.at(c) << ", ";
17+
}
18+
flux << std::endl;
19+
}
20+
return flux;
21+
}
22+
23+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#ifndef _AV_TRANSCODER_INPUT_STREAM_DESC_HPP_
2+
#define _AV_TRANSCODER_INPUT_STREAM_DESC_HPP_
3+
4+
#include <AvTranscoder/common.hpp>
5+
6+
#include <string>
7+
#include <vector>
8+
9+
namespace avtranscoder
10+
{
11+
12+
/**
13+
* @brief Structure to describe the source data to extract.
14+
*/
15+
struct InputStreamDesc
16+
{
17+
18+
InputStreamDesc()
19+
: _filename()
20+
, _streamIndex(0)
21+
, _channelIndexArray()
22+
{
23+
}
24+
25+
InputStreamDesc(const std::string& filename, const size_t streamIndex, const std::vector<size_t>& channelIndexArray)
26+
: _filename(filename)
27+
, _streamIndex(streamIndex)
28+
, _channelIndexArray(channelIndexArray)
29+
{
30+
}
31+
32+
InputStreamDesc(const std::string& filename, const size_t streamIndex, const size_t channelIndex)
33+
: _filename(filename)
34+
, _streamIndex(streamIndex)
35+
, _channelIndexArray()
36+
{
37+
_channelIndexArray.push_back(channelIndex);
38+
}
39+
40+
InputStreamDesc(const std::string& filename, const size_t streamIndex)
41+
: _filename(filename)
42+
, _streamIndex(streamIndex)
43+
, _channelIndexArray()
44+
{
45+
}
46+
47+
/**
48+
* @return If a demultiplexing step will be done to extract the expected data.
49+
*/
50+
bool demultiplexing() const { return !_channelIndexArray.empty(); }
51+
52+
public:
53+
std::string _filename; ///< Source file path.
54+
size_t _streamIndex; ///< Source stream to extract.
55+
std::vector<size_t> _channelIndexArray; ///< List of source channels to extract from the stream
56+
};
57+
58+
#ifndef SWIG
59+
AvExport std::ostream& operator<<(std::ostream& flux, const InputStreamDesc& inputStreamDesc);
60+
#endif
61+
62+
}
63+
64+
#endif

src/AvTranscoder/transcoder/Transcoder.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -502,21 +502,4 @@ void Transcoder::fillProcessStat(ProcessStat& processStat)
502502
}
503503
}
504504
}
505-
506-
std::ostream& operator<<(std::ostream& flux, const InputStreamDesc& inputStreamDesc)
507-
{
508-
flux << "input stream description: " << std::endl;
509-
flux << "- filename: " << inputStreamDesc._filename << std::endl;
510-
flux << "- stream index: " << inputStreamDesc._streamIndex << std::endl;
511-
if(inputStreamDesc.demultiplexing())
512-
{
513-
flux << "- channels index: ";
514-
for(size_t c = 0; c < inputStreamDesc._channelIndexArray.size(); ++c)
515-
{
516-
flux << inputStreamDesc._channelIndexArray.at(c) << ", ";
517-
}
518-
flux << std::endl;
519-
}
520-
return flux;
521-
}
522505
}

src/AvTranscoder/transcoder/Transcoder.hpp

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,15 @@
88
#include <AvTranscoder/profile/ProfileLoader.hpp>
99
#include <AvTranscoder/stat/ProcessStat.hpp>
1010

11-
#include "StreamTranscoder.hpp"
11+
#include <AvTranscoder/transcoder/InputStreamDesc.hpp>
12+
#include <AvTranscoder/transcoder/StreamTranscoder.hpp>
1213

1314
#include <string>
1415
#include <vector>
1516

1617
namespace avtranscoder
1718
{
1819

19-
/**
20-
* @brief Structure to describe the source data to extract.
21-
*/
22-
struct InputStreamDesc
23-
{
24-
25-
InputStreamDesc(const std::string& filename, const size_t streamIndex, const std::vector<size_t>& channelIndexArray)
26-
: _filename(filename)
27-
, _streamIndex(streamIndex)
28-
, _channelIndexArray(channelIndexArray)
29-
{
30-
}
31-
32-
InputStreamDesc(const std::string& filename, const size_t streamIndex, const size_t channelIndex)
33-
: _filename(filename)
34-
, _streamIndex(streamIndex)
35-
, _channelIndexArray()
36-
{
37-
_channelIndexArray.push_back(channelIndex);
38-
}
39-
40-
InputStreamDesc(const std::string& filename, const size_t streamIndex)
41-
: _filename(filename)
42-
, _streamIndex(streamIndex)
43-
, _channelIndexArray()
44-
{
45-
}
46-
47-
/**
48-
* @return If a demultiplexing step will be done to extract the expected data.
49-
*/
50-
bool demultiplexing() const { return !_channelIndexArray.empty(); }
51-
52-
public:
53-
std::string _filename; ///< Source file path.
54-
size_t _streamIndex; ///< Source stream to extract.
55-
std::vector<size_t> _channelIndexArray; ///< List of source channels to extract from the stream
56-
};
57-
58-
#ifndef SWIG
59-
AvExport std::ostream& operator<<(std::ostream& flux, const InputStreamDesc& inputStreamDesc);
60-
#endif
61-
6220
/**
6321
* @brief Enum to set a policy of how we manage the process in case of several streams.
6422
* eProcessMethodShortest: stop the process at the end of the shortest stream.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
%{
2+
#include <AvTranscoder/transcoder/InputStreamDesc.hpp>
23
#include <AvTranscoder/transcoder/StreamTranscoder.hpp>
34
#include <AvTranscoder/transcoder/Transcoder.hpp>
45
%}
56

67
%template(StreamTranscoderVector) std::vector< avtranscoder::StreamTranscoder* >;
78

9+
%include <AvTranscoder/transcoder/InputStreamDesc.hpp>
810
%include <AvTranscoder/transcoder/StreamTranscoder.hpp>
911
%include <AvTranscoder/transcoder/Transcoder.hpp>

0 commit comments

Comments
 (0)