From 9aab2ddd1305dc21a796483b7a46690265af6b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 26 Dec 2024 01:33:37 +0100 Subject: [PATCH] tsdemux: fix JPEG XS framerate handling for 29.97fps .. and other framerate values with a 1.001 denominator. The coded framerate denominator value is a code that maps to either 1 (for 1) or 1.001 (for 2) not a direct value. Before, 29.97fps would be announced as 15fps because it would calculate 30/2 instead of 30/1.001. Part-of: --- subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c b/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c index 595510118c..df1e6a54bd 100644 --- a/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c +++ b/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c @@ -1894,6 +1894,17 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, if (jpegxs.frat != 0) { gint framerate_num = (jpegxs.frat & 0x0000FFFFU); gint framerate_den = ((jpegxs.frat >> 24) & 0x0000003FU); + if (framerate_den == 1) { + // framerate_den = 1; + } else if (framerate_den == 2) { + framerate_num *= 1000; + framerate_den = 1001; + } else { // Reserved value + GST_WARNING_OBJECT (demux, + "Unknown JPEG XS framerate denominator code %u", framerate_den); + break; + } + gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, framerate_num, framerate_den, NULL); }