Add compatibility defines into LibAvContextHandle

This commit is contained in:
jfmcarreira committed 2014-02-03 01:41:34 +00:00
1 parent d1c771daf0
commit a24009d870
2 files changed
+25 -12

No files matched your search

+10 -4
View File
@@ -81,7 +81,6 @@ Void LibAvContextHandle::closeAvFormat()
Bool LibAvContextHandle::initAvFormat( char* filename, UInt& width, UInt& height, Int& pixel_format, UInt& frame_rate )
{
Bool bRet = true;
int ret = 0;
fmt_ctx = NULL;
@@ -117,6 +116,8 @@ Bool LibAvContextHandle::initAvFormat( char* filename, UInt& width, UInt& height
case YUV400:
av_dict_set( &format_opts, "pixel_format", av_get_pix_fmt_name( AV_PIX_FMT_GRAY8 ), 0 );
break;
default:
break;
}
/* open input file, and allocate format context */
@@ -173,6 +174,8 @@ Bool LibAvContextHandle::initAvFormat( char* filename, UInt& width, UInt& height
case AV_PIX_FMT_GRAY8:
pixel_format = YUV400;
break;
default:
break;
}
/* dump input information to stderr */
@@ -180,12 +183,15 @@ Bool LibAvContextHandle::initAvFormat( char* filename, UInt& width, UInt& height
if( !video_stream )
{
//qDebug( ) << " Could not find audio or video stream in the input, aborting !!!" << endl;
bRet = false;
closeAvFormat();
return false;
}
#if( LIBAVFORMAT_VERSION_MAJOR >= 55 )
frame = av_frame_alloc();
#else
frame = avcodec_alloc_frame();
#endif
if( !frame )
{
//qDebug( ) << " Could not allocate frame !!!" << endl;
@@ -245,7 +251,7 @@ Bool LibAvContextHandle::decodeAvFormat()
// }
// while( got_frame );
true;
return true;
}
Void LibAvContextHandle::seekAvFormat( UInt frame_num )
+15 -8
View File
@@ -24,19 +24,26 @@
#ifndef __LIBAVCONTEXTHANDLE_H__
#define __LIBAVCONTEXTHANDLE_H__
//#include "config.h"
#include <inttypes.h>
#ifndef __PRI64_PREFIX
#define __PRI64_PREFIX "l"
#endif
#ifndef PRId64
#define PRId64 __PRI64_PREFIX "d"
#endif
extern "C"
{
#include "libavutil/imgutils.h"
#include "libavutil/samplefmt.h"
#include "libavutil/timestamp.h"
#include "libavformat/avformat.h"
#include <libavutil/avutil.h>
#include <libavutil/imgutils.h>
#include <libavutil/samplefmt.h>
#include <libavutil/timestamp.h>
#include <libavformat/avformat.h>
}
#ifndef __STDC_CONSTANT_MACROS
#define smprintf _snprintf
#endif
#include "TypeDef.h"