Re-format code

This commit is contained in:
jfmcarreira committed 2017-03-23 04:29:34 +00:00
1 parent fd68d340bd
commit ebc10d1b84
85 files changed
+8092 -4419

No files matched your search

+31 -17
View File
@@ -22,25 +22,32 @@
* \brief Interface with libav libs
*/
#include <cstdio>
#include "StreamHandlerLibav.h"
#include "LibMemory.h"
#include "PlaYUVerFrame.h"
#include "PlaYUVerFramePixelFormats.h"
#include "LibMemory.h"
#include <cstdio>
std::vector<PlaYUVerSupportedFormat> StreamHandlerLibav::supportedReadFormats()
{
INI_REGIST_PLAYUVER_SUPPORTED_FMT;
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Portable Network Graphics", "png" );
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Joint Photographic Experts Group", "jpg" );
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Joint Photographic Experts Group",
"jpg" );
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Windows Bitmap", "bmp" );
REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Tagged Image File Format", "tiff" );
// REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Audio video interleaved", "avi" );
// REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Windows media video", "wmv" );
// REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "MPEG4", "mp4" );
// REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Matroska Multimedia Container", "mkv" );
// REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "H.264 streams", "h264" );
// REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "HEVC streams", "hevc" );
// REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Audio video
// interleaved", "avi" );
// REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Windows
// media video", "wmv" );
// REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "MPEG4",
// "mp4" );
// REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "Matroska
// Multimedia Container", "mkv" );
// REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "H.264
// streams", "h264" );
// REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerLibav::Create, "HEVC
// streams", "hevc" );
END_REGIST_PLAYUVER_SUPPORTED_FMT;
}
@@ -113,10 +120,12 @@ Bool StreamHandlerLibav::openHandler( String strFilename, Bool bInput )
// av_dict_set( &format_opts, "video_size", aux_string, 0 );
// }
// Int ffmpeg_pel_format = g_PlaYUVerPixFmtDescriptorsList[pixel_format].ffmpegPelFormat;
// Int ffmpeg_pel_format =
// g_PlaYUVerPixFmtDescriptorsList[pixel_format].ffmpegPelFormat;
// if( ffmpeg_pel_format >= 0 )
// {
// av_dict_set( &format_opts, "pixel_format", av_get_pix_fmt_name( AVPixelFormat( ffmpeg_pel_format ) ), 0 );
// av_dict_set( &format_opts, "pixel_format", av_get_pix_fmt_name(
// AVPixelFormat( ffmpeg_pel_format ) ), 0 );
// }
/* open input file, and allocate format context */
@@ -139,7 +148,8 @@ Bool StreamHandlerLibav::openHandler( String strFilename, Bool bInput )
m_cCodecCtx = m_cStream->codec;
// /* allocate image where the decoded image will be put */
// ret = av_image_alloc( video_dst_data, video_dst_linesize, m_cCodecCtx->width, m_cCodecCtx->height,
// ret = av_image_alloc( video_dst_data, video_dst_linesize,
// m_cCodecCtx->width, m_cCodecCtx->height,
// m_cCodecCtx->pix_fmt, 1 );
// if( ret < 0 )
// {
@@ -149,7 +159,8 @@ Bool StreamHandlerLibav::openHandler( String strFilename, Bool bInput )
// }
// video_dst_bufsize = ret;
m_uiFrameBufferSize = av_image_get_buffer_size( m_cCodecCtx->pix_fmt, m_cCodecCtx->width, m_cCodecCtx->height, 1 );
m_uiFrameBufferSize = av_image_get_buffer_size( m_cCodecCtx->pix_fmt, m_cCodecCtx->width,
m_cCodecCtx->height, 1 );
getMem1D( &m_pchFrameBuffer, m_uiFrameBufferSize );
}
@@ -224,7 +235,8 @@ Bool StreamHandlerLibav::openHandler( String strFilename, Bool bInput )
av_dump_format( m_cFmtCtx, 0, filename, 0 );
if( !m_cStream )
{
// qDebug( ) << " Could not find audio or video stream in the input, aborting !!!" << endl;
// qDebug( ) << " Could not find audio or video stream in the input,
// aborting !!!" << endl;
closeHandler();
return false;
}
@@ -350,11 +362,13 @@ Bool StreamHandlerLibav::read( PlaYUVerFrame* pcFrame )
if( bGotFrame )
{
// av_image_copy_to_buffer( m_pchFrameBuffer, m_uiFrameBufferSize, m_cFrame->data, m_cFrame->linesize,
// av_image_copy_to_buffer( m_pchFrameBuffer, m_uiFrameBufferSize,
// m_cFrame->data, m_cFrame->linesize,
// m_cCodecCtx->pix_fmt, m_cCodecCtx->width,
// m_cCodecCtx->height, 1 );
av_image_copy_to_buffer( m_pStreamBuffer, m_uiFrameBufferSize, m_cFrame->data, m_cFrame->linesize,
m_cCodecCtx->pix_fmt, m_cCodecCtx->width, m_cCodecCtx->height, 1 );
av_image_copy_to_buffer( m_pStreamBuffer, m_uiFrameBufferSize, m_cFrame->data,
m_cFrame->linesize, m_cCodecCtx->pix_fmt, m_cCodecCtx->width,
m_cCodecCtx->height, 1 );
if( orig_pkt.size )
av_free_packet( &orig_pkt );