]> granicus.if.org Git - libvpx/commitdiff
Dll build of libvpx
authorJim Bankoski <jimbankoski@google.com>
Mon, 23 Jul 2012 19:32:59 +0000 (12:32 -0700)
committerYaowu Xu <yaowu@google.com>
Mon, 23 Jul 2012 21:51:21 +0000 (14:51 -0700)
Change-Id: I74e50b4dfbe73eb98e1dce1695a9973f637220c0

build/make/gen_msvs_proj.sh
configure
examples.mk
libs.mk
vp8/exports_enc
vp8/vp8_cx_iface.c
vpx/vp8cx.h
vpxdec.c
vpxenc.c

index 6d429410d90b40b27145848f2c446b5bd2ae5f79..7d473899d6ea657a81efb4fd6548e05cfb05e8f8 100755 (executable)
@@ -26,6 +26,7 @@ Options:
     --help                      Print this message
     --exe                       Generate a project for building an Application
     --lib                       Generate a project for creating a static library
+    --dll                       Generate a project for creating a dll
     --static-crt                Use the static C runtime (/MT)
     --target=isa-os-cc          Target specifier (required)
     --out=filename              Write output to a file [stdout]
@@ -190,6 +191,8 @@ for opt in "$@"; do
         ;;
         --exe) proj_kind="exe"
         ;;
+        --dll) proj_kind="dll"
+        ;;
         --lib) proj_kind="lib"
         ;;
         --src-path-bare=*) src_path_bare="$optval"
@@ -299,6 +302,8 @@ generate_vcproj() {
     case "$proj_kind" in
         exe) vs_ConfigurationType=1
         ;;
+        dll) vs_ConfigurationType=2
+        ;;
         *)   vs_ConfigurationType=4
         ;;
     esac
index a24a1e10fdfb38edd724686f51d232992ac2a2e4..c517313374dd942c74b7c5a9d31380ac33c2076d 100755 (executable)
--- a/configure
+++ b/configure
@@ -457,7 +457,7 @@ process_detect() {
         # Can only build shared libs on a subset of platforms. Doing this check
         # here rather than at option parse time because the target auto-detect
         # magic happens after the command line has been parsed.
-        enabled linux || die "--enable-shared only supported on ELF for now"
+        enabled linux || enabled win32 || enabled win64 || die "--enable-shared only supported on ELF for now"
     fi
     if [ -z "$CC" ]; then
         echo "Bypassing toolchain for environment detection."
index 934e828df1e85c22468c026c9ff1c7b7770261d3..74c460e24171fd8342644a9032184f2d06366f34 100644 (file)
@@ -192,7 +192,7 @@ INSTALL_MAPS += %         %
 
 # Set up additional MSVS environment
 ifeq ($(CONFIG_MSVS),yes)
-CODEC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd)
+CODEC_LIB=$(if $(CONFIG_SHARED),vpx,$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd))
 # This variable uses deferred expansion intentionally, since the results of
 # $(wildcard) may change during the course of the Make.
 VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
