Skip to content

Commit b2b5d0a

Browse files
author
Clement Champetier
committed
StreamTranscoder: added a FilterGraph attribute
1 parent bec1155 commit b2b5d0a

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/AvTranscoder/transcoder/StreamTranscoder.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ StreamTranscoder::StreamTranscoder(IInputStream& inputStream, IOutputFile& outpu
3030
, _currentDecoder(NULL)
3131
, _outputEncoder(NULL)
3232
, _transform(NULL)
33+
, _filterGraph(NULL)
3334
, _subStreamIndex(-1)
3435
, _offset(offset)
3536
, _needToSwitchToGenerator(false)
@@ -44,6 +45,9 @@ StreamTranscoder::StreamTranscoder(IInputStream& inputStream, IOutputFile& outpu
4445

4546
try
4647
{
48+
// filter
49+
_filterGraph = new FilterGraph(_inputStream->getVideoCodec());
50+
4751
VideoFrameDesc inputFrameDesc(_inputStream->getVideoCodec().getVideoFrameDesc());
4852

4953
// generator decoder
@@ -78,6 +82,9 @@ StreamTranscoder::StreamTranscoder(IInputStream& inputStream, IOutputFile& outpu
7882

7983
try
8084
{
85+
// filter
86+
_filterGraph = new FilterGraph(_inputStream->getAudioCodec());
87+
8188
AudioFrameDesc inputFrameDesc(_inputStream->getAudioCodec().getAudioFrameDesc());
8289

8390
// generator decoder
@@ -128,6 +135,7 @@ StreamTranscoder::StreamTranscoder(IInputStream& inputStream, IOutputFile& outpu
128135
, _currentDecoder(NULL)
129136
, _outputEncoder(NULL)
130137
, _transform(NULL)
138+
, _filterGraph(NULL)
131139
, _subStreamIndex(subStreamIndex)
132140
, _offset(offset)
133141
, _needToSwitchToGenerator(false)
@@ -137,6 +145,9 @@ StreamTranscoder::StreamTranscoder(IInputStream& inputStream, IOutputFile& outpu
137145
{
138146
case AVMEDIA_TYPE_VIDEO:
139147
{
148+
// filter
149+
_filterGraph = new FilterGraph(_inputStream->getVideoCodec());
150+
140151
// input decoder
141152
VideoDecoder* inputVideo = new VideoDecoder(*static_cast<InputStream*>(_inputStream));
142153
inputVideo->setupDecoder();
@@ -170,6 +181,9 @@ StreamTranscoder::StreamTranscoder(IInputStream& inputStream, IOutputFile& outpu
170181
}
171182
case AVMEDIA_TYPE_AUDIO:
172183
{
184+
// filter
185+
_filterGraph = new FilterGraph(_inputStream->getAudioCodec());
186+
173187
// input decoder
174188
AudioDecoder* inputAudio = new AudioDecoder(*static_cast<InputStream*>(_inputStream));
175189
inputAudio->setupDecoder();
@@ -228,6 +242,7 @@ StreamTranscoder::StreamTranscoder(const ICodec& inputCodec, IOutputFile& output
228242
, _currentDecoder(NULL)
229243
, _outputEncoder(NULL)
230244
, _transform(NULL)
245+
, _filterGraph(NULL)
231246
, _subStreamIndex(-1)
232247
, _offset(0)
233248
, _needToSwitchToGenerator(false)
@@ -241,6 +256,9 @@ StreamTranscoder::StreamTranscoder(const ICodec& inputCodec, IOutputFile& output
241256
_generator = generatorVideo;
242257
_currentDecoder = _generator;
243258

259+
// filter
260+
_filterGraph = new FilterGraph(inputVideoCodec);
261+
244262
// buffers to process
245263
VideoFrameDesc inputFrameDesc = inputVideoCodec.getVideoFrameDesc();
246264
VideoFrameDesc outputFrameDesc = inputFrameDesc;
@@ -267,6 +285,9 @@ StreamTranscoder::StreamTranscoder(const ICodec& inputCodec, IOutputFile& output
267285
_generator = generatorAudio;
268286
_currentDecoder = _generator;
269287

288+
// filter
289+
_filterGraph = new FilterGraph(inputAudioCodec);
290+
270291
// buffers to process
271292
AudioFrameDesc inputFrameDesc = inputAudioCodec.getAudioFrameDesc();
272293
AudioFrameDesc outputFrameDesc = inputFrameDesc;
@@ -298,6 +319,7 @@ StreamTranscoder::~StreamTranscoder()
298319
delete _generator;
299320
delete _outputEncoder;
300321
delete _transform;
322+
delete _filterGraph;
301323
delete _inputDecoder;
302324
}
303325

src/AvTranscoder/transcoder/StreamTranscoder.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <AvTranscoder/encoder/IEncoder.hpp>
1111

1212
#include <AvTranscoder/file/IOutputFile.hpp>
13-
13+
#include <AvTranscoder/filter/FilterGraph.hpp>
1414
#include <AvTranscoder/profile/ProfileLoader.hpp>
1515

1616
namespace avtranscoder
@@ -131,6 +131,8 @@ class AvExport StreamTranscoder
131131

132132
ITransform* _transform; ///< Video or audio transform (has ownership)
133133

134+
FilterGraph* _filterGraph; ///< Filter graph (has ownership)
135+
134136
int _subStreamIndex; ///< Index of channel that is processed from the input stream (<0 if no demultiplexing).
135137

136138
float _offset; ///< Offset, in seconds, at the beginning of the StreamTranscoder.

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