mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2024-11-09 23:18:20 +00:00
update libcallback to support v2
This commit is contained in:
parent
35988bec3b
commit
d098f91413
@ -56,6 +56,15 @@ static uint32_t audio_pcm_capture(struct frames_st *frames) {
|
|||||||
static int firstEntry = 0;
|
static int firstEntry = 0;
|
||||||
uint32_t *buf = frames->buf;
|
uint32_t *buf = frames->buf;
|
||||||
|
|
||||||
|
static int snd_rate = 16000;
|
||||||
|
const char *productv2="/driver/sensor_jxf23.ko";
|
||||||
|
|
||||||
|
//Change sample rate to 8000 if we are a V2 Camera
|
||||||
|
if( access( productv2, F_OK ) == 0 ) {
|
||||||
|
snd_rate = 8000;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!firstEntry) {
|
if(!firstEntry) {
|
||||||
firstEntry++;
|
firstEntry++;
|
||||||
unsigned int card = 0;
|
unsigned int card = 0;
|
||||||
@ -63,7 +72,7 @@ static uint32_t audio_pcm_capture(struct frames_st *frames) {
|
|||||||
int flags = PCM_OUT | PCM_MMAP;
|
int flags = PCM_OUT | PCM_MMAP;
|
||||||
const struct pcm_config config = {
|
const struct pcm_config config = {
|
||||||
.channels = 1,
|
.channels = 1,
|
||||||
.rate = 16000,
|
.rate = snd_rate,
|
||||||
.format = PCM_FORMAT_S16_LE,
|
.format = PCM_FORMAT_S16_LE,
|
||||||
.period_size = 128,
|
.period_size = 128,
|
||||||
.period_count = 8,
|
.period_count = 8,
|
||||||
@ -151,6 +160,15 @@ uint32_t local_sdk_audio_set_pcm_frame_callback(int ch, void *callback) {
|
|||||||
callback = audio_pcm_capture1;
|
callback = audio_pcm_capture1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if V2 here, we have to latch on to the same callback as CH0, since the V2's only have one audio callback
|
||||||
|
const char *productv2="/driver/sensor_jxf23.ko";
|
||||||
|
if( access( productv2, F_OK ) == 0 ) {
|
||||||
|
if( (ch == 0) && ch_count == 1) {
|
||||||
|
audio_pcm_cb1 = callback;
|
||||||
|
fprintf(stderr,"enc func injection CH0 second callback for V2 save audio_pcm_cb=0x%x\n", audio_pcm_cb1);
|
||||||
|
callback = audio_pcm_capture1;
|
||||||
|
}
|
||||||
|
}
|
||||||
ch_count=ch_count+1;
|
ch_count=ch_count+1;
|
||||||
|
|
||||||
return real_local_sdk_audio_set_pcm_frame_callback(ch, callback);
|
return real_local_sdk_audio_set_pcm_frame_callback(ch, callback);
|
||||||
|
Binary file not shown.
@ -8,10 +8,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
static int (*original_mp4write_start_handler)(void *handler, char *file, void *config);
|
static int (*original_mp4write_start_handler)(void *handler, char *file, void *config);
|
||||||
|
|
||||||
|
|
||||||
static int mp4WriteEnable = 0;
|
static int mp4WriteEnable = 0;
|
||||||
|
|
||||||
char *mp4Write(int fd, char *tokenPtr) {
|
char *mp4Write(int fd, char *tokenPtr) {
|
||||||
|
@ -59,7 +59,21 @@ static uint32_t video_encode_capture(struct frames_st *frames) {
|
|||||||
if(!firstEntry) {
|
if(!firstEntry) {
|
||||||
firstEntry++;
|
firstEntry++;
|
||||||
int err;
|
int err;
|
||||||
const char *v4l2_device_path = "/dev/video1";
|
|
||||||
|
|
||||||
|
char *v4l2_device_path = "/dev/video0";
|
||||||
|
//Check for this file, which should only exist on the V2 cameras
|
||||||
|
const char *productv2="/driver/sensor_jxf23.ko";
|
||||||
|
|
||||||
|
if( access( productv2, F_OK ) != -1 ) {
|
||||||
|
v4l2_device_path = "/dev/video6";
|
||||||
|
fprintf(stderr, "[command] v4l2_device_path = %s\n", v4l2_device_path);
|
||||||
|
} else {
|
||||||
|
v4l2_device_path = "/dev/video1";
|
||||||
|
fprintf(stderr, "[command] v4l2_device_path = %s\n", v4l2_device_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *productf="/configs/.product_db3";
|
const char *productf="/configs/.product_db3";
|
||||||
fprintf(stderr,"Opening V4L2 device: %s \n", v4l2_device_path);
|
fprintf(stderr,"Opening V4L2 device: %s \n", v4l2_device_path);
|
||||||
v4l2Fd = open(v4l2_device_path, O_WRONLY, 0777);
|
v4l2Fd = open(v4l2_device_path, O_WRONLY, 0777);
|
||||||
@ -108,7 +122,19 @@ static uint32_t video_encode_capture1(struct frames_st *frames) {
|
|||||||
if(!firstEntry) {
|
if(!firstEntry) {
|
||||||
firstEntry++;
|
firstEntry++;
|
||||||
int err;
|
int err;
|
||||||
const char *v4l2_device_path = "/dev/video2";
|
|
||||||
|
char *v4l2_device_path = "/dev/video0";
|
||||||
|
//Check for this file, which should only exist on the V2 cameras
|
||||||
|
const char *productv2="/driver/sensor_jxf23.ko";
|
||||||
|
|
||||||
|
if( access( productv2, F_OK ) != -1 ) {
|
||||||
|
v4l2_device_path = "/dev/video7";
|
||||||
|
fprintf(stderr, "[command] v4l2_device_path = %s\n", v4l2_device_path);
|
||||||
|
} else {
|
||||||
|
v4l2_device_path = "/dev/video2";
|
||||||
|
fprintf(stderr, "[command] v4l2_device_path = %s\n", v4l2_device_path);
|
||||||
|
}
|
||||||
|
|
||||||
const char *productf="/configs/.product_db3";
|
const char *productf="/configs/.product_db3";
|
||||||
fprintf(stderr,"Opening V4L2 device: %s \n", v4l2_device_path);
|
fprintf(stderr,"Opening V4L2 device: %s \n", v4l2_device_path);
|
||||||
v4l2Fd = open(v4l2_device_path, O_WRONLY, 0777);
|
v4l2Fd = open(v4l2_device_path, O_WRONLY, 0777);
|
||||||
@ -149,7 +175,6 @@ static uint32_t video_encode_capture1(struct frames_st *frames) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int local_sdk_video_set_encode_frame_callback(int ch, void *callback) {
|
int local_sdk_video_set_encode_frame_callback(int ch, void *callback) {
|
||||||
|
|
||||||
fprintf(stderr, "local_sdk_video_set_encode_frame_callback streamChId=%d, callback=0x%x\n", ch, callback);
|
fprintf(stderr, "local_sdk_video_set_encode_frame_callback streamChId=%d, callback=0x%x\n", ch, callback);
|
||||||
|
Loading…
Reference in New Issue
Block a user