summaryrefslogtreecommitdiff
path: root/src/gstreamer/gstlibcamerapool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gstreamer/gstlibcamerapool.cpp')
0 files changed, 0 insertions, 0 deletions
a> 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2020, Google Inc.
 *
 * exif.h - EXIF tag creator using libexif
 */

#pragma once

#include <chrono>
#include <string>
#include <time.h>
#include <vector>

#include <libexif/exif-data.h>

#include <libcamera/base/span.h>

#include <libcamera/geometry.h>

class Exif
{
public:
	Exif();
	~Exif();

	enum Compression {
		None = 1,
		JPEG = 6,
	};

	enum Flash {
		/* bit 0 */
		Fired = 0x01,
		/* bits 1 and 2 */
		StrobeDetected = 0x04,
		StrobeNotDetected = 0x06,
		/* bits 3 and 4 */
		ModeCompulsoryFiring = 0x08,
		ModeCompulsorySuppression = 0x10,
		ModeAuto = 0x18,
		/* bit 5 */
		FlashNotPresent = 0x20,
		/* bit 6 */
		RedEye = 0x40,
	};

	enum WhiteBalance {
		Auto = 0,
		Manual = 1,
	};

	enum StringEncoding {
		NoEncoding = 0,
		ASCII = 1,
		Unicode = 2,
	};

	void setMake(const std::string &make);
	void setModel(const std::string &model);

	void setOrientation(int orientation);
	void setSize(const libcamera::Size &size);
	void setThumbnail(std::vector<unsigned char> &&thumbnail,
			  Compression compression);
	void setTimestamp(time_t timestamp, std::chrono::milliseconds msec);

	void setGPSDateTimestamp(time_t timestamp);
	void setGPSLocation(const double *coords);
	void setGPSMethod(const std::string &method);

	void setFocalLength(float length);
	void setExposureTime(uint64_t nsec);
	void setAperture(float size);
	void setISO(uint16_t iso);
	void setFlash(Flash flash);
	void setWhiteBalance(WhiteBalance wb);

	libcamera::Span<const uint8_t> data() const { return { exifData_, size_ }; }
	[[nodiscard]] int generate();

private: