diff --git a/app/cpp/avplay/AvReader.hpp b/app/cpp/avplay/AvReader.hpp index b88c0c09..82f0fb3b 100644 --- a/app/cpp/avplay/AvReader.hpp +++ b/app/cpp/avplay/AvReader.hpp @@ -13,60 +13,60 @@ class AvReader : public Reader { public: AvReader( const std::string& filename ) - : m_inputFile( filename ) - , m_inputVideo( NULL ) - , m_sourceImage( NULL ) - , m_imageToDisplay( NULL ) + : _inputFile( filename ) + , _inputVideo( NULL ) + , _sourceImage( NULL ) + , _imageToDisplay( NULL ) { avtranscoder::ProgressListener p; - m_inputFile.analyse( p ); - m_videoStream = m_inputFile.getProperties().videoStreams.at(0).streamId; + _inputFile.analyse( p ); + _videoStream = _inputFile.getProperties().videoStreams.at(0).streamId; - m_inputFile.readStream( m_videoStream ); + _inputFile.readStream( _videoStream ); - m_inputVideo = new avtranscoder::InputVideo( m_inputFile.getStream( m_videoStream ) ); + _inputVideo = new avtranscoder::InputVideo( _inputFile.getStream( _videoStream ) ); - m_inputVideo->setup(); + _inputVideo->setup(); - m_sourceImage = new avtranscoder::VideoFrame( m_inputFile.getStream( m_videoStream ).getVideoDesc().getVideoFrameDesc() ); + _sourceImage = new avtranscoder::VideoFrame( _inputFile.getStream( _videoStream ).getVideoDesc().getVideoFrameDesc() ); - pixel.setBitsPerPixel( getComponents() * getBitDepth() ); - pixel.setComponents( getComponents() ); - pixel.setColorComponents( avtranscoder::eComponentRgb ); - pixel.setSubsampling( avtranscoder::eSubsamplingNone ); - pixel.setAlpha( false ); - pixel.setPlanar( false ); + _pixel.setBitsPerPixel( getComponents() * getBitDepth() ); + _pixel.setComponents( getComponents() ); + _pixel.setColorComponents( avtranscoder::eComponentRgb ); + _pixel.setSubsampling( avtranscoder::eSubsamplingNone ); + _pixel.setAlpha( false ); + _pixel.setPlanar( false ); - VideoFrameDescToDisplay.setWidth( m_sourceImage->desc().getWidth() ); - VideoFrameDescToDisplay.setHeight( m_sourceImage->desc().getHeight() ); - VideoFrameDescToDisplay.setDar( m_sourceImage->desc().getDar() ); + _videoFrameDescToDisplay.setWidth( _sourceImage->desc().getWidth() ); + _videoFrameDescToDisplay.setHeight( _sourceImage->desc().getHeight() ); + _videoFrameDescToDisplay.setDar( _sourceImage->desc().getDar() ); - VideoFrameDescToDisplay.setPixel( pixel.findPixel() ); + _videoFrameDescToDisplay.setPixel( _pixel.findPixel() ); - m_imageToDisplay = new avtranscoder::VideoFrame( VideoFrameDescToDisplay ); + _imageToDisplay = new avtranscoder::VideoFrame( _videoFrameDescToDisplay ); } ~AvReader() { - delete m_inputVideo; - delete m_sourceImage; - delete m_imageToDisplay; + delete _inputVideo; + delete _sourceImage; + delete _imageToDisplay; } size_t getWidth() { - return m_inputFile.getProperties().videoStreams.at(0).width; + return _inputFile.getProperties().videoStreams.at(0).width; }; size_t getHeight() { - return m_inputFile.getProperties().videoStreams.at(0).height; + return _inputFile.getProperties().videoStreams.at(0).height; } size_t getComponents() { - return m_inputFile.getProperties().videoStreams.at(0).componentsCount; + return _inputFile.getProperties().videoStreams.at(0).componentsCount; } size_t getBitDepth() @@ -76,44 +76,44 @@ class AvReader : public Reader const char* readNextFrame() { - ++currentFrame; - m_inputVideo->readNextFrame( *m_sourceImage ); - m_videoEssenceTransform.convert( *m_sourceImage, *m_imageToDisplay ); - return (const char*)m_imageToDisplay->getPtr(); + ++_currentFrame; + _inputVideo->readNextFrame( *_sourceImage ); + _videoEssenceTransform.convert( *_sourceImage, *_imageToDisplay ); + return (const char*)_imageToDisplay->getPtr(); } const char* readPrevFrame() { - --currentFrame; - return readFrameAt( currentFrame ); + --_currentFrame; + return readFrameAt( _currentFrame ); } const char* readFrameAt( const size_t frame ) { // /std::cout << "seek at " << frame << std::endl; - m_inputFile.seekAtFrame( frame ); - m_inputVideo->flushDecoder(); + _inputFile.seekAtFrame( frame ); + _inputVideo->flushDecoder(); return readNextFrame(); } void printMetadatas() { - std::cout << m_inputFile << std::endl; + std::cout << _inputFile << std::endl; } private: - avtranscoder::InputFile m_inputFile; + avtranscoder::InputFile _inputFile; - avtranscoder::InputVideo* m_inputVideo; + avtranscoder::InputVideo* _inputVideo; - avtranscoder::VideoFrame* m_sourceImage; - avtranscoder::VideoFrame* m_imageToDisplay; + avtranscoder::VideoFrame* _sourceImage; + avtranscoder::VideoFrame* _imageToDisplay; - avtranscoder::Pixel pixel; - avtranscoder::VideoFrameDesc VideoFrameDescToDisplay; + avtranscoder::Pixel _pixel; + avtranscoder::VideoFrameDesc _videoFrameDescToDisplay; - avtranscoder::VideoEssenceTransform m_videoEssenceTransform; - size_t m_videoStream; + avtranscoder::VideoEssenceTransform _videoEssenceTransform; + size_t _videoStream; }; #endif diff --git a/app/cpp/avplay/Reader.hpp b/app/cpp/avplay/Reader.hpp index 55729e1c..418e18dc 100644 --- a/app/cpp/avplay/Reader.hpp +++ b/app/cpp/avplay/Reader.hpp @@ -5,7 +5,7 @@ class Reader { public: Reader() - : currentFrame( 0 ) + : _currentFrame( 0 ) {} virtual size_t getWidth() = 0; @@ -21,7 +21,7 @@ class Reader protected: - size_t currentFrame; + size_t _currentFrame; }; #endif diff --git a/app/cpp/avplay/Window.cpp b/app/cpp/avplay/Window.cpp index 2e338d99..63d81d48 100644 --- a/app/cpp/avplay/Window.cpp +++ b/app/cpp/avplay/Window.cpp @@ -14,38 +14,38 @@ #include #include -Reader* Window::m_reader = NULL; +Reader* Window::_reader = NULL; -size_t Window::m_width = 0; -size_t Window::m_height = 0; +size_t Window::_width = 0; +size_t Window::_height = 0; -int Window::m_x1 = -1.0; -int Window::m_x2 = 1.0; -int Window::m_y1 = 1.0; -int Window::m_y2 = -1.0; +int Window::_x1 = -1.0; +int Window::_x2 = 1.0; +int Window::_y1 = 1.0; +int Window::_y2 = -1.0; -int Window::m_xMinViewport = 0; -int Window::m_yMinViewport = 0; -int Window::m_xMouseRef = 0; -int Window::m_yMouseRef = 0; +int Window::_xMinViewport = 0; +int Window::_yMinViewport = 0; +int Window::_xMouseRef = 0; +int Window::_yMouseRef = 0; -int Window::m_windowId = 0; +int Window::_windowId = 0; -float Window::m_currentZoom = 1.0; -float Window::m_factorZoom = 1.25; +float Window::_currentZoom = 1.0; +float Window::_factorZoom = 1.25; -float Window::m_scale = 1.0; +float Window::_scale = 1.0; -bool Window::m_play = false; +bool Window::_play = false; -bool Window::m_flip = false; -bool Window::m_flop = false; +bool Window::_flip = false; +bool Window::_flop = false; // channel properties -bool Window::m_showRedChannel = false; -bool Window::m_showGreenChannel = false; -bool Window::m_showBlueChannel = false; -bool Window::m_showAlphaChannel = false; +bool Window::_showRedChannel = false; +bool Window::_showGreenChannel = false; +bool Window::_showBlueChannel = false; +bool Window::_showAlphaChannel = false; // image properties struct ImgProperties @@ -59,7 +59,7 @@ struct ImgProperties size_t component; }; -ImgProperties m_imageProperties; +ImgProperties _imageProperties; void loadNewTexture( const ImgProperties& properties ) @@ -77,40 +77,40 @@ void loadNewTexture( const ImgProperties& properties ) void loadNewTexture( const char* data, GLint internalFormat, size_t width, size_t height, GLenum format, GLenum type ) { - m_imageProperties.data = data; - m_imageProperties.internalFormat = internalFormat; - m_imageProperties.width = width; - m_imageProperties.height = height; - m_imageProperties.format = format; - m_imageProperties.type = type; - - switch( m_imageProperties.format ) + _imageProperties.data = data; + _imageProperties.internalFormat = internalFormat; + _imageProperties.width = width; + _imageProperties.height = height; + _imageProperties.format = format; + _imageProperties.type = type; + + switch( _imageProperties.format ) { - case GL_LUMINANCE : m_imageProperties.component = 1; break; - case GL_RGB : m_imageProperties.component = 3; break; - case GL_RGBA : m_imageProperties.component = 4; break; + case GL_LUMINANCE : _imageProperties.component = 1; break; + case GL_RGB : _imageProperties.component = 3; break; + case GL_RGBA : _imageProperties.component = 4; break; } - loadNewTexture( m_imageProperties ); + loadNewTexture( _imageProperties ); } Window::Window( Reader& reader ) { - m_reader = &reader; - m_width = m_reader->getWidth(); - m_height = m_reader->getHeight(); + _reader = &reader; + _width = _reader->getWidth(); + _height = _reader->getHeight(); char *argv[2] = { (char*)"", NULL }; int argc = 1; glutInit( &argc, argv ); glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_RGBA | GLUT_MULTISAMPLE ); - glutInitWindowSize( m_width, m_height ); + glutInitWindowSize( _width, _height ); glutInitWindowPosition( 0, 0 ); #ifdef GLUT_ACTION_ON_WINDOW_CLOSE glutSetOption( GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION ); #endif - m_windowId = glutCreateWindow("AV Player Viewer"); + _windowId = glutCreateWindow("AV Player Viewer"); glClearColor(0.0f, 0.0f, 0.0f, 0.0f ); glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT ); @@ -136,18 +136,18 @@ void Window::display() glBegin (GL_QUADS); - float x1 = m_x1; - float x2 = m_x2; + float x1 = _x1; + float x2 = _x2; - float y1 = m_y1; - float y2 = m_y2; + float y1 = _y1; + float y2 = _y2; - if( m_flip ) + if( _flip ) { y1 = -y1; y2 = -y2; } - if( m_flop ) + if( _flop ) { x1 = -x1; x2 = -x2; @@ -181,30 +181,30 @@ void Window::keyboard( unsigned char k, int x, int y ) switch( k ) { case '\r': - glutDestroyWindow( m_windowId ); - m_windowId = 0; + glutDestroyWindow( _windowId ); + _windowId = 0; break; case 27: // ESCAPE key - glutDestroyWindow( m_windowId ); - m_windowId = 0; + glutDestroyWindow( _windowId ); + _windowId = 0; break; case 'i': displayInformations(); break; case 'z': - glutReshapeWindow( m_width, m_height ); - m_currentZoom = 1.0; - m_x1 = -1.0; - m_x2 = 1.0; - m_y1 = 1.0; - m_y2 = -1.0; + glutReshapeWindow( _width, _height ); + _currentZoom = 1.0; + _x1 = -1.0; + _x2 = 1.0; + _y1 = 1.0; + _y2 = -1.0; glutPostRedisplay(); break; case 'h': displayHelp(); break; case 32: // spacebar - m_play = !m_play; + _play = ! _play; loopPlaying(0); break; @@ -222,20 +222,20 @@ void Window::keyboard( unsigned char k, int x, int y ) break; case 'm': - m_reader->printMetadatas(); + _reader->printMetadatas(); break; case 'H': if( shift ) { - m_flop = !m_flop; + _flop = ! _flop; glutPostRedisplay(); } break; case 'V': if( shift ) { - m_flip = !m_flip; + _flip = ! _flip; glutPostRedisplay(); } break; @@ -279,31 +279,31 @@ void Window::mouse( int button, int state, int x, int y ) mapToImage(x, y, iX, iY); - if( iX < 0 || iY < 0 || iX >= (int)m_imageProperties.width || iY >= (int)m_imageProperties.height ) + if( iX < 0 || iY < 0 || iX >= (int)_imageProperties.width || iY >= (int)_imageProperties.height ) return; - std::cout << "at " << std::setw(4) << iX << "," << std::setw(4) << (int)m_imageProperties.height - iY << ": "; + std::cout << "at " << std::setw(4) << iX << "," << std::setw(4) << (int)_imageProperties.height - iY << ": "; - for( size_t i = 0; i < m_imageProperties.component; i++ ) + for( size_t i = 0; i < _imageProperties.component; i++ ) { - size_t idx = ( iX + iY * m_imageProperties.width ) * m_imageProperties.component + i; - switch( m_imageProperties.type ) + size_t idx = ( iX + iY * _imageProperties.width ) * _imageProperties.component + i; + switch( _imageProperties.type ) { case GL_UNSIGNED_BYTE: { - const unsigned char* d = (const unsigned char*) m_imageProperties.data; + const unsigned char* d = (const unsigned char*) _imageProperties.data; std::cout << std::setw(5) << (unsigned int) d[idx] ; break; } case GL_UNSIGNED_SHORT: { - const unsigned short* d = (const unsigned short*) m_imageProperties.data; + const unsigned short* d = (const unsigned short*) _imageProperties.data; std::cout << std::setw(7) << d[idx] ; break; } case GL_FLOAT: { - const float* d = (const float*) m_imageProperties.data; + const float* d = (const float*) _imageProperties.data; std::cout << std::setw(10) << d[idx] ; break; } @@ -319,49 +319,49 @@ void Window::mouse( int button, int state, int x, int y ) if(button == 3) { - m_currentZoom *= m_factorZoom; - zoom( m_factorZoom ); + _currentZoom *= _factorZoom; + zoom( _factorZoom ); } else { - m_currentZoom /= m_factorZoom; - zoom( 1.0 / m_factorZoom ); + _currentZoom /= _factorZoom; + zoom( 1.0 / _factorZoom ); } mapToImage(x, y, iX2, iY2); - move( ( m_currentZoom / m_imageProperties.width * 2) * (iX2 - iX), - ( m_currentZoom / m_imageProperties.height * 2) * (iY2 - iY)); + move( ( _currentZoom / _imageProperties.width * 2) * (iX2 - iX), + ( _currentZoom / _imageProperties.height * 2) * (iY2 - iY)); glutPostRedisplay (); } - m_xMouseRef = x; - m_yMouseRef = y; + _xMouseRef = x; + _yMouseRef = y; } void Window::motion( int x, int y ) { float x_diff, y_diff; - x_diff = ( x - m_xMouseRef ) / m_currentZoom; - y_diff = ( m_yMouseRef - y ) / m_currentZoom; + x_diff = ( x - _xMouseRef ) / _currentZoom; + y_diff = ( _yMouseRef - y ) / _currentZoom; - if( m_flip ) + if( _flip ) { y_diff *= -1.0; } - if( m_flop ) + if( _flop ) { x_diff *= -1.0; } - move( m_currentZoom / m_imageProperties.width * 2 * x_diff, - m_currentZoom / m_imageProperties.height * 2 * y_diff ); + move( _currentZoom / _imageProperties.width * 2 * x_diff, + _currentZoom / _imageProperties.height * 2 * y_diff ); - m_xMouseRef = x; - m_yMouseRef = y; + _xMouseRef = x; + _yMouseRef = y; glutPostRedisplay(); } @@ -370,25 +370,25 @@ void Window::reshape( int width, int height ) { float w, h, xPos, yPos; - if( (float) m_width / m_height > (float) width / height ) + if( (float) _width / _height > (float) width / height ) { w = width; - h = 1.0f * m_height / m_width * (float)width; + h = 1.0f * _height / _width * (float)width; xPos = 0.0; yPos = 0.5f * (height - h); } else { - w = 1.0f * m_width / m_height * (float)height; + w = 1.0f * _width / _height * (float)height; h = height; xPos = 0.5f * (width - w); yPos = 0.0; } - m_xMinViewport = xPos; - m_yMinViewport = yPos; + _xMinViewport = xPos; + _yMinViewport = yPos; - m_scale = w / m_width; + _scale = w / _width; glViewport( (GLsizei) xPos, (GLsizei) yPos, (GLsizei) w, (GLsizei) h ); glutReshapeWindow( width, height ); @@ -412,35 +412,35 @@ void Window::displayHelp() void Window::displayInformations() { std::string textureType; - switch( m_imageProperties.format ) + switch( _imageProperties.format ) { case GL_LUMINANCE : textureType = "Gray "; break; case GL_RGB : textureType = "RGB "; break; case GL_RGBA : textureType = "RGBA "; break; } - switch( m_imageProperties.type ) + switch( _imageProperties.type ) { case GL_UNSIGNED_BYTE : textureType += "8 bits"; break; case GL_UNSIGNED_SHORT : textureType += "16 bits"; break; case GL_FLOAT : textureType += "32 float"; break; } - std::cout << textureType << " " << m_width << "x" << m_height << std::endl; + std::cout << textureType << " " << _width << "x" << _height << std::endl; } void Window::move( float x, float y ) { - m_x1 += x; - m_x2 += x; - m_y1 += y; - m_y2 += y; + _x1 += x; + _x2 += x; + _y1 += y; + _y2 += y; } void Window::zoom(float factor) { - m_x1 *= factor; - m_x2 *= factor; - m_y1 *= factor; - m_y2 *= factor; + _x1 *= factor; + _x2 *= factor; + _y1 *= factor; + _y2 *= factor; } void Window::mapToImage(int x, int y, int &iX, int &iY) @@ -448,29 +448,29 @@ void Window::mapToImage(int x, int y, int &iX, int &iY) int mapX, mapY; float mx, my; - mapX = ( x - m_xMinViewport ) / m_scale; - mapY = ( y - m_yMinViewport ) / m_scale; + mapX = ( x - _xMinViewport ) / _scale; + mapY = ( y - _yMinViewport ) / _scale; - if( !m_flip ) + if( ! _flip ) { - mapY = m_imageProperties.height - mapY; + mapY = _imageProperties.height - mapY; } - if( m_flop ) + if( _flop ) { - mapX = m_imageProperties.width - mapX; + mapX = _imageProperties.width - mapX; } - mx = (float)mapX / (float)m_imageProperties.width * 2.0 - 1.0; - iX = ((m_x1 - mx) / (m_currentZoom * 2.0) * (float)m_imageProperties.width * -1.0) + 0.5; + mx = (float)mapX / (float)_imageProperties.width * 2.0 - 1.0; + iX = ((_x1 - mx) / (_currentZoom * 2.0) * (float)_imageProperties.width * -1.0) + 0.5; - my = (float)mapY / (float)m_imageProperties.height * 2.0 - 1.0; - iY = ((m_y1 - my) / (m_currentZoom * 2.0) * (float)m_imageProperties.height * -1.0) + 0.5; + my = (float)mapY / (float)_imageProperties.height * 2.0 - 1.0; + iY = ((_y1 - my) / (_currentZoom * 2.0) * (float)_imageProperties.height * -1.0) + 0.5; } void Window::setTransfert( float red, float green, float blue, float alpha ) { - switch( m_imageProperties.format ) + switch( _imageProperties.format ) { case GL_LUMINANCE : return; @@ -490,14 +490,14 @@ void Window::setTransfert( float red, float green, float blue, float alpha ) void Window::displayChannelTexture( bool& channel, const float red, const float green, const float blue ) { - ImgProperties p = m_imageProperties; + ImgProperties p = _imageProperties; if( ! channel ) { setTransfert( red, green, blue ); - m_showRedChannel = false; - m_showGreenChannel = false; - m_showBlueChannel = false; - m_showAlphaChannel = false; + _showRedChannel = false; + _showGreenChannel = false; + _showBlueChannel = false; + _showAlphaChannel = false; channel = true; } else @@ -512,17 +512,17 @@ void Window::displayChannelTexture( bool& channel, const float red, const float void Window::showRedChannelTexture( ) { - displayChannelTexture( m_showRedChannel, 1.f, 0.f, 0.f ); + displayChannelTexture( _showRedChannel, 1.f, 0.f, 0.f ); } void Window::showGreenChannelTexture( ) { - displayChannelTexture( m_showGreenChannel, 0.f, 1.f, 0.f ); + displayChannelTexture( _showGreenChannel, 0.f, 1.f, 0.f ); } void Window::showBlueChannelTexture( ) { - displayChannelTexture( m_showBlueChannel, 0.f, 0.f, 1.f ); + displayChannelTexture( _showBlueChannel, 0.f, 0.f, 1.f ); } void Window::showAlphaChannelTexture( ) @@ -532,14 +532,14 @@ void Window::showAlphaChannelTexture( ) void Window::displayNextFrame() { - const char* buffer = m_reader->readNextFrame(); - loadNewTexture( buffer, m_reader->getComponents(), m_reader->getWidth(), m_reader->getHeight(), GL_RGB, GL_UNSIGNED_BYTE ); + const char* buffer = _reader->readNextFrame(); + loadNewTexture( buffer, _reader->getComponents(), _reader->getWidth(), _reader->getHeight(), GL_RGB, GL_UNSIGNED_BYTE ); } void Window::displayPrevFrame() { - const char* buffer = m_reader->readPrevFrame(); - loadNewTexture( buffer, m_reader->getComponents(), m_reader->getWidth(), m_reader->getHeight(), GL_RGB, GL_UNSIGNED_BYTE ); + const char* buffer = _reader->readPrevFrame(); + loadNewTexture( buffer, _reader->getComponents(), _reader->getWidth(), _reader->getHeight(), GL_RGB, GL_UNSIGNED_BYTE ); } void Window::displayFirstFrame() @@ -549,13 +549,13 @@ void Window::displayFirstFrame() void Window::displayAtFrame( const size_t frame ) { - const char* buffer = m_reader->readFrameAt( frame ); - loadNewTexture( buffer, m_reader->getComponents(), m_reader->getWidth(), m_reader->getHeight(), GL_RGB, GL_UNSIGNED_BYTE ); + const char* buffer = _reader->readFrameAt( frame ); + loadNewTexture( buffer, _reader->getComponents(), _reader->getWidth(), _reader->getHeight(), GL_RGB, GL_UNSIGNED_BYTE ); } void Window::loopPlaying( int value ) { - if( m_play ) + if( _play ) glutTimerFunc( 40, &loopPlaying, 0 ); displayNextFrame(); } diff --git a/app/cpp/avplay/Window.hpp b/app/cpp/avplay/Window.hpp index 45d74f8e..78e6e807 100644 --- a/app/cpp/avplay/Window.hpp +++ b/app/cpp/avplay/Window.hpp @@ -8,7 +8,7 @@ class Window { public: - Window( Reader& reader); + Window( Reader& reader ); void launch(); @@ -43,39 +43,39 @@ class Window static void loopPlaying( int value ); - static Reader* m_reader; + static Reader* _reader; - static size_t m_width; - static size_t m_height; + static size_t _width; + static size_t _height; - static int m_x1; - static int m_x2; - static int m_y1; - static int m_y2; + static int _x1; + static int _x2; + static int _y1; + static int _y2; - static int m_xMinViewport; - static int m_yMinViewport; + static int _xMinViewport; + static int _yMinViewport; - static int m_xMouseRef; - static int m_yMouseRef; + static int _xMouseRef; + static int _yMouseRef; - static int m_windowId; + static int _windowId; // viewing properties - zoom - static float m_currentZoom; - static float m_factorZoom; + static float _currentZoom; + static float _factorZoom; - static float m_scale; + static float _scale; - static bool m_play; + static bool _play; - static bool m_flip; - static bool m_flop; + static bool _flip; + static bool _flop; - static bool m_showRedChannel; - static bool m_showGreenChannel; - static bool m_showBlueChannel; - static bool m_showAlphaChannel; + static bool _showRedChannel; + static bool _showGreenChannel; + static bool _showBlueChannel; + static bool _showAlphaChannel; }; #endif \ No newline at end of file diff --git a/app/cpp/presetChecker/presetChecker.cpp b/app/cpp/presetChecker/presetChecker.cpp index a4304feb..52359895 100644 --- a/app/cpp/presetChecker/presetChecker.cpp +++ b/app/cpp/presetChecker/presetChecker.cpp @@ -14,6 +14,8 @@ int main( int argc, char** argv ) std::cout << p.getProfiles().size() << std::endl; + size_t presetInError = 0; + std::cout << std::left; for( auto profile : p.getProfiles() ) @@ -22,18 +24,35 @@ int main( int argc, char** argv ) for( auto key : profile ) std::cout << std::setw(35) << key.first << key.second << std::endl; - if( profile.find( avtranscoder::Profile::avProfileType )->second == avtranscoder::Profile::avProfileTypeVideo ) - { - avtranscoder::OutputVideo outputVideo; - outputVideo.setProfile( profile, outputVideo.getVideoDesc().getVideoFrameDesc() ); + try{ + if( profile.find( avtranscoder::Profile::avProfileType )->second == avtranscoder::Profile::avProfileTypeVideo ) + { + avtranscoder::OutputVideo outputVideo; + outputVideo.setProfile( profile, outputVideo.getVideoDesc().getVideoFrameDesc() ); + } + + if( profile.find( avtranscoder::Profile::avProfileType )->second == avtranscoder::Profile::avProfileTypeAudio ) + { + avtranscoder::OutputAudio outputAudio; + outputAudio.setProfile( profile, outputAudio.getAudioDesc().getFrameDesc() ); + } } - - if( profile.find( avtranscoder::Profile::avProfileType )->second == avtranscoder::Profile::avProfileTypeAudio ) + catch( ... ) { - avtranscoder::OutputAudio outputAudio; - outputAudio.setProfile( profile, outputAudio.getAudioDesc().getFrameDesc() ); + std::cout << "ERROR on preset ! " << std::endl; + presetInError ++; } - } -} \ No newline at end of file + std::cout << "********************" << std::endl; + std::cout << " Result: " << std::endl; + if( presetInError ) + { + std::cout << presetInError << " / " << p.getProfiles().size() << " are incorrects" << std::endl; + } + else + { + std::cout << "every presets are corrects" << std::endl; + } + std::cout << "********************" << std::endl; +} diff --git a/src/AvTranscoder/CodedStream/AvInputStream.cpp b/src/AvTranscoder/CodedStream/AvInputStream.cpp index bf1367c0..be6ba99f 100644 --- a/src/AvTranscoder/CodedStream/AvInputStream.cpp +++ b/src/AvTranscoder/CodedStream/AvInputStream.cpp @@ -89,7 +89,7 @@ void AvInputStream::addPacket( AVPacket& packet ) // remove reference on packet because it's passed to DataStream // packet.data = NULL; - // packet.size = 0; + // packet.size = 0; // std::cout << this << " buffer size " << _streamCache.size() << std::endl; } diff --git a/src/AvTranscoder/CodedStream/OutputStream.hpp b/src/AvTranscoder/CodedStream/OutputStream.hpp index bd4bb6f4..3479f388 100644 --- a/src/AvTranscoder/CodedStream/OutputStream.hpp +++ b/src/AvTranscoder/CodedStream/OutputStream.hpp @@ -21,7 +21,7 @@ class OutputStream // Stream properties virtual VideoDesc getVideoDesc() const = 0; - virtual AudioDesc getAudioDesc() const = 0; + virtual AudioDesc getAudioDesc() const = 0; }; } diff --git a/src/AvTranscoder/CodedStructures/AudioDesc.cpp b/src/AvTranscoder/CodedStructures/AudioDesc.cpp index 5fa37221..1c358f0f 100644 --- a/src/AvTranscoder/CodedStructures/AudioDesc.cpp +++ b/src/AvTranscoder/CodedStructures/AudioDesc.cpp @@ -18,18 +18,18 @@ AudioDesc::AudioDesc( const AVCodecID codecId ) AudioDesc::AudioDesc( const CodedDesc& essenceDesc ) : CodedDesc( essenceDesc.getCodecId() ) { - m_codec = essenceDesc.getCodec(); - m_codecContext = essenceDesc.getCodecContext(); + _codec = essenceDesc.getCodec(); + _codecContext = essenceDesc.getCodecContext(); } AudioFrameDesc AudioDesc::getFrameDesc() const { - assert( m_codecContext != NULL ); + assert( _codecContext != NULL ); AudioFrameDesc audioFrameDesc; - audioFrameDesc.setChannels( m_codecContext->channels ); - audioFrameDesc.setSampleRate( m_codecContext->sample_rate ); - audioFrameDesc.setSampleFormat( m_codecContext->sample_fmt ); + audioFrameDesc.setChannels( _codecContext->channels ); + audioFrameDesc.setSampleRate( _codecContext->sample_rate ); + audioFrameDesc.setSampleFormat( _codecContext->sample_fmt ); // audioFrameDesc.setFps( 25 ); return audioFrameDesc; @@ -37,20 +37,20 @@ AudioFrameDesc AudioDesc::getFrameDesc() const const size_t AudioDesc::getSampleRate() const { - assert( m_codecContext != NULL ); - return m_codecContext->sample_rate; + assert( _codecContext != NULL ); + return _codecContext->sample_rate; } const size_t AudioDesc::getChannels() const { - assert( m_codecContext != NULL ); - return m_codecContext->channels; + assert( _codecContext != NULL ); + return _codecContext->channels; } const AVSampleFormat AudioDesc::getSampleFormat() const { - assert( m_codecContext != NULL ); - return m_codecContext->sample_fmt; + assert( _codecContext != NULL ); + return _codecContext->sample_fmt; } void AudioDesc::setAudioParameters( const AudioFrameDesc& audioFrameDesc ) @@ -60,9 +60,9 @@ void AudioDesc::setAudioParameters( const AudioFrameDesc& audioFrameDesc ) void AudioDesc::setAudioParameters( const size_t sampleRate, const size_t channels, const AVSampleFormat sampleFormat ) { - m_codecContext->sample_rate = sampleRate; - m_codecContext->channels = channels; - m_codecContext->sample_fmt = sampleFormat; + _codecContext->sample_rate = sampleRate; + _codecContext->channels = channels; + _codecContext->sample_fmt = sampleFormat; } } diff --git a/src/AvTranscoder/CodedStructures/CodedDesc.cpp b/src/AvTranscoder/CodedStructures/CodedDesc.cpp index f5361dcc..3f8418b4 100644 --- a/src/AvTranscoder/CodedStructures/CodedDesc.cpp +++ b/src/AvTranscoder/CodedStructures/CodedDesc.cpp @@ -6,73 +6,73 @@ namespace avtranscoder { CodedDesc::CodedDesc( const std::string& codecName ) - : m_codec( NULL ) - , m_codecContext( NULL ) + : _codec( NULL ) + , _codecContext( NULL ) { if( codecName.size() ) setCodec( codecName ); } CodedDesc::CodedDesc( const AVCodecID codecId ) - : m_codec( NULL ) - , m_codecContext( NULL ) + : _codec( NULL ) + , _codecContext( NULL ) { setCodec( codecId ); } CodedDesc::CodedDesc( AVCodec& avCodec, AVCodecContext& avCodecContext ) - : m_codec( &avCodec ) - , m_codecContext( &avCodecContext ) + : _codec( &avCodec ) + , _codecContext( &avCodecContext ) { } std::string CodedDesc::getCodecName() const { - assert( m_codecContext != NULL ); - return avcodec_descriptor_get( m_codecContext->codec_id )->name; + assert( _codecContext != NULL ); + return avcodec_descriptor_get( _codecContext->codec_id )->name; } AVCodecID CodedDesc::getCodecId() const { - assert( m_codecContext != NULL ); - return m_codecContext->codec_id; + assert( _codecContext != NULL ); + return _codecContext->codec_id; } int CodedDesc::getLatency() const { - assert( m_codecContext != NULL ); - return m_codecContext->delay; + assert( _codecContext != NULL ); + return _codecContext->delay; } void CodedDesc::setCodec( const std::string& codecName ) { avcodec_register_all(); // Warning: should be called only once - m_codec = avcodec_find_encoder_by_name( codecName.c_str() ); + _codec = avcodec_find_encoder_by_name( codecName.c_str() ); initCodecContext(); } void CodedDesc::setCodec( const AVCodecID codecId ) { avcodec_register_all(); // Warning: should be called only once - m_codec = avcodec_find_encoder( codecId ); + _codec = avcodec_find_encoder( codecId ); initCodecContext(); } void CodedDesc::initCodecContext( ) { - if( m_codec == NULL ) + if( _codec == NULL ) { throw std::runtime_error( "unknown codec" ); } - if( ( m_codecContext = avcodec_alloc_context3( m_codec ) ) == NULL ) + if( ( _codecContext = avcodec_alloc_context3( _codec ) ) == NULL ) { throw std::runtime_error( "unable to create context for context" ); } // Set default codec parameters - if( avcodec_get_context_defaults3( m_codecContext, m_codec ) != 0 ) + if( avcodec_get_context_defaults3( _codecContext, _codec ) != 0 ) { throw std::runtime_error( "unable to find codec default values" ); } diff --git a/src/AvTranscoder/CodedStructures/CodedDesc.hpp b/src/AvTranscoder/CodedStructures/CodedDesc.hpp index 13a3e487..3bbf65c3 100644 --- a/src/AvTranscoder/CodedStructures/CodedDesc.hpp +++ b/src/AvTranscoder/CodedStructures/CodedDesc.hpp @@ -29,8 +29,8 @@ class AvExport CodedDesc void setCodec( const AVCodecID codecId ); #ifndef SWIG - AVCodec* getCodec() const { return m_codec; } - AVCodecContext* getCodecContext() const { return m_codecContext; } + AVCodec* getCodec() const { return _codec; } + AVCodecContext* getCodecContext() const { return _codecContext; } #endif private: @@ -39,8 +39,8 @@ class AvExport CodedDesc void checkError( int error ); protected: - AVCodec* m_codec; - AVCodecContext* m_codecContext; + AVCodec* _codec; + AVCodecContext* _codecContext; }; } diff --git a/src/AvTranscoder/CodedStructures/DataStream.hpp b/src/AvTranscoder/CodedStructures/DataStream.hpp index 65d9caaa..8f1f1a18 100644 --- a/src/AvTranscoder/CodedStructures/DataStream.hpp +++ b/src/AvTranscoder/CodedStructures/DataStream.hpp @@ -13,18 +13,18 @@ class DataStream typedef std::vector< unsigned char > DataBuffer; DataStream( ) - : m_dataBuffer( 0, 0 ) + : _dataBuffer( 0, 0 ) { } - DataBuffer& getBuffer() { return m_dataBuffer; } - unsigned char* getPtr() { return &m_dataBuffer[0]; } + DataBuffer& getBuffer() { return _dataBuffer; } + unsigned char* getPtr() { return &_dataBuffer[0]; } #ifndef SWIG - const unsigned char* getPtr() const { return &m_dataBuffer[0]; } + const unsigned char* getPtr() const { return &_dataBuffer[0]; } #endif - size_t getSize() const { return m_dataBuffer.size(); } + size_t getSize() const { return _dataBuffer.size(); } private: - DataBuffer m_dataBuffer; + DataBuffer _dataBuffer; }; } diff --git a/src/AvTranscoder/CodedStructures/VideoDesc.cpp b/src/AvTranscoder/CodedStructures/VideoDesc.cpp index 96c83433..1c145c4f 100644 --- a/src/AvTranscoder/CodedStructures/VideoDesc.cpp +++ b/src/AvTranscoder/CodedStructures/VideoDesc.cpp @@ -18,29 +18,29 @@ VideoDesc::VideoDesc( const AVCodecID codecId ) VideoDesc::VideoDesc( const CodedDesc& essenceDesc ) : CodedDesc( essenceDesc.getCodecId() ) { - m_codec = essenceDesc.getCodec(); - m_codecContext = essenceDesc.getCodecContext(); + _codec = essenceDesc.getCodec(); + _codecContext = essenceDesc.getCodecContext(); } VideoFrameDesc VideoDesc::getVideoFrameDesc() const { - assert( m_codecContext != NULL ); + assert( _codecContext != NULL ); VideoFrameDesc VideoFrameDesc; - Pixel pixel( m_codecContext->pix_fmt ); + Pixel pixel( _codecContext->pix_fmt ); - VideoFrameDesc.setWidth ( m_codecContext->width ); - VideoFrameDesc.setHeight( m_codecContext->height ); + VideoFrameDesc.setWidth ( _codecContext->width ); + VideoFrameDesc.setHeight( _codecContext->height ); VideoFrameDesc.setPixel ( pixel ); - VideoFrameDesc.setDar ( m_codecContext->height, m_codecContext->width ); + VideoFrameDesc.setDar ( _codecContext->height, _codecContext->width ); return VideoFrameDesc; } std::pair< size_t, size_t > VideoDesc::getTimeBase() const { - assert( m_codecContext != NULL ); + assert( _codecContext != NULL ); std::pair< size_t, size_t > timeBase; - timeBase.first = m_codecContext->time_base.num; - timeBase.second = m_codecContext->time_base.den; + timeBase.first = _codecContext->time_base.num; + timeBase.second = _codecContext->time_base.den; return timeBase; } @@ -57,16 +57,16 @@ void VideoDesc::setImageParameters( const size_t width, const size_t height, con void VideoDesc::setImageParameters( const size_t width, const size_t height, const AVPixelFormat& pixel ) { - m_codecContext->width = width; - m_codecContext->height = height; - m_codecContext->pix_fmt = pixel; + _codecContext->width = width; + _codecContext->height = height; + _codecContext->pix_fmt = pixel; } void VideoDesc::setTimeBase( const size_t num, const size_t den, const size_t ticksPerFrame ) { - m_codecContext->time_base.num = num; - m_codecContext->time_base.den = den; - m_codecContext->ticks_per_frame = ticksPerFrame; + _codecContext->time_base.num = num; + _codecContext->time_base.den = den; + _codecContext->ticks_per_frame = ticksPerFrame; } } diff --git a/src/AvTranscoder/EssenceStream/DummyAudio.hpp b/src/AvTranscoder/EssenceStream/DummyAudio.hpp index df66a3a0..e4acc93d 100644 --- a/src/AvTranscoder/EssenceStream/DummyAudio.hpp +++ b/src/AvTranscoder/EssenceStream/DummyAudio.hpp @@ -33,7 +33,7 @@ class AvExport DummyAudio : public InputEssence AudioDesc _audioDesc; AudioFrameDesc _frameDesc; - Frame* _inputFrame; + Frame* _inputFrame; }; } diff --git a/src/AvTranscoder/EssenceStream/DummyVideo.hpp b/src/AvTranscoder/EssenceStream/DummyVideo.hpp index 69bc2738..1da068e6 100644 --- a/src/AvTranscoder/EssenceStream/DummyVideo.hpp +++ b/src/AvTranscoder/EssenceStream/DummyVideo.hpp @@ -30,11 +30,11 @@ class AvExport DummyVideo : public InputEssence bool readNextFrame( Frame& frameBuffer, const size_t subStreamIndex ); private: - Frame* _inputFrame; - VideoDesc _videoDesc; + Frame* _inputFrame; + VideoDesc _videoDesc; VideoFrameDesc _videoFrameDesc; - size_t _numberOfView; + size_t _numberOfView; }; } diff --git a/src/AvTranscoder/EssenceStream/InputAudio.cpp b/src/AvTranscoder/EssenceStream/InputAudio.cpp index 65753c0d..d6e00bb3 100644 --- a/src/AvTranscoder/EssenceStream/InputAudio.cpp +++ b/src/AvTranscoder/EssenceStream/InputAudio.cpp @@ -106,9 +106,10 @@ bool InputAudio::readNextFrame( Frame& frameBuffer ) if( ! getNextFrame() ) return false; - size_t decodedSize = av_samples_get_buffer_size(NULL, _codecContext->channels, - _frame->nb_samples, - _codecContext->sample_fmt, 1); + size_t decodedSize = av_samples_get_buffer_size( + NULL, _codecContext->channels, + _frame->nb_samples, + _codecContext->sample_fmt, 1 ); AudioFrame& audioBuffer = static_cast( frameBuffer ); @@ -120,9 +121,10 @@ bool InputAudio::readNextFrame( Frame& frameBuffer ) audioBuffer.getBuffer().resize( decodedSize, 0 ); unsigned char* dst = audioBuffer.getPtr(); - av_samples_copy(&dst, (uint8_t* const* )_frame->data, 0, - 0, _frame->nb_samples, _codecContext->channels, - _codecContext->sample_fmt); + av_samples_copy( + &dst, (uint8_t* const* )_frame->data, 0, + 0, _frame->nb_samples, _codecContext->channels, + _codecContext->sample_fmt ); } return true; diff --git a/src/AvTranscoder/EssenceStructures/AudioFrame.hpp b/src/AvTranscoder/EssenceStructures/AudioFrame.hpp index a6ac1038..99f01d76 100644 --- a/src/AvTranscoder/EssenceStructures/AudioFrame.hpp +++ b/src/AvTranscoder/EssenceStructures/AudioFrame.hpp @@ -12,21 +12,21 @@ class AvExport AudioFrameDesc { public: AudioFrameDesc() - : m_sampleRate( 0 ) - , m_channels( 0 ) - , m_fps( 1.0 ) - , m_sampleFormat( AV_SAMPLE_FMT_NONE ) + : _sampleRate( 0 ) + , _channels( 0 ) + , _fps( 1.0 ) + , _sampleFormat( AV_SAMPLE_FMT_NONE ) {}; - void setSampleRate ( const size_t sampleRate ){ m_sampleRate = sampleRate; } - void setChannels ( const size_t channels ){ m_channels = channels; } - void setFps ( const size_t fps ){ m_fps = fps; } - void setSampleFormat( const std::string& sampleFormatName ){ m_sampleFormat = av_get_sample_fmt( sampleFormatName.c_str() ); } - void setSampleFormat( const AVSampleFormat sampleFormat ){ m_sampleFormat = sampleFormat; } + void setSampleRate ( const size_t sampleRate ){ _sampleRate = sampleRate; } + void setChannels ( const size_t channels ){ _channels = channels; } + void setFps ( const size_t fps ){ _fps = fps; } + void setSampleFormat( const std::string& sampleFormatName ){ _sampleFormat = av_get_sample_fmt( sampleFormatName.c_str() ); } + void setSampleFormat( const AVSampleFormat sampleFormat ){ _sampleFormat = sampleFormat; } size_t getDataSize() const { - return ( m_sampleRate / m_fps ) * m_channels * av_get_bytes_per_sample( m_sampleFormat ); + return ( _sampleRate / _fps ) * _channels * av_get_bytes_per_sample( _sampleFormat ); } void setParameters( const Profile::ProfileDesc& desc ) @@ -35,37 +35,37 @@ class AvExport AudioFrameDesc setSampleFormat( desc.find( Profile::avProfileSampleFormat )->second ); } - size_t getSampleRate() const { return m_sampleRate; } - size_t getChannels () const { return m_channels; } - size_t getFps () const { return m_fps; } - AVSampleFormat getSampleFormat() const { return m_sampleFormat; } + size_t getSampleRate() const { return _sampleRate; } + size_t getChannels () const { return _channels; } + size_t getFps () const { return _fps; } + AVSampleFormat getSampleFormat() const { return _sampleFormat; } private: - size_t m_sampleRate; - size_t m_channels; - double m_fps; + size_t _sampleRate; + size_t _channels; + double _fps; - AVSampleFormat m_sampleFormat; + AVSampleFormat _sampleFormat; }; class AvExport AudioFrame : public Frame { public: AudioFrame( const AudioFrameDesc& ref ) - : m_audioFrameDesc( ref ) - , m_nbSamples( 0 ) + : _audioFrameDesc( ref ) + , _nbSamples( 0 ) { - m_dataBuffer = DataBuffer( ref.getDataSize(), (unsigned char) 0 ); + _dataBuffer = DataBuffer( ref.getDataSize(), (unsigned char) 0 ); } - const AudioFrameDesc& desc() const { return m_audioFrameDesc; } + const AudioFrameDesc& desc() const { return _audioFrameDesc; } - size_t getNbSamples() const { return m_nbSamples; } - void setNbSamples( size_t nbSamples ) { m_nbSamples = nbSamples; } + size_t getNbSamples() const { return _nbSamples; } + void setNbSamples( size_t nbSamples ) { _nbSamples = nbSamples; } private: - const AudioFrameDesc m_audioFrameDesc; - size_t m_nbSamples; + const AudioFrameDesc _audioFrameDesc; + size_t _nbSamples; }; } diff --git a/src/AvTranscoder/EssenceStructures/Frame.hpp b/src/AvTranscoder/EssenceStructures/Frame.hpp index d133574d..056d41ef 100644 --- a/src/AvTranscoder/EssenceStructures/Frame.hpp +++ b/src/AvTranscoder/EssenceStructures/Frame.hpp @@ -17,15 +17,15 @@ class AvExport Frame virtual ~Frame(){}; - virtual DataBuffer& getBuffer() { return m_dataBuffer; } - virtual unsigned char* getPtr() { return &m_dataBuffer[0]; } + virtual DataBuffer& getBuffer() { return _dataBuffer; } + virtual unsigned char* getPtr() { return &_dataBuffer[0]; } #ifndef SWIG - virtual const unsigned char* getPtr() const { return &m_dataBuffer[0]; } + virtual const unsigned char* getPtr() const { return &_dataBuffer[0]; } #endif - virtual size_t getSize() const { return m_dataBuffer.size(); } + virtual size_t getSize() const { return _dataBuffer.size(); } protected: - DataBuffer m_dataBuffer; + DataBuffer _dataBuffer; }; diff --git a/src/AvTranscoder/EssenceStructures/Pixel.cpp b/src/AvTranscoder/EssenceStructures/Pixel.cpp index a17a3a01..86b5cee1 100644 --- a/src/AvTranscoder/EssenceStructures/Pixel.cpp +++ b/src/AvTranscoder/EssenceStructures/Pixel.cpp @@ -21,13 +21,13 @@ Pixel::Pixel( const std::string& avPixelFormat ) } Pixel::Pixel( const AVPixelFormat avPixelFormat ) - : m_pixelSize ( 24 ) - , m_components ( 3 ) - , m_componentType ( eComponentYuv ) - , m_subsamplingType ( eSubsamplingNone ) - , m_endianess ( false ) - , m_withAlpha ( false ) - , m_planar ( true ) + : _pixelSize ( 24 ) + , _components ( 3 ) + , _componentType ( eComponentYuv ) + , _subsamplingType ( eSubsamplingNone ) + , _endianess ( false ) + , _withAlpha ( false ) + , _planar ( true ) { init( avPixelFormat ); } @@ -44,16 +44,16 @@ AVPixelFormat Pixel::findPixel() const { const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[ pixFmtIndex ]; #endif - if( m_components == (size_t) pix_desc->nb_components && - m_pixelSize == (size_t) av_get_bits_per_pixel( pix_desc ) && - m_endianess == ( pix_desc->flags & PIX_FMT_BE ) && + if( _components == (size_t) pix_desc->nb_components && + _pixelSize == (size_t) av_get_bits_per_pixel( pix_desc ) && + _endianess == ( pix_desc->flags & PIX_FMT_BE ) && #if LIBAVUTIL_VERSION_MAJOR > 51 - m_withAlpha == ( pix_desc->flags & PIX_FMT_ALPHA ) && + _withAlpha == ( pix_desc->flags & PIX_FMT_ALPHA ) && // @todo what need todo if libavutil <= 51 ? #endif - m_planar == ( ( pix_desc->flags & PIX_FMT_PLANAR ) != 0 ) && - asCorrectColorComponents( pix_desc, m_componentType ) && - asCorrectSubsampling( pix_desc, m_subsamplingType ) ) + _planar == ( ( pix_desc->flags & PIX_FMT_PLANAR ) != 0 ) && + asCorrectColorComponents( pix_desc, _componentType ) && + asCorrectSubsampling( pix_desc, _subsamplingType ) ) { #if LIBAVUTIL_VERSION_MAJOR > 51 return av_pix_fmt_desc_get_id( pix_desc ); diff --git a/src/AvTranscoder/EssenceStructures/Pixel.hpp b/src/AvTranscoder/EssenceStructures/Pixel.hpp index 50db8933..252d4a08 100644 --- a/src/AvTranscoder/EssenceStructures/Pixel.hpp +++ b/src/AvTranscoder/EssenceStructures/Pixel.hpp @@ -35,34 +35,34 @@ class Pixel { public: Pixel() - : m_pixelSize ( 24 ) - , m_components ( 3 ) - , m_componentType ( eComponentYuv ) - , m_subsamplingType ( eSubsamplingNone ) - , m_endianess ( false ) - , m_withAlpha ( false ) - , m_planar ( true ) + : _pixelSize ( 24 ) + , _components ( 3 ) + , _componentType ( eComponentYuv ) + , _subsamplingType ( eSubsamplingNone ) + , _endianess ( false ) + , _withAlpha ( false ) + , _planar ( true ) { } Pixel( const std::string& avPixelFormat ); Pixel( const AVPixelFormat avPixelFormat ); - void setBitsPerPixel ( const size_t pixelSize ) { m_pixelSize = pixelSize; } - void setBigEndian ( const bool endianess ) { m_endianess = endianess; } - void setComponents ( const size_t components ) { m_components = components; } - void setColorComponents( const EComponentType componentType ) { m_componentType = componentType; } - void setSubsampling ( const ESubsamplingType subsamplingType = eSubsamplingNone ) { m_subsamplingType = subsamplingType; } - void setAlpha ( const bool withAlpha = true ) { m_withAlpha = withAlpha; } - void setPlanar ( const bool isPlanar ) { m_planar = isPlanar; } - - size_t getBitsPerPixel () const { return m_pixelSize; } - bool getBigEndian () const { return m_endianess; } - size_t getComponents () const { return m_components; } - EComponentType getColorComponents() const { return m_componentType; } - ESubsamplingType getSubsampling () const { return m_subsamplingType; } - bool getAlpha () const { return m_withAlpha; } - bool getPlanar () const { return m_planar; } + void setBitsPerPixel ( const size_t pixelSize ) { _pixelSize = pixelSize; } + void setBigEndian ( const bool endianess ) { _endianess = endianess; } + void setComponents ( const size_t components ) { _components = components; } + void setColorComponents( const EComponentType componentType ) { _componentType = componentType; } + void setSubsampling ( const ESubsamplingType subsamplingType = eSubsamplingNone ) { _subsamplingType = subsamplingType; } + void setAlpha ( const bool withAlpha = true ) { _withAlpha = withAlpha; } + void setPlanar ( const bool isPlanar ) { _planar = isPlanar; } + + size_t getBitsPerPixel () const { return _pixelSize; } + bool getBigEndian () const { return _endianess; } + size_t getComponents () const { return _components; } + EComponentType getColorComponents() const { return _componentType; } + ESubsamplingType getSubsampling () const { return _subsamplingType; } + bool getAlpha () const { return _withAlpha; } + bool getPlanar () const { return _planar; } AVPixelFormat findPixel() const; @@ -72,13 +72,13 @@ class Pixel bool asCorrectColorComponents( const AVPixFmtDescriptor* pix_desc, const EComponentType componentType ) const; bool asCorrectSubsampling( const AVPixFmtDescriptor* pix_desc, const ESubsamplingType subsamplingType ) const; - size_t m_pixelSize; - size_t m_components; - EComponentType m_componentType; - ESubsamplingType m_subsamplingType; - bool m_endianess; - bool m_withAlpha; - bool m_planar; + size_t _pixelSize; + size_t _components; + EComponentType _componentType; + ESubsamplingType _subsamplingType; + bool _endianess; + bool _withAlpha; + bool _planar; //AVChromaLocation }; diff --git a/src/AvTranscoder/EssenceStructures/VideoFrame.hpp b/src/AvTranscoder/EssenceStructures/VideoFrame.hpp index bfade4ad..5817b5bc 100644 --- a/src/AvTranscoder/EssenceStructures/VideoFrame.hpp +++ b/src/AvTranscoder/EssenceStructures/VideoFrame.hpp @@ -35,19 +35,19 @@ class AvExport VideoFrameDesc { public: VideoFrameDesc() - : m_width( 0 ) - , m_height( 0 ) - , m_displayAspectRatio() - , m_pixel() - , m_interlaced( false ) - , m_topFieldFirst( false ) + : _width( 0 ) + , _height( 0 ) + , _displayAspectRatio() + , _pixel() + , _interlaced( false ) + , _topFieldFirst( false ) {}; - void setWidth ( const size_t width ) { m_width = width; } - void setHeight( const size_t height ) { m_height = height; } - void setPixel ( const Pixel pixel ) { m_pixel = pixel; } - void setDar ( const size_t num, const size_t den ) { m_displayAspectRatio.num = num; m_displayAspectRatio.den = den; } - void setDar ( const Ratio ratio ) { m_displayAspectRatio = ratio; } + void setWidth ( const size_t width ) { _width = width; } + void setHeight( const size_t height ) { _height = height; } + void setPixel ( const Pixel pixel ) { _pixel = pixel; } + void setDar ( const size_t num, const size_t den ) { _displayAspectRatio.num = num; _displayAspectRatio.den = den; } + void setDar ( const Ratio ratio ) { _displayAspectRatio = ratio; } void setParameters( const Profile::ProfileDesc& desc ) { @@ -55,19 +55,19 @@ class AvExport VideoFrameDesc setPixel( Pixel( desc.find( Profile::avProfilePixelFormat )->second.c_str() ) ); } - size_t getWidth () const { return m_width; } - size_t getHeight() const { return m_height; } - Ratio getDar() const { return m_displayAspectRatio; } - Pixel getPixelDesc() const { return m_pixel; } + size_t getWidth () const { return _width; } + size_t getHeight() const { return _height; } + Ratio getDar() const { return _displayAspectRatio; } + Pixel getPixelDesc() const { return _pixel; } size_t getDataSize() const { - AVPixelFormat pixelFormat = m_pixel.findPixel(); + AVPixelFormat pixelFormat = _pixel.findPixel(); if( pixelFormat == AV_PIX_FMT_NONE ) { throw std::runtime_error( "incorrect pixel description" ); } - size_t size = avpicture_get_size( pixelFormat, m_width, m_height ); + size_t size = avpicture_get_size( pixelFormat, _width, _height ); if( size == 0 ) { throw std::runtime_error( "unable to determine image buffer size" ); @@ -76,14 +76,14 @@ class AvExport VideoFrameDesc } private: - size_t m_width; - size_t m_height; - Ratio m_displayAspectRatio; - Pixel m_pixel; - // ColorProperties m_color; - - bool m_interlaced; - bool m_topFieldFirst; + size_t _width; + size_t _height; + Ratio _displayAspectRatio; + Pixel _pixel; + // ColorProperties _color; + + bool _interlaced; + bool _topFieldFirst; }; //template< template Alloc > @@ -92,15 +92,15 @@ class AvExport VideoFrame : public Frame { public: VideoFrame( const VideoFrameDesc& ref ) - : m_videoFrameDesc( ref ) + : _videoFrameDesc( ref ) { - m_dataBuffer = DataBuffer( ref.getDataSize(), 0 ); + _dataBuffer = DataBuffer( ref.getDataSize(), 0 ); } - const VideoFrameDesc& desc() const { return m_videoFrameDesc; } + const VideoFrameDesc& desc() const { return _videoFrameDesc; } private: - const VideoFrameDesc m_videoFrameDesc; + const VideoFrameDesc _videoFrameDesc; }; //typedef ImageBase VideoFrame; diff --git a/src/AvTranscoder/File/OutputFile.hpp b/src/AvTranscoder/File/OutputFile.hpp index d7effd3d..06cc0dab 100644 --- a/src/AvTranscoder/File/OutputFile.hpp +++ b/src/AvTranscoder/File/OutputFile.hpp @@ -104,7 +104,7 @@ class AvExport OutputFile /** * @brief Add metadata to the output file. * @note Depending on the format, you are not sure to find your metadata after the transcode. - */ + */ virtual void addMetadata( const MetadatasMap& dataMap ); virtual void addMetadata( const std::string& key, const std::string& value ); diff --git a/src/AvTranscoder/Metadatas/AttachementStreamProperties.hpp b/src/AvTranscoder/Metadatas/AttachementStreamProperties.hpp index 2e3f7e2c..93de0ae5 100644 --- a/src/AvTranscoder/Metadatas/AttachementStreamProperties.hpp +++ b/src/AvTranscoder/Metadatas/AttachementStreamProperties.hpp @@ -9,7 +9,7 @@ namespace avtranscoder AttachementProperties attachementStreamInfo( const AVFormatContext* formatContext, const size_t index ) { AttachementProperties ap; - ap.streamId = index; + ap.streamId = index; return ap; } diff --git a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp index cedb7209..41a95771 100644 --- a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp +++ b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp @@ -19,7 +19,7 @@ namespace detail { /** * @brief Fill metadata parameter with the given AVDictionary. - */ + */ void fillMetadataDictionnary( AVDictionary* avdictionnary, MetadatasMap& metadata ); } @@ -98,7 +98,7 @@ struct AudioProperties std::string sampleFormat; std::string channelLayout; std::string channelName; - std::string channelDescription; + std::string channelDescription; size_t streamId; size_t codecId; size_t sampleRate; diff --git a/src/AvTranscoder/Metadatas/SubtitleStreamProperties.hpp b/src/AvTranscoder/Metadatas/SubtitleStreamProperties.hpp index 49aca6a1..9253a319 100644 --- a/src/AvTranscoder/Metadatas/SubtitleStreamProperties.hpp +++ b/src/AvTranscoder/Metadatas/SubtitleStreamProperties.hpp @@ -9,7 +9,7 @@ namespace avtranscoder SubtitleProperties subtitleStreamInfo( const AVFormatContext* formatContext, const size_t index ) { SubtitleProperties sp; - sp.streamId = index; + sp.streamId = index; return sp; } diff --git a/src/AvTranscoder/Metadatas/UnknownStreamProperties.hpp b/src/AvTranscoder/Metadatas/UnknownStreamProperties.hpp index a6fc9aee..3d2b21e4 100644 --- a/src/AvTranscoder/Metadatas/UnknownStreamProperties.hpp +++ b/src/AvTranscoder/Metadatas/UnknownStreamProperties.hpp @@ -9,7 +9,7 @@ namespace avtranscoder UnknownProperties unknownStreamInfo( const AVFormatContext* formatContext, const size_t index ) { UnknownProperties up; - up.streamId = index; + up.streamId = index; return up; } diff --git a/src/AvTranscoder/Option.cpp b/src/AvTranscoder/Option.cpp index bbf8bb49..2bd4b73f 100644 --- a/src/AvTranscoder/Option.cpp +++ b/src/AvTranscoder/Option.cpp @@ -9,7 +9,6 @@ Option::Option( const AVOption& avOption, OptionType type ) , _options() , _defaultChildIndex( 0 ) { - } OptionType Option::getTypeFromAVOption( const char* unit, AVOptionType avType ) diff --git a/src/AvTranscoder/OptionLoader.cpp b/src/AvTranscoder/OptionLoader.cpp index 1727dd0f..2d55cae8 100644 --- a/src/AvTranscoder/OptionLoader.cpp +++ b/src/AvTranscoder/OptionLoader.cpp @@ -278,7 +278,7 @@ OptionLoader::OptionArray OptionLoader::loadOptions( void* av_class, int req_fla parentOption.setDefaultChildIndex( parentOption.getNbChilds() - 1 ); } } - } + } } return options; } diff --git a/src/AvTranscoder/OptionLoader.hpp b/src/AvTranscoder/OptionLoader.hpp index 8cf448b8..69010829 100644 --- a/src/AvTranscoder/OptionLoader.hpp +++ b/src/AvTranscoder/OptionLoader.hpp @@ -76,13 +76,13 @@ class OptionLoader /** * @brief Get the corresponding AVPixelFormat from the pixel format name * @param pixelFormat the name of the pixel format - */ + */ static AVPixelFormat getAVPixelFormat( const std::string& pixelFormat ); /** * @brief Get the corresponding AVSampleFormat from the sample format name * @param sampleFormat the name of the sample format - */ + */ static AVSampleFormat getAVSampleFormat( const std::string& sampleFormat ); private: diff --git a/src/AvTranscoder/Transcoder/StreamTranscoder.hpp b/src/AvTranscoder/Transcoder/StreamTranscoder.hpp index 274446cc..9eb47cbb 100644 --- a/src/AvTranscoder/Transcoder/StreamTranscoder.hpp +++ b/src/AvTranscoder/Transcoder/StreamTranscoder.hpp @@ -111,7 +111,7 @@ class StreamTranscoder */ bool _infinityStream; }; - + } #endif diff --git a/src/AvTranscoder/avTranscoder.i b/src/AvTranscoder/avTranscoder.i index 395e25f5..2da7e36e 100644 --- a/src/AvTranscoder/avTranscoder.i +++ b/src/AvTranscoder/avTranscoder.i @@ -18,7 +18,7 @@ #include #include #include - + #include #include #include @@ -48,8 +48,6 @@ #include #include - - %} %include "AvTranscoder/ProgressListener.i" @@ -75,7 +73,7 @@ namespace std { %include %include %include - + %include %include %include @@ -105,4 +103,3 @@ namespace std { %include %include - diff --git a/src/AvTranscoder/common.cpp b/src/AvTranscoder/common.cpp index 22e2b157..74ca9d97 100644 --- a/src/AvTranscoder/common.cpp +++ b/src/AvTranscoder/common.cpp @@ -130,23 +130,23 @@ void split( std::vector< std::string >& splitedString, const std::string& inputS int getFilesInDir( const std::string& dir, std::vector< std::string >& files ) { - DIR *dp; - struct dirent *dirp; - if( ( dp = opendir( dir.c_str() ) ) == NULL ) - { - std::cerr << "Error(" << errno << ") opening " << dir << std::endl; - return errno; - } - - while( ( dirp = readdir( dp ) ) != NULL ) - { - std::string filename( dirp->d_name ); + DIR *dp; + struct dirent *dirp; + if( ( dp = opendir( dir.c_str() ) ) == NULL ) + { + std::cerr << "Error(" << errno << ") opening " << dir << std::endl; + return errno; + } + + while( ( dirp = readdir( dp ) ) != NULL ) + { + std::string filename( dirp->d_name ); if( filename == "." || filename == ".." ) continue; - files.push_back( filename ); - } - closedir( dp ); - return 0; + files.push_back( filename ); + } + closedir( dp ); + return 0; } std::string getFormat( const std::string& filename ) diff --git a/src/AvTranscoder/common.hpp b/src/AvTranscoder/common.hpp index 13f78171..51f4f922 100644 --- a/src/AvTranscoder/common.hpp +++ b/src/AvTranscoder/common.hpp @@ -82,11 +82,9 @@ class ParamSet void* _objContext; }; - void split( std::vector< std::string >& splitedString, const std::string& inputString, const std::string& splitChars = ";" ); int getFilesInDir( const std::string& dir, std::vector< std::string >& files ); - std::string getFormat( const std::string& filename ); bool matchFormat( const std::string& format, const std::string& filename );