Add supported formats in LibAvHandle

This commit is contained in:
jfmcarreira committed 2015-02-19 11:32:15 +00:00
1 parent f5aed7132b
commit 54ba2c99aa
2 files changed
+67 -9

No files matched your search

+56 -8
View File
@@ -31,6 +31,56 @@
namespace plaYUVer namespace plaYUVer
{ {
std::vector<std::string> LibAvContextHandle::supportedReadFormatsExt()
{
std::vector<std::string> formatsExt;
formatsExt.push_back( "avi" );
formatsExt.push_back( "mp4" );
formatsExt.push_back( "wmv" );
formatsExt.push_back( "pgm" );
formatsExt.push_back( "png" );
formatsExt.push_back( "bmp" );
formatsExt.push_back( "jpg" );
return formatsExt;
}
std::vector<std::string> LibAvContextHandle::supportedReadFormatsName()
{
std::vector<std::string> formatsName;
formatsName.push_back( "Audio video interleaved" );
formatsName.push_back( "MPEG4" );
formatsName.push_back( "Windows media video" );
formatsName.push_back( "Portable Grayscale Map" );
formatsName.push_back( "Portable Network Graphics" );
formatsName.push_back( "Windows Bitmap" );
formatsName.push_back( "Joint Photographic Experts Group" );
return formatsName;
}
std::vector<std::string> LibAvContextHandle::supportedWriteFormatsExt()
{
std::vector<std::string> formatsExt;
return formatsExt;
}
std::vector<std::string> LibAvContextHandle::supportedWriteFormatsName()
{
std::vector<std::string> formatsName;
return formatsName;
}
std::vector<std::string> LibAvContextHandle::supportedSaveFormatsExt()
{
std::vector<std::string> formatsExt;
return formatsExt;
}
std::vector<std::string> LibAvContextHandle::supportedSaveFormatsName()
{
std::vector<std::string> formatsName;
return formatsName;
}
static int open_codec_context( int *stream_idx, AVFormatContext *fmt_ctx, enum AVMediaType type ) static int open_codec_context( int *stream_idx, AVFormatContext *fmt_ctx, enum AVMediaType type )
{ {
int ret; int ret;
@@ -108,7 +158,6 @@ Bool LibAvContextHandle::initAvFormat( const char* filename, UInt& width, UInt&
av_dict_set( &format_opts, "video_size", aux_string, 0 ); av_dict_set( &format_opts, "video_size", aux_string, 0 );
} }
Int ffmpeg_pel_format = g_PlaYUVerFramePelFormatsList[pixel_format].ffmpegPelFormat; Int ffmpeg_pel_format = g_PlaYUVerFramePelFormatsList[pixel_format].ffmpegPelFormat;
if( ffmpeg_pel_format >= 0 ) if( ffmpeg_pel_format >= 0 )
{ {
@@ -144,7 +193,7 @@ Bool LibAvContextHandle::initAvFormat( const char* filename, UInt& width, UInt&
// } // }
// video_dst_bufsize = ret; // video_dst_bufsize = ret;
m_uiFrameBufferSize = av_image_get_buffer_size( video_dec_ctx->pix_fmt, video_dec_ctx->width, video_dec_ctx->height, 1); m_uiFrameBufferSize = av_image_get_buffer_size( video_dec_ctx->pix_fmt, video_dec_ctx->width, video_dec_ctx->height, 1 );
getMem1D( &m_pchFrameBuffer, m_uiFrameBufferSize ); getMem1D( &m_pchFrameBuffer, m_uiFrameBufferSize );
} }
@@ -204,7 +253,7 @@ Bool LibAvContextHandle::initAvFormat( const char* filename, UInt& width, UInt&
break; break;
} }
} }
if( pixel_format == PlaYUVerFrame::NO_FMT ) if( pixel_format == PlaYUVerFrame::NO_FMT )
{ {
closeAvFormat(); closeAvFormat();
return false; return false;
@@ -260,14 +309,13 @@ Bool LibAvContextHandle::decodeAvFormat()
if( got_frame ) if( got_frame )
{ {
av_image_copy_to_buffer( m_pchFrameBuffer, m_uiFrameBufferSize, av_image_copy_to_buffer( m_pchFrameBuffer, m_uiFrameBufferSize, frame->data, frame->linesize, video_dec_ctx->pix_fmt, video_dec_ctx->width,
frame->data,frame->linesize, video_dec_ctx->pix_fmt, video_dec_ctx->width, video_dec_ctx->height, 1 );
video_dec_ctx->height, 1);
/* copy decoded frame to destination buffer: /* copy decoded frame to destination buffer:
* this is required since rawvideo expects non aligned data */ * this is required since rawvideo expects non aligned data */
// av_image_copy( video_dst_data, video_dst_linesize, ( const uint8_t ** )( frame->data ), frame->linesize, video_dec_ctx->pix_fmt, video_dec_ctx->width, // av_image_copy( video_dst_data, video_dst_linesize, ( const uint8_t ** )( frame->data ), frame->linesize, video_dec_ctx->pix_fmt, video_dec_ctx->width,
// video_dec_ctx->height ); // video_dec_ctx->height );
} }
} }
av_free_packet( &pkt ); av_free_packet( &pkt );
+11 -1
View File
@@ -26,6 +26,8 @@
#define __LIBAVCONTEXTHANDLE_H__ #define __LIBAVCONTEXTHANDLE_H__
#include <inttypes.h> #include <inttypes.h>
#include <vector>
#include <string>
#ifndef __PRI64_PREFIX #ifndef __PRI64_PREFIX
#define __PRI64_PREFIX "l" #define __PRI64_PREFIX "l"
@@ -52,6 +54,14 @@ namespace plaYUVer
class LibAvContextHandle class LibAvContextHandle
{ {
public: public:
static std::vector<std::string> supportedReadFormatsExt();
static std::vector<std::string> supportedReadFormatsName();
static std::vector<std::string> supportedWriteFormatsExt();
static std::vector<std::string> supportedWriteFormatsName();
static std::vector<std::string> supportedSaveFormatsExt();
static std::vector<std::string> supportedSaveFormatsName();
LibAvContextHandle() : LibAvContextHandle() :
m_bHasStream( false ) m_bHasStream( false )
{ {
@@ -70,7 +80,7 @@ public:
{ {
return m_acCodecName; return m_acCodecName;
} }
UInt getStreamDuration( ) UInt getStreamDuration()
{ {
return m_uiSecs; return m_uiSecs;
} }