2020-04-10 07:42:14 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2024-05-30 13:00:28 +00:00
|
|
|
// picture (more precisely media) related strutures and functions
|
2020-04-10 07:42:14 +00:00
|
|
|
#ifndef PICTURE_H
|
|
|
|
#define PICTURE_H
|
|
|
|
|
|
|
|
#include "units.h"
|
2024-05-30 13:00:28 +00:00
|
|
|
#include <optional>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2020-04-10 07:42:14 +00:00
|
|
|
|
2020-04-19 15:01:58 +00:00
|
|
|
struct dive;
|
|
|
|
|
2020-04-10 07:42:14 +00:00
|
|
|
struct picture {
|
2024-05-30 13:00:28 +00:00
|
|
|
std::string filename;
|
2024-05-04 17:15:47 +00:00
|
|
|
offset_t offset;
|
|
|
|
location_t location;
|
2024-05-30 13:00:28 +00:00
|
|
|
bool operator<(const picture &) const;
|
2020-04-10 07:42:14 +00:00
|
|
|
};
|
|
|
|
|
2020-04-11 15:41:56 +00:00
|
|
|
/* Table of pictures. Attention: this stores pictures,
|
2024-05-30 13:00:28 +00:00
|
|
|
* *not* pointers to pictures. This means that
|
|
|
|
* pointers to pictures are not stable. They are
|
|
|
|
* invalidated if the table is reallocated.
|
|
|
|
*/
|
|
|
|
using picture_table = std::vector<picture>;
|
2020-04-11 15:41:56 +00:00
|
|
|
|
|
|
|
/* picture table functions */
|
2024-05-30 13:00:28 +00:00
|
|
|
extern void add_to_picture_table(picture_table &, int idx, struct picture pic);
|
|
|
|
extern void add_picture(picture_table &, struct picture newpic);
|
|
|
|
extern int get_picture_idx(const picture_table &, const std::string &filename); /* Return -1 if not found */
|
2020-04-10 07:42:14 +00:00
|
|
|
|
2024-05-30 13:00:28 +00:00
|
|
|
extern std::pair<std::optional<picture>, dive *> create_picture(const std::string &filename, timestamp_t shift_time, bool match_all);
|
2024-01-15 20:39:14 +00:00
|
|
|
extern bool picture_check_valid_time(timestamp_t timestamp, timestamp_t shift_time);
|
2020-04-19 15:01:58 +00:00
|
|
|
|
2020-04-10 07:42:14 +00:00
|
|
|
#endif // PICTURE_H
|