mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 00:58:12 +00:00
tsdemux: handle interlaced JPEG XS
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8219>
This commit is contained in:
parent
570c086254
commit
23ffffe57b
1 changed files with 39 additions and 7 deletions
|
@ -1873,24 +1873,56 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream,
|
|||
GST_WARNING_OBJECT (demux, "Invalid JPEG XS descriptor");
|
||||
break;
|
||||
}
|
||||
if (jpegxs.frat >> 30) {
|
||||
GST_WARNING_OBJECT (demux, "Interlaced JPEG-XS not supported yet");
|
||||
|
||||
guint8 interlace_mode = (jpegxs.frat >> 30) & 0x3;
|
||||
|
||||
if (interlace_mode == 3) { // Reserved
|
||||
GST_WARNING_OBJECT (demux, "Unknown JPEG XS interlace mode 3");
|
||||
break;
|
||||
}
|
||||
|
||||
const gchar *field_order_str;
|
||||
guint n_fields;
|
||||
|
||||
switch (interlace_mode) {
|
||||
case 1:
|
||||
field_order_str = "top-field-first";
|
||||
n_fields = 2;
|
||||
break;
|
||||
case 2:
|
||||
field_order_str = "bottom-field-first";
|
||||
n_fields = 2;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
/* fall through */
|
||||
case 0:
|
||||
field_order_str = NULL;
|
||||
n_fields = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((jpegxs.schar >> 15) == 0) {
|
||||
GST_WARNING_OBJECT (demux, "JPEG-XS sampling properties are required");
|
||||
break;
|
||||
}
|
||||
is_video = TRUE;
|
||||
caps =
|
||||
gst_caps_from_string
|
||||
("image/x-jxsc, alignment=(string)frame, interlace-mode=(string)progressive");
|
||||
|
||||
caps = gst_caps_from_string ("image/x-jxsc, alignment=(string)frame");
|
||||
/* interlace-mode, sampling, depth, framerate */
|
||||
gint depth = ((jpegxs.schar >> 4) & 0xf) + 1;
|
||||
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 * n_fields,
|
||||
"depth", G_TYPE_INT, depth, NULL);
|
||||
|
||||
if (field_order_str) {
|
||||
gst_caps_set_simple (caps,
|
||||
"interlace-mode", G_TYPE_STRING, "fields",
|
||||
"field-order", G_TYPE_STRING, field_order_str, NULL);
|
||||
} else {
|
||||
gst_caps_set_simple (caps,
|
||||
"interlace-mode", G_TYPE_STRING, "progressive", NULL);
|
||||
}
|
||||
|
||||
if (jpegxs.frat != 0) {
|
||||
gint framerate_num = (jpegxs.frat & 0x0000FFFFU);
|
||||
gint framerate_den = ((jpegxs.frat >> 24) & 0x0000003FU);
|
||||
|
|
Loading…
Reference in a new issue