jpegparse: Rewrite element.
Now it uses the JPEG parser in libgstcodecparsers, while the whole code is simplified by relying more in baseparser class for tag handling. The element now signals chroma-format and default framerate is 0/1, which is for still-images. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1473>
This commit is contained in:
parent
fa2b697389
commit
5542dd395d
subprojects/gst-plugins-bad
docs/plugins
gst/jpegformat
tests/check/elements
@ -29620,7 +29620,7 @@
|
|||||||
"rank": "secondary"
|
"rank": "secondary"
|
||||||
},
|
},
|
||||||
"jpegparse": {
|
"jpegparse": {
|
||||||
"author": "Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>",
|
"author": "Víctor Jáquez <vjaquez@igalia.com>",
|
||||||
"description": "Parse JPEG images into single-frame buffers",
|
"description": "Parse JPEG images into single-frame buffers",
|
||||||
"hierarchy": [
|
"hierarchy": [
|
||||||
"GstJpegParse",
|
"GstJpegParse",
|
||||||
@ -29630,7 +29630,7 @@
|
|||||||
"GInitiallyUnowned",
|
"GInitiallyUnowned",
|
||||||
"GObject"
|
"GObject"
|
||||||
],
|
],
|
||||||
"klass": "Video/Parser",
|
"klass": "Codec/Parser/Image",
|
||||||
"long-name": "JPEG stream parser",
|
"long-name": "JPEG stream parser",
|
||||||
"pad-templates": {
|
"pad-templates": {
|
||||||
"sink": {
|
"sink": {
|
||||||
@ -29639,7 +29639,7 @@
|
|||||||
"presence": "always"
|
"presence": "always"
|
||||||
},
|
},
|
||||||
"src": {
|
"src": {
|
||||||
"caps": "image/jpeg:\n format: { I420, Y41B, UYVY, YV12 }\n width: [ 0, 2147483647 ]\n height: [ 0, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n parsed: true\n",
|
"caps": "image/jpeg:\n framerate: [ 0/1, 2147483647/1 ]\n parsed: true\n",
|
||||||
"direction": "src",
|
"direction": "src",
|
||||||
"presence": "always"
|
"presence": "always"
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,7 @@
|
|||||||
* jpegparse: a parser for JPEG streams
|
* jpegparse: a parser for JPEG streams
|
||||||
*
|
*
|
||||||
* Copyright (C) <2009> Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
|
* Copyright (C) <2009> Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
|
||||||
|
* <2022> Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -47,30 +48,22 @@ struct _GstJpegParse {
|
|||||||
GstBaseParse parse;
|
GstBaseParse parse;
|
||||||
|
|
||||||
guint last_offset;
|
guint last_offset;
|
||||||
guint last_entropy_len;
|
gint state;
|
||||||
gboolean last_resync;
|
|
||||||
|
|
||||||
/* negotiated state */
|
gint8 sof;
|
||||||
gint caps_width, caps_height;
|
gint8 adobe_transform;
|
||||||
gint caps_framerate_numerator;
|
|
||||||
gint caps_framerate_denominator;
|
|
||||||
|
|
||||||
/* the parsed frame size */
|
/* the parsed frame size */
|
||||||
guint16 width, height;
|
guint16 width, height;
|
||||||
|
|
||||||
/* format color space */
|
/* format color space */
|
||||||
const gchar *format;
|
guint colorspace;
|
||||||
|
guint sampling;
|
||||||
|
guint16 x_density;
|
||||||
|
guint16 y_density;
|
||||||
|
GstCaps *prev_caps;
|
||||||
|
|
||||||
/* TRUE if the src caps sets a specific framerate */
|
/* fps */
|
||||||
gboolean has_fps;
|
|
||||||
|
|
||||||
/* the (expected) timestamp of the next frame */
|
|
||||||
guint64 next_ts;
|
|
||||||
|
|
||||||
/* duration of the current frame */
|
|
||||||
guint64 duration;
|
|
||||||
|
|
||||||
/* video state */
|
|
||||||
gint framerate_numerator;
|
gint framerate_numerator;
|
||||||
gint framerate_denominator;
|
gint framerate_denominator;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ gstjpegformat = library('gstjpegformat',
|
|||||||
jpegf_sources,
|
jpegf_sources,
|
||||||
c_args : gst_plugins_bad_args + [ '-DGST_USE_UNSTABLE_API' ],
|
c_args : gst_plugins_bad_args + [ '-DGST_USE_UNSTABLE_API' ],
|
||||||
include_directories : [configinc],
|
include_directories : [configinc],
|
||||||
dependencies : [gstbase_dep, gstcodecparsers_dep, gsttag_dep],
|
dependencies : [gstbase_dep, gstcodecparsers_dep, gstvideo_dep, gsttag_dep],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : plugins_install_dir,
|
install_dir : plugins_install_dir,
|
||||||
)
|
)
|
||||||
|
@ -192,7 +192,7 @@ GST_START_TEST (test_parse_single_byte)
|
|||||||
caps_in = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, FALSE,
|
caps_in = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
caps_out = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
|
caps_out = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
|
||||||
"framerate", GST_TYPE_FRACTION, 1, 1, NULL);
|
"framerate", GST_TYPE_FRACTION, 0, 1, NULL);
|
||||||
|
|
||||||
/* Push the data byte by byte, injecting some garbage. */
|
/* Push the data byte by byte, injecting some garbage. */
|
||||||
buffer_in = make_buffers_in (buffer_in, test_data_garbage);
|
buffer_in = make_buffers_in (buffer_in, test_data_garbage);
|
||||||
@ -262,7 +262,7 @@ GST_START_TEST (test_parse_all_in_one_buf)
|
|||||||
buffer_in = g_list_append (buffer_in, buffer);
|
buffer_in = g_list_append (buffer_in, buffer);
|
||||||
|
|
||||||
caps_out = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
|
caps_out = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
|
||||||
"framerate", GST_TYPE_FRACTION, 1, 1, NULL);
|
"framerate", GST_TYPE_FRACTION, 0, 1, NULL);
|
||||||
buffer_out = make_buffers_out (buffer_out, test_data_short_frame);
|
buffer_out = make_buffers_out (buffer_out, test_data_short_frame);
|
||||||
buffer_out = make_buffers_out (buffer_out, test_data_normal_frame);
|
buffer_out = make_buffers_out (buffer_out, test_data_normal_frame);
|
||||||
buffer_out = make_buffers_out (buffer_out, test_data_entropy);
|
buffer_out = make_buffers_out (buffer_out, test_data_entropy);
|
||||||
@ -326,8 +326,9 @@ GST_START_TEST (test_parse_app1_exif)
|
|||||||
G_TYPE_BOOLEAN, FALSE, NULL);
|
G_TYPE_BOOLEAN, FALSE, NULL);
|
||||||
|
|
||||||
caps_out = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
|
caps_out = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
|
||||||
"framerate", GST_TYPE_FRACTION, 1, 1, "format", G_TYPE_STRING,
|
"framerate", GST_TYPE_FRACTION, 0, 1, "width", G_TYPE_INT, 80, "height",
|
||||||
"I420", "width", G_TYPE_INT, 80, "height", G_TYPE_INT, 60, NULL);
|
G_TYPE_INT, 60, "sof-marker", G_TYPE_INT, 0, "colorspace", G_TYPE_STRING,
|
||||||
|
"sYUV", "sampling", G_TYPE_STRING, "YCbCr-4:2:0", NULL);
|
||||||
|
|
||||||
buffer_in = make_my_input_buffer (test_data_app1_exif,
|
buffer_in = make_my_input_buffer (test_data_app1_exif,
|
||||||
sizeof (test_data_app1_exif));
|
sizeof (test_data_app1_exif));
|
||||||
@ -351,8 +352,9 @@ GST_START_TEST (test_parse_comment)
|
|||||||
G_TYPE_BOOLEAN, FALSE, NULL);
|
G_TYPE_BOOLEAN, FALSE, NULL);
|
||||||
|
|
||||||
caps_out = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
|
caps_out = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
|
||||||
"framerate", GST_TYPE_FRACTION, 1, 1, "format", G_TYPE_STRING,
|
"framerate", GST_TYPE_FRACTION, 0, 1, "width", G_TYPE_INT, 80, "height",
|
||||||
"I420", "width", G_TYPE_INT, 80, "height", G_TYPE_INT, 60, NULL);
|
G_TYPE_INT, 60, "sof-marker", G_TYPE_INT, 0, "colorspace", G_TYPE_STRING,
|
||||||
|
"sYUV", "sampling", G_TYPE_STRING, "YCbCr-4:2:0", NULL);
|
||||||
|
|
||||||
buffer_in = make_my_input_buffer (test_data_comment,
|
buffer_in = make_my_input_buffer (test_data_comment,
|
||||||
sizeof (test_data_comment));
|
sizeof (test_data_comment));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user