Skip to content

Commit 40898c0

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

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/AvTranscoder/transcoder/StreamTranscoder.cpp

Lines changed: 23 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,10 @@ StreamTranscoder::StreamTranscoder(IInputStream& inputStream, IOutputFile& outpu
137145
{
138146
case AVMEDIA_TYPE_VIDEO:
139147
{
148+
// filter
149+
_filterGraph = new FilterGraph(_inputStream->getVideoCodec());
150+
_filterGraph->addFilter("scale", "78:54");
151+
140152
// input decoder
141153
VideoDecoder* inputVideo = new VideoDecoder(*static_cast<InputStream*>(_inputStream));
142154
inputVideo->setupDecoder();
@@ -170,6 +182,9 @@ StreamTranscoder::StreamTranscoder(IInputStream& inputStream, IOutputFile& outpu
170182
}
171183
case AVMEDIA_TYPE_AUDIO:
172184
{
185+
// filter
186+
_filterGraph = new FilterGraph(_inputStream->getAudioCodec());
187+
173188
// input decoder
174189
AudioDecoder* inputAudio = new AudioDecoder(*static_cast<InputStream*>(_inputStream));
175190
inputAudio->setupDecoder();
@@ -228,6 +243,7 @@ StreamTranscoder::StreamTranscoder(const ICodec& inputCodec, IOutputFile& output
228243
, _currentDecoder(NULL)
229244
, _outputEncoder(NULL)
230245
, _transform(NULL)
246+
, _filterGraph(NULL)
231247
, _subStreamIndex(-1)
232248
, _offset(0)
233249
, _needToSwitchToGenerator(false)
@@ -241,6 +257,9 @@ StreamTranscoder::StreamTranscoder(const ICodec& inputCodec, IOutputFile& output
241257
_generator = generatorVideo;
242258
_currentDecoder = _generator;
243259

260+
// filter
261+
_filterGraph = new FilterGraph(inputVideoCodec);
262+
244263
// buffers to process
245264
VideoFrameDesc inputFrameDesc = inputVideoCodec.getVideoFrameDesc();
246265
VideoFrameDesc outputFrameDesc = inputFrameDesc;
@@ -267,6 +286,9 @@ StreamTranscoder::StreamTranscoder(const ICodec& inputCodec, IOutputFile& output
267286
_generator = generatorAudio;
268287
_currentDecoder = _generator;
269288

289+
// filter
290+
_filterGraph = new FilterGraph(inputAudioCodec);
291+
270292
// buffers to process
271293
AudioFrameDesc inputFrameDesc = inputAudioCodec.getAudioFrameDesc();
272294
AudioFrameDesc outputFrameDesc = inputFrameDesc;
@@ -298,6 +320,7 @@ StreamTranscoder::~StreamTranscoder()
298320
delete _generator;
299321
delete _outputEncoder;
300322
delete _transform;
323+
delete _filterGraph;
301324
delete _inputDecoder;
302325
}
303326

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