Skip to content

Commit 2ee8330

Browse files
author
Clement Champetier
committed
InputStreamDesc: add a constructor to read all the channels of the stream at index 0
Use it in the python tests.
1 parent f77cd3e commit 2ee8330

File tree

9 files changed

+38
-25
lines changed

9 files changed

+38
-25
lines changed

src/AvTranscoder/transcoder/InputStreamDesc.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,26 @@ struct InputStreamDesc
3737
_channelIndexArray.push_back(channelIndex);
3838
}
3939

40+
/**
41+
* @brief Read all the channels of the indicated stream.
42+
*/
4043
InputStreamDesc(const std::string& filename, const size_t streamIndex)
4144
: _filename(filename)
4245
, _streamIndex(streamIndex)
4346
, _channelIndexArray()
4447
{
4548
}
4649

50+
/**
51+
* @brief Read all the channels of the stream at index 0.
52+
*/
53+
InputStreamDesc(const std::string& filename)
54+
: _filename(filename)
55+
, _streamIndex(0)
56+
, _channelIndexArray()
57+
{
58+
}
59+
4760
/**
4861
* @return If a demultiplexing step will be done to extract the expected data.
4962
*/

test/pyTest/testAudioReader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def testAudioReader():
1616
The InputFile is created inside the reader.
1717
"""
1818
inputFileName = os.environ['AVTRANSCODER_TEST_AUDIO_WAVE_FILE']
19-
reader = av.AudioReader(av.InputStreamDesc(inputFileName, 0))
19+
reader = av.AudioReader(av.InputStreamDesc(inputFileName))
2020

2121
# read all frames and check their size
2222
while True:
@@ -62,7 +62,7 @@ def testAudioReaderWithGenerator():
6262
When there is no more data to decode, switch to a generator and process some frames.
6363
"""
6464
inputFileName = os.environ['AVTRANSCODER_TEST_AUDIO_WAVE_FILE']
65-
reader = av.AudioReader(av.InputStreamDesc(inputFileName, 0))
65+
reader = av.AudioReader(av.InputStreamDesc(inputFileName))
6666

6767
# read all frames and check their size
6868
while True:

test/pyTest/testNbFrames.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def testNbFramesVideoRewrap():
2020
ouputFile = av.OutputFile( outputFileName )
2121
transcoder = av.Transcoder( ouputFile )
2222

23-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0) )
23+
transcoder.addStream( av.InputStreamDesc(inputFileName) )
2424

2525
progress = av.ConsoleProgress()
2626
transcoder.process( progress )
@@ -47,7 +47,7 @@ def testNbFramesVideoTranscode():
4747
ouputFile = av.OutputFile( outputFileName )
4848
transcoder = av.Transcoder( ouputFile )
4949

50-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0), "mpeg2" )
50+
transcoder.addStream( av.InputStreamDesc(inputFileName), "mpeg2" )
5151

5252
progress = av.ConsoleProgress()
5353
transcoder.process( progress )

test/pyTest/testNbSamples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def testNbSamplesAudioRewrap():
2020
ouputFile = av.OutputFile( outputFileName )
2121
transcoder = av.Transcoder( ouputFile )
2222

23-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0) )
23+
transcoder.addStream( av.InputStreamDesc(inputFileName) )
2424

2525
progress = av.ConsoleProgress()
2626
transcoder.process( progress )
@@ -54,7 +54,7 @@ def testNbSamplesAudioTranscode():
5454
customProfile[av.avProfileType] = av.avProfileTypeAudio
5555
customProfile[av.avProfileCodec] = "pcm_s16le"
5656

57-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0), customProfile )
57+
transcoder.addStream( av.InputStreamDesc(inputFileName), customProfile )
5858

5959
progress = av.ConsoleProgress()
6060
transcoder.process( progress )

test/pyTest/testOffset.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def testTranscodeAudioPositiveOffset():
2626
ouputFile = av.OutputFile( outputFileName )
2727
transcoder = av.Transcoder( ouputFile )
2828

29-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0), "wave24b48kmono", offset )
29+
transcoder.addStream( av.InputStreamDesc(inputFileName), "wave24b48kmono", offset )
3030

3131
progress = av.ConsoleProgress()
3232
transcoder.process( progress )
@@ -56,7 +56,7 @@ def testTranscodeAudioNegativeOffset():
5656
ouputFile = av.OutputFile( outputFileName )
5757
transcoder = av.Transcoder( ouputFile )
5858

59-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0), "wave24b48kmono", offset )
59+
transcoder.addStream( av.InputStreamDesc(inputFileName), "wave24b48kmono", offset )
6060

6161
progress = av.ConsoleProgress()
6262
transcoder.process( progress )
@@ -86,7 +86,7 @@ def testRewrapAudioPositiveOffset():
8686
ouputFile = av.OutputFile( outputFileName )
8787
transcoder = av.Transcoder( ouputFile )
8888

89-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0), "", offset )
89+
transcoder.addStream( av.InputStreamDesc(inputFileName), "", offset )
9090

9191
progress = av.ConsoleProgress()
9292
transcoder.process( progress )
@@ -117,7 +117,7 @@ def testRewrapAudioNegativeOffset():
117117
ouputFile = av.OutputFile( outputFileName )
118118
transcoder = av.Transcoder( ouputFile )
119119

120-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0), "", offset )
120+
transcoder.addStream( av.InputStreamDesc(inputFileName), "", offset )
121121

122122
progress = av.ConsoleProgress()
123123
transcoder.process( progress )
@@ -150,7 +150,7 @@ def testTranscodeVideoPositiveOffset():
150150
ouputFile = av.OutputFile( outputFileName )
151151
transcoder = av.Transcoder( ouputFile )
152152

