fps -> fpsi, store frame meta

This commit is contained in:
Maxim Devaev
2024-03-30 15:35:14 +02:00
parent 580ca68291
commit 14e9d9f7af
8 changed files with 129 additions and 117 deletions

51
src/libs/fpsi.h Normal file
View File

@@ -0,0 +1,51 @@
/*****************************************************************************
# #
# uStreamer - Lightweight and fast MJPEG-HTTP streamer. #
# #
# Copyright (C) 2018-2024 Maxim Devaev <mdevaev@gmail.com> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
# #
*****************************************************************************/
#pragma once
#include <pthread.h>
#include "types.h"
#include "frame.h"
typedef struct {
US_FRAME_META_DECLARE;
} us_fpsi_meta_s;
typedef struct {
char *name;
bool with_meta;
uint accum;
ldf ts;
uint current;
us_fpsi_meta_s meta;
pthread_mutex_t mutex;
} us_fpsi_s;
us_fpsi_s *us_fpsi_init(const char *name, bool with_meta);
void us_fpsi_destroy(us_fpsi_s *fpsi);
void us_fpsi_bump(us_fpsi_s *fpsi, const us_frame_s *frame);
void us_fpsi_reset(us_fpsi_s *fpsi, const us_frame_s *meta);
uint us_fpsi_get(us_fpsi_s *fpsi, us_fpsi_meta_s *meta);