diff --git a/libs.mk b/libs.mk
index bc9e888d8dc3c6956733ffd65531b83e49cdc36d..adad2d427bb755e7ea01d72d1d4c43502a1f9e7c 100644 (file)
--- a/libs.mk
+++ b/libs.mk
@@ -172,8 +172,8 @@ CLEAN-OBJS += vpx.def
 vpx.vcproj: $(CODEC_SRCS) vpx.def
        @echo "    [CREATE] $@"
        $(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
-                       --lib \
-                       --target=$(TOOLCHAIN) \
+            $(if $(CONFIG_SHARED),--dll,--lib) \
+            --target=$(TOOLCHAIN) \
             $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
             --name=vpx \
             --proj-guid=DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74 \
index 29ff35ef7bd5ddac5301d8e110d3513c235bd8e6..2b4cefafc1bce6991332c4b7950e905a3d5ce08c 100644 (file)
@@ -1,2 +1,5 @@
 data vpx_codec_vp8_cx_algo
 text vpx_codec_vp8_cx
+data vpx_codec_vp8x_cx_algo
+text vpx_codec_vp8x_cx
+
index b12aac80b56899ba332547a686acf362bca00de3..e74eb78cf3a0aefd8383b97a1303613878b36948 100644 (file)
@@ -1058,7 +1058,8 @@ CODEC_INTERFACE(vpx_codec_vp8_cx) = {
 
 
 #if CONFIG_EXPERIMENTAL
-vpx_codec_iface_t vpx_codec_vp8x_cx_algo = {
+
+CODEC_INTERFACE(vpx_codec_vp8x_cx) = {
   "VP8 Experimental Encoder" VERSION_STRING,
   VPX_CODEC_INTERNAL_ABI_VERSION,
   VPX_CODEC_CAP_ENCODER | VPX_CODEC_CAP_PSNR,
index f691c65353c403e45db4387cb505f26df1cfe916..504b6d7b9ecca1deb52ceba5773670e74c1caa8b 100644 (file)
@@ -42,6 +42,7 @@ extern vpx_codec_iface_t *vpx_codec_vp8_cx(void);
  * VP8 variant, which is bitstream incompatible with the default VP8 encoder.
  */
 extern vpx_codec_iface_t vpx_codec_vp8x_cx_algo;
+extern vpx_codec_iface_t *vpx_codec_vp8x_cx(void);
 #endif
 
 
index 1bcc8e5b31510bd0c53470cc1ecc4a094c999531..73209c1bbe9b3e6b64451396ccb71ff65a09ac26 100644 (file)
--- a/vpxdec.c
+++ b/vpxdec.c
 static const char *exec_name;
 
 #define VP8_FOURCC (0x00385056)
+
 static const struct {
-  char const *name;
-  const vpx_codec_iface_t *iface;
-  unsigned int             fourcc;
-  unsigned int             fourcc_mask;
+   char const *name;
+   const vpx_codec_iface_t *(*iface)(void);
+   unsigned int             fourcc;
+   unsigned int             fourcc_mask;
 } ifaces[] = {
 #if CONFIG_VP8_DECODER
-  {"vp8",  &vpx_codec_vp8_dx_algo,   VP8_FOURCC, 0x00FFFFFF},
+  {"vp8",  vpx_codec_vp8_dx,   VP8_FOURCC, 0x00FFFFFF},
 #endif
 };
 
+
 #include "args.h"
 static const arg_def_t codecarg = ARG_DEF(NULL, "codec", 1,
                                           "Codec to use");
@@ -154,7 +156,7 @@ static void usage_exit() {
   for (i = 0; i < sizeof(ifaces) / sizeof(ifaces[0]); i++)
     fprintf(stderr, "    %-6s - %s\n",
             ifaces[i].name,
-            vpx_codec_iface_name(ifaces[i].iface));
+            vpx_codec_iface_name(ifaces[i].iface()));
 
   exit(EXIT_FAILURE);
 }
@@ -409,7 +411,7 @@ unsigned int file_is_raw(FILE *infile,
 
     if (mem_get_le32(buf) < 256 * 1024 * 1024)
       for (i = 0; i < sizeof(ifaces) / sizeof(ifaces[0]); i++)
-        if (!vpx_codec_peek_stream_info(ifaces[i].iface,
+        if (!vpx_codec_peek_stream_info(ifaces[i].iface(),
                                         buf + 4, 32 - 4, &si)) {
           is_raw = 1;
           *fourcc = ifaces[i].fourcc;
@@ -706,7 +708,7 @@ int main(int argc, const char **argv_) {
           k = j;
 
       if (k >= 0)
-        iface = ifaces[k].iface;
+        iface = ifaces[k].iface();
       else
         die("Error: Unrecognized argument (%s) to --codec\n",
             arg.val);
@@ -881,7 +883,7 @@ int main(int argc, const char **argv_) {
   /* Try to determine the codec from the fourcc. */
   for (i = 0; i < sizeof(ifaces) / sizeof(ifaces[0]); i++)
     if ((fourcc & ifaces[i].fourcc_mask) == ifaces[i].fourcc) {
-      vpx_codec_iface_t  *ivf_iface = ifaces[i].iface;
+      vpx_codec_iface_t  *ivf_iface = ifaces[i].iface();
 
       if (iface && iface != ivf_iface)
         fprintf(stderr, "Notice -- IVF header indicates codec: %s\n",
@@ -893,7 +895,7 @@ int main(int argc, const char **argv_) {
     }
 
   dec_flags = (postproc ? VPX_CODEC_USE_POSTPROC : 0);
-  if (vpx_codec_dec_init(&decoder, iface ? iface :  ifaces[0].iface, &cfg,
+  if (vpx_codec_dec_init(&decoder, iface ? iface :  ifaces[0].iface(), &cfg,
                          dec_flags)) {
     fprintf(stderr, "Failed to initialize decoder: %s\n", vpx_codec_error(&decoder));
     return EXIT_FAILURE;
index df38ceb6d393fb207c31144bb361452d64e9c7a2..284d8b032677bc92090a46ba13b4c946c8092b0d 100644 (file)
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -72,28 +72,28 @@ typedef long off_t;
 
 static const char *exec_name;
 
-static const struct codec_item {
-  char const              *name;
-  const vpx_codec_iface_t *iface;
-  unsigned int             fourcc;
-} codecs[] = {
-#if CONFIG_EXPERIMENTAL && CONFIG_VP8_ENCODER
-  {"vp8x",  &vpx_codec_vp8x_cx_algo, 0x78385056},
-#endif
-#if CONFIG_VP8_ENCODER
-  {"vp8",  &vpx_codec_vp8_cx_algo, 0x30385056},
-#endif
-};
 
-#define VP8_FOURCC (0x00385056)
+
+#define VP8_FOURCC (0x78385056)
 static const struct {
   char const *name;
-  const vpx_codec_iface_t *iface;
+  const vpx_codec_iface_t *(*iface)(void);
   unsigned int             fourcc;
   unsigned int             fourcc_mask;
 } ifaces[] = {
 #if CONFIG_VP8_DECODER
-  {"vp8",  &vpx_codec_vp8_dx_algo,   VP8_FOURCC, 0x00FFFFFF},
+  {"vp8",  &vpx_codec_vp8_dx,   VP8_FOURCC, 0x00FFFFFF},
+#endif
+};
+
+static const struct codec_item {
+  char const *name;
+  const vpx_codec_iface_t *(*iface)(void);
+  unsigned int             fourcc;
+  unsigned int             fourcc_mask;
+} codecs[] = {
+#if CONFIG_VP8_ENCODER
+  {"vp8",  vpx_codec_vp8x_cx,   VP8_FOURCC, 0x00FFFFFF},
 #endif
 };
 
@@ -1094,7 +1094,7 @@ static void usage_exit() {
   for (i = 0; i < sizeof(codecs) / sizeof(codecs[0]); i++)
     fprintf(stderr, "    %-6s - %s\n",
             codecs[i].name,
-            vpx_codec_iface_name(codecs[i].iface));
+            vpx_codec_iface_name(codecs[i].iface()));
 
   exit(EXIT_FAILURE);
 }
@@ -1407,7 +1407,7 @@ int main(int argc, const char **argv_) {
   int                    pass, one_pass_only = 0;
   stats_io_t             stats;
   vpx_image_t            raw;
-  const struct codec_item  *codec = codecs;
+  struct codec_item  *codec = codecs;
   int                    frame_avail, got_data;
 
   struct arg               arg;
@@ -1543,7 +1543,7 @@ int main(int argc, const char **argv_) {
   }
 
   /* Populate encoder configuration */
-  res = vpx_codec_enc_config_default(codec->iface, &cfg, arg_usage);
+  res = vpx_codec_enc_config_default(codec->iface(), &cfg, arg_usage);
 
   if (res) {
     fprintf(stderr, "Failed to get config: %s\n",
@@ -1660,11 +1660,7 @@ int main(int argc, const char **argv_) {
   /* Handle codec specific options */
 #if CONFIG_VP8_ENCODER
 
-  if (codec->iface == &vpx_codec_vp8_cx_algo
-#if CONFIG_EXPERIMENTAL
-      || codec->iface == &vpx_codec_vp8x_cx_algo
-#endif
-     ) {
+  if (codec->fourcc == VP8_FOURCC) {
     ctrl_args = vp8_args;
     ctrl_args_map = vp8_arg_ctrl_map;
   }
@@ -1775,7 +1771,7 @@ int main(int argc, const char **argv_) {
 #define SHOW(field) fprintf(stderr, "    %-28s = %d\n", #field, cfg.field)
 
     if (verbose && pass == 0) {
-      fprintf(stderr, "Codec: %s\n", vpx_codec_iface_name(codec->iface));
+      fprintf(stderr, "Codec: %s\n", vpx_codec_iface_name(codec->iface()));
       fprintf(stderr, "Source file: %s Format: %s\n", in_fn,
               arg_use_i420 ? "I420" : "YV12");
       fprintf(stderr, "Destination file: %s\n", out_fn);
@@ -1885,12 +1881,12 @@ int main(int argc, const char **argv_) {
 
 
     /* Construct Encoder Context */
-    vpx_codec_enc_init(&encoder, codec->iface, &cfg,
+    vpx_codec_enc_init(&encoder, codec->iface(), &cfg,
                        show_psnr ? VPX_CODEC_USE_PSNR : 0);
     ctx_exit_on_error(&encoder, "Failed to initialize encoder");
 
     if (test_decode &&
-        vpx_codec_dec_init(&decoder, ifaces[0].iface, &dec_cfg, 0)) {
+        vpx_codec_dec_init(&decoder, ifaces[0].iface(), &dec_cfg, 0)) {
       fprintf(stderr,
               "Failed to initialize decoder: %s\n",
               vpx_codec_error(&decoder));