tsdemux: validate frat before setting framerate in caps

From JPEG-XS part3 : "If the frame rate is unknown, the frat parameter is 0."

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7836>
This commit is contained in:
Adrien De Coninck 2024-11-06 12:05:25 +01:00 committed by GStreamer Marge Bot
parent b3e2ad498a
commit abd9fc5635

View file

@ -1864,12 +1864,15 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream,
/* interlace-mode, sampling, depth, framerate */ /* interlace-mode, sampling, depth, framerate */
gint depth = ((jpegxs.schar >> 4) & 0xf) + 1; gint depth = ((jpegxs.schar >> 4) & 0xf) + 1;
gint framerate_num = (jpegxs.frat & 0x0000FFFFU);
gint framerate_den = ((jpegxs.frat >> 24) & 0x0000003FU);
gst_caps_set_simple (caps, "width", G_TYPE_INT, jpegxs.horizontal_size, gst_caps_set_simple (caps, "width", G_TYPE_INT, jpegxs.horizontal_size,
"height", G_TYPE_INT, jpegxs.vertical_size, "height", G_TYPE_INT, jpegxs.vertical_size,
"depth", G_TYPE_INT, depth, "depth", G_TYPE_INT, depth, NULL);
"framerate", GST_TYPE_FRACTION, framerate_num, framerate_den, NULL); if (jpegxs.frat != 0) {
gint framerate_num = (jpegxs.frat & 0x0000FFFFU);
gint framerate_den = ((jpegxs.frat >> 24) & 0x0000003FU);
gst_caps_set_simple (caps,
"framerate", GST_TYPE_FRACTION, framerate_num, framerate_den, NULL);
}
switch (jpegxs.schar & 0xf) { switch (jpegxs.schar & 0xf) {
case 0: case 0: