Skip to content
Snippets Groups Projects
Commit 7f38f222 authored by Ezequiel Garcia's avatar Ezequiel Garcia
Browse files

Port build to non-chromeos

parent a4286c45
Branches
Tags
No related merge requests found
# Copyright 2014 The Chromium OS Authors. All rights reserved. # Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
#
#if WITH_V4L_PLUGINS
#libv4l2plugin_LTLIBRARIES = libv4l-encplugin.la
#endif
#
#libv4l_encplugin_la_SOURCES = \
# libv4l-encplugin-rockchip.c \
# libvpu/rk_vepu.c \
# libvpu/rk_vepu_debug.c \
# libvpu/vp8_enc/encasiccontroller.c \
# libvpu/vp8_enc/encasiccontroller_v2.c \
# libvpu/vp8_enc/rk_vp8encapi.c \
# libvpu/vp8_enc/vp8codeframe.c \
# libvpu/vp8_enc/vp8encapi.c \
# libvpu/vp8_enc/vp8entropy.c \
# libvpu/vp8_enc/vp8header.c \
# libvpu/vp8_enc/vp8init.c \
# libvpu/vp8_enc/vp8macroblocktools.c \
# libvpu/vp8_enc/vp8picparameterset.c \
# libvpu/vp8_enc/vp8picturebuffer.c \
# libvpu/vp8_enc/vp8putbits.c \
# libvpu/vp8_enc/vp8ratecontrol.c \
# libvpu/vp8_enc/vpu_mem.c
#libv4l_encplugin_la_CPPFLAGS = $(CFLAG_VISIBILITY)
#libv4l_encplugin_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
#libv4l_encplugin_la_LIBADD = -lpthread
if WITH_V4L_PLUGINS CC=gcc
libv4l2plugin_LTLIBRARIES = libv4l-encplugin.la CFLAGS = -fPIC -Wall -Wextra -O2 -g -I.
endif LDFLAGS = -shared -export-dynamic
RM = rm -f
TARGET_LIB = libv4l-encplugin.so
libv4l_encplugin_la_SOURCES = \ SRCS = \
libv4l-encplugin-rockchip.c \ libv4l-encplugin-rockchip.c \
libvpu/rk_vepu.c \ libvpu/rk_vepu.c \
libvpu/rk_vepu_debug.c \ libvpu/rk_vepu_debug.c \
...@@ -24,6 +52,20 @@ libv4l_encplugin_la_SOURCES = \ ...@@ -24,6 +52,20 @@ libv4l_encplugin_la_SOURCES = \
libvpu/vp8_enc/vp8putbits.c \ libvpu/vp8_enc/vp8putbits.c \
libvpu/vp8_enc/vp8ratecontrol.c \ libvpu/vp8_enc/vp8ratecontrol.c \
libvpu/vp8_enc/vpu_mem.c libvpu/vp8_enc/vpu_mem.c
libv4l_encplugin_la_CPPFLAGS = $(CFLAG_VISIBILITY)
libv4l_encplugin_la_LDFLAGS = -avoid-version -module -shared -export-dynamic OBJS = $(SRCS:.c=.o)
libv4l_encplugin_la_LIBADD = -lpthread
.PHONY: all
all: ${TARGET_LIB}
$(TARGET_LIB): $(OBJS)
$(CC) ${LDFLAGS} -o $@ $^
$(SRCS:.c=.d):%.d:%.c
$(CC) $(CFLAGS) -MM $< >$@
include $(SRCS:.c=.d)
.PHONY: clean
clean:
-${RM} ${TARGET_LIB} ${OBJS} $(SRCS:.c=.d)
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <string.h> #include <string.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <sys/syscall.h> #include <sys/syscall.h>
#include "config.h" /* For HAVE_VISIBILITY */
#include "libv4l-plugin.h" #include "libv4l-plugin.h"
#include "libvpu/rk_vepu_debug.h" #include "libvpu/rk_vepu_debug.h"
#include "libvpu/rk_vepu_interface.h" #include "libvpu/rk_vepu_interface.h"
...@@ -195,7 +194,7 @@ static void *plugin_init(int fd) ...@@ -195,7 +194,7 @@ static void *plugin_init(int fd)
queue_init(&ctx->pending_buffers); queue_init(&ctx->pending_buffers);
memset(&ext_ctrl, 0, sizeof(ext_ctrl)); memset(&ext_ctrl, 0, sizeof(ext_ctrl));
ext_ctrl.id = V4L2_CID_PRIVATE_RK3288_GET_PARAMS; ext_ctrl.id = V4L2_CID_PRIVATE_HANTRO_RET_PARAMS;
ret = SYS_IOCTL(fd, VIDIOC_QUERY_EXT_CTRL, &ext_ctrl); ret = SYS_IOCTL(fd, VIDIOC_QUERY_EXT_CTRL, &ext_ctrl);
if (ret) { if (ret) {
goto fail; goto fail;
...@@ -386,7 +385,7 @@ static int ioctl_dqbuf_locked(struct encoder_context *ctx, int fd, ...@@ -386,7 +385,7 @@ static int ioctl_dqbuf_locked(struct encoder_context *ctx, int fd,
if (bytesused) { if (bytesused) {
memset(ctx->get_param_payload, 0, ctx->get_param_payload_size); memset(ctx->get_param_payload, 0, ctx->get_param_payload_size);
memset(&v4l2_ctrl, 0, sizeof(v4l2_ctrl)); memset(&v4l2_ctrl, 0, sizeof(v4l2_ctrl));
v4l2_ctrl.id = V4L2_CID_PRIVATE_RK3288_GET_PARAMS; v4l2_ctrl.id = V4L2_CID_PRIVATE_HANTRO_RET_PARAMS;
v4l2_ctrl.size = ctx->get_param_payload_size; v4l2_ctrl.size = ctx->get_param_payload_size;
v4l2_ctrl.ptr = ctx->get_param_payload; v4l2_ctrl.ptr = ctx->get_param_payload;
memset(&ext_ctrls, 0, sizeof(ext_ctrls)); memset(&ext_ctrls, 0, sizeof(ext_ctrls));
...@@ -604,6 +603,8 @@ static int initialize_libvpu(struct encoder_context *ctx, int fd) ...@@ -604,6 +603,8 @@ static int initialize_libvpu(struct encoder_context *ctx, int fd)
if (ret) if (ret)
return ret; return ret;
init_param.input_format = format.fmt.pix_mp.pixelformat; init_param.input_format = format.fmt.pix_mp.pixelformat;
init_param.width = format.fmt.pix_mp.width;
init_param.height = format.fmt.pix_mp.height;
/* Get the output format. */ /* Get the output format. */
memset(&format, 0, sizeof(format)); memset(&format, 0, sizeof(format));
...@@ -614,14 +615,16 @@ static int initialize_libvpu(struct encoder_context *ctx, int fd) ...@@ -614,14 +615,16 @@ static int initialize_libvpu(struct encoder_context *ctx, int fd)
init_param.output_format = format.fmt.pix_mp.pixelformat; init_param.output_format = format.fmt.pix_mp.pixelformat;
/* Get the cropped size. */ /* Get the cropped size. */
struct v4l2_crop crop; // struct v4l2_crop crop;
memset(&crop, 0, sizeof(crop)); // memset(&crop, 0, sizeof(crop));
crop.type = ctx->output_streamon_type; // crop.type = ctx->output_streamon_type;
ret = SYS_IOCTL(fd, VIDIOC_G_CROP, &crop); // ret = SYS_IOCTL(fd, VIDIOC_G_CROP, &crop);
if (ret) // if (ret)
return ret; // return ret;
init_param.width = crop.c.width; // init_param.width = crop.c.width;
init_param.height = crop.c.height; // init_param.height = crop.c.height;
printf("%d %d\n", init_param.width, init_param.height);
/* /*
* If the encoder library has initialized and parameters have not * If the encoder library has initialized and parameters have not
...@@ -751,10 +754,14 @@ static const char* v4l_cmd2str(unsigned long int cmd) ...@@ -751,10 +754,14 @@ static const char* v4l_cmd2str(unsigned long int cmd)
return "VIDIOC_G_EXT_CTRLS"; return "VIDIOC_G_EXT_CTRLS";
case VIDIOC_S_EXT_CTRLS: case VIDIOC_S_EXT_CTRLS:
return "VIDIOC_S_EXT_CTRLS"; return "VIDIOC_S_EXT_CTRLS";
case VIDIOC_QUERY_EXT_CTRL:
return "VIDIOC_QUERY_EXT_CTRL";
case VIDIOC_QUERYBUF: case VIDIOC_QUERYBUF:
return "VIDIOC_QUERYBUF"; return "VIDIOC_QUERYBUF";
case VIDIOC_ENCODER_CMD: case VIDIOC_ENCODER_CMD:
return "VIDIOC_ENCODER_CMD"; return "VIDIOC_ENCODER_CMD";
case VIDIOC_CROPCAP:
return "VIDIOC_CROPCAP";
default: default:
return "UNKNOWN"; return "UNKNOWN";
} }
......
...@@ -24,9 +24,9 @@ void *rk_vepu_init(struct rk_vepu_init_param *param) { ...@@ -24,9 +24,9 @@ void *rk_vepu_init(struct rk_vepu_init_param *param) {
return NULL; return NULL;
} }
enc->rk_ctrl_ids[0] = V4L2_CID_PRIVATE_RK3288_HEADER; enc->rk_ctrl_ids[0] = V4L2_CID_PRIVATE_HANTRO_HEADER;
enc->rk_ctrl_ids[1] = V4L2_CID_PRIVATE_RK3288_REG_PARAMS; enc->rk_ctrl_ids[1] = V4L2_CID_PRIVATE_HANTRO_REG_PARAMS;
enc->rk_ctrl_ids[2] = V4L2_CID_PRIVATE_RK3288_HW_PARAMS; enc->rk_ctrl_ids[2] = V4L2_CID_PRIVATE_HANTRO_HW_PARAMS;
retval = enc->ops->init(enc, param); retval = enc->ops->init(enc, param);
if (retval < 0) { if (retval < 0) {
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
/* TODO(wuchengli): Remove these after the header is updated. */ #define V4L2_CID_USER_HANTRO_ENCODER_BASE (V4L2_CID_USER_BASE + 0x2000)
#define V4L2_CID_CUSTOM_BASE (V4L2_CID_USER_BASE | 0x1000) #define V4L2_CID_PRIVATE_HANTRO_HEADER (V4L2_CID_USER_HANTRO_ENCODER_BASE + 0)
#define V4L2_CID_PRIVATE_RK3288_HEADER (V4L2_CID_CUSTOM_BASE) #define V4L2_CID_PRIVATE_HANTRO_REG_PARAMS (V4L2_CID_USER_HANTRO_ENCODER_BASE + 1)
#define V4L2_CID_PRIVATE_RK3288_REG_PARAMS (V4L2_CID_CUSTOM_BASE + 1) #define V4L2_CID_PRIVATE_HANTRO_HW_PARAMS (V4L2_CID_USER_HANTRO_ENCODER_BASE + 2)
#define V4L2_CID_PRIVATE_RK3288_HW_PARAMS (V4L2_CID_CUSTOM_BASE + 2) #define V4L2_CID_PRIVATE_HANTRO_RET_PARAMS (V4L2_CID_USER_HANTRO_ENCODER_BASE + 3)
#define V4L2_CID_PRIVATE_RK3288_GET_PARAMS (V4L2_CID_CUSTOM_BASE + 3)
/* The maximum number of controls returned by rk_vepu_get_config(). */ /* The maximum number of controls returned by rk_vepu_get_config(). */
#define MAX_NUM_GET_CONFIG_CTRLS 5 #define MAX_NUM_GET_CONFIG_CTRLS 5
......
# Copyright 2016 The Chromium OS Authors. All rights reserved. # Copyright 2016 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
#
#if WITH_V4L_PLUGINS
#libv4l2plugin_LTLIBRARIES = libv4l-encplugin.la
#endif
#
#libv4l_encplugin_la_SOURCES = \
# libv4l-encplugin-rockchip.c \
# libvepu/streams.c \
# libvepu/rk_vepu.c \
# libvepu/rk_vepu_debug.c \
# libvepu/common/rk_venc_rate_control.c \
# libvepu/h264e/h264e.c \
# libvepu/h264e/h264e_rate_control.c \
# libvepu/vp8e/vp8e.c \
# libvepu/vp8e/boolhuff.c \
# libvepu/vp8e/vp8e_bitstream.c \
# libvepu/vp8e/vp8e_prob_adapt.c
#
#libv4l_encplugin_la_CPPFLAGS = $(CFLAG_VISIBILITY)
#libv4l_encplugin_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
#libv4l_encplugin_la_LIBADD = -lpthread
#
CFLAGS = -fPIC -Wall -Wextra -O2 -g -I.
LDFLAGS = -shared -export-dynamic
RM = rm -f
TARGET_LIB = libv4l-encplugin.so
if WITH_V4L_PLUGINS SRCS = \
libv4l2plugin_LTLIBRARIES = libv4l-encplugin.la
endif
libv4l_encplugin_la_SOURCES = \
libv4l-encplugin-rockchip.c \ libv4l-encplugin-rockchip.c \
libvepu/streams.c \ libvepu/streams.c \
libvepu/rk_vepu.c \ libvepu/rk_vepu.c \
...@@ -18,7 +40,19 @@ libv4l_encplugin_la_SOURCES = \ ...@@ -18,7 +40,19 @@ libv4l_encplugin_la_SOURCES = \
libvepu/vp8e/boolhuff.c \ libvepu/vp8e/boolhuff.c \
libvepu/vp8e/vp8e_bitstream.c \ libvepu/vp8e/vp8e_bitstream.c \
libvepu/vp8e/vp8e_prob_adapt.c libvepu/vp8e/vp8e_prob_adapt.c
OBJS = $(SRCS:.c=.o)
.PHONY: all
all: ${TARGET_LIB}
$(TARGET_LIB): $(OBJS)
$(CC) ${LDFLAGS} -o $@ $^
$(SRCS:.c=.d):%.d:%.c
$(CC) $(CFLAGS) -MM $< >$@
include $(SRCS:.c=.d)
libv4l_encplugin_la_CPPFLAGS = $(CFLAG_VISIBILITY) .PHONY: clean
libv4l_encplugin_la_LDFLAGS = -avoid-version -module -shared -export-dynamic clean:
libv4l_encplugin_la_LIBADD = -lpthread -${RM} ${TARGET_LIB} ${OBJS} $(SRCS:.c=.d)
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <string.h> #include <string.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <sys/syscall.h> #include <sys/syscall.h>
#include "config.h" /* For HAVE_VISIBILITY */
#include "libv4l-plugin.h" #include "libv4l-plugin.h"
#include "libvepu/rk_vepu_debug.h" #include "libvepu/rk_vepu_debug.h"
#include "libvepu/rk_vepu_interface.h" #include "libvepu/rk_vepu_interface.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment