gstreamer/subprojects/gst-plugins-bad/sys/applemedia/helpers.h
Nirbheek Chauhan a8ed817d30 avfvideosrc: Use frame duration instead of frame rate
These days you're can use minFrameDuration and maxFrameDuration which
are CMTime with fractional values. That way we don't need to convert
between double and fractions in a really weird way.

This fixes really odd fractional values exposed in caps, like:

2000000/76923, 1000000/37037, 5000000/178571, 10000000/344827, 10000000/333333

Which are actually just 26/1, 27/1, 28/1, 29/1, 30/1

We can also delete a lot of outdated code for iOS versions older than
7.0 by using newer APIs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4134>
2023-03-14 00:00:24 +00:00

37 lines
1.3 KiB
C

/*
* Copyright (C) 2023 Nirbheek Chauhan <nirbheek@centricular.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _APPLEMEDIA_HELPERS_H_
#define _APPLEMEDIA_HELPERS_H_
#include <gst/video/video.h>
G_BEGIN_DECLS
#define GST_CVPIXELFORMAT_FOURCC_ARGS(fourcc) \
__GST_PRINT_CHAR(((fourcc) >> 24) & 0xff), \
__GST_PRINT_CHAR(((fourcc) >> 16) & 0xff), \
__GST_PRINT_CHAR(((fourcc) >> 8) & 0xff), \
__GST_PRINT_CHAR((fourcc) & 0xff)
GstVideoFormat gst_video_format_from_cvpixelformat (int fmt);
int gst_video_format_to_cvpixelformat (GstVideoFormat fmt);
G_END_DECLS
#endif /* _APPLEMEDIA_HELPERS_H_ */