Improve decoder and add buffer validator
This commit is contained in:
parent
6806a6bdf2
commit
1352df220b
@ -79,8 +79,7 @@ retry:
|
|||||||
|
|
||||||
// JPEG is in 16x16 blocks (shrink image to fit) (but adapt to 32x32)
|
// JPEG is in 16x16 blocks (shrink image to fit) (but adapt to 32x32)
|
||||||
// And ISP output
|
// And ISP output
|
||||||
if (strstr(buf_list->name, "JPEG") || strstr(buf_list->name, "H264") || buf_list->do_capture && strstr(buf_list->name, "ISP")
|
if (strstr(buf_list->name, "JPEG") || strstr(buf_list->name, "H264") || buf_list->do_capture && strstr(buf_list->name, "ISP")) {
|
||||||
|| strstr(buf_list->name, "DECODER")) {
|
|
||||||
width = shrink_to_block(width, 32);
|
width = shrink_to_block(width, 32);
|
||||||
height = shrink_to_block(height, 32);
|
height = shrink_to_block(height, 32);
|
||||||
E_LOG_VERBOSE(buf_list, "Adapting size to 32x32 block: %dx%d vs %dx%d", orig_width, orig_height, width, height);
|
E_LOG_VERBOSE(buf_list, "Adapting size to 32x32 block: %dx%d vs %dx%d", orig_width, orig_height, width, height);
|
||||||
|
@ -181,6 +181,7 @@ int device_set_decoder_start(device_t *dev, bool do_on)
|
|||||||
|
|
||||||
E_LOG_DEBUG(dev, "Setting decoder state %s...", do_on ? "Start" : "Stop");
|
E_LOG_DEBUG(dev, "Setting decoder state %s...", do_on ? "Start" : "Stop");
|
||||||
E_XIOCTL(dev, dev->fd, VIDIOC_DECODER_CMD, &cmd, "Cannot set decoder state");
|
E_XIOCTL(dev, dev->fd, VIDIOC_DECODER_CMD, &cmd, "Cannot set decoder state");
|
||||||
|
dev->decoder_started = do_on;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -15,6 +15,7 @@ typedef struct device_s {
|
|||||||
|
|
||||||
struct device_s *output_device;
|
struct device_s *output_device;
|
||||||
bool paused;
|
bool paused;
|
||||||
|
bool decoder_started;
|
||||||
} device_t;
|
} device_t;
|
||||||
|
|
||||||
device_t *device_open(const char *name, const char *path);
|
device_t *device_open(const char *name, const char *path);
|
||||||
|
@ -101,6 +101,11 @@ int links_enqueue_from_source(buffer_list_t *buf_list, link_t *link)
|
|||||||
E_LOG_ERROR(buf_list, "No buffer dequeued from source?");
|
E_LOG_ERROR(buf_list, "No buffer dequeued from source?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (link->callbacks.validate_buffer && !link->callbacks.validate_buffer(link, buf)) {
|
||||||
|
E_LOG_DEBUG(buf_list, "Buffer rejected by validation");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (int j = 0; link->sinks[j]; j++) {
|
for (int j = 0; link->sinks[j]; j++) {
|
||||||
if (link->sinks[j]->device->paused) {
|
if (link->sinks[j]->device->paused) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -6,9 +6,11 @@
|
|||||||
|
|
||||||
typedef struct buffer_s buffer_t;
|
typedef struct buffer_s buffer_t;
|
||||||
typedef struct buffer_list_s buffer_list_t;
|
typedef struct buffer_list_s buffer_list_t;
|
||||||
|
typedef struct link_s link_t;
|
||||||
|
|
||||||
typedef void (*link_on_buffer)(buffer_t *buf);
|
typedef void (*link_on_buffer)(buffer_t *buf);
|
||||||
typedef bool (*link_check_streaming)();
|
typedef bool (*link_check_streaming)();
|
||||||
|
typedef bool (*link_validate_buffer)(struct link_s *link, buffer_t *buf);
|
||||||
|
|
||||||
typedef struct link_s {
|
typedef struct link_s {
|
||||||
struct buffer_list_s *source; // capture_list
|
struct buffer_list_s *source; // capture_list
|
||||||
@ -16,6 +18,7 @@ typedef struct link_s {
|
|||||||
struct {
|
struct {
|
||||||
link_on_buffer on_buffer;
|
link_on_buffer on_buffer;
|
||||||
link_check_streaming check_streaming;
|
link_check_streaming check_streaming;
|
||||||
|
link_validate_buffer validate_buffer;
|
||||||
} callbacks;
|
} callbacks;
|
||||||
} link_t;
|
} link_t;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user