Merge pull request #2760 from aballier/ffmpeg_cleanups
[vuplus_xbmc] / lib / DllAvUtil.h
index 8ef67dc..1afee5e 100644 (file)
@@ -1,6 +1,6 @@
 #pragma once
 /*
- *      Copyright (C) 2005-2010 Team XBMC
+ *      Copyright (C) 2005-2013 Team XBMC
  *      http://www.xbmc.org
  *
  *  This Program is free software; you can redistribute it and/or modify
 
 extern "C" {
 #if (defined USE_EXTERNAL_FFMPEG)
-  #if (defined HAVE_LIBAVUTIL_AVUTIL_H)
-    #include <libavutil/avutil.h>
-    #include <libavutil/crc.h>
-    #include <libavutil/fifo.h>
-    // for LIBAVCODEC_VERSION_INT:
-    #include <libavcodec/avcodec.h>
-  #elif (defined HAVE_FFMPEG_AVUTIL_H)
-    #include <ffmpeg/avutil.h>
-    #include <ffmpeg/crc.h>
-    #include <ffmpeg/fifo.h>
-    // for LIBAVCODEC_VERSION_INT:
-    #include <ffmpeg/avcodec.h>
-  #endif
-  #if defined(HAVE_LIBAVUTIL_OPT_H)
-    #include <libavutil/opt.h>
-  #elif defined(HAVE_LIBAVCODEC_AVCODEC_H)
-    #include <libavcodec/opt.h>
-  #else
-    #include <ffmpeg/opt.h>
-  #endif
-  #if defined(HAVE_LIBAVUTIL_MEM_H)
-    #include <libavutil/mem.h>
-  #else
-    #include <ffmpeg/mem.h>
-  #endif
-  #if (defined HAVE_LIBAVUTIL_MATHEMATICS_H)
-    #include <libavutil/mathematics.h>
-  #endif
+  #include <libavutil/avutil.h>
+  // for av_get_default_channel_layout
+  #include <libavutil/audioconvert.h>
+  #include <libavutil/crc.h>
+  #include <libavutil/fifo.h>
+  // for LIBAVCODEC_VERSION_INT:
+  #include <libavcodec/avcodec.h>
+  // for enum AVSampleFormat
+  #include <libavutil/samplefmt.h>
+  #include <libavutil/opt.h>
+  #include <libavutil/mem.h>
+  #include <libavutil/mathematics.h>
 #else
   #include "libavutil/avutil.h"
+  //for av_get_default_channel_layout
   #include "libavutil/audioconvert.h"
   #include "libavutil/crc.h"
   #include "libavutil/opt.h"
   #include "libavutil/mem.h"
   #include "libavutil/fifo.h"
+  // for enum AVSampleFormat
   #include "libavutil/samplefmt.h"
 #endif
 }
@@ -92,6 +78,7 @@ public:
   virtual void av_freep(void *ptr)=0;
   virtual int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding)=0;
   virtual int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)=0;
+  virtual int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size)=0;
   virtual const AVCRC* av_crc_get_table(AVCRCId crc_id)=0;
   virtual uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)=0;
   virtual int av_opt_set(void *obj, const char *name, const char *val, int search_flags)=0;
@@ -105,6 +92,7 @@ public:
   virtual int av_get_bytes_per_sample(enum AVSampleFormat p1) = 0;
   virtual AVDictionaryEntry *av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags) = 0;
   virtual int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)=0;
+  virtual void av_dict_free(AVDictionary **pm) = 0;
   virtual int av_samples_get_buffer_size (int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) = 0;
   virtual int64_t av_get_default_channel_layout(int nb_channels)=0;
 };
@@ -124,6 +112,7 @@ public:
    virtual void av_freep(void *ptr) { ::av_freep(ptr); }
    virtual int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding d) { return ::av_rescale_rnd(a, b, c, d); }
    virtual int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) { return ::av_rescale_q(a, bq, cq); }
+   virtual int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size) { return ::av_crc_init(ctx, le, bits, poly, ctx_size); }
    virtual const AVCRC* av_crc_get_table(AVCRCId crc_id) { return ::av_crc_get_table(crc_id); }
    virtual uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length) { return ::av_crc(ctx, crc, buffer, length); }
    virtual int av_opt_set(void *obj, const char *name, const char *val, int search_flags) { return ::av_opt_set(obj, name, val, search_flags); }
@@ -140,6 +129,7 @@ public:
     { return ::av_get_bytes_per_sample(p1); }
   virtual AVDictionaryEntry *av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags){ return ::av_dict_get(m, key, prev, flags); }
   virtual int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags) { return ::av_dict_set(pm, key, value, flags); }
+  virtual void av_dict_free(AVDictionary **pm) { ::av_dict_free(pm); }
   virtual int av_samples_get_buffer_size (int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
     { return ::av_samples_get_buffer_size(linesize, nb_channels, nb_samples, sample_fmt, align); }
   virtual int64_t av_get_default_channel_layout(int nb_channels) { return ::av_get_default_channel_layout(nb_channels); }
@@ -147,7 +137,9 @@ public:
    // DLL faking.
    virtual bool ResolveExports() { return true; }
    virtual bool Load() {
+#if !defined(TARGET_DARWIN)
      CLog::Log(LOGDEBUG, "DllAvUtilBase: Using libavutil system library");
+#endif
      return true;
    }
    virtual void Unload() {}
@@ -170,6 +162,7 @@ class DllAvUtilBase : public DllDynamic, DllAvUtilInterface
   DEFINE_METHOD4(int64_t, av_rescale_rnd, (int64_t p1, int64_t p2, int64_t p3, enum AVRounding p4));
   DEFINE_METHOD3(int64_t, av_rescale_q, (int64_t p1, AVRational p2, AVRational p3));
   DEFINE_METHOD1(const AVCRC*, av_crc_get_table, (AVCRCId p1))
+  DEFINE_METHOD5(int, av_crc_init, (AVCRC *p1, int p2, int p3, uint32_t p4, int p5));
   DEFINE_METHOD4(uint32_t, av_crc, (const AVCRC *p1, uint32_t p2, const uint8_t *p3, size_t p4));
   DEFINE_METHOD4(int, av_opt_set, (void *p1, const char *p2, const char *p3, int p4));
   DEFINE_METHOD1(AVFifoBuffer*, av_fifo_alloc, (unsigned int p1))
@@ -182,6 +175,7 @@ class DllAvUtilBase : public DllDynamic, DllAvUtilInterface
   DEFINE_METHOD1(int, av_get_bytes_per_sample, (enum AVSampleFormat p1))
   DEFINE_METHOD4(AVDictionaryEntry *, av_dict_get, (AVDictionary *p1, const char *p2, const AVDictionaryEntry *p3, int p4))
   DEFINE_METHOD4(int, av_dict_set, (AVDictionary **p1, const char *p2, const char *p3, int p4));
+  DEFINE_METHOD1(void, av_dict_free, (AVDictionary **p1));
   DEFINE_METHOD5(int, av_samples_get_buffer_size, (int *p1, int p2, int p3, enum AVSampleFormat p4, int p5))
   DEFINE_METHOD1(int64_t, av_get_default_channel_layout, (int p1))
 
@@ -195,6 +189,7 @@ class DllAvUtilBase : public DllDynamic, DllAvUtilInterface
     RESOLVE_METHOD(av_freep)
     RESOLVE_METHOD(av_rescale_rnd)
     RESOLVE_METHOD(av_rescale_q)
+    RESOLVE_METHOD(av_crc_init)
     RESOLVE_METHOD(av_crc_get_table)
     RESOLVE_METHOD(av_crc)
     RESOLVE_METHOD(av_opt_set)
@@ -208,6 +203,7 @@ class DllAvUtilBase : public DllDynamic, DllAvUtilInterface
     RESOLVE_METHOD(av_get_bytes_per_sample)
     RESOLVE_METHOD(av_dict_get)
     RESOLVE_METHOD(av_dict_set)
+    RESOLVE_METHOD(av_dict_free)
     RESOLVE_METHOD(av_samples_get_buffer_size)
     RESOLVE_METHOD(av_get_default_channel_layout)
   END_METHOD_RESOLVE()