Browse Source

try to fix travis build.
What an ancient version of ffmpeg does it have?

AlexVinS 10 years ago
parent
commit
e20f861727
2 changed files with 24 additions and 10 deletions
  1. 0 10
      client/CVideoHandler.cpp
  2. 24 0
      client/CVideoHandler.h

+ 0 - 10
client/CVideoHandler.cpp

@@ -142,14 +142,9 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay, bool scal
 		return false;
 	}
 	// Allocate video frame
-#ifdef VCMI_USE_OLD_AVUTIL 
- 	frame = avcodec_alloc_frame();
-#else
 	frame = av_frame_alloc();
-#endif
 	
 	//setup scaling
-	
 	if(scale)
 	{
 		pos.w = screen->w;		
@@ -362,12 +357,7 @@ void CVideoPlayer::close()
 
 	if (frame)
 	{
-#ifdef VCMI_USE_OLD_AVUTIL
-		av_free(frame);
-		frame = nullptr;
-#else
 		av_frame_free(&frame);//will be set to null		
-#endif		
 	}
 
 	if (codec)

+ 24 - 0
client/CVideoHandler.h

@@ -58,6 +58,30 @@ extern "C" {
 #define VCMI_USE_OLD_AVUTIL
 #endif // LIBSWSCALE_VERSION_INT
 
+#ifdef VCMI_USE_OLD_AVUTIL
+
+#define AVPixelFormat PixelFormat 
+#define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
+#define AV_PIX_FMT_BGR565 PIX_FMT_BGR565
+#define AV_PIX_FMT_BGR24 PIX_FMT_BGR24
+#define AV_PIX_FMT_BGR32 PIX_FMT_BGR32
+#define AV_PIX_FMT_RGB565 PIX_FMT_RGB565
+#define AV_PIX_FMT_RGB24 PIX_FMT_RGB24
+#define AV_PIX_FMT_RGB32 PIX_FMT_RGB32
+
+inline AVFrame * av_frame_alloc()
+{
+	return avcodec_alloc_frame();
+}
+
+inline void av_frame_free(AVFrame ** frame)
+{
+	av_free(*frame);
+	*frame = nullptr;
+}
+
+#endif // VCMI_USE_OLD_AVUTIL
+
 class CVideoPlayer : public IMainVideoPlayer
 {
 	int stream;					// stream index in video