Dll build of libvpx

Change-Id: I74e50b4dfbe73eb98e1dce1695a9973f637220c0
This commit is contained in:
Jim Bankoski 2012-07-23 12:32:59 -07:00 committed by Yaowu Xu
parent 6f6856839b
commit 1b16e74813
9 changed files with 49 additions and 41 deletions

View File

@ -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

2
configure vendored
View File

@ -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."

View 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))))

View File

@ -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 \

View 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

View 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,

View 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

View File

@ -49,17 +49,19 @@
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;

View File

@ -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));