Browse Source

Various compile fixes

rdb 9 years ago
parent
commit
7d414500c6

+ 8 - 7
panda/src/ffmpeg/ffmpegVideoCursor.cxx

@@ -44,10 +44,11 @@ PStatCollector FfmpegVideoCursor::_export_frame_pcollector("*:FFMPEG Convert Vid
 #define AV_PIX_FMT_NONE PIX_FMT_NONE
 #define AV_PIX_FMT_NONE PIX_FMT_NONE
 #define AV_PIX_FMT_BGR24 PIX_FMT_BGR24
 #define AV_PIX_FMT_BGR24 PIX_FMT_BGR24
 #define AV_PIX_FMT_BGRA PIX_FMT_BGRA
 #define AV_PIX_FMT_BGRA PIX_FMT_BGRA
+typedef PixelFormat AVPixelFormat;
 #endif
 #endif
 
 
 #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 32, 100)
 #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 32, 100)
-#define AV_PIX_FMT_FLAG_ALPHA PIX_FMT_FLAG_ALPHA
+#define AV_PIX_FMT_FLAG_ALPHA PIX_FMT_ALPHA
 #endif
 #endif
 
 
 /**
 /**
@@ -65,7 +66,7 @@ FfmpegVideoCursor() :
   _format_ctx(NULL),
   _format_ctx(NULL),
   _video_ctx(NULL),
   _video_ctx(NULL),
   _convert_ctx(NULL),
   _convert_ctx(NULL),
-  _pixel_format(AV_PIX_FMT_NONE),
+  _pixel_format((int)AV_PIX_FMT_NONE),
   _video_index(-1),
   _video_index(-1),
   _frame(NULL),
   _frame(NULL),
   _frame_out(NULL),
   _frame_out(NULL),
@@ -121,16 +122,16 @@ init_from(FfmpegVideo *source) {
   const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(_video_ctx->pix_fmt);
   const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(_video_ctx->pix_fmt);
   if (desc && (desc->flags & AV_PIX_FMT_FLAG_ALPHA) != 0) {
   if (desc && (desc->flags & AV_PIX_FMT_FLAG_ALPHA) != 0) {
     _num_components = 4;
     _num_components = 4;
-    _pixel_format = AV_PIX_FMT_BGRA;
+    _pixel_format = (int)AV_PIX_FMT_BGRA;
   } else {
   } else {
     _num_components = 3;
     _num_components = 3;
-    _pixel_format = AV_PIX_FMT_BGR24;
+    _pixel_format = (int)AV_PIX_FMT_BGR24;
   }
   }
 
 
 #ifdef HAVE_SWSCALE
 #ifdef HAVE_SWSCALE
   nassertv(_convert_ctx == NULL);
   nassertv(_convert_ctx == NULL);
   _convert_ctx = sws_getContext(_size_x, _size_y, _video_ctx->pix_fmt,
   _convert_ctx = sws_getContext(_size_x, _size_y, _video_ctx->pix_fmt,
-                                _size_x, _size_y, _pixel_format,
+                                _size_x, _size_y, (AVPixelFormat)_pixel_format,
                                 SWS_BILINEAR | SWS_PRINT_INFO, NULL, NULL, NULL);
                                 SWS_BILINEAR | SWS_PRINT_INFO, NULL, NULL, NULL);
 #endif  // HAVE_SWSCALE
 #endif  // HAVE_SWSCALE
 
 
@@ -1115,7 +1116,7 @@ export_frame(FfmpegBuffer *buffer) {
     nassertv(_convert_ctx != NULL && _frame != NULL && _frame_out != NULL);
     nassertv(_convert_ctx != NULL && _frame != NULL && _frame_out != NULL);
     sws_scale(_convert_ctx, _frame->data, _frame->linesize, 0, _size_y, _frame_out->data, _frame_out->linesize);
     sws_scale(_convert_ctx, _frame->data, _frame->linesize, 0, _size_y, _frame_out->data, _frame_out->linesize);
 #else
 #else
-    img_convert((AVPicture *)_frame_out, _pixel_format,
+    img_convert((AVPicture *)_frame_out, (AVPixelFormat)_pixel_format,
                 (AVPicture *)_frame, _video_ctx->pix_fmt, _size_x, _size_y);
                 (AVPicture *)_frame, _video_ctx->pix_fmt, _size_x, _size_y);
 #endif
 #endif
   } else {
   } else {
@@ -1123,7 +1124,7 @@ export_frame(FfmpegBuffer *buffer) {
     nassertv(_convert_ctx != NULL && _frame != NULL && _frame_out != NULL);
     nassertv(_convert_ctx != NULL && _frame != NULL && _frame_out != NULL);
     sws_scale(_convert_ctx, _frame->data, _frame->linesize, 0, _size_y, _frame_out->data, _frame_out->linesize);
     sws_scale(_convert_ctx, _frame->data, _frame->linesize, 0, _size_y, _frame_out->data, _frame_out->linesize);
 #else
 #else
-    img_convert((AVPicture *)_frame_out, _pixel_format,
+    img_convert((AVPicture *)_frame_out, (AVPixelFormat)_pixel_format,
                 (AVPicture *)_frame, _video_ctx->pix_fmt, _size_x, _size_y);
                 (AVPicture *)_frame, _video_ctx->pix_fmt, _size_x, _size_y);
 #endif
 #endif
   }
   }

+ 1 - 5
panda/src/ffmpeg/ffmpegVideoCursor.h

@@ -105,11 +105,7 @@ private:
   ThreadPriority _thread_priority;
   ThreadPriority _thread_priority;
   PT(GenericThread) _thread;
   PT(GenericThread) _thread;
 
 
-#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 74, 100)
-  PixelFormat _pixel_format;
-#else
-  AVPixelFormat _pixel_format;
-#endif
+  int _pixel_format;
 
 
   // This global Mutex protects calls to avcodec_opencloseetc.
   // This global Mutex protects calls to avcodec_opencloseetc.
   static ReMutex _av_lock;
   static ReMutex _av_lock;

+ 6 - 2
panda/src/movies/dr_flac.h

@@ -534,7 +534,9 @@ static DRFLAC_INLINE uint64_t drflac__swap_endian_uint64(uint64_t n)
 
 
 static DRFLAC_INLINE uint32_t drflac__be2host_32(uint32_t n)
 static DRFLAC_INLINE uint32_t drflac__be2host_32(uint32_t n)
 {
 {
-#ifdef __linux__
+#if defined(__BYTE_ORDER__) && (__BYTE_ORDER == __ORDER_LITTLE_ENDIAN__)
+    return drflac__swap_endian_uint32(n);
+#elif defined(__linux__)
     return be32toh(n);
     return be32toh(n);
 #else
 #else
     if (drflac__is_little_endian()) {
     if (drflac__is_little_endian()) {
@@ -547,7 +549,9 @@ static DRFLAC_INLINE uint32_t drflac__be2host_32(uint32_t n)
 
 
 static DRFLAC_INLINE uint64_t drflac__be2host_64(uint64_t n)
 static DRFLAC_INLINE uint64_t drflac__be2host_64(uint64_t n)
 {
 {
-#ifdef __linux__
+#if defined(__BYTE_ORDER__) && (__BYTE_ORDER == __ORDER_LITTLE_ENDIAN__)
+    return drflac__swap_endian_uint64(n);
+#elif defined(__linux__)
     return be64toh(n);
     return be64toh(n);
 #else
 #else
     if (drflac__is_little_endian()) {
     if (drflac__is_little_endian()) {

+ 3 - 1
panda/src/putil/cachedTypedWritableReferenceCount.h

@@ -46,8 +46,10 @@ PUBLISHED:
 
 
   MAKE_PROPERTY(cache_ref_count, get_cache_ref_count);
   MAKE_PROPERTY(cache_ref_count, get_cache_ref_count);
 
 
-protected:
+public:
   INLINE void cache_ref_only() const;
   INLINE void cache_ref_only() const;
+
+protected:
   INLINE void cache_unref_only() const;
   INLINE void cache_unref_only() const;
   bool do_test_ref_count_integrity() const;
   bool do_test_ref_count_integrity() const;