2020-11-25 14:34:57 +01:00
|
|
|
#include "process_pipeline.h"
|
|
|
|
|
|
|
|
#include "pipeline.h"
|
2021-02-19 11:57:44 +01:00
|
|
|
#include "zbar_pipeline.h"
|
2021-04-07 16:16:17 +02:00
|
|
|
#include "io_pipeline.h"
|
2020-11-25 14:34:57 +01:00
|
|
|
#include "main.h"
|
|
|
|
#include "config.h"
|
2021-04-18 15:13:56 +02:00
|
|
|
#include "gles2_debayer.h"
|
2020-11-25 14:34:57 +01:00
|
|
|
#include <tiffio.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2021-04-18 15:13:56 +02:00
|
|
|
#include "gl_util.h"
|
2021-04-10 14:39:55 +02:00
|
|
|
#include <sys/mman.h>
|
2021-04-09 14:57:14 +02:00
|
|
|
|
2020-11-25 14:34:57 +01:00
|
|
|
#define TIFFTAG_FORWARDMATRIX1 50964
|
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
static const float colormatrix_srgb[] = { 3.2409, -1.5373, -0.4986, -0.9692, 1.8759,
|
|
|
|
0.0415, 0.0556, -0.2039, 1.0569 };
|
2020-11-25 14:34:57 +01:00
|
|
|
|
|
|
|
static MPPipeline *pipeline;
|
|
|
|
|
|
|
|
static char burst_dir[23];
|
|
|
|
static char processing_script[512];
|
|
|
|
|
|
|
|
static volatile bool is_capturing = false;
|
|
|
|
static volatile int frames_processed = 0;
|
|
|
|
static volatile int frames_received = 0;
|
|
|
|
|
|
|
|
static const struct mp_camera_config *camera;
|
2021-05-03 16:06:55 +02:00
|
|
|
static int camera_rotation;
|
2020-11-25 14:34:57 +01:00
|
|
|
|
|
|
|
static MPCameraMode mode;
|
|
|
|
|
|
|
|
static int burst_length;
|
|
|
|
static int captures_remaining = 0;
|
|
|
|
|
|
|
|
static int preview_width;
|
|
|
|
static int preview_height;
|
|
|
|
|
2021-05-03 16:06:55 +02:00
|
|
|
static int device_rotation;
|
|
|
|
|
2021-05-01 13:28:02 +02:00
|
|
|
static int output_buffer_width = -1;
|
|
|
|
static int output_buffer_height = -1;
|
|
|
|
|
2020-11-25 14:34:57 +01:00
|
|
|
// static bool gain_is_manual;
|
|
|
|
static int gain;
|
|
|
|
static int gain_max;
|
|
|
|
|
|
|
|
static bool exposure_is_manual;
|
|
|
|
static int exposure;
|
|
|
|
|
2021-06-14 00:32:55 +02:00
|
|
|
static bool save_dng;
|
|
|
|
|
2020-11-25 14:34:57 +01:00
|
|
|
static char capture_fname[255];
|
|
|
|
|
|
|
|
static void
|
|
|
|
register_custom_tiff_tags(TIFF *tif)
|
|
|
|
{
|
2020-12-06 15:44:31 +01:00
|
|
|
static const TIFFFieldInfo custom_fields[] = {
|
|
|
|
{ TIFFTAG_FORWARDMATRIX1, -1, -1, TIFF_SRATIONAL, FIELD_CUSTOM, 1, 1,
|
|
|
|
"ForwardMatrix1" },
|
|
|
|
};
|
|
|
|
|
|
|
|
// Add missing dng fields
|
|
|
|
TIFFMergeFieldInfo(tif, custom_fields,
|
|
|
|
sizeof(custom_fields) / sizeof(custom_fields[0]));
|
2020-11-25 14:34:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
find_processor(char *script)
|
|
|
|
{
|
2020-12-06 15:44:31 +01:00
|
|
|
char filename[] = "postprocess.sh";
|
|
|
|
|
2021-04-26 17:57:50 +02:00
|
|
|
// Check postprocess.sh in the current working directory
|
|
|
|
sprintf(script, "./data/%s", filename);
|
2020-12-06 15:44:31 +01:00
|
|
|
if (access(script, F_OK) != -1) {
|
2021-04-18 15:13:56 +02:00
|
|
|
sprintf(script, "./data/%s", filename);
|
2020-12-06 15:44:31 +01:00
|
|
|
printf("Found postprocessor script at %s\n", script);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check for a script in XDG_CONFIG_HOME
|
2021-04-26 17:57:50 +02:00
|
|
|
sprintf(script, "%s/megapixels/%s", g_get_user_config_dir(), filename);
|
2020-12-06 15:44:31 +01:00
|
|
|
if (access(script, F_OK) != -1) {
|
|
|
|
printf("Found postprocessor script at %s\n", script);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check user overridden /etc/megapixels/postprocessor.sh
|
|
|
|
sprintf(script, "%s/megapixels/%s", SYSCONFDIR, filename);
|
|
|
|
if (access(script, F_OK) != -1) {
|
|
|
|
printf("Found postprocessor script at %s\n", script);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check packaged /usr/share/megapixels/postprocessor.sh
|
|
|
|
sprintf(script, "%s/megapixels/%s", DATADIR, filename);
|
|
|
|
if (access(script, F_OK) != -1) {
|
|
|
|
printf("Found postprocessor script at %s\n", script);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2020-11-25 14:34:57 +01:00
|
|
|
}
|
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
static void
|
|
|
|
setup(MPPipeline *pipeline, const void *data)
|
2020-11-25 14:34:57 +01:00
|
|
|
{
|
2020-12-06 15:44:31 +01:00
|
|
|
TIFFSetTagExtender(register_custom_tiff_tags);
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
if (!find_processor(processing_script)) {
|
|
|
|
g_printerr("Could not find any post-process script\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
2020-11-25 14:34:57 +01:00
|
|
|
}
|
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
void
|
|
|
|
mp_process_pipeline_start()
|
2020-11-25 14:34:57 +01:00
|
|
|
{
|
2020-12-06 15:44:31 +01:00
|
|
|
pipeline = mp_pipeline_new();
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
mp_pipeline_invoke(pipeline, setup, NULL, 0);
|
2021-02-19 11:57:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
mp_zbar_pipeline_start();
|
2020-11-25 14:34:57 +01:00
|
|
|
}
|
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
void
|
|
|
|
mp_process_pipeline_stop()
|
2020-11-25 14:34:57 +01:00
|
|
|
{
|
2020-12-06 15:44:31 +01:00
|
|
|
mp_pipeline_free(pipeline);
|
2021-02-19 11:57:44 +01:00
|
|
|
|
|
|
|
mp_zbar_pipeline_stop();
|
2020-11-25 14:34:57 +01:00
|
|
|
}
|
|
|
|
|
2021-04-07 16:16:17 +02:00
|
|
|
void
|
|
|
|
mp_process_pipeline_sync()
|
|
|
|
{
|
|
|
|
mp_pipeline_sync(pipeline);
|
|
|
|
}
|
|
|
|
|
2021-04-09 14:57:14 +02:00
|
|
|
#define NUM_BUFFERS 4
|
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
struct _MPProcessPipelineBuffer {
|
|
|
|
GLuint texture_id;
|
2021-04-09 14:57:14 +02:00
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
_Atomic(int) refcount;
|
|
|
|
};
|
|
|
|
static MPProcessPipelineBuffer output_buffers[NUM_BUFFERS];
|
2021-04-09 14:57:14 +02:00
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
void
|
|
|
|
mp_process_pipeline_buffer_ref(MPProcessPipelineBuffer *buf)
|
2021-04-09 14:57:14 +02:00
|
|
|
{
|
2021-04-15 15:14:20 +02:00
|
|
|
++buf->refcount;
|
2021-04-09 14:57:14 +02:00
|
|
|
}
|
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
void
|
|
|
|
mp_process_pipeline_buffer_unref(MPProcessPipelineBuffer *buf)
|
|
|
|
{
|
|
|
|
--buf->refcount;
|
|
|
|
}
|
2021-04-09 14:57:14 +02:00
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
uint32_t
|
|
|
|
mp_process_pipeline_buffer_get_texture_id(MPProcessPipelineBuffer *buf)
|
2020-11-25 14:34:57 +01:00
|
|
|
{
|
2021-04-15 15:14:20 +02:00
|
|
|
return buf->texture_id;
|
|
|
|
}
|
2021-04-09 14:57:14 +02:00
|
|
|
|
2021-04-18 15:13:56 +02:00
|
|
|
static GLES2Debayer *gles2_debayer = NULL;
|
2021-04-09 14:57:14 +02:00
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
static GdkGLContext *context;
|
2021-04-09 14:57:14 +02:00
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
#define RENDERDOC
|
2020-12-06 15:44:31 +01:00
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
#ifdef RENDERDOC
|
|
|
|
#include <renderdoc/app.h>
|
|
|
|
extern RENDERDOC_API_1_1_2 *rdoc_api;
|
|
|
|
#endif
|
2021-04-09 14:57:14 +02:00
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
static void
|
|
|
|
init_gl(MPPipeline *pipeline, GdkSurface **surface)
|
|
|
|
{
|
|
|
|
GError *error = NULL;
|
|
|
|
context = gdk_surface_create_gl_context(*surface, &error);
|
|
|
|
if (context == NULL) {
|
|
|
|
printf("Failed to initialize OpenGL context: %s\n", error->message);
|
|
|
|
g_clear_error(&error);
|
2021-04-09 14:57:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
gdk_gl_context_set_use_es(context, true);
|
|
|
|
gdk_gl_context_set_required_version(context, 2, 0);
|
2021-04-18 15:13:56 +02:00
|
|
|
gdk_gl_context_set_forward_compatible(context, false);
|
2021-04-15 15:14:20 +02:00
|
|
|
#ifdef DEBUG
|
|
|
|
gdk_gl_context_set_debug_enabled(context, true);
|
|
|
|
#else
|
|
|
|
gdk_gl_context_set_debug_enabled(context, false);
|
|
|
|
#endif
|
2021-04-09 14:57:14 +02:00
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
gdk_gl_context_realize(context, &error);
|
|
|
|
if (error != NULL) {
|
|
|
|
printf("Failed to create OpenGL context: %s\n", error->message);
|
|
|
|
g_clear_object(&context);
|
|
|
|
g_clear_error(&error);
|
2021-04-09 14:57:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
gdk_gl_context_make_current(context);
|
2021-04-09 14:57:14 +02:00
|
|
|
check_gl();
|
|
|
|
|
2021-04-18 15:13:56 +02:00
|
|
|
// Make a VAO for OpenGL
|
|
|
|
if (!gdk_gl_context_get_use_es(context)) {
|
|
|
|
GLuint vao;
|
|
|
|
glGenVertexArrays(1, &vao);
|
|
|
|
glBindVertexArray(vao);
|
|
|
|
check_gl();
|
|
|
|
}
|
2020-12-06 15:44:31 +01:00
|
|
|
|
2021-04-18 15:13:56 +02:00
|
|
|
gles2_debayer = gles2_debayer_new(MP_PIXEL_FMT_BGGR8);
|
|
|
|
check_gl();
|
2021-04-09 14:57:14 +02:00
|
|
|
|
2021-04-18 15:13:56 +02:00
|
|
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
2021-04-09 14:57:14 +02:00
|
|
|
check_gl();
|
|
|
|
|
2021-04-18 15:13:56 +02:00
|
|
|
gles2_debayer_use(gles2_debayer);
|
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
for (size_t i = 0; i < NUM_BUFFERS; ++i) {
|
|
|
|
glGenTextures(1, &output_buffers[i].texture_id);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, output_buffers[i].texture_id);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
|
|
}
|
|
|
|
|
|
|
|
glBindTexture(GL_TEXTURE_2D, 0);
|
|
|
|
|
2021-04-18 15:13:56 +02:00
|
|
|
gboolean is_es = gdk_gl_context_get_use_es(context);
|
|
|
|
int major, minor;
|
|
|
|
gdk_gl_context_get_version(context, &major, &minor);
|
|
|
|
|
|
|
|
printf("Initialized %s %d.%d\n", is_es ? "OpenGL ES" : "OpenGL", major, minor);
|
2021-04-09 14:57:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-04-15 15:14:20 +02:00
|
|
|
mp_process_pipeline_init_gl(GdkSurface *surface)
|
2021-04-09 14:57:14 +02:00
|
|
|
{
|
2021-04-15 15:14:20 +02:00
|
|
|
mp_pipeline_invoke(pipeline, (MPPipelineCallback) init_gl, &surface, sizeof(GdkSurface *));
|
2021-04-09 14:57:14 +02:00
|
|
|
}
|
|
|
|
|
2021-05-01 13:28:02 +02:00
|
|
|
static GdkTexture *
|
2021-04-09 14:57:14 +02:00
|
|
|
process_image_for_preview(const uint8_t *image)
|
|
|
|
{
|
2021-04-26 11:07:59 +02:00
|
|
|
#ifdef PROFILE_DEBAYER
|
2021-04-10 14:39:55 +02:00
|
|
|
clock_t t1 = clock();
|
2021-04-26 11:07:59 +02:00
|
|
|
#endif
|
2021-04-10 14:39:55 +02:00
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
// Pick an available buffer
|
|
|
|
MPProcessPipelineBuffer *output_buffer = NULL;
|
|
|
|
for (size_t i = 0; i < NUM_BUFFERS; ++i) {
|
|
|
|
if (output_buffers[i].refcount == 0) {
|
|
|
|
output_buffer = &output_buffers[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (output_buffer == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
assert(output_buffer != NULL);
|
|
|
|
|
2021-04-09 14:57:14 +02:00
|
|
|
#ifdef RENDERDOC
|
2021-04-15 15:14:20 +02:00
|
|
|
if (rdoc_api) rdoc_api->StartFrameCapture(NULL, NULL);
|
2021-04-09 14:57:14 +02:00
|
|
|
#endif
|
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
// Copy image to a GL texture. TODO: This can be avoided
|
|
|
|
GLuint input_texture;
|
|
|
|
glGenTextures(1, &input_texture);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, input_texture);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, mode.width, mode.height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, image);
|
|
|
|
check_gl();
|
2021-04-09 14:57:14 +02:00
|
|
|
|
2021-04-18 15:13:56 +02:00
|
|
|
gles2_debayer_process(
|
|
|
|
gles2_debayer, output_buffer->texture_id, input_texture);
|
2021-04-15 15:14:20 +02:00
|
|
|
check_gl();
|
|
|
|
|
|
|
|
glFinish();
|
|
|
|
|
2021-04-18 15:13:56 +02:00
|
|
|
glDeleteTextures(1, &input_texture);
|
2021-04-15 15:14:20 +02:00
|
|
|
|
2021-04-26 11:07:59 +02:00
|
|
|
#ifdef PROFILE_DEBAYER
|
2021-04-15 15:14:20 +02:00
|
|
|
clock_t t2 = clock();
|
2021-05-01 15:36:12 +02:00
|
|
|
printf("process_image_for_preview %fms\n", (float)(t2 - t1) / CLOCKS_PER_SEC * 1000);
|
2021-04-26 11:07:59 +02:00
|
|
|
#endif
|
2021-04-15 15:14:20 +02:00
|
|
|
|
2021-04-09 14:57:14 +02:00
|
|
|
#ifdef RENDERDOC
|
2021-04-15 15:14:20 +02:00
|
|
|
if(rdoc_api) rdoc_api->EndFrameCapture(NULL, NULL);
|
2021-04-09 14:57:14 +02:00
|
|
|
#endif
|
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
mp_process_pipeline_buffer_ref(output_buffer);
|
|
|
|
mp_main_set_preview(output_buffer);
|
2020-12-06 15:44:31 +01:00
|
|
|
|
2021-01-06 13:24:05 +01:00
|
|
|
// Create a thumbnail from the preview for the last capture
|
2021-05-01 13:28:02 +02:00
|
|
|
GdkTexture *thumb = NULL;
|
|
|
|
if (captures_remaining == 1) {
|
|
|
|
printf("Making thumbnail\n");
|
2021-04-15 15:14:20 +02:00
|
|
|
|
2021-05-01 13:28:02 +02:00
|
|
|
size_t size = output_buffer_width * output_buffer_height * sizeof(uint32_t);
|
2021-01-06 13:24:05 +01:00
|
|
|
|
2021-05-01 13:28:02 +02:00
|
|
|
uint32_t *data = g_malloc_n(size, 1);
|
|
|
|
|
|
|
|
glReadPixels(0, 0, output_buffer_width, output_buffer_height, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
|
|
|
check_gl();
|
|
|
|
|
|
|
|
// Flip vertically
|
|
|
|
for (size_t y = 0; y < output_buffer_height / 2; ++y) {
|
|
|
|
for (size_t x = 0; x < output_buffer_width; ++x) {
|
|
|
|
uint32_t tmp = data[(output_buffer_height - y - 1) * output_buffer_width + x];
|
|
|
|
data[(output_buffer_height - y - 1) * output_buffer_width + x] = data[y * output_buffer_width + x];
|
|
|
|
data[y * output_buffer_width + x] = tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
thumb = gdk_memory_texture_new(
|
|
|
|
output_buffer_width,
|
|
|
|
output_buffer_height,
|
|
|
|
GDK_MEMORY_R8G8B8A8,
|
|
|
|
g_bytes_new_take(data, size),
|
|
|
|
output_buffer_width * sizeof(uint32_t));
|
|
|
|
}
|
2021-01-06 13:24:05 +01:00
|
|
|
|
|
|
|
return thumb;
|
2020-11-25 14:34:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2021-04-07 16:16:17 +02:00
|
|
|
process_image_for_capture(const uint8_t *image, int count)
|
2020-11-25 14:34:57 +01:00
|
|
|
{
|
2020-12-06 15:44:31 +01:00
|
|
|
time_t rawtime;
|
|
|
|
time(&rawtime);
|
|
|
|
struct tm tim = *(localtime(&rawtime));
|
|
|
|
|
|
|
|
char datetime[20] = { 0 };
|
|
|
|
strftime(datetime, 20, "%Y:%m:%d %H:%M:%S", &tim);
|
|
|
|
|
|
|
|
char fname[255];
|
|
|
|
sprintf(fname, "%s/%d.dng", burst_dir, count);
|
|
|
|
|
|
|
|
TIFF *tif = TIFFOpen(fname, "w");
|
|
|
|
if (!tif) {
|
|
|
|
printf("Could not open tiff\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Define TIFF thumbnail
|
|
|
|
TIFFSetField(tif, TIFFTAG_SUBFILETYPE, 1);
|
2021-04-07 16:16:17 +02:00
|
|
|
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, mode.width >> 4);
|
|
|
|
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, mode.height >> 4);
|
2020-12-06 15:44:31 +01:00
|
|
|
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
|
|
|
|
TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
|
|
|
|
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
|
|
|
TIFFSetField(tif, TIFFTAG_MAKE, mp_get_device_make());
|
|
|
|
TIFFSetField(tif, TIFFTAG_MODEL, mp_get_device_model());
|
|
|
|
uint16_t orientation;
|
2021-05-03 16:06:55 +02:00
|
|
|
if (camera_rotation == 0) {
|
2020-12-06 15:44:31 +01:00
|
|
|
orientation = camera->mirrored ? ORIENTATION_TOPRIGHT :
|
|
|
|
ORIENTATION_TOPLEFT;
|
2021-05-03 16:06:55 +02:00
|
|
|
} else if (camera_rotation == 90) {
|
2020-12-06 15:44:31 +01:00
|
|
|
orientation = camera->mirrored ? ORIENTATION_RIGHTBOT :
|
|
|
|
ORIENTATION_LEFTBOT;
|
2021-05-03 16:06:55 +02:00
|
|
|
} else if (camera_rotation == 180) {
|
2020-12-06 15:44:31 +01:00
|
|
|
orientation = camera->mirrored ? ORIENTATION_BOTLEFT :
|
|
|
|
ORIENTATION_BOTRIGHT;
|
|
|
|
} else {
|
|
|
|
orientation = camera->mirrored ? ORIENTATION_LEFTTOP :
|
|
|
|
ORIENTATION_RIGHTTOP;
|
|
|
|
}
|
|
|
|
TIFFSetField(tif, TIFFTAG_ORIENTATION, orientation);
|
|
|
|
TIFFSetField(tif, TIFFTAG_DATETIME, datetime);
|
|
|
|
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3);
|
|
|
|
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
|
|
|
TIFFSetField(tif, TIFFTAG_SOFTWARE, "Megapixels");
|
|
|
|
long sub_offset = 0;
|
|
|
|
TIFFSetField(tif, TIFFTAG_SUBIFD, 1, &sub_offset);
|
|
|
|
TIFFSetField(tif, TIFFTAG_DNGVERSION, "\001\001\0\0");
|
|
|
|
TIFFSetField(tif, TIFFTAG_DNGBACKWARDVERSION, "\001\0\0\0");
|
|
|
|
char uniquecameramodel[255];
|
|
|
|
sprintf(uniquecameramodel, "%s %s", mp_get_device_make(),
|
|
|
|
mp_get_device_model());
|
|
|
|
TIFFSetField(tif, TIFFTAG_UNIQUECAMERAMODEL, uniquecameramodel);
|
|
|
|
if (camera->colormatrix[0]) {
|
|
|
|
TIFFSetField(tif, TIFFTAG_COLORMATRIX1, 9, camera->colormatrix);
|
|
|
|
} else {
|
|
|
|
TIFFSetField(tif, TIFFTAG_COLORMATRIX1, 9, colormatrix_srgb);
|
|
|
|
}
|
|
|
|
if (camera->forwardmatrix[0]) {
|
|
|
|
TIFFSetField(tif, TIFFTAG_FORWARDMATRIX1, 9, camera->forwardmatrix);
|
|
|
|
}
|
|
|
|
static const float neutral[] = { 1.0, 1.0, 1.0 };
|
|
|
|
TIFFSetField(tif, TIFFTAG_ASSHOTNEUTRAL, 3, neutral);
|
|
|
|
TIFFSetField(tif, TIFFTAG_CALIBRATIONILLUMINANT1, 21);
|
|
|
|
// Write black thumbnail, only windows uses this
|
|
|
|
{
|
|
|
|
unsigned char *buf =
|
2021-06-02 04:37:55 +02:00
|
|
|
(unsigned char *)calloc(1, (mode.width >> 4) * 3);
|
2021-04-07 16:16:17 +02:00
|
|
|
for (int row = 0; row < (mode.height >> 4); row++) {
|
2020-12-06 15:44:31 +01:00
|
|
|
TIFFWriteScanline(tif, buf, row, 0);
|
|
|
|
}
|
|
|
|
free(buf);
|
|
|
|
}
|
|
|
|
TIFFWriteDirectory(tif);
|
|
|
|
|
|
|
|
// Define main photo
|
|
|
|
TIFFSetField(tif, TIFFTAG_SUBFILETYPE, 0);
|
2021-04-07 16:16:17 +02:00
|
|
|
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, mode.width);
|
|
|
|
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, mode.height);
|
2021-06-02 04:41:33 +02:00
|
|
|
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, mp_pixel_format_bits_per_pixel(mode.pixel_format));
|
2020-12-06 15:44:31 +01:00
|
|
|
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_CFA);
|
|
|
|
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
|
|
|
|
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
|
|
|
static const short cfapatterndim[] = { 2, 2 };
|
|
|
|
TIFFSetField(tif, TIFFTAG_CFAREPEATPATTERNDIM, cfapatterndim);
|
2020-12-22 17:13:36 +01:00
|
|
|
#if (TIFFLIB_VERSION < 20201219) && !LIBTIFF_CFA_PATTERN
|
2020-12-06 15:44:31 +01:00
|
|
|
TIFFSetField(tif, TIFFTAG_CFAPATTERN, "\002\001\001\000"); // BGGR
|
2020-12-22 16:05:06 +01:00
|
|
|
#else
|
|
|
|
TIFFSetField(tif, TIFFTAG_CFAPATTERN, 4, "\002\001\001\000"); // BGGR
|
|
|
|
#endif
|
2020-12-22 17:13:36 +01:00
|
|
|
printf("TIFF version %d\n", TIFFLIB_VERSION);
|
2020-12-06 15:44:31 +01:00
|
|
|
if (camera->whitelevel) {
|
|
|
|
TIFFSetField(tif, TIFFTAG_WHITELEVEL, 1, &camera->whitelevel);
|
|
|
|
}
|
|
|
|
if (camera->blacklevel) {
|
2021-06-02 04:39:37 +02:00
|
|
|
const float blacklevel = camera->blacklevel;
|
|
|
|
TIFFSetField(tif, TIFFTAG_BLACKLEVEL, 1, &blacklevel);
|
2020-12-06 15:44:31 +01:00
|
|
|
}
|
|
|
|
TIFFCheckpointDirectory(tif);
|
|
|
|
printf("Writing frame to %s\n", fname);
|
|
|
|
|
2021-04-07 16:16:17 +02:00
|
|
|
for (int row = 0; row < mode.height; row++) {
|
2021-06-02 04:41:33 +02:00
|
|
|
TIFFWriteScanline(tif, (void *) image + (row * mp_pixel_format_width_to_bytes(mode.pixel_format, mode.width)), row, 0);
|
2020-12-06 15:44:31 +01:00
|
|
|
}
|
|
|
|
TIFFWriteDirectory(tif);
|
|
|
|
|
|
|
|
// Add an EXIF block to the tiff
|
|
|
|
TIFFCreateEXIFDirectory(tif);
|
|
|
|
// 1 = manual, 2 = full auto, 3 = aperture priority, 4 = shutter priority
|
|
|
|
if (!exposure_is_manual) {
|
|
|
|
TIFFSetField(tif, EXIFTAG_EXPOSUREPROGRAM, 2);
|
|
|
|
} else {
|
|
|
|
TIFFSetField(tif, EXIFTAG_EXPOSUREPROGRAM, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
TIFFSetField(tif, EXIFTAG_EXPOSURETIME,
|
|
|
|
(mode.frame_interval.numerator /
|
|
|
|
(float)mode.frame_interval.denominator) /
|
2021-04-07 16:16:17 +02:00
|
|
|
((float)mode.height / (float)exposure));
|
2020-12-06 15:44:31 +01:00
|
|
|
uint16_t isospeed[1];
|
|
|
|
isospeed[0] = (uint16_t)remap(gain - 1, 0, gain_max, camera->iso_min,
|
|
|
|
camera->iso_max);
|
|
|
|
TIFFSetField(tif, EXIFTAG_ISOSPEEDRATINGS, 1, isospeed);
|
|
|
|
TIFFSetField(tif, EXIFTAG_FLASH, 0);
|
|
|
|
|
|
|
|
TIFFSetField(tif, EXIFTAG_DATETIMEORIGINAL, datetime);
|
|
|
|
TIFFSetField(tif, EXIFTAG_DATETIMEDIGITIZED, datetime);
|
|
|
|
if (camera->fnumber) {
|
|
|
|
TIFFSetField(tif, EXIFTAG_FNUMBER, camera->fnumber);
|
|
|
|
}
|
|
|
|
if (camera->focallength) {
|
|
|
|
TIFFSetField(tif, EXIFTAG_FOCALLENGTH, camera->focallength);
|
|
|
|
}
|
|
|
|
if (camera->focallength && camera->cropfactor) {
|
|
|
|
TIFFSetField(tif, EXIFTAG_FOCALLENGTHIN35MMFILM,
|
|
|
|
(short)(camera->focallength * camera->cropfactor));
|
|
|
|
}
|
|
|
|
uint64_t exif_offset = 0;
|
|
|
|
TIFFWriteCustomDirectory(tif, &exif_offset);
|
|
|
|
TIFFFreeDirectory(tif);
|
|
|
|
|
|
|
|
// Update exif pointer
|
|
|
|
TIFFSetDirectory(tif, 0);
|
|
|
|
TIFFSetField(tif, TIFFTAG_EXIFIFD, exif_offset);
|
|
|
|
TIFFRewriteDirectory(tif);
|
|
|
|
|
|
|
|
TIFFClose(tif);
|
2020-11-25 14:34:57 +01:00
|
|
|
}
|
|
|
|
|
2021-01-06 09:12:11 +01:00
|
|
|
static void
|
2021-05-01 13:28:02 +02:00
|
|
|
post_process_finished(GSubprocess *proc, GAsyncResult *res, GdkTexture *thumb)
|
2021-01-06 09:12:11 +01:00
|
|
|
{
|
|
|
|
char *stdout;
|
|
|
|
g_subprocess_communicate_utf8_finish(proc, res, &stdout, NULL, NULL);
|
|
|
|
|
|
|
|
// The last line contains the file name
|
|
|
|
int end = strlen(stdout);
|
|
|
|
// Skip the newline at the end
|
|
|
|
stdout[--end] = '\0';
|
|
|
|
|
|
|
|
char *path = path = stdout + end - 1;
|
|
|
|
do {
|
|
|
|
if (*path == '\n') {
|
2021-01-11 16:43:48 +01:00
|
|
|
path++;
|
2021-01-06 09:12:11 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
--path;
|
|
|
|
} while (path > stdout);
|
|
|
|
|
2021-01-06 13:24:05 +01:00
|
|
|
mp_main_capture_completed(thumb, path);
|
2021-01-06 09:12:11 +01:00
|
|
|
}
|
|
|
|
|
2020-11-25 14:34:57 +01:00
|
|
|
static void
|
2021-05-01 13:28:02 +02:00
|
|
|
process_capture_burst(GdkTexture *thumb)
|
2020-11-25 14:34:57 +01:00
|
|
|
{
|
2020-12-06 15:44:31 +01:00
|
|
|
time_t rawtime;
|
|
|
|
time(&rawtime);
|
|
|
|
struct tm tim = *(localtime(&rawtime));
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
char timestamp[30];
|
|
|
|
strftime(timestamp, 30, "%Y%m%d%H%M%S", &tim);
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2021-02-23 20:42:40 +01:00
|
|
|
if (g_get_user_special_dir(G_USER_DIRECTORY_PICTURES) != NULL) {
|
|
|
|
sprintf(capture_fname,
|
|
|
|
"%s/IMG%s",
|
|
|
|
g_get_user_special_dir(G_USER_DIRECTORY_PICTURES),
|
|
|
|
timestamp);
|
|
|
|
} else if (getenv("XDG_PICTURES_DIR") != NULL) {
|
|
|
|
sprintf(capture_fname,
|
|
|
|
"%s/IMG%s",
|
|
|
|
getenv("XDG_PICTURES_DIR"),
|
|
|
|
timestamp);
|
|
|
|
} else {
|
|
|
|
sprintf(capture_fname,
|
|
|
|
"%s/Pictures/IMG%s",
|
|
|
|
getenv("HOME"),
|
|
|
|
timestamp);
|
|
|
|
}
|
|
|
|
|
2021-06-14 00:32:55 +02:00
|
|
|
char save_dng_s[2] = "0";
|
|
|
|
if (save_dng) {
|
|
|
|
save_dng_s[0] = '1';
|
|
|
|
}
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
// Start post-processing the captured burst
|
2021-06-14 00:32:55 +02:00
|
|
|
g_print("Post process %s to %s.ext (save-dng %s)\n", burst_dir, capture_fname, save_dng_s);
|
2021-01-06 09:12:11 +01:00
|
|
|
GError *error = NULL;
|
|
|
|
GSubprocess *proc = g_subprocess_new(
|
|
|
|
G_SUBPROCESS_FLAGS_STDOUT_PIPE,
|
|
|
|
&error,
|
|
|
|
processing_script,
|
|
|
|
burst_dir,
|
|
|
|
capture_fname,
|
2021-06-14 00:32:55 +02:00
|
|
|
save_dng_s,
|
2021-01-06 09:12:11 +01:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (!proc) {
|
|
|
|
g_printerr("Failed to spawn postprocess process: %s\n",
|
|
|
|
error->message);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_subprocess_communicate_utf8_async(
|
|
|
|
proc,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
(GAsyncReadyCallback)post_process_finished,
|
2021-01-06 13:24:05 +01:00
|
|
|
thumb);
|
2020-11-25 14:34:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2021-04-07 16:16:17 +02:00
|
|
|
process_image(MPPipeline *pipeline, const MPBuffer *buffer)
|
2020-11-25 14:34:57 +01:00
|
|
|
{
|
2021-05-01 15:36:12 +02:00
|
|
|
#ifdef PROFILE_PROCESS
|
|
|
|
clock_t t1 = clock();
|
|
|
|
#endif
|
|
|
|
|
2021-04-07 16:16:17 +02:00
|
|
|
size_t size =
|
|
|
|
mp_pixel_format_width_to_bytes(mode.pixel_format, mode.width) *
|
|
|
|
mode.height;
|
|
|
|
uint8_t *image = malloc(size);
|
|
|
|
memcpy(image, buffer->data, size);
|
|
|
|
mp_io_pipeline_release_buffer(buffer->index);
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2021-05-03 16:06:55 +02:00
|
|
|
MPZBarImage *zbar_image = mp_zbar_image_new(image, mode.pixel_format, mode.width, mode.height, camera_rotation, camera->mirrored);
|
2021-04-26 10:09:04 +02:00
|
|
|
mp_zbar_pipeline_process_image(mp_zbar_image_ref(zbar_image));
|
|
|
|
|
2021-05-01 15:36:12 +02:00
|
|
|
#ifdef PROFILE_PROCESS
|
|
|
|
clock_t t2 = clock();
|
|
|
|
#endif
|
|
|
|
|
2021-05-01 13:28:02 +02:00
|
|
|
GdkTexture *thumb = process_image_for_preview(image);
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
if (captures_remaining > 0) {
|
|
|
|
int count = burst_length - captures_remaining;
|
|
|
|
--captures_remaining;
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
process_image_for_capture(image, count);
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
if (captures_remaining == 0) {
|
2021-01-06 13:24:05 +01:00
|
|
|
assert(thumb);
|
|
|
|
process_capture_burst(thumb);
|
|
|
|
} else {
|
|
|
|
assert(!thumb);
|
2020-12-06 15:44:31 +01:00
|
|
|
}
|
2021-01-06 13:24:05 +01:00
|
|
|
} else {
|
|
|
|
assert(!thumb);
|
2020-12-06 15:44:31 +01:00
|
|
|
}
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2021-04-26 10:09:04 +02:00
|
|
|
mp_zbar_image_unref(zbar_image);
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
++frames_processed;
|
|
|
|
if (captures_remaining == 0) {
|
|
|
|
is_capturing = false;
|
|
|
|
}
|
2021-05-01 15:36:12 +02:00
|
|
|
|
|
|
|
#ifdef PROFILE_PROCESS
|
|
|
|
clock_t t3 = clock();
|
|
|
|
printf("process_image %fms, step 1:%fms, step 2:%fms\n",
|
|
|
|
(float)(t3 - t1) / CLOCKS_PER_SEC * 1000,
|
|
|
|
(float)(t2 - t1) / CLOCKS_PER_SEC * 1000,
|
|
|
|
(float)(t3 - t2) / CLOCKS_PER_SEC * 1000);
|
|
|
|
#endif
|
2020-11-25 14:34:57 +01:00
|
|
|
}
|
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
void
|
2021-04-07 16:16:17 +02:00
|
|
|
mp_process_pipeline_process_image(MPBuffer buffer)
|
2020-11-25 14:34:57 +01:00
|
|
|
{
|
2020-12-06 15:44:31 +01:00
|
|
|
// If we haven't processed the previous frame yet, drop this one
|
|
|
|
if (frames_received != frames_processed && !is_capturing) {
|
2021-04-07 16:16:17 +02:00
|
|
|
mp_io_pipeline_release_buffer(buffer.index);
|
2020-12-06 15:44:31 +01:00
|
|
|
return;
|
|
|
|
}
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
++frames_received;
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2021-04-07 16:16:17 +02:00
|
|
|
mp_pipeline_invoke(pipeline, (MPPipelineCallback)process_image, &buffer,
|
|
|
|
sizeof(MPBuffer));
|
2020-11-25 14:34:57 +01:00
|
|
|
}
|
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
static void
|
|
|
|
capture()
|
2020-11-25 14:34:57 +01:00
|
|
|
{
|
2020-12-06 15:44:31 +01:00
|
|
|
char template[] = "/tmp/megapixels.XXXXXX";
|
|
|
|
char *tempdir;
|
|
|
|
tempdir = mkdtemp(template);
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
if (tempdir == NULL) {
|
|
|
|
g_printerr("Could not make capture directory %s\n", template);
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
strcpy(burst_dir, tempdir);
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
captures_remaining = burst_length;
|
2020-11-25 14:34:57 +01:00
|
|
|
}
|
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
void
|
|
|
|
mp_process_pipeline_capture()
|
2020-11-25 14:34:57 +01:00
|
|
|
{
|
2020-12-06 15:44:31 +01:00
|
|
|
is_capturing = true;
|
2020-11-25 14:34:57 +01:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
mp_pipeline_invoke(pipeline, capture, NULL, 0);
|
2020-11-25 14:34:57 +01:00
|
|
|
}
|
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
static void
|
2021-04-18 15:13:56 +02:00
|
|
|
on_output_changed()
|
2021-04-15 15:14:20 +02:00
|
|
|
{
|
2021-04-19 16:04:53 +02:00
|
|
|
output_buffer_width = mode.width / 2;
|
|
|
|
output_buffer_height = mode.height / 2;
|
2021-04-15 15:14:20 +02:00
|
|
|
|
|
|
|
if (camera->rotate != 0 || camera->rotate != 180) {
|
|
|
|
int tmp = output_buffer_width;
|
|
|
|
output_buffer_width = output_buffer_height;
|
|
|
|
output_buffer_height = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < NUM_BUFFERS; ++i) {
|
|
|
|
glBindTexture(GL_TEXTURE_2D, output_buffers[i].texture_id);
|
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, output_buffer_width, output_buffer_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
glBindTexture(GL_TEXTURE_2D, 0);
|
2021-04-18 15:13:56 +02:00
|
|
|
|
|
|
|
gles2_debayer_configure(
|
|
|
|
gles2_debayer,
|
|
|
|
output_buffer_width, output_buffer_height,
|
|
|
|
mode.width, mode.height,
|
|
|
|
camera->rotate, camera->mirrored,
|
|
|
|
camera->previewmatrix[0] == 0 ? NULL : camera->previewmatrix,
|
|
|
|
camera->blacklevel);
|
2021-04-15 15:14:20 +02:00
|
|
|
}
|
|
|
|
|
2021-05-03 16:06:55 +02:00
|
|
|
static int
|
|
|
|
mod(int a, int b)
|
|
|
|
{
|
|
|
|
int r = a % b;
|
|
|
|
return r < 0 ? r + b : r;
|
|
|
|
}
|
|
|
|
|
2020-11-25 14:34:57 +01:00
|
|
|
static void
|
|
|
|
update_state(MPPipeline *pipeline, const struct mp_process_pipeline_state *state)
|
|
|
|
{
|
2021-05-03 16:06:55 +02:00
|
|
|
const bool output_changed =
|
|
|
|
!mp_camera_mode_is_equivalent(&mode, &state->mode)
|
|
|
|
|| preview_width != state->preview_width
|
|
|
|
|| preview_height != state->preview_height
|
|
|
|
|| device_rotation != state->device_rotation;
|
2021-04-15 15:14:20 +02:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
camera = state->camera;
|
|
|
|
mode = state->mode;
|
|
|
|
|
|
|
|
preview_width = state->preview_width;
|
|
|
|
preview_height = state->preview_height;
|
|
|
|
|
2021-05-03 16:06:55 +02:00
|
|
|
device_rotation = state->device_rotation;
|
|
|
|
|
2021-04-15 15:14:20 +02:00
|
|
|
burst_length = state->burst_length;
|
2021-06-14 00:32:55 +02:00
|
|
|
save_dng = state->save_dng;
|
2021-04-15 15:14:20 +02:00
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
// gain_is_manual = state->gain_is_manual;
|
|
|
|
gain = state->gain;
|
|
|
|
gain_max = state->gain_max;
|
|
|
|
|
|
|
|
exposure_is_manual = state->exposure_is_manual;
|
|
|
|
exposure = state->exposure;
|
|
|
|
|
2021-04-18 15:13:56 +02:00
|
|
|
if (output_changed) {
|
2021-05-03 16:06:55 +02:00
|
|
|
camera_rotation = mod(camera->rotate - device_rotation, 360);
|
|
|
|
|
2021-04-18 15:13:56 +02:00
|
|
|
on_output_changed();
|
2021-04-15 15:14:20 +02:00
|
|
|
}
|
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
struct mp_main_state main_state = {
|
|
|
|
.camera = camera,
|
|
|
|
.mode = mode,
|
2021-04-19 16:04:53 +02:00
|
|
|
.image_width = output_buffer_width,
|
|
|
|
.image_height = output_buffer_height,
|
2020-12-06 15:44:31 +01:00
|
|
|
.gain_is_manual = state->gain_is_manual,
|
|
|
|
.gain = gain,
|
|
|
|
.gain_max = gain_max,
|
|
|
|
.exposure_is_manual = exposure_is_manual,
|
|
|
|
.exposure = exposure,
|
|
|
|
.has_auto_focus_continuous = state->has_auto_focus_continuous,
|
|
|
|
.has_auto_focus_start = state->has_auto_focus_start,
|
|
|
|
};
|
|
|
|
mp_main_update_state(&main_state);
|
2020-11-25 14:34:57 +01:00
|
|
|
}
|
|
|
|
|
2020-12-06 15:44:31 +01:00
|
|
|
void
|
|
|
|
mp_process_pipeline_update_state(const struct mp_process_pipeline_state *new_state)
|
2020-11-25 14:34:57 +01:00
|
|
|
{
|
2020-12-06 15:44:31 +01:00
|
|
|
mp_pipeline_invoke(pipeline, (MPPipelineCallback)update_state, new_state,
|
|
|
|
sizeof(struct mp_process_pipeline_state));
|
2020-11-25 14:34:57 +01:00
|
|
|
}
|
2021-04-15 15:14:20 +02:00
|
|
|
|
2021-05-01 15:36:12 +02:00
|
|
|
// GTK4 seems to require this
|
2021-04-15 15:14:20 +02:00
|
|
|
void pango_fc_font_get_languages() {}
|