Commit 635702d9 authored by gates's avatar gates

Modify libbluray build system to have similar CFLAGS defaults as libaacs and libbdplus.

Also fix library build accordingly.
parent 890c9dd2
......@@ -17,6 +17,16 @@ AC_ARG_WITH([dlopen],
[use libaacs and libbdplus via dlopen (default is auto)])],
[use_dlopen=$withval],
[use_dlopen=auto])
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--enable-werror],
[set warnings as errors via -Werror (default is yes)])],
[use_werror=$enableval],
[use_werror=yes])
AC_ARG_ENABLE([optimizations],
[AS_HELP_STRING([--enable-optimizations],
[enable optimizations (default is yes)])],
[use_optimizations=$enableval],
[use_optimizations=yes])
# required programs
AC_PROG_CC
......@@ -60,8 +70,19 @@ fi
AM_CONDITIONAL([USING_DLOPEN],
[test $use_dlopen = "auto" || test $use_dlopen = "yes"])
# use -Werror
if [[ $use_werror = "yes" ]]; then
WERROR="-Werror"
fi
# use optimizations
if [[ $use_optimizations = "yes" ]]; then
OPTIMIZATIONS="-O3 -fomit-frame-pointer"
fi
# generate output files
AC_SUBST(DLOPEN_LDFLAGS)
AC_SUBST(WERROR)
AC_SUBST(OPTIMIZATIONS)
AC_CONFIG_FILES([Makefile src/Makefile src/examples/Makefile src/libbluray.pc])
AC_OUTPUT
SUBDIRS= . examples
AM_CFLAGS = -I$(top_builddir)/src
SET_FEATURES = -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112L -D_REENTRANT
SET_WARNINGS = -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith \
-Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings \
-Wtype-limits -Wundef @WERROR@
SET_OPTIMIZATIONS = @OPTIMIZATIONS@
SET_INCLUDES = -I$(top_srcdir)/src
AM_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_WARNINGS) $(SET_OPTIMIZATIONS) \
$(SET_INCLUDES)
CFLAGS=$(shell test -z "$$CFLAGS" && echo "-g" || echo "$$CFLAGS")
if USING_DLOPEN
LIBBLURAY_LDFLAGS=@DLOPEN_LDFLAGS@
......
# Set this for all builds, or use $bin_CFLAGS for individual
AM_CFLAGS = -I$(top_builddir)/src
SET_FEATURES = -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112L -D_REENTRANT
SET_WARNINGS = -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith \
-Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings \
-Wtype-limits -Wundef @WERROR@
SET_OPTIMIZATIONS = @OPTIMIZATIONS@
SET_INCLUDES = -I$(top_srcdir)/src
AM_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_WARNINGS) $(SET_OPTIMIZATIONS) \
$(SET_INCLUDES)
CFLAGS=$(shell test -z "$$CFLAGS" && echo "-g" || echo "$$CFLAGS")
noinst_PROGRAMS=bdsplice mpls_dump clpi_dump index_dump mobj_dump \
libbluray_test list_titles
......
......@@ -38,10 +38,10 @@ static int verbose;
typedef struct {
int value;
char *str;
const char *str;
} VALUE_MAP;
static inline char*
static inline const char*
_lookup_str(VALUE_MAP *map, int val)
{
int ii;
......
......@@ -75,18 +75,18 @@ static void _indx_print_bdj_obj(INDX_BDJ_OBJ *bdj)
static void _indx_print_play_item(INDX_PLAY_ITEM *title)
{
if (title->object_type == 1) {
_indx_print_hdmv_obj(&title->hdmv);
_indx_print_hdmv_obj(&title->indx_union.hdmv);
} else {
_indx_print_bdj_obj(&title->bdj);
_indx_print_bdj_obj(&title->indx_union.bdj);
}
}
static void _indx_print_title(INDX_TITLE *title)
{
if (title->object_type == 1) {
_indx_print_hdmv_obj(&title->hdmv);
_indx_print_hdmv_obj(&title->indx_union.hdmv);
} else {
_indx_print_bdj_obj(&title->bdj);
_indx_print_bdj_obj(&title->indx_union.bdj);
}
printf(" access type : %d\n", title->access_type);
}
......
......@@ -43,7 +43,7 @@ static int verbose;
typedef struct {
int value;
char *str;
const char *str;
} VALUE_MAP;
VALUE_MAP codec_map[] = {
......@@ -116,7 +116,7 @@ VALUE_MAP audio_rate_map[] = {
{0, NULL}
};
char*
const char*
_lookup_str(VALUE_MAP *map, int val)
{
int ii;
......@@ -486,8 +486,8 @@ _usage(char *cmd)
static int
_qsort_str_cmp(const void *a, const void *b)
{
char *stra = *(char**)a;
char *strb = *(char**)b;
const char *stra = (const char *)a;
const char *strb = (const char *)b;
return strcmp(stra, strb);
}
......@@ -589,7 +589,9 @@ main(int argc, char *argv[])
int jj = 0;
for (ent = readdir(dir); ent != NULL; ent = readdir(dir)) {
if (ent->d_name != NULL) {
dirlist[jj++] = strdup(ent->d_name);
dirlist[jj] = (char*)malloc(strlen(ent->d_name) + 1);
strcpy(dirlist[jj], ent->d_name);
jj++;
}
}
qsort(dirlist, jj, sizeof(char*), _qsort_str_cmp);
......
......@@ -50,7 +50,7 @@ hex_dump(uint8_t *buf, int count)
}
void
indent_printf(int level, char *fmt, ...)
indent_printf(int level, const char *fmt, ...)
{
va_list ap;
int ii;
......
......@@ -47,5 +47,5 @@
#endif
void hex_dump(uint8_t *buf, int count);
void indent_printf(int level, char *fmt, ...);
void indent_printf(int level, const char *fmt, ...);
......@@ -48,6 +48,6 @@ struct dir
int (*read)(DIR_H *dir, DIRENT *entry);
};
extern DIR_H *dir_open_posix(const char* dirname);
DIR_H *dir_open_posix(const char* dirname);
#endif /* DIR_H_ */
......@@ -38,7 +38,6 @@
#include <dirent.h>
#include <string.h>
DIR_H *dir_open_posix(const char* dirname);
void dir_close_posix(DIR_H *dir);
int dir_read_posix(DIR_H *dir, DIRENT *ent);
......
......@@ -28,6 +28,6 @@ struct file
int (*write)(FILE_H *file, uint8_t *buf, int64_t size);
};
extern FILE_H *file_open_linux(const char* filename, const char *mode);
FILE_H *file_open_linux(const char* filename, const char *mode);
#endif /* FILE_H_ */
......@@ -8,7 +8,6 @@
#include <stdlib.h>
FILE_H *file_open_linux(const char* filename, const char *mode);
void file_close_linux(FILE_H *file);
int64_t file_seek_linux(FILE_H *file, int64_t offset, int32_t origin);
int64_t file_tell_linux(FILE_H *file);
......
......@@ -61,9 +61,9 @@ static int _parse_playback_obj(BITSTREAM *bs, INDX_PLAY_ITEM *obj)
bs_skip(bs, 30);
if (obj->object_type == 1) {
return _parse_hdmv_obj(bs, &obj->hdmv);
return _parse_hdmv_obj(bs, &obj->indx_union.hdmv);
} else {
return _parse_bdj_obj(bs, &obj->bdj);
return _parse_bdj_obj(bs, &obj->indx_union.bdj);
}
}
......@@ -91,9 +91,9 @@ static int _parse_index(BITSTREAM *bs, INDX_ROOT *index)
bs_skip(bs, 28);
if (index->titles[i].object_type == 1) {
_parse_hdmv_obj(bs, &index->titles[i].hdmv);
_parse_hdmv_obj(bs, &index->titles[i].indx_union.hdmv);
} else {
_parse_bdj_obj(bs, &index->titles[i].bdj);
_parse_bdj_obj(bs, &index->titles[i].indx_union.bdj);
}
}
......
......@@ -91,7 +91,7 @@ typedef struct {
union {
INDX_BDJ_OBJ bdj;
INDX_HDMV_OBJ hdmv;
};
} indx_union;
} INDX_PLAY_ITEM;
typedef struct {
......@@ -100,7 +100,7 @@ typedef struct {
union {
INDX_BDJ_OBJ bdj;
INDX_HDMV_OBJ hdmv;
};
} indx_union;
} INDX_TITLE;
typedef struct indx_root_s {
......
......@@ -276,7 +276,9 @@ char* nav_find_main_title(char *root)
mpls_free(pl_list[ii]);
}
if (count > 0) {
return strdup(longest);
char *str = (char*)malloc(strlen(longest) + 1);
strcpy(str, longest);
return str;
} else {
return NULL;
}
......@@ -376,7 +378,8 @@ NAV_TITLE* nav_title_open(char *root, char *playlist)
if (title == NULL) {
return NULL;
}
title->root = strdup(root);
title->root = (char*)malloc(strlen(root) + 1);
strcpy(title->root, root);
strncpy(title->name, playlist, 11);
title->name[10] = '\0';
path = str_printf("%s" DIR_SEP "BDMV" DIR_SEP "PLAYLIST" DIR_SEP "%s",
......
......@@ -122,7 +122,8 @@ BLURAY *bd_open(const char* device_path, const char* keyfile_path)
if (device_path) {
bd->device_path = strdup(device_path);
bd->device_path = (char*)malloc(strlen(device_path) + 1);
strcpy(bd->device_path, device_path);
bd->aacs = NULL;
bd->h_libaacs = NULL;
......
......@@ -52,9 +52,9 @@ typedef struct {
int size;
} BITSTREAM;
static inline void bb_init( BITBUFFER *bb, const void *p_data, size_t i_data )
static inline void bb_init( BITBUFFER *bb, void *p_data, size_t i_data )
{
bb->p_start = (void *)p_data;
bb->p_start = p_data;
bb->p = bb->p_start;
bb->p_end = bb->p_start + i_data;
bb->i_left = 8;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment