Skip to content

Commit 54ab5f8

Browse files
author
Clement Champetier
committed
Merge branch 'develop' of https://github.com/mikrosimage/avTranscoder into fix_pyTest_video_transcode
Conflicts: test/pyTest/testTranscoderTranscode.py
2 parents ab3b7f2 + 060bc45 commit 54ab5f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+350
-723
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ avProfileName=profileName
3434
avProfileLongName=profileLongName
3535
avProfileType=avProfileTypeVideo
3636
codec=codecName
37-
r=frameRate
3837
```
3938

4039
The minimum audio profile is:

app/CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
add_subdirectory(avInfo)
22
add_subdirectory(avMeta)
3-
add_subdirectory(avplay)
4-
add_subdirectory(avTranscoder)
5-
add_subdirectory(genericProcessor)
6-
add_subdirectory(optionChecker)
7-
add_subdirectory(presetChecker)
3+
add_subdirectory(avPlay)
4+
add_subdirectory(avProcessor)

app/avInfo/avInfo.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,18 @@ int main( int argc, char** argv )
1717
std::cout << std::endl;
1818
}
1919

20-
// std::cout << "avinfo" << std::endl;
20+
avtranscoder::preloadCodecsAndFormats();
21+
2122
std::vector<std::string> inputExtension = avtranscoder::getInputExtensions();
2223
std::vector<std::string> outputExtension = avtranscoder::getOutputExtensions();
2324

24-
std::cout << "----- inputExtension -----" << std::endl;
25-
std::cout << "nb inputExtension: " << inputExtension.size() << std::endl;
25+
std::cout << "Supported input extensions: " << inputExtension.size() << std::endl;
2626
for( std::vector<std::string>::iterator it = inputExtension.begin(); it != inputExtension.end(); ++it )
27-
std::cout << *it << std::endl;
27+
std::cout << *it << ", ";;
2828

29-
std::cout << "----- outputExtension -----" << std::endl;
30-
std::cout << "nb outputExtension: " << outputExtension.size() << std::endl;
29+
std::cout << std::endl << std::endl << "Supported output extensions: " << outputExtension.size() << std::endl;
3130
for( std::vector<std::string>::iterator it = outputExtension.begin(); it != outputExtension.end(); ++it )
32-
std::cout << *it << std::endl;
33-
31+
std::cout << *it << ", ";
32+
std::cout << std::endl;
3433
return 0;
3534
}

app/avMeta/avMeta.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ int main( int argc, char** argv )
1313
return( -1 );
1414
}
1515

16-
avtranscoder::NoDisplayProgress p;
16+
avtranscoder::preloadCodecsAndFormats();
1717

18+
// analyse inputFile
1819
avtranscoder::InputFile input( argv[1] );
20+
avtranscoder::NoDisplayProgress p;
1921
input.analyse( p, avtranscoder::eAnalyseLevelFirstGop );
2022

21-
// a simply metadata display
23+
// display file properties
2224
std::cout << input;
2325
}

app/avPlay/AvReader.cpp

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#include "AvReader.hpp"
2+
3+
#include <AvTranscoder/progress/NoDisplayProgress.hpp>
4+
#include <AvTranscoder/mediaProperty/print.hpp>
5+
6+
AvReader::AvReader( const std::string& filename )
7+
: _inputFile( filename )
8+
, _inputVideo( NULL )
9+
, _sourceImage( NULL )
10+
, _imageToDisplay( NULL )
11+
, _videoTransform()
12+
, _videoStream( 0 )
13+
{
14+
avtranscoder::NoDisplayProgress p;
15+
_inputFile.analyse( p );
16+
_videoStream = _inputFile.getProperties().getVideoProperties().at(0).getStreamId();
17+
_inputFile.activateStream( _videoStream );
18+
19+
_inputVideo = new avtranscoder::VideoDecoder( _inputFile.getStream( _videoStream ) );
20+
_inputVideo->setup();
21+
22+
_sourceImage = new avtranscoder::VideoFrame( _inputFile.getStream( _videoStream ).getVideoCodec().getVideoFrameDesc() );
23+
24+
avtranscoder::VideoFrameDesc videoFrameDescToDisplay( _sourceImage->desc().getWidth(), _sourceImage->desc().getHeight(), "rgb24" );
25+
_imageToDisplay = new avtranscoder::VideoFrame( videoFrameDescToDisplay );
26+
}
27+
28+
AvReader::~AvReader()
29+
{
30+
delete _inputVideo;
31+
delete _sourceImage;
32+
delete _imageToDisplay;
33+
}
34+
35+
size_t AvReader::getWidth()
36+
{
37+
return _inputFile.getProperties().getVideoProperties().at(0).getWidth();
38+
};
39+
40+
size_t AvReader::getHeight()
41+
{
42+
return _inputFile.getProperties().getVideoProperties().at(0).getHeight();
43+
}
44+
45+
size_t AvReader::getComponents()
46+
{
47+
return _inputFile.getProperties().getVideoProperties().at(0).getPixelProperties().getNbComponents();
48+
}
49+
50+
size_t AvReader::getBitDepth()
51+
{
52+
return _inputFile.getProperties().getVideoProperties().at(0).getPixelProperties().getBitsPerPixel();
53+
}
54+
55+
AVPixelFormat AvReader::getPixelFormat()
56+
{
57+
return _inputFile.getProperties().getVideoProperties().at(0).getPixelProperties().getAVPixelFormat();
58+
}
59+
60+
const char* AvReader::readNextFrame()
61+
{
62+
++_currentFrame;
63+
_inputVideo->decodeNextFrame( *_sourceImage );
64+
_videoTransform.convert( *_sourceImage, *_imageToDisplay );
65+
return (const char*)_imageToDisplay->getPtr();
66+
}
67+
68+
const char* AvReader::readPrevFrame()
69+
{
70+
--_currentFrame;
71+
return readFrameAt( _currentFrame );
72+
}
73+
74+
const char* AvReader::readFrameAt( const size_t frame )
75+
{
76+
// /std::cout << "seek at " << frame << std::endl;
77+
_inputFile.seekAtFrame( frame );
78+
_inputVideo->flushDecoder();
79+
return readNextFrame();
80+
}
81+
82+
void AvReader::printMetadatas()
83+
{
84+
std::cout << _inputFile << std::endl;
85+
}

app/avPlay/AvReader.hpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#ifndef _AVPLAYER_AVREADER_
2+
#define _AVPLAYER_AVREADER_
3+
4+
#include <AvTranscoder/file/InputFile.hpp>
5+
#include <AvTranscoder/decoder/VideoDecoder.hpp>
6+
#include <AvTranscoder/frame/VideoFrame.hpp>
7+
#include <AvTranscoder/transform/VideoTransform.hpp>
8+
9+
#include "Reader.hpp"
10+
11+
class AvReader : public Reader
12+
{
13+
public:
14+
AvReader( const std::string& filename );
15+
~AvReader();
16+
17+
size_t getWidth();
18+
size_t getHeight();
19+
size_t getComponents();
20+
size_t getBitDepth();
21+
AVPixelFormat getPixelFormat();
22+
23+
const char* readNextFrame();
24+
const char* readPrevFrame();
25+
const char* readFrameAt( const size_t frame );
26+
27+
void printMetadatas();
28+
29+
private:
30+
avtranscoder::InputFile _inputFile;
31+
32+
avtranscoder::VideoDecoder* _inputVideo;
33+
34+
avtranscoder::VideoFrame* _sourceImage;
35+
avtranscoder::VideoFrame* _imageToDisplay;
36+
37+
avtranscoder::VideoTransform _videoTransform;
38+
size_t _videoStream;
39+
};
40+
41+
#endif
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)