Skip to content

Commit

Permalink
media:support linux build
Browse files Browse the repository at this point in the history
Change-Id: Icee49df04cdd1ac5b55e2044d3d8f64fcc204c24
Signed-off-by: Laisheng Hu <[email protected]>
  • Loading branch information
Laisheng Hu authored and Gerrit - the friendly Code Review server committed Oct 6, 2018
1 parent 9793456 commit 33fb67b
Show file tree
Hide file tree
Showing 14 changed files with 111 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
ACLOCAL_AMFLAGS = -I m4

BUILD_COMPONENTS := mm-core
BUILD_COMPONENTS := mm-core libc2dcolorconvert libplatformconfig libarbitrarybytes

if BUILD_MM_VIDEO
BUILD_COMPONENTS += mm-video-v4l2
Expand Down
9 changes: 6 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ AC_ARG_ENABLE([use-glib],
[use_glib="${enableval}"])

AC_ARG_ENABLE([build-mm-video],
AC_HELP_STRING([--enable-use-glib],
[Enable conditional compile for use glib [default=no]]),
AC_HELP_STRING([--enable-build-mm-video],
[Enable conditional compile for build mm video [default=no]]),
[build_mm_video="${enableval}"])

AC_ARG_WITH([sanitized-headers],
Expand Down Expand Up @@ -187,7 +187,10 @@ AC_SUBST([CFLAGS])

AC_CONFIG_FILES([ \
Makefile \
mm-core/Makefile
mm-core/Makefile \
libc2dcolorconvert/Makefile \
libarbitrarybytes/Makefile \
libplatformconfig/Makefile \
mm-video-v4l2/Makefile \
mm-video-v4l2/vidc/Makefile \
mm-video-v4l2/vidc/venc/Makefile \
Expand Down
23 changes: 23 additions & 0 deletions libarbitrarybytes/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
AM_CFLAGS = -Werror
AM_CPPFLAGS = -Werror
AM_CPPFLAGS += -D_ENABLE_QC_MSG_LOG_
AM_CPPFLAGS += -I$(top_srcdir)/mm-core/inc/
AM_CPPFLAGS += -I$(top_srcdir)/mm-video-v4l2/vidc/common/inc/
AM_CPPFLAGS += -I$(top_srcdir)/libarbitrarybytes/inc/
h_sources =inc/frameparser.h
h_sources +=inc/h264_utils.h
h_sources +=inc/hevc_utils.h
h_sources +=inc/Map.h
h_sources +=inc/qtypes.h

c_sources =src/frameparser.cpp
c_sources +=src/h264_utils.cpp
c_sources +=src/hevc_utils.cpp


lib_LTLIBRARIES = libarbitrarybytes.la
include_HEADERS = $(h_sources)
libarbitrarybytes_la_SOURCES = $(c_sources)
libarbitrarybytes_la_CFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -fPIC
libarbitrarybytes_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -fPIC
libarbitrarybytes_la_LDFLAGS = -llog -lcutils
5 changes: 2 additions & 3 deletions libc2dcolorconvert/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
AM_CFLAGS = -Wall
AM_CFLAGS += -Wundef
AM_CFLAGS += -Wstrict-prototypes
AM_CFLAGS += -Wno-trigraphs
AM_CFLAGS += -g -O3
AM_CFLAGS += "-include stdint.h"
AM_CFLAGS += "-std=c++11"


AM_CPPFLAGS = $(CPPFLAGS)

AM_CPPFLAGS += -I$(WORKSPACE)/graphics/libdrm/freedreno/kgsl/
AM_CPPFLAGS += -I$(WORKSPACE)/display/display-hal/gralloc/
c_sources = C2DColorConverter.cpp
h_sources = C2DColorConverter.h

Expand Down
1 change: 1 addition & 0 deletions libplatformconfig/ConfigParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#define LOG_TAG "ConfigParser"

#include <string.h>
#include <errno.h>
#include <utils/Log.h>
#include <sys/mman.h>
Expand Down
27 changes: 27 additions & 0 deletions libplatformconfig/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
AM_CFLAGS = -Werror
AM_CFLAGS += -Wall
AM_CFLAGS += -g -O3

AM_CPPFLAGS = -g -O3
AM_CFLAGS += "-std=c++11"
AM_CPPFLAGS += -Wno-error=unused-variable
AM_CPPFLAGS += -D__unused=__attribute__\(\(__unused__\)\)


AM_CPPFLAGS += "-Dstrlcpy=g_strlcpy"
AM_CPPFLAGS += "-Dstrlcat=g_strlcat"
AM_CPPFLAGS += -Wextra
AM_CPPFLAGS += -Wno-missing-field-initializers
AM_CPPFLAGS += -fexceptions


AM_CPPFLAGS += -I$(top_srcdir)/mm-core/inc/
AM_CPPFLAGS += -I$(top_srcdir)/mm-video-v4l2/vidc/common/inc/
c_sources := PlatformConfig.cpp
c_sources += ConfigParser.cpp

lib_LTLIBRARIES = libplatformconfig.la
libplatformconfig_la_SOURCES = $(c_sources)
libplatformconfig_la_CFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -fPIC
libplatformconfig_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -fPIC
libplatformconfig_la_LIBADD = -lexpat -llog -lcutils -lutils
1 change: 1 addition & 0 deletions libstagefrighthw/QComOMXMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "cutils/native_handle.h"
#include <media/hardware/MetadataBufferType.h>

typedef const native_handle_t* buffer_handle_t;
namespace android {

#ifdef USE_NATIVE_HANDLE_SOURCE
Expand Down
12 changes: 6 additions & 6 deletions mm-core/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if TARGET_MSM8909
TARGET_REGISTRY = 8909
endif

c_sources +=src/${TARGET_REGISTRY}/registry_table_android.c
c_sources +=src/registry_table_android.c

lib_LTLIBRARIES = libOmxCore.la
include_HEADERS = $(h_sources)
Expand All @@ -68,14 +68,14 @@ libOmxCore_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -fPIC
libOmxCore_la_LDFLAGS = -ldl -lrt -lpthread -lglib-2.0 -lcutils
libOmxCore_la_LDFLAGS += -shared -avoid-version


lib_LTLIBRARIES += libmm-omxcore.la

c_sources =src/common/omx_core_cmp.cpp
c_sources +=src/common/qc_omx_core.c
c_sources +=src/${TARGET_REGISTRY}/registry_table.c
c1_sources =src/common/omx_core_cmp.cpp
c1_sources +=src/common/qc_omx_core.c
c1_sources +=src/registry_table.c

include_HEADERS = $(h_sources)
libmm_omxcore_la_SOURCES = $(c_sources)
libmm_omxcore_la_SOURCES = $(c1_sources)
libmm_omxcore_la_CFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -fPIC
libmm_omxcore_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -fPIC
libmm_omxcore_la_LDFLAGS = -ldl -lrt -lpthread -lglib-2.0 -lcutils
Expand Down
1 change: 1 addition & 0 deletions mm-video-v4l2/vidc/common/inc/vidc_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class Signal {

#ifdef _ANDROID_
#define ATRACE_TAG ATRACE_TAG_VIDEO
#include <cutils/trace.h>
#include <utils/Trace.h>

class AutoTracer {
Expand Down
4 changes: 4 additions & 0 deletions mm-video-v4l2/vidc/common/src/vidc_vendor_extensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "OMX_IndexExt.h"
#include "vidc_vendor_extensions.h"

#ifdef _USE_GLIB_
#include <glib.h>
#endif

VendorExtension::VendorExtension(OMX_INDEXTYPE id, const char *name, OMX_DIRTYPE dir,
const ParamListBuilder& p)
: mId(id),
Expand Down
24 changes: 15 additions & 9 deletions mm-video-v4l2/vidc/vdec/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ AM_CPPFLAGS += -UOUTPUT_BUFFER_LOG
AM_CPPFLAGS += -Wno-parentheses
AM_CPPFLAGS += -D_ANDROID_ICS_
AM_CPPFLAGS += -DPROCESS_EXTRADATA_IN_OUTPUT_PORT
AM_CPPFLAGS += -DNATIVE_BASE_DISABLE
#AM_CPPFLAGS += "-include stdint.h"
AM_CPPFLAGS += "-Dstrlcpy=g_strlcpy"
AM_CPPFLAGS += "-Dstrlcat=g_strlcat"
AM_CPPFLAGS += "-std=c++11"
AM_CPPFLAGS += "-DHAVE_ANDROID_OS"
AM_CPPFLAGS += -DSYS_IOCTL

if USE_GLIB
AM_CPPFLAGS += -D_USE_GLIB_
endif
Expand All @@ -51,18 +51,24 @@ endif
AM_CPPFLAGS += -I$(top_srcdir)/mm-video-v4l2/vidc/common/inc/
AM_CPPFLAGS += -I$(top_srcdir)/mm-video-v4l2/vidc/vdec/inc/
AM_CPPFLAGS += -I$(top_srcdir)/libc2dcolorconvert/
AM_CPPFLAGS += -I$(top_srcdir)/libplatformconfig/
AM_CPPFLAGS += -I$(top_srcdir)/libarbitrarybytes/inc/
AM_CPPFLAGS += -I$(top_srcdir)/mm-core/inc/
AM_CPPFLAGS += -I$(top_srcdir)/mm-core/src/common/

c_sources := src/frameparser.cpp
c_sources += src/h264_utils.cpp
c_sources += src/ts_parser.cpp
c_sources += src/mp4_utils.cpp
c_sources += src/hevc_utils.cpp
c_sources += src/omx_vdec_v4l2.cpp
AM_CPPFLAGS += -I$(WORKSPACE)/graphics/libdrm/freedreno/kgsl/
AM_CPPFLAGS += -I$(WORKSPACE)/display/display-hal/gralloc/
AM_CPPFLAGS += -I$(WORKSPACE)/display/display-hal/libqdutils/
AM_CPPFLAGS += -I${WORKSPACE}/frameworks/native/include/
c_sources = src/ts_parser.cpp
c_sources += src/omx_vdec_v4l2.cpp
c_sources += $(top_srcdir)/mm-video-v4l2/vidc/common/src/vidc_common.cpp
c_sources += $(top_srcdir)/mm-video-v4l2/vidc/common/src/vidc_vendor_extensions.cpp

lib_LTLIBRARIES = libOmxVdec.la
libOmxVdec_la_SOURCES = $(c_sources)
libOmxVdec_la_CFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -fPIC
libOmxVdec_la_CFLAGS += ../libc2d2colorconvert/libc2dcolorconvert.la
libOmxVdec_la_LDFLAGS = -lglib-2.0 -shared -version-info 0
libOmxVdec_la_LDFLAGS = -module -shared -avoid-version
libOmxVdec_la_LDFLAGS += -llog -lcutils -lglib-2.0 -lion -lqdMetaData
libOmxVdec_la_LDFLAGS += -L$(top_builddir)/libc2dcolorconvert -L$(top_builddir)/libplatformconfig -L$(top_builddir)/libarbitrarybytes
libOmxVdec_la_LDFLAGS += -lc2dcolorconvert -lplatformconfig -larbitrarybytes
2 changes: 2 additions & 0 deletions mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ extern "C" {
//#include <binder/MemoryHeapIon.h>
//#else
#endif
#ifndef NATIVE_BASE_DISABLE
#include <nativebase/nativebase.h>
#endif
#include <linux/videodev2.h>
#define VALID_TS(ts) ((ts < LLONG_MAX)? true : false)
#include <poll.h>
Expand Down
20 changes: 12 additions & 8 deletions mm-video-v4l2/vidc/venc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,22 @@ AM_CPPFLAGS += -I$(top_srcdir)/libc2dcolorconvert/
AM_CPPFLAGS += -I$(top_srcdir)/mm-core/inc/
AM_CPPFLAGS += -I$(top_srcdir)/mm-core/src/common/
AM_CPPFLAGS += -I$(top_srcdir)/libstagefrighthw/

AM_CPPFLAGS += -I$(top_srcdir)/libplatformconfig/
AM_CPPFLAGS += -I$(WORKSPACE)/graphics/libdrm/freedreno/kgsl/
AM_CPPFLAGS += -I$(WORKSPACE)/display/display-hal/gralloc/
AM_CPPFLAGS += -I$(WORKSPACE)/display/display-hal/libqdutils/
AM_CPPFLAGS += -I${WORKSPACE}/frameworks/native/include/
sources = src/omx_video_base.cpp
sources += src/omx_video_encoder.cpp
sources += src/video_encoder_device_v4l2.cpp
sources += $(top_srcdir)/mm-video-v4l2/vidc/common/src/extra_data_handler.cpp
sources += $(top_srcdir)/mm-video-v4l2/vidc/common/src/vidc_color_converter.cpp
sources += $(top_srcdir)/mm-video-v4l2/vidc/common/src/vidc_common.cpp
sources += $(top_srcdir)/mm-video-v4l2/vidc/common/src/vidc_vendor_extensions.cpp

lib_LTLIBRARIES = libOmxVenc.la
libOmxVenc_la_SOURCES = $(sources)
libOmxVenc_la_CFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -fPIC
#libOmxVenc_la_LDLIBS = ../libc2d2colorconvert/libc2dcolorconvert.la
#libOmxVenc_la_LIBADD = ../../../mm-core/libOmxCore.la
libOmxVenc_la_LDFLAGS = -lstdc++ -lpthread -llog -lutils -lbinder -lcutils -lglib-2.0 -lbase -ldl -lpthread -shared -lqdMetaData
# -lc2d2 -lgui -lOmxCore -lgpustats -ldl -lpthread
libOmxVenc_la_LDFLAGS += -version-info 0
libOmxVenc_la_LDFLAGS = -module -shared -avoid-version
libOmxVenc_la_LDFLAGS += -lstdc++ -lpthread -llog -lutils -lcutils -lglib-2.0 -lbase -ldl -lpthread -lion

libOmxVenc_la_LDFLAGS += -L$(top_builddir)/libc2dcolorconvert -L$(top_builddir)/libplatformconfig -L$(top_builddir)/libarbitrarybytes
libOmxVenc_la_LDFLAGS += -lc2dcolorconvert -lplatformconfig -larbitrarybytes
10 changes: 10 additions & 0 deletions mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <gralloc_priv.h>
#endif

#ifdef _USE_GLIB_
#include <glib.h>
#define strlcpy g_strlcpy
#endif

#include <qdMetaData.h>
#include <color_metadata.h>
#include "PlatformConfig.h"
Expand All @@ -63,8 +68,13 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define ALIGN(x, to_align) ((((unsigned long) x) + (to_align - 1)) & ~(to_align - 1))
#define EXTRADATA_IDX(__num_planes) ((__num_planes) ? (__num_planes) - 1 : 0)
#define MAXDPB 16
#ifndef MIN
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
#endif
#ifndef MAX
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
#endif

#define ROUND(__sz, __align) (((__sz) + ((__align>>1))) & (~(__align-1)))
#define MAX_PROFILE_PARAMS 6
#define HEVC_MAIN_START 0
Expand Down

0 comments on commit 33fb67b

Please sign in to comment.