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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8226>
This commit is contained in:
Tim-Philipp Müller 2024-12-26 01:33:37 +01:00
parent faa4d572c4
commit 9aab2ddd13

View file

@ -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);
}