From b3e2ad498af400c6ecdafc5e553bb330ddfb15d7 Mon Sep 17 00:00:00 2001 From: Adrien De Coninck Date: Tue, 5 Nov 2024 18:04:44 +0100 Subject: [PATCH] tsdemux: use JXS_video_descriptor "frat" to set caps "framerate" Part-of: --- subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c b/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c index 253cc7ec55..5c583516cb 100644 --- a/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c +++ b/subprojects/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c @@ -1862,10 +1862,15 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, gst_caps_from_string ("image/x-jxsc, alignment=(string)frame, interlace-mode=(string)progressive"); - /* interlace-mode, sampling, depth */ + /* interlace-mode, sampling, depth, framerate */ + 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, - "height", G_TYPE_INT, jpegxs.vertical_size, "depth", G_TYPE_INT, - ((jpegxs.schar >> 4) & 0xf) + 1, NULL); + "height", G_TYPE_INT, jpegxs.vertical_size, + "depth", G_TYPE_INT, depth, + "framerate", GST_TYPE_FRACTION, framerate_num, framerate_den, NULL); + switch (jpegxs.schar & 0xf) { case 0: gst_caps_set_simple (caps, "sampling", G_TYPE_STRING, "YCbCr-4:2:2",