Skip to content

Commit 260618a

Browse files
author
Clement Champetier
committed
pyTest of rewrap: fix check of format
Get the format name of the input, and set it to the output file.
1 parent 955da92 commit 260618a

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

src/AvTranscoder/mediaProperty/FileProperties.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class AvExport FileProperties
2323
FileProperties( const FormatContext& formatContext );
2424

2525
std::string getFilename() const;
26-
std::string getFormatName() const;
26+
std::string getFormatName() const; ///< A comma separated list of short names for the format
2727
std::string getFormatLongName() const;
2828

2929
size_t getProgramsCount() const;

test/pyTest/testTranscoderRewrap.py

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,22 @@ def testRewrapAudioStream():
88
"""
99
Rewrap one audio stream.
1010
"""
11+
# get src file of wrap
1112
inputFileName = os.environ['AVTRANSCODER_TEST_AUDIO_FILE']
12-
outputFileName = "testRewrapAudioStream.wav"
13+
src_inputFile = av.InputFile( inputFileName )
14+
progress = av.NoDisplayProgress()
15+
src_inputFile.analyse( progress )
16+
src_properties = src_inputFile.getProperties()
17+
src_audioStream = src_properties.getAudioProperties()[0]
1318

19+
formatList = src_properties.getFormatName().split(",")
20+
outputFileName = "testRewrapAudioStream." + formatList[0]
1421
ouputFile = av.OutputFile( outputFileName )
15-
transcoder = av.Transcoder( ouputFile )
1622

23+
transcoder = av.Transcoder( ouputFile )
1724
transcoder.add( inputFileName, 0, "" )
18-
19-
progress = av.NoDisplayProgress()
2025
transcoder.process( progress )
2126

22-
# get src file of wrap
23-
src_inputFile = av.InputFile( inputFileName )
24-
src_inputFile.analyse( progress )
25-
src_properties = src_inputFile.getProperties()
26-
src_audioStream = src_properties.getAudioProperties()[0]
27-
2827
# get dst file of wrap
2928
dst_inputFile = av.InputFile( outputFileName )
3029
dst_inputFile.analyse( progress, av.eAnalyseLevelHeader )
@@ -65,23 +64,22 @@ def testRewrapVideoStream():
6564
"""
6665
Rewrap one video stream.
6766
"""
67+
# get src file of wrap
6868
inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_FILE']
69-
outputFileName = "testRewrapVideoStream.avi"
69+
src_inputFile = av.InputFile( inputFileName )
70+
progress = av.NoDisplayProgress()
71+
src_inputFile.analyse( progress )
72+
src_properties = src_inputFile.getProperties()
73+
src_videoStream = src_properties.getVideoProperties()[0]
7074

75+
formatList = src_properties.getFormatName().split(",")
76+
outputFileName = "testRewrapVideoStream." + formatList[0]
7177
ouputFile = av.OutputFile( outputFileName )
72-
transcoder = av.Transcoder( ouputFile )
7378

79+
transcoder = av.Transcoder( ouputFile )
7480
transcoder.add( inputFileName, 0, "" )
75-
76-
progress = av.NoDisplayProgress()
7781
transcoder.process( progress )
7882

79-
# get src file of wrap
80-
src_inputFile = av.InputFile( inputFileName )
81-
src_inputFile.analyse( progress )
82-
src_properties = src_inputFile.getProperties()
83-
src_videoStream = src_properties.getVideoProperties()[0]
84-
8583
# get dst file of wrap
8684
dst_inputFile = av.InputFile( outputFileName )
8785
dst_inputFile.analyse( progress )

0 commit comments

Comments
 (0)