From 2acfa869d79ef4dea8d264153948b7c44c1b8f80 Mon Sep 17 00:00:00 2001
From: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
Date: Mon, 9 Sep 2013 11:43:49 -0400
Subject: [PATCH] #28513: fix PixelFormat deprecation.

This enum is now AVPixelFormat, but Ubuntu's libav doesn't define it yet,
causing build error.
---
 daemon/src/video/libav_deps.h     | 4 ++++
 daemon/src/video/video_base.cpp   | 6 +++---
 daemon/src/video/video_scaler.cpp | 4 ++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/daemon/src/video/libav_deps.h b/daemon/src/video/libav_deps.h
index 27f65bdfe3..371483e0e3 100644
--- a/daemon/src/video/libav_deps.h
+++ b/daemon/src/video/libav_deps.h
@@ -51,4 +51,8 @@ extern "C" {
 
 #define HAVE_SDP_CUSTOM_IO LIBAVFORMAT_VERSION_CHECK(54,20,3,59,103)
 
+#if (LIBAVUTIL_VERSION_MAJOR < 53) && !defined(FF_API_PIX_FMT)
+#define AVPixelFormat PixelFormat
+#endif
+
 #endif // __LIBAV_DEPS_H__
diff --git a/daemon/src/video/video_base.cpp b/daemon/src/video/video_base.cpp
index 4ccbf7ad97..2fca184d0f 100644
--- a/daemon/src/video/video_base.cpp
+++ b/daemon/src/video/video_base.cpp
@@ -129,13 +129,13 @@ void VideoFrame::setDestination(void *data)
     }
 
     avpicture_fill((AVPicture *) frame_, (uint8_t *) data,
-                   (PixelFormat) frame_->format, frame_->width,
+                   (AVPixelFormat) frame_->format, frame_->width,
                    frame_->height);
 }
 
 size_t VideoFrame::getSize()
 {
-    return avpicture_get_size((PixelFormat) frame_->format,
+    return avpicture_get_size((AVPixelFormat) frame_->format,
                               frame_->width,
                               frame_->height);
 }
@@ -143,7 +143,7 @@ size_t VideoFrame::getSize()
 size_t VideoFrame::getSize(int width, int height, int format)
 {
     return avpicture_get_size(
-        (PixelFormat) libav_utils::libav_pixel_format(format), width, height);
+        (AVPixelFormat) libav_utils::libav_pixel_format(format), width, height);
 }
 
 int VideoFrame::blit(VideoFrame &src, int xoff, int yoff)
diff --git a/daemon/src/video/video_scaler.cpp b/daemon/src/video/video_scaler.cpp
index 7f41efc88d..15b6a94a37 100644
--- a/daemon/src/video/video_scaler.cpp
+++ b/daemon/src/video/video_scaler.cpp
@@ -47,10 +47,10 @@ void VideoScaler::scale(VideoFrame &input, VideoFrame &output)
     ctx_ = sws_getCachedContext(ctx_,
                                 input_frame->width,
                                 input_frame->height,
-                                (PixelFormat) input_frame->format,
+                                (AVPixelFormat) input_frame->format,
                                 output_frame->width,
                                 output_frame->height,
-                                (PixelFormat) output_frame->format,
+                                (AVPixelFormat) output_frame->format,
                                 mode_,
                                 NULL, NULL, NULL);
     if (!ctx_) {
-- 
GitLab