| 1 |
|
| 2 |
> |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
#ifdef HAVE_CONFIG_H |
| 26 |
#include "config.h" |
| 27 |
#endif |
| 28 |
|
| 29 |
#include "gstsvtjpegxsenc.h" |
| 30 |
|
| 31 |
GST_DEBUG_CATEGORY_STATIC (svtjpegxsenc_debug); |
| 32 |
#define GST_CAT_DEFAULT svtjpegxsenc_debug |
| 33 |
|
| 34 |
static const uint8_t BLOCKING = 1; |
| 35 |
|
| 36 |
#define GST_SVT_JPEG_XS_ENC_TYPE_QUANT_MODE (gst_svt_jpeg_xs_enc_quant_mode_get_type()) |
| 37 |
static GType |
| 38 |
gst_svt_jpeg_xs_enc_quant_mode_get_type (void) |
| 39 |
{ |
| 40 |
static GType quant_mode_type = 0; |
| 41 |
static const GEnumValue quant_modes[] = { |
| 42 |
{0, "Deadzone", "deadzone"}, |
| 43 |
{1, "Uniform", "uniform"}, |
| 44 |
{0, NULL, NULL}, |
| 45 |
}; |
| 46 |
|
| 47 |
if (!quant_mode_type) { |
| 48 |
quant_mode_type = |
| 49 |
g_enum_register_static ("GstSvtJpegXsEncQuantModeType", quant_modes); |
| 50 |
} |
| 51 |
return quant_mode_type; |
| 52 |
} |
| 53 |
|
| 54 |
#define GST_SVT_JPEG_XS_ENC_TYPE_RATE_CONTROL_MODE (gst_svt_jpeg_xs_enc_rate_control_mode_get_type()) |
| 55 |
static GType |
| 56 |
gst_svt_jpeg_xs_enc_rate_control_mode_get_type (void) |
| 57 |
{ |
| 58 |
static GType rc_mode_type = 0; |
| 59 |
static const GEnumValue rc_modes[] = { |
| 60 |
{0, "CBR budget per precinct", "cbr-precinct"}, |
| 61 |
{1, "CBR budget per precinct move padding", "cbr-precinct-move-padding"}, |
| 62 |
{2, "CBR budget per slice", "cbr-slice"}, |
| 63 |
|
| 64 |
|
| 65 |
{0, NULL, NULL}, |
| 66 |
}; |
| 67 |
|
| 68 |
if (!rc_mode_type) { |
| 69 |
rc_mode_type = |
| 70 |
g_enum_register_static ("GstSvtJpegXsEncRateControlModeType", rc_modes); |
| 71 |
} |
| 72 |
return rc_mode_type; |
| 73 |
} |
| 74 |
|
| 75 |
#define GST_SVT_JPEG_XS_ENC_TYPE_CODING_SIGNS (gst_svt_jpeg_xs_enc_coding_signs_get_type()) |
| 76 |
static GType |
| 77 |
gst_svt_jpeg_xs_enc_coding_signs_get_type (void) |
| 78 |
{ |
| 79 |
static GType cs_type = 0; |
| 80 |
static const GEnumValue coding_signs[] = { |
| 81 |
{0, "Disable", "disable"}, |
| 82 |
{1, "Fast", "fast"}, |
| 83 |
{2, "Full", "full"}, |
| 84 |
{0, NULL, NULL}, |
| 85 |
}; |
| 86 |
|
| 87 |
if (!cs_type) { |
| 88 |
cs_type = |
| 89 |
g_enum_register_static ("GstSvtJpegXsEncCodingSignsType", coding_signs); |
| 90 |
} |
| 91 |
return cs_type; |
| 92 |
} |
| 93 |
|
| 94 |
typedef struct _GstSvtJpegXsEnc |
| 95 |
{ |
| 96 |
GstVideoEncoder video_encoder; |
| 97 |
|
| 98 |
|
| 99 |
svt_jpeg_xs_encoder_api_t *jxs_encoder; |
| 100 |
|
| 101 |
uint32_t bytes_per_frame; |
| 102 |
|
| 103 |
|
| 104 |
GstVideoCodecState *state; |
| 105 |
|
| 106 |
|
| 107 |
double bits_per_pixel; |
| 108 |
int decomp_v; |
| 109 |
int decomp_h; |
| 110 |
int slice_height; |
| 111 |
int threads; |
| 112 |
int quant_mode; |
| 113 |
int rate_control_mode; |
| 114 |
int coding_signs; |
| 115 |
} GstSvtJpegXsEnc; |
| 116 |
|
| 117 |
static void gst_svt_jpeg_xs_enc_set_property (GObject * object, |
| 118 |
guint property_id, const GValue * value, GParamSpec * pspec); |
| 119 |
static void gst_svt_jpeg_xs_enc_get_property (GObject * object, |
| 120 |
guint property_id, GValue * value, GParamSpec * pspec); |
| 121 |
static void gst_svt_jpeg_xs_enc_finalize (GObject * object); |
| 122 |
|
| 123 |
static gboolean gst_svt_jpeg_xs_enc_start (GstVideoEncoder * encoder); |
| 124 |
static gboolean gst_svt_jpeg_xs_enc_stop (GstVideoEncoder * encoder); |
| 125 |
static gboolean gst_svt_jpeg_xs_enc_set_format (GstVideoEncoder * encoder, |
| 126 |
GstVideoCodecState * state); |
| 127 |
static GstFlowReturn gst_svt_jpeg_xs_enc_handle_frame (GstVideoEncoder * |
| 128 |
encoder, GstVideoCodecFrame * frame); |
| 129 |
static gboolean gst_svt_jpeg_xs_enc_propose_allocation (GstVideoEncoder * venc, |
| 130 |
GstQuery * query); |
| 131 |
|
| 132 |
enum |
| 133 |
{ |
| 134 |
PROP_BITS_PER_PIXEL = 1, |
| 135 |
PROP_DECOMP_H, |
| 136 |
PROP_DECOMP_V, |
| 137 |
PROP_SLICE_HEIGHT, |
| 138 |
PROP_THREADS, |
| 139 |
PROP_QUANT_MODE, |
| 140 |
PROP_RATE_CONTROL_MODE, |
| 141 |
PROP_CODING_SIGNS, |
| 142 |
}; |
| 143 |
|
| 144 |
#define DEFAULT_BITS_PER_PIXEL 3 // or add an auto default for bpp? |
| 145 |
#define DEFAULT_DECOMP_H 5 |
| 146 |
#define DEFAULT_DECOMP_V 2 |
| 147 |
#define DEFAULT_SLICE_HEIGHT 16 |
| 148 |
#define DEFAULT_THREADS 0 |
| 149 |
#define DEFAULT_QUANT_MODE 0 |
| 150 |
#define DEFAULT_RATE_CONTROL_MODE 0 |
| 151 |
#define DEFAULT_CODING_SIGNS 0 |
| 152 |
|
| 153 |
#define FORMATS_8_BIT "Y444, Y42B, I420" |
| 154 |
|
| 155 |
#if G_BYTE_ORDER == G_LITTLE_ENDIAN |
| 156 |
#define FORMATS_10_BIT "Y444_10LE, I422_10LE, I420_10LE" |
| 157 |
#define FORMATS_12_BIT "Y444_12LE, I422_12LE, I420_12LE" |
| 158 |
#else |
| 159 |
#define FORMATS_10_BIT "Y444_10BE, I422_10BE, I420_10BE" |
| 160 |
#define FORMATS_12_BIT "Y444_12BE, I422_12BE, I420_12BE" |
| 161 |
#endif |
| 162 |
|
| 163 |
#define SUPPORTED_FORMATS FORMATS_8_BIT ", " FORMATS_10_BIT ", " FORMATS_12_BIT |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
static GstStaticPadTemplate sink_pad_template = |
| 168 |
GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, |
| 169 |
GST_STATIC_CAPS ("video/x-raw, " |
| 170 |
"format = { " SUPPORTED_FORMATS " }," |
| 171 |
"interlace-mode = progressive, " |
| 172 |
"width = (int) [16, 16384], " |
| 173 |
"height = (int) [16, 16384], " |
| 174 |
"framerate = (fraction) [0, MAX]; " |
| 175 |
"video/x-raw, " |
| 176 |
"format = { " SUPPORTED_FORMATS " }," |
| 177 |
"interlace-mode = interleaved, " |
| 178 |
"field-order = { top-field-first, bottom-field-first }, " |
| 179 |
"width = (int) [16, 16384], " "height = (int) [16, 16384], " |
| 180 |
"framerate = (fraction) [0, MAX]")); |
| 181 |
|
| 182 |
static GstStaticPadTemplate src_pad_template = |
| 183 |
GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, |
| 184 |
GST_STATIC_CAPS ("image/x-jxsc, alignment = frame, " |
| 185 |
"width = (int) [16, 16384], height = (int) [16, 16384], " |
| 186 |
"interlace-mode = { progressive, fields }, " |
| 187 |
"sampling = { YCbCr-4:4:4, YCbCr-4:2:2, YCbCr-4:2:0 }, " |
| 188 |
"framerate = (fraction) [0, MAX]")); |
| 189 |
|
| 190 |
#define gst_svt_jpeg_xs_enc_parent_class parent_class |
| 191 |
|
| 192 |
G_DEFINE_TYPE_WITH_CODE (GstSvtJpegXsEnc, gst_svt_jpeg_xs_enc, |
| 193 |
GST_TYPE_VIDEO_ENCODER, GST_DEBUG_CATEGORY_INIT (svtjpegxsenc_debug, |
| 194 |
"svtjpegxsenc", 0, "SVT JPEG XS encoder element")); |
| 195 |
|
| 196 |
GST_ELEMENT_REGISTER_DEFINE (svtjpegxsenc, "svtjpegxsenc", GST_RANK_SECONDARY, |
| 197 |
gst_svt_jpeg_xs_enc_get_type ()); |
| 198 |
|
| 199 |
static void |
| 200 |
gst_svt_jpeg_xs_enc_class_init (GstSvtJpegXsEncClass * klass) |
| 201 |
{ |
| 202 |
GstVideoEncoderClass *video_encoder_class = GST_VIDEO_ENCODER_CLASS (klass); |
| 203 |
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); |
| 204 |
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 205 |
|
| 206 |
gst_element_class_add_static_pad_template (element_class, &src_pad_template); |
| 207 |
|
| 208 |
gst_element_class_add_static_pad_template (element_class, &sink_pad_template); |
| 209 |
|
| 210 |
gst_element_class_set_static_metadata (element_class, |
| 211 |
"SVT JPEG XS encoder", |
| 212 |
"Codec/Encoder/Video", |
| 213 |
"Scalable Video Technology for JPEG XS Encoder", |
| 214 |
"Tim-Philipp Müller <tim centricular com>"); |
| 215 |
|
| 216 |
gobject_class->set_property = gst_svt_jpeg_xs_enc_set_property; |
| 217 |
gobject_class->get_property = gst_svt_jpeg_xs_enc_get_property; |
| 218 |
gobject_class->finalize = gst_svt_jpeg_xs_enc_finalize; |
| 219 |
|
| 220 |
video_encoder_class->start = gst_svt_jpeg_xs_enc_start; |
| 221 |
video_encoder_class->stop = gst_svt_jpeg_xs_enc_stop; |
| 222 |
video_encoder_class->set_format = gst_svt_jpeg_xs_enc_set_format; |
| 223 |
video_encoder_class->handle_frame = gst_svt_jpeg_xs_enc_handle_frame; |
| 224 |
video_encoder_class->propose_allocation = |
| 225 |
gst_svt_jpeg_xs_enc_propose_allocation; |
| 226 |
|
| 227 |
|
| 228 |
g_object_class_install_property (gobject_class, |
| 229 |
PROP_BITS_PER_PIXEL, |
| 230 |
g_param_spec_double ("bits-per-pixel", |
| 231 |
"Bits per pixel", |
| 232 |
"Bits per pixel (can be a fractional number, e.g. 3.75)", |
| 233 |
0.001, |
| 234 |
100.00, |
| 235 |
DEFAULT_BITS_PER_PIXEL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 236 |
|
| 237 |
g_object_class_install_property (gobject_class, |
| 238 |
PROP_DECOMP_H, |
| 239 |
g_param_spec_int ("decomp-h", |
| 240 |
"Horizontal Decomposition Level", |
| 241 |
"Horizontal decomposition (has to be great or equal to decomp-v)", |
| 242 |
0, 5, DEFAULT_DECOMP_H, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 243 |
|
| 244 |
g_object_class_install_property (gobject_class, |
| 245 |
PROP_DECOMP_V, |
| 246 |
g_param_spec_int ("decomp-v", |
| 247 |
"Vertical Decomposition Level", |
| 248 |
"Vertical decomposition", |
| 249 |
0, 2, DEFAULT_DECOMP_V, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 250 |
|
| 251 |
g_object_class_install_property (gobject_class, |
| 252 |
PROP_SLICE_HEIGHT, |
| 253 |
g_param_spec_int ("slice-height", |
| 254 |
"Slice Height", |
| 255 |
"The height of each slice in pixel lines (per thread processing unit)", |
| 256 |
1, |
| 257 |
16, |
| 258 |
DEFAULT_SLICE_HEIGHT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 259 |
|
| 260 |
g_object_class_install_property (gobject_class, |
| 261 |
PROP_THREADS, |
| 262 |
g_param_spec_int ("threads", |
| 263 |
"Threads", |
| 264 |
"Number of threads to use (0 = automatic)", |
| 265 |
0, |
| 266 |
G_MAXINT, |
| 267 |
DEFAULT_THREADS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 268 |
|
| 269 |
g_object_class_install_property (gobject_class, |
| 270 |
PROP_QUANT_MODE, |
| 271 |
g_param_spec_enum ("quant-mode", |
| 272 |
"Quantization Mode", |
| 273 |
"Quantization Mode", |
| 274 |
GST_SVT_JPEG_XS_ENC_TYPE_QUANT_MODE, |
| 275 |
DEFAULT_QUANT_MODE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 276 |
|
| 277 |
g_object_class_install_property (gobject_class, |
| 278 |
PROP_RATE_CONTROL_MODE, |
| 279 |
g_param_spec_enum ("rate-control-mode", |
| 280 |
"Rate Control Mode", |
| 281 |
"Rate Control Mode", |
| 282 |
GST_SVT_JPEG_XS_ENC_TYPE_RATE_CONTROL_MODE, |
| 283 |
DEFAULT_RATE_CONTROL_MODE, |
| 284 |
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 285 |
|
| 286 |
g_object_class_install_property (gobject_class, |
| 287 |
PROP_CODING_SIGNS, |
| 288 |
g_param_spec_enum ("coding-signs", |
| 289 |
"Coding Signs Handling Strategy", |
| 290 |
"Coding signs handling strategy", |
| 291 |
GST_SVT_JPEG_XS_ENC_TYPE_CODING_SIGNS, |
| 292 |
DEFAULT_CODING_SIGNS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
| 293 |
|
| 294 |
gst_type_mark_as_plugin_api (GST_SVT_JPEG_XS_ENC_TYPE_QUANT_MODE, 0); |
| 295 |
gst_type_mark_as_plugin_api (GST_SVT_JPEG_XS_ENC_TYPE_RATE_CONTROL_MODE, 0); |
| 296 |
gst_type_mark_as_plugin_api (GST_SVT_JPEG_XS_ENC_TYPE_CODING_SIGNS, 0); |
| 297 |
} |
| 298 |
|
| 299 |
static void |
| 300 |
gst_svt_jpeg_xs_enc_finalize (GObject * object) |
| 301 |
{ |
| 302 |
|
| 303 |
|
| 304 |
G_OBJECT_CLASS (parent_class)->finalize (object); |
| 305 |
} |
| 306 |
|
| 307 |
static void |
| 308 |
gst_svt_jpeg_xs_enc_init (GstSvtJpegXsEnc * jxsenc) |
| 309 |
{ |
| 310 |
jxsenc->bits_per_pixel = DEFAULT_BITS_PER_PIXEL; |
| 311 |
jxsenc->decomp_h = DEFAULT_DECOMP_H; |
| 312 |
jxsenc->decomp_v = DEFAULT_DECOMP_V; |
| 313 |
jxsenc->slice_height = DEFAULT_SLICE_HEIGHT; |
| 314 |
jxsenc->quant_mode = DEFAULT_QUANT_MODE; |
| 315 |
jxsenc->rate_control_mode = DEFAULT_RATE_CONTROL_MODE; |
| 316 |
jxsenc->coding_signs = DEFAULT_CODING_SIGNS; |
| 317 |
jxsenc->threads = DEFAULT_THREADS; |
| 318 |
} |
| 319 |
|
| 320 |
static gboolean |
| 321 |
gst_svt_jpeg_xs_enc_start (GstVideoEncoder * encoder) |
| 322 |
{ |
| 323 |
svt_jpeg_xs_encoder_api_t dummy_encoder = { 0, }; |
| 324 |
SvtJxsErrorType_t ret; |
| 325 |
|
| 326 |
|
| 327 |
ret = svt_jpeg_xs_encoder_load_default_parameters (SVT_JPEGXS_API_VER_MAJOR, |
| 328 |
SVT_JPEGXS_API_VER_MINOR, &dummy_encoder); |
| 329 |
|
| 330 |
if (ret == SvtJxsErrorNone) |
| 331 |
return TRUE; |
| 332 |
|
| 333 |
GST_ELEMENT_ERROR (encoder, |
| 334 |
LIBRARY, INIT, |
| 335 |
(NULL), |
| 336 |
("encoder_load_default_parameters failed with error 0x%08x", ret)); |
| 337 |
|
| 338 |
return FALSE; |
| 339 |
} |
| 340 |
|
| 341 |
static gboolean |
| 342 |
gst_svt_jpeg_xs_enc_stop (GstVideoEncoder * encoder) |
| 343 |
{ |
| 344 |
GstSvtJpegXsEnc *jxsenc = GST_SVT_JPEG_XS_ENC (encoder); |
| 345 |
|
| 346 |
GST_DEBUG_OBJECT (jxsenc, "Stopping"); |
| 347 |
|
| 348 |
if (jxsenc->state) { |
| 349 |
gst_video_codec_state_unref (jxsenc->state); |
| 350 |
jxsenc->state = NULL; |
| 351 |
} |
| 352 |
|
| 353 |
if (jxsenc->jxs_encoder != NULL) { |
| 354 |
svt_jpeg_xs_encoder_close (jxsenc->jxs_encoder); |
| 355 |
g_free (jxsenc->jxs_encoder); |
| 356 |
jxsenc->jxs_encoder = NULL; |
| 357 |
} |
| 358 |
jxsenc->bytes_per_frame = 0; |
| 359 |
|
| 360 |
return TRUE; |
| 361 |
} |
| 362 |
|
| 363 |
static gboolean |
| 364 |
gst_svt_jpeg_xs_enc_set_format (GstVideoEncoder * encoder, |
| 365 |
GstVideoCodecState * state) |
| 366 |
{ |
| 367 |
GstSvtJpegXsEnc *jxsenc = GST_SVT_JPEG_XS_ENC (encoder); |
| 368 |
|
| 369 |
GST_DEBUG_OBJECT (jxsenc, "New input caps: %" GST_PTR_FORMAT, state->caps); |
| 370 |
|
| 371 |
if (jxsenc->state != NULL) { |
| 372 |
|
| 373 |
if (gst_video_info_is_equal (&jxsenc->state->info, &state->info)) |
| 374 |
return TRUE; |
| 375 |
|
| 376 |
|
| 377 |
gst_svt_jpeg_xs_enc_stop (encoder); |
| 378 |
gst_svt_jpeg_xs_enc_start (encoder); |
| 379 |
} |
| 380 |
jxsenc->state = gst_video_codec_state_ref (state); |
| 381 |
|
| 382 |
|
| 383 |
{ |
| 384 |
g_assert (jxsenc->jxs_encoder == NULL); |
| 385 |
|
| 386 |
jxsenc->jxs_encoder = g_new0 (svt_jpeg_xs_encoder_api_t, 1); |
| 387 |
} |
| 388 |
|
| 389 |
|
| 390 |
{ |
| 391 |
SvtJxsErrorType_t ret; |
| 392 |
|
| 393 |
ret = svt_jpeg_xs_encoder_load_default_parameters (SVT_JPEGXS_API_VER_MAJOR, |
| 394 |
SVT_JPEGXS_API_VER_MINOR, jxsenc->jxs_encoder); |
| 395 |
|
| 396 |
if (ret != SvtJxsErrorNone) { |
| 397 |
GST_ELEMENT_ERROR (encoder, |
| 398 |
LIBRARY, INIT, |
| 399 |
(NULL), |
| 400 |
("encoder load_default_parameters failed with error 0x%08x", ret)); |
| 401 |
return FALSE; |
| 402 |
} |
| 403 |
} |
| 404 |
|
| 405 |
svt_jpeg_xs_encoder_api_t *enc = jxsenc->jxs_encoder; |
| 406 |
|
| 407 |
|
| 408 |
{ |
| 409 |
int num, denom; |
| 410 |
|
| 411 |
GST_OBJECT_LOCK (jxsenc); |
| 412 |
|
| 413 |
gst_util_double_to_fraction (jxsenc->bits_per_pixel, &num, &denom); |
| 414 |
enc->bpp_numerator = num; |
| 415 |
enc->bpp_denominator = denom; |
| 416 |
|
| 417 |
enc->ndecomp_h = jxsenc->decomp_h; |
| 418 |
enc->ndecomp_v = jxsenc->decomp_v; |
| 419 |
|
| 420 |
enc->slice_height = jxsenc->slice_height; |
| 421 |
enc->quantization = jxsenc->quant_mode; |
| 422 |
|
| 423 |
enc->threads_num = jxsenc->threads; |
| 424 |
|
| 425 |
enc->rate_control_mode = jxsenc->rate_control_mode; |
| 426 |
|
| 427 |
enc->coding_signs_handling = jxsenc->coding_signs; |
| 428 |
|
| 429 |
GST_OBJECT_UNLOCK (jxsenc); |
| 430 |
} |
| 431 |
|
| 432 |
|
| 433 |
{ |
| 434 |
|
| 435 |
enc->slice_packetization_mode = 0; |
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
GstDebugLevel level = gst_debug_category_get_threshold (svtjpegxsenc_debug); |
| 440 |
if (level < GST_LEVEL_WARNING) { |
| 441 |
enc->verbose = VERBOSE_ERRORS; |
| 442 |
} else if (level == GST_LEVEL_WARNING) { |
| 443 |
enc->verbose = VERBOSE_WARNINGS; |
| 444 |
} else { |
| 445 |
enc->verbose = VERBOSE_SYSTEM_INFO; |
| 446 |
} |
| 447 |
} |
| 448 |
|
| 449 |
guint n_fields = !!GST_VIDEO_INFO_IS_INTERLACED (&state->info) + 1; |
| 450 |
|
| 451 |
const char *sampling = NULL; |
| 452 |
|
| 453 |
|
| 454 |
{ |
| 455 |
enc->source_width = GST_VIDEO_INFO_WIDTH (&state->info); |
| 456 |
enc->source_height = GST_VIDEO_INFO_HEIGHT (&state->info) / n_fields; |
| 457 |
|
| 458 |
switch (GST_VIDEO_INFO_FORMAT (&state->info)) { |
| 459 |
case GST_VIDEO_FORMAT_I420: |
| 460 |
enc->input_bit_depth = 8; |
| 461 |
enc->colour_format = COLOUR_FORMAT_PLANAR_YUV420; |
| 462 |
sampling = "YCbCr-4:2:0"; |
| 463 |
break; |
| 464 |
case GST_VIDEO_FORMAT_Y42B: |
| 465 |
enc->input_bit_depth = 8; |
| 466 |
enc->colour_format = COLOUR_FORMAT_PLANAR_YUV422; |
| 467 |
sampling = "YCbCr-4:2:2"; |
| 468 |
break; |
| 469 |
case GST_VIDEO_FORMAT_Y444: |
| 470 |
enc->input_bit_depth = 8; |
| 471 |
enc->colour_format = COLOUR_FORMAT_PLANAR_YUV444_OR_RGB; |
| 472 |
sampling = "YCbCr-4:4:4"; |
| 473 |
break; |
| 474 |
case GST_VIDEO_FORMAT_I420_10BE: |
| 475 |
case GST_VIDEO_FORMAT_I420_10LE: |
| 476 |
enc->input_bit_depth = 10; |
| 477 |
enc->colour_format = COLOUR_FORMAT_PLANAR_YUV420; |
| 478 |
sampling = "YCbCr-4:2:0"; |
| 479 |
break; |
| 480 |
case GST_VIDEO_FORMAT_I422_10BE: |
| 481 |
case GST_VIDEO_FORMAT_I422_10LE: |
| 482 |
enc->input_bit_depth = 10; |
| 483 |
enc->colour_format = COLOUR_FORMAT_PLANAR_YUV422; |
| 484 |
sampling = "YCbCr-4:2:2"; |
| 485 |
break; |
| 486 |
case GST_VIDEO_FORMAT_Y444_10BE: |
| 487 |
case GST_VIDEO_FORMAT_Y444_10LE: |
| 488 |
enc->input_bit_depth = 10; |
| 489 |
enc->colour_format = COLOUR_FORMAT_PLANAR_YUV444_OR_RGB; |
| 490 |
sampling = "YCbCr-4:4:4"; |
| 491 |
break; |
| 492 |
case GST_VIDEO_FORMAT_I420_12BE: |
| 493 |
case GST_VIDEO_FORMAT_I420_12LE: |
| 494 |
enc->input_bit_depth = 12; |
| 495 |
enc->colour_format = COLOUR_FORMAT_PLANAR_YUV420; |
| 496 |
sampling = "YCbCr-4:2:0"; |
| 497 |
break; |
| 498 |
case GST_VIDEO_FORMAT_I422_12BE: |
| 499 |
case GST_VIDEO_FORMAT_I422_12LE: |
| 500 |
enc->input_bit_depth = 12; |
| 501 |
enc->colour_format = COLOUR_FORMAT_PLANAR_YUV422; |
| 502 |
sampling = "YCbCr-4:2:2"; |
| 503 |
break; |
| 504 |
case GST_VIDEO_FORMAT_Y444_12BE: |
| 505 |
case GST_VIDEO_FORMAT_Y444_12LE: |
| 506 |
enc->input_bit_depth = 12; |
| 507 |
enc->colour_format = COLOUR_FORMAT_PLANAR_YUV444_OR_RGB; |
| 508 |
sampling = "YCbCr-4:4:4"; |
| 509 |
break; |
| 510 |
default: |
| 511 |
g_error ("Unexpected input video format %s!", |
| 512 |
gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&state->info))); |
| 513 |
return FALSE; |
| 514 |
} |
| 515 |
} |
| 516 |
|
| 517 |
|
| 518 |
{ |
| 519 |
SvtJxsErrorType_t ret; |
| 520 |
|
| 521 |
|
| 522 |
ret = svt_jpeg_xs_encoder_init (SVT_JPEGXS_API_VER_MAJOR, |
| 523 |
SVT_JPEGXS_API_VER_MINOR, enc); |
| 524 |
|
| 525 |
if (ret != SvtJxsErrorNone) { |
| 526 |
GST_ELEMENT_ERROR (encoder, |
| 527 |
LIBRARY, INIT, |
| 528 |
(NULL), ("encoder initialisation failed with error 0x%08x", ret)); |
| 529 |
return FALSE; |
| 530 |
} |
| 531 |
} |
| 532 |
|
| 533 |
|
| 534 |
{ |
| 535 |
SvtJxsErrorType_t ret; |
| 536 |
svt_jpeg_xs_image_config_t img_config; |
| 537 |
uint32_t bytes_per_frame_or_field = 0; |
| 538 |
|
| 539 |
ret = svt_jpeg_xs_encoder_get_image_config (SVT_JPEGXS_API_VER_MAJOR, |
| 540 |
SVT_JPEGXS_API_VER_MINOR, enc, &img_config, &bytes_per_frame_or_field); |
| 541 |
|
| 542 |
if (ret != SvtJxsErrorNone || bytes_per_frame_or_field == 0) { |
| 543 |
GST_ELEMENT_ERROR (encoder, |
| 544 |
LIBRARY, INIT, |
| 545 |
(NULL), |
| 546 |
("Couldn't query encoder output image config, error 0x%08x", ret)); |
| 547 |
return FALSE; |
| 548 |
} |
| 549 |
|
| 550 |
if (n_fields == 2) { |
| 551 |
GST_DEBUG_OBJECT (jxsenc, "Encoded field size: %u bytes", |
| 552 |
bytes_per_frame_or_field); |
| 553 |
} |
| 554 |
|
| 555 |
GST_DEBUG_OBJECT (jxsenc, "Encoded frame size: %u bytes", |
| 556 |
bytes_per_frame_or_field * n_fields); |
| 557 |
|
| 558 |
jxsenc->bytes_per_frame = bytes_per_frame_or_field * n_fields; |
| 559 |
} |
| 560 |
|
| 561 |
GstCaps *src_caps = gst_static_pad_template_get_caps (&src_pad_template); |
| 562 |
|
| 563 |
src_caps = gst_caps_make_writable (src_caps); |
| 564 |
|
| 565 |
|
| 566 |
gst_caps_set_simple (src_caps, |
| 567 |
"sampling", G_TYPE_STRING, sampling, |
| 568 |
"depth", G_TYPE_INT, enc->input_bit_depth, |
| 569 |
"codestream-length", G_TYPE_INT, jxsenc->bytes_per_frame, |
| 570 |
NULL); |
| 571 |
|
| 572 |
GstVideoCodecState *output_state = |
| 573 |
gst_video_encoder_set_output_state (GST_VIDEO_ENCODER (encoder), src_caps, |
| 574 |
jxsenc->state); |
| 575 |
|
| 576 |
if (n_fields == 2) { |
| 577 |
|
| 578 |
GST_VIDEO_INFO_INTERLACE_MODE (&output_state->info) = |
| 579 |
GST_VIDEO_INTERLACE_MODE_FIELDS; |
| 580 |
} |
| 581 |
|
| 582 |
if (!gst_video_encoder_negotiate (encoder)) { |
| 583 |
gst_video_codec_state_unref (output_state); |
| 584 |
return FALSE; |
| 585 |
} |
| 586 |
|
| 587 |
GST_INFO_OBJECT (jxsenc, "Output caps: %" GST_PTR_FORMAT, output_state->caps); |
| 588 |
gst_video_codec_state_unref (output_state); |
| 589 |
|
| 590 |
return TRUE; |
| 591 |
} |
| 592 |
|
| 593 |
|
| 594 |
static GstFlowReturn |
| 595 |
gst_svt_jpeg_xs_enc_encode_codestream (GstSvtJpegXsEnc * jxsenc, |
| 596 |
guint field, guint n_fields, GstVideoFrame * video_frame, |
| 597 |
svt_jpeg_xs_bitstream_buffer_t * bitstream_buffer) |
| 598 |
{ |
| 599 |
|
| 600 |
svt_jpeg_xs_frame_t encoder_frame; |
| 601 |
|
| 602 |
|
| 603 |
{ |
| 604 |
svt_jpeg_xs_image_buffer_t img = { {0,} |
| 605 |
}; |
| 606 |
|
| 607 |
img.data_yuv[0] = (guint8 *) GST_VIDEO_FRAME_PLANE_DATA (video_frame, 0) |
| 608 |
+ field * GST_VIDEO_FRAME_COMP_STRIDE (video_frame, 0); |
| 609 |
img.data_yuv[1] = (guint8 *) GST_VIDEO_FRAME_PLANE_DATA (video_frame, 1) |
| 610 |
+ field * GST_VIDEO_FRAME_COMP_STRIDE (video_frame, 1); |
| 611 |
img.data_yuv[2] = (guint8 *) GST_VIDEO_FRAME_PLANE_DATA (video_frame, 2) |
| 612 |
+ field * GST_VIDEO_FRAME_COMP_STRIDE (video_frame, 2); |
| 613 |
|
| 614 |
|
| 615 |
img.stride[0] = n_fields * GST_VIDEO_FRAME_COMP_STRIDE (video_frame, 0) |
| 616 |
/ GST_VIDEO_FRAME_COMP_PSTRIDE (video_frame, 0); |
| 617 |
img.stride[1] = n_fields * GST_VIDEO_FRAME_COMP_STRIDE (video_frame, 1) |
| 618 |
/ GST_VIDEO_FRAME_COMP_PSTRIDE (video_frame, 1); |
| 619 |
img.stride[2] = n_fields * GST_VIDEO_FRAME_COMP_STRIDE (video_frame, 2) |
| 620 |
/ GST_VIDEO_FRAME_COMP_PSTRIDE (video_frame, 2); |
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
img.alloc_size[0] = GST_VIDEO_FRAME_COMP_STRIDE (video_frame, 0) |
| 627 |
* GST_VIDEO_FRAME_COMP_HEIGHT (video_frame, 0); |
| 628 |
|
| 629 |
img.alloc_size[1] = GST_VIDEO_FRAME_COMP_STRIDE (video_frame, 1) |
| 630 |
* GST_VIDEO_FRAME_COMP_HEIGHT (video_frame, 1); |
| 631 |
|
| 632 |
img.alloc_size[2] = GST_VIDEO_FRAME_COMP_STRIDE (video_frame, 2) |
| 633 |
* GST_VIDEO_FRAME_COMP_HEIGHT (video_frame, 2); |
| 634 |
|
| 635 |
|
| 636 |
for (int i = 0; i < 3; ++i) { |
| 637 |
GST_TRACE_OBJECT (jxsenc, "img stride[%u] = %u, alloc_size[%u]: %u", |
| 638 |
i, img.stride[i], i, img.alloc_size[i]); |
| 639 |
} |
| 640 |
|
| 641 |
encoder_frame.image = img; |
| 642 |
} |
| 643 |
|
| 644 |
encoder_frame.bitstream = *bitstream_buffer; |
| 645 |
|
| 646 |
encoder_frame.user_prv_ctx_ptr = NULL; |
| 647 |
|
| 648 |
SvtJxsErrorType_t enc_ret; |
| 649 |
|
| 650 |
|
| 651 |
{ |
| 652 |
enc_ret = |
| 653 |
svt_jpeg_xs_encoder_send_picture (jxsenc->jxs_encoder, &encoder_frame, |
| 654 |
BLOCKING); |
| 655 |
|
| 656 |
if (enc_ret != SvtJxsErrorNone) |
| 657 |
goto send_picture_error; |
| 658 |
} |
| 659 |
|
| 660 |
memset (&encoder_frame, 0, sizeof (svt_jpeg_xs_frame_t)); |
| 661 |
|
| 662 |
|
| 663 |
{ |
| 664 |
enc_ret = |
| 665 |
svt_jpeg_xs_encoder_get_packet (jxsenc->jxs_encoder, &encoder_frame, |
| 666 |
BLOCKING); |
| 667 |
|
| 668 |
if (enc_ret != SvtJxsErrorNone) |
| 669 |
goto get_packet_error; |
| 670 |
} |
| 671 |
|
| 672 |
*bitstream_buffer = encoder_frame.bitstream; |
| 673 |
|
| 674 |
GST_TRACE_OBJECT (jxsenc, "Codestream length: %u (%s)", |
| 675 |
encoder_frame.bitstream.used_size, (n_fields == 2) ? "field" : "frame"); |
| 676 |
|
| 677 |
return GST_FLOW_OK; |
| 678 |
|
| 679 |
|
| 680 |
send_picture_error: |
| 681 |
{ |
| 682 |
GST_ELEMENT_ERROR (jxsenc, LIBRARY, ENCODE, (NULL), |
| 683 |
("Error encoding image (%s): 0x%08x", "send_picture", enc_ret)); |
| 684 |
return GST_FLOW_ERROR; |
| 685 |
} |
| 686 |
|
| 687 |
get_packet_error: |
| 688 |
{ |
| 689 |
GST_ELEMENT_ERROR (jxsenc, LIBRARY, ENCODE, (NULL), |
| 690 |
("Error encoding image (%s): 0x%08x", "get_packet", enc_ret)); |
| 691 |
return GST_FLOW_ERROR; |
| 692 |
} |
| 693 |
} |
| 694 |
|
| 695 |
static GstFlowReturn |
| 696 |
gst_svt_jpeg_xs_enc_handle_frame (GstVideoEncoder * vencoder, |
| 697 |
GstVideoCodecFrame * frame) |
| 698 |
{ |
| 699 |
GstSvtJpegXsEnc *jxsenc = GST_SVT_JPEG_XS_ENC (vencoder); |
| 700 |
|
| 701 |
GST_LOG_OBJECT (jxsenc, "Frame to encode"); |
| 702 |
|
| 703 |
if (jxsenc->jxs_encoder == NULL || jxsenc->state == NULL) { |
| 704 |
GST_ERROR_OBJECT (jxsenc, |
| 705 |
"Encoder not initialised yet. No input caps set?"); |
| 706 |
return GST_FLOW_NOT_NEGOTIATED; |
| 707 |
} |
| 708 |
|
| 709 |
GstVideoFrame video_frame; |
| 710 |
|
| 711 |
if (!gst_video_frame_map (&video_frame, &jxsenc->state->info, |
| 712 |
frame->input_buffer, GST_MAP_READ)) |
| 713 |
goto map_error; |
| 714 |
|
| 715 |
GstFlowReturn flow; |
| 716 |
|
| 717 |
|
| 718 |
{ |
| 719 |
|
| 720 |
flow = |
| 721 |
gst_video_encoder_allocate_output_frame (vencoder, frame, |
| 722 |
jxsenc->bytes_per_frame); |
| 723 |
|
| 724 |
if (flow != GST_FLOW_OK) |
| 725 |
goto allocate_output_frame_failure; |
| 726 |
} |
| 727 |
|
| 728 |
guint n_fields = !!GST_VIDEO_FRAME_IS_INTERLACED (&video_frame) + 1; |
| 729 |
|
| 730 |
|
| 731 |
GstMapInfo outbuf_map = GST_MAP_INFO_INIT; |
| 732 |
|
| 733 |
if (!gst_buffer_map (frame->output_buffer, &outbuf_map, GST_MAP_WRITE)) |
| 734 |
goto output_buffer_map_write_failure; |
| 735 |
|
| 736 |
|
| 737 |
gsize offset = 0; |
| 738 |
|
| 739 |
for (guint field = 0; field < n_fields; ++field) { |
| 740 |
svt_jpeg_xs_bitstream_buffer_t out_buf; |
| 741 |
|
| 742 |
if (n_fields == 2) { |
| 743 |
GST_TRACE_OBJECT (jxsenc, |
| 744 |
"Encoding field %u of 2 @ %zu", field + 1, offset); |
| 745 |
} |
| 746 |
|
| 747 |
|
| 748 |
out_buf.buffer = outbuf_map.data + offset; |
| 749 |
out_buf.allocation_size = outbuf_map.size - offset; |
| 750 |
out_buf.used_size = 0; |
| 751 |
|
| 752 |
flow = |
| 753 |
gst_svt_jpeg_xs_enc_encode_codestream (jxsenc, field, n_fields, |
| 754 |
&video_frame, &out_buf); |
| 755 |
|
| 756 |
if (flow != GST_FLOW_OK) |
| 757 |
goto out_unmap; |
| 758 |
|
| 759 |
offset += out_buf.used_size; |
| 760 |
} |
| 761 |
|
| 762 |
gst_buffer_unmap (frame->output_buffer, &outbuf_map); |
| 763 |
|
| 764 |
|
| 765 |
if (offset < jxsenc->bytes_per_frame) { |
| 766 |
GST_WARNING_OBJECT (jxsenc, "Short encoder output: %zu < %u bytes", |
| 767 |
offset, jxsenc->bytes_per_frame); |
| 768 |
gst_buffer_set_size (frame->output_buffer, offset); |
| 769 |
} |
| 770 |
|
| 771 |
GST_LOG_OBJECT (jxsenc, "Output buffer size: %zu bytes, codestreams=%u", |
| 772 |
offset, n_fields); |
| 773 |
|
| 774 |
|
| 775 |
GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (frame); |
| 776 |
|
| 777 |
|
| 778 |
flow = gst_video_encoder_finish_frame (vencoder, frame); |
| 779 |
|
| 780 |
frame = NULL; |
| 781 |
|
| 782 |
out_unmap: |
| 783 |
|
| 784 |
if (frame != NULL && outbuf_map.memory != NULL) |
| 785 |
gst_buffer_unmap (frame->output_buffer, &outbuf_map); |
| 786 |
|
| 787 |
gst_video_frame_unmap (&video_frame); |
| 788 |
|
| 789 |
out: |
| 790 |
|
| 791 |
if (frame != NULL) |
| 792 |
gst_video_codec_frame_unref (frame); |
| 793 |
|
| 794 |
return flow; |
| 795 |
|
| 796 |
|
| 797 |
map_error: |
| 798 |
{ |
| 799 |
GST_ELEMENT_ERROR (jxsenc, LIBRARY, ENCODE, (NULL), |
| 800 |
("Couldn't map input frame")); |
| 801 |
flow = GST_FLOW_ERROR; |
| 802 |
goto out; |
| 803 |
} |
| 804 |
|
| 805 |
allocate_output_frame_failure: |
| 806 |
{ |
| 807 |
GST_DEBUG_OBJECT (jxsenc, "Couldn't allocate output frame, flow=%s", |
| 808 |
gst_flow_get_name (flow)); |
| 809 |
goto out_unmap; |
| 810 |
} |
| 811 |
|
| 812 |
output_buffer_map_write_failure: |
| 813 |
{ |
| 814 |
GST_ERROR_OBJECT (jxsenc, "Couldn't map output buffer!"); |
| 815 |
flow = GST_FLOW_ERROR; |
| 816 |
goto out_unmap; |
| 817 |
} |
| 818 |
} |
| 819 |
|
| 820 |
static gboolean |
| 821 |
gst_svt_jpeg_xs_enc_propose_allocation (GstVideoEncoder * venc, |
| 822 |
GstQuery * query) |
| 823 |
{ |
| 824 |
GstSvtJpegXsEnc *jxsenc = GST_SVT_JPEG_XS_ENC (venc); |
| 825 |
|
| 826 |
GST_DEBUG_OBJECT (jxsenc, "propose_allocation"); |
| 827 |
|
| 828 |
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL); |
| 829 |
|
| 830 |
return GST_VIDEO_ENCODER_CLASS (parent_class)->propose_allocation (venc, |
| 831 |
query); |
| 832 |
} |
| 833 |
|
| 834 |
static void |
| 835 |
gst_svt_jpeg_xs_enc_set_property (GObject * object, guint property_id, |
| 836 |
const GValue * value, GParamSpec * pspec) |
| 837 |
{ |
| 838 |
GstSvtJpegXsEnc *jxsenc = GST_SVT_JPEG_XS_ENC (object); |
| 839 |
|
| 840 |
|
| 841 |
if (jxsenc->jxs_encoder != NULL) { |
| 842 |
GST_ERROR_OBJECT (jxsenc, |
| 843 |
"Encoder has been configured already, can't change properties now."); |
| 844 |
return; |
| 845 |
} |
| 846 |
|
| 847 |
GST_LOG_OBJECT (jxsenc, "Setting property %s", pspec->name); |
| 848 |
|
| 849 |
switch (property_id) { |
| 850 |
case PROP_BITS_PER_PIXEL: |
| 851 |
GST_OBJECT_LOCK (jxsenc); |
| 852 |
jxsenc->bits_per_pixel = g_value_get_double (value); |
| 853 |
GST_OBJECT_UNLOCK (jxsenc); |
| 854 |
break; |
| 855 |
case PROP_DECOMP_H: |
| 856 |
GST_OBJECT_LOCK (jxsenc); |
| 857 |
jxsenc->decomp_h = g_value_get_int (value); |
| 858 |
GST_OBJECT_UNLOCK (jxsenc); |
| 859 |
break; |
| 860 |
case PROP_DECOMP_V: |
| 861 |
GST_OBJECT_LOCK (jxsenc); |
| 862 |
jxsenc->decomp_v = g_value_get_int (value); |
| 863 |
GST_OBJECT_UNLOCK (jxsenc); |
| 864 |
break; |
| 865 |
case PROP_SLICE_HEIGHT: |
| 866 |
GST_OBJECT_LOCK (jxsenc); |
| 867 |
jxsenc->slice_height = g_value_get_int (value); |
| 868 |
GST_OBJECT_UNLOCK (jxsenc); |
| 869 |
break; |
| 870 |
case PROP_THREADS: |
| 871 |
GST_OBJECT_LOCK (jxsenc); |
| 872 |
jxsenc->threads = g_value_get_int (value); |
| 873 |
GST_OBJECT_UNLOCK (jxsenc); |
| 874 |
break; |
| 875 |
case PROP_QUANT_MODE: |
| 876 |
GST_OBJECT_LOCK (jxsenc); |
| 877 |
jxsenc->quant_mode = g_value_get_enum (value); |
| 878 |
GST_OBJECT_UNLOCK (jxsenc); |
| 879 |
break; |
| 880 |
case PROP_RATE_CONTROL_MODE: |
| 881 |
GST_OBJECT_LOCK (jxsenc); |
| 882 |
jxsenc->rate_control_mode = g_value_get_enum (value); |
| 883 |
GST_OBJECT_UNLOCK (jxsenc); |
| 884 |
break; |
| 885 |
case PROP_CODING_SIGNS: |
| 886 |
GST_OBJECT_LOCK (jxsenc); |
| 887 |
jxsenc->coding_signs = g_value_get_enum (value); |
| 888 |
GST_OBJECT_UNLOCK (jxsenc); |
| 889 |
break; |
| 890 |
default: |
| 891 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); |
| 892 |
break; |
| 893 |
} |
| 894 |
} |
| 895 |
|
| 896 |
static void |
| 897 |
gst_svt_jpeg_xs_enc_get_property (GObject * object, guint property_id, |
| 898 |
GValue * value, GParamSpec * pspec) |
| 899 |
{ |
| 900 |
GstSvtJpegXsEnc *jxsenc = GST_SVT_JPEG_XS_ENC (object); |
| 901 |
|
| 902 |
GST_LOG_OBJECT (jxsenc, "Getting property %s", pspec->name); |
| 903 |
|
| 904 |
switch (property_id) { |
| 905 |
case PROP_BITS_PER_PIXEL: |
| 906 |
GST_OBJECT_LOCK (jxsenc); |
| 907 |
g_value_set_double (value, jxsenc->bits_per_pixel); |
| 908 |
GST_OBJECT_UNLOCK (jxsenc); |
| 909 |
break; |
| 910 |
case PROP_DECOMP_H: |
| 911 |
GST_OBJECT_LOCK (jxsenc); |
| 912 |
g_value_set_int (value, jxsenc->decomp_h); |
| 913 |
GST_OBJECT_UNLOCK (jxsenc); |
| 914 |
break; |
| 915 |
case PROP_DECOMP_V: |
| 916 |
GST_OBJECT_LOCK (jxsenc); |
| 917 |
g_value_set_int (value, jxsenc->decomp_v); |
| 918 |
GST_OBJECT_UNLOCK (jxsenc); |
| 919 |
break; |
| 920 |
case PROP_SLICE_HEIGHT: |
| 921 |
GST_OBJECT_LOCK (jxsenc); |
| 922 |
g_value_set_int (value, jxsenc->slice_height); |
| 923 |
GST_OBJECT_UNLOCK (jxsenc); |
| 924 |
break; |
| 925 |
case PROP_THREADS: |
| 926 |
GST_OBJECT_LOCK (jxsenc); |
| 927 |
g_value_set_int (value, jxsenc->threads); |
| 928 |
GST_OBJECT_UNLOCK (jxsenc); |
| 929 |
break; |
| 930 |
case PROP_QUANT_MODE: |
| 931 |
GST_OBJECT_LOCK (jxsenc); |
| 932 |
g_value_set_enum (value, jxsenc->quant_mode); |
| 933 |
GST_OBJECT_UNLOCK (jxsenc); |
| 934 |
break; |
| 935 |
case PROP_RATE_CONTROL_MODE: |
| 936 |
GST_OBJECT_LOCK (jxsenc); |
| 937 |
g_value_set_enum (value, jxsenc->rate_control_mode); |
| 938 |
GST_OBJECT_UNLOCK (jxsenc); |
| 939 |
break; |
| 940 |
case PROP_CODING_SIGNS: |
| 941 |
GST_OBJECT_LOCK (jxsenc); |
| 942 |
g_value_set_enum (value, jxsenc->coding_signs); |
| 943 |
GST_OBJECT_UNLOCK (jxsenc); |
| 944 |
break; |
| 945 |
default: |
| 946 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); |
| 947 |
break; |
| 948 |
} |
| 949 |
} |