153-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0), "mpeg2", offset )
153+
transcoder.addStream( av.InputStreamDesc(inputFileName), "mpeg2", offset )
154154

155155
progress = av.ConsoleProgress()
156156
transcoder.process( progress )
@@ -180,7 +180,7 @@ def testTranscodeVideoNegativeOffset():
180180
ouputFile = av.OutputFile( outputFileName )
181181
transcoder = av.Transcoder( ouputFile )
182182

183-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0), "mpeg2", offset )
183+
transcoder.addStream( av.InputStreamDesc(inputFileName), "mpeg2", offset )
184184

185185
progress = av.ConsoleProgress()
186186
transcoder.process( progress )
@@ -210,7 +210,7 @@ def testRewrapVideoPositiveOffset():
210210
ouputFile = av.OutputFile( outputFileName )
211211
transcoder = av.Transcoder( ouputFile )
212212

213-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0), "", offset )
213+
transcoder.addStream( av.InputStreamDesc(inputFileName), "", offset )
214214

215215
progress = av.ConsoleProgress()
216216
transcoder.process( progress )
@@ -241,7 +241,7 @@ def testRewrapVideoNegativeOffset():
241241
ouputFile = av.OutputFile( outputFileName )
242242
transcoder = av.Transcoder( ouputFile )
243243

244-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0), "", offset )
244+
transcoder.addStream( av.InputStreamDesc(inputFileName), "", offset )
245245

246246
progress = av.ConsoleProgress()
247247
transcoder.process( progress )
@@ -275,7 +275,7 @@ def testMultipleOffsetFromSameInputFile():
275275
ouputFile = av.OutputFile( outputFileName )
276276
transcoder = av.Transcoder( ouputFile )
277277

278-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0), "", offset_1 )
278+
transcoder.addStream( av.InputStreamDesc(inputFileName), "", offset_1 )
279279
transcoder.addStream( av.InputStreamDesc(inputFileName, 1), "", offset_2 )
280280

281281
progress = av.ConsoleProgress()
@@ -312,8 +312,8 @@ def testMultipleOffsetFromSameStream():
312312
ouputFile = av.OutputFile( outputFileName )
313313
transcoder = av.Transcoder( ouputFile )
314314

315-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0), "", offset_1 )
316-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0), "", offset_2 )
315+
transcoder.addStream( av.InputStreamDesc(inputFileName), "", offset_1 )
316+
transcoder.addStream( av.InputStreamDesc(inputFileName), "", offset_2 )
317317

318318
progress = av.ConsoleProgress()
319319
transcoder.process( progress )

test/pyTest/testProperties.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def testAddPossibleMetadata():
2828
transcoder = av.Transcoder( ouputFile )
2929

3030
# rewrap a stream
31-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0) )
31+
transcoder.addStream( av.InputStreamDesc(inputFileName) )
3232

3333
# add a set of metadata
3434
metadata_to_check = av.PropertyVector()
@@ -57,7 +57,7 @@ def testAddImpossibleMetadata():
5757
transcoder = av.Transcoder( ouputFile )
5858

5959
# rewrap a stream
60-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0) )
60+
transcoder.addStream( av.InputStreamDesc(inputFileName) )
6161

6262
# add one metadata
6363
metadata_to_check = ("undefinedMetadataKey", "undefinedMetadataValue")

test/pyTest/testTranscoderAdd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def testAddAStreamFromAFileWhichDoesNotExist():
4747
ouputFile = av.OutputFile( outputFileName )
4848

4949
transcoder = av.Transcoder( ouputFile )
50-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0) )
50+
transcoder.addStream( av.InputStreamDesc(inputFileName) )
5151

5252
# process
5353
transcoder.process()

test/pyTest/testTranscoderRewrap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def testRewrapAudioStream():
7272
ouputFile = av.OutputFile( outputFileName )
7373

7474
transcoder = av.Transcoder( ouputFile )
75-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0) )
75+
transcoder.addStream( av.InputStreamDesc(inputFileName) )
7676
processStat = transcoder.process()
7777

7878
# check process stat returned
@@ -106,7 +106,7 @@ def testRewrapAVIVideoStream():
106106
ouputFile = av.OutputFile( outputFileName )
107107

108108
transcoder = av.Transcoder( ouputFile )
109-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0) )
109+
transcoder.addStream( av.InputStreamDesc(inputFileName) )
110110
processStat = transcoder.process()
111111

112112
# check process stat returned
@@ -173,7 +173,7 @@ def testRewrapRawVideoStream():
173173
ouputFile = av.OutputFile(outputFileName)
174174

175175
transcoder = av.Transcoder(ouputFile)
176-
transcoder.addStream( av.InputStreamDesc(inputFileName, 0) )
176+
transcoder.addStream( av.InputStreamDesc(inputFileName) )
177177
processStat = transcoder.process()
178178

179179
# check process stat returned

test/pyTest/testVideoReader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def testVideoReader():
1616
The InputFile is created inside the reader.
1717
"""
1818
inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_AVI_FILE']
19-
reader = av.VideoReader(av.InputStreamDesc(inputFileName, 0))
19+
reader = av.VideoReader(av.InputStreamDesc(inputFileName))
2020

2121
# read all frames and check their size
2222
for i in xrange(0, reader.getSourceVideoProperties().getNbFrames()):
@@ -34,7 +34,7 @@ def testVideoReaderWithGenerator():
3434
When there is no more data to decode, switch to a generator and process some frames.
3535
"""
3636
inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_AVI_FILE']
37-
reader = av.VideoReader(av.InputStreamDesc(inputFileName, 0))
37+
reader = av.VideoReader(av.InputStreamDesc(inputFileName))
3838

3939
# read all frames and check their size
4040
for i in xrange(0, reader.getSourceVideoProperties().getNbFrames()):

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