mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-11 02:24:13 +00:00
katedec: only put primary language tag in GST_TAG_LANGUAGE
Only put primary language into GST_TAG_LANGUAGE, and convert to lower case, ie. only use "en" of "en_GB". This is per our tag documentation and hence what apps expect. Also add example to kateenc property description so people know a language code is wanted here.
This commit is contained in:
parent
b04587f4f7
commit
ced14a1ff7
3 changed files with 21 additions and 12 deletions
|
@ -69,6 +69,8 @@
|
|||
*/
|
||||
|
||||
/* FIXME: post appropriate GST_ELEMENT_ERROR when returning FLOW_ERROR */
|
||||
/* FIXME: should we automatically pick up the language code from the
|
||||
* upstream event tags if none was set via the property? */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
|
@ -176,44 +178,45 @@ gst_kate_enc_class_init (GstKateEncClass * klass)
|
|||
|
||||
g_object_class_install_property (gobject_class, ARG_LANGUAGE,
|
||||
g_param_spec_string ("language", "Language",
|
||||
"Set the language of the stream", "", G_PARAM_READWRITE));
|
||||
"The language of the stream (e.g. \"fr\" or \"fr_FR\" for French)",
|
||||
"", G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_CATEGORY,
|
||||
g_param_spec_string ("category", "Category",
|
||||
"Set the category of the stream", "", G_PARAM_READWRITE));
|
||||
"The category of the stream", "", G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_GRANULE_RATE_NUM,
|
||||
g_param_spec_int ("granule-rate-numerator", "Granule rate numerator",
|
||||
"Set the numerator of the granule rate",
|
||||
"The numerator of the granule rate",
|
||||
1, G_MAXINT, 1, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_GRANULE_RATE_DEN,
|
||||
g_param_spec_int ("granule-rate-denominator", "Granule rate denominator",
|
||||
"Set the denominator of the granule rate",
|
||||
"The denominator of the granule rate",
|
||||
1, G_MAXINT, 1000, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_GRANULE_SHIFT,
|
||||
g_param_spec_int ("granule-shift", "Granule shift",
|
||||
"Set the granule shift", 0, 64, 32, G_PARAM_READWRITE));
|
||||
"The granule shift", 0, 64, 32, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_ORIGINAL_CANVAS_WIDTH,
|
||||
g_param_spec_int ("original-canvas-width", "Original canvas width",
|
||||
"Set the width of the canvas this stream was authored for (0 is unspecified)",
|
||||
"The width of the canvas this stream was authored for (0 is unspecified)",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_ORIGINAL_CANVAS_HEIGHT,
|
||||
g_param_spec_int ("original-canvas-height", "Original canvas height",
|
||||
"Set the height of the canvas this stream was authored for (0 is unspecified)",
|
||||
"The height of the canvas this stream was authored for (0 is unspecified)",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_KEEPALIVE_MIN_TIME,
|
||||
g_param_spec_float ("keepalive-min-time", "Keepalive mimimum time",
|
||||
"Set minimum time to emit keepalive packets (0 disables keepalive packets)",
|
||||
"Minimum time to emit keepalive packets (0 disables keepalive packets)",
|
||||
0.0f, FLT_MAX, DEFAULT_KEEPALIVE_MIN_TIME, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_DEFAULT_SPU_DURATION,
|
||||
g_param_spec_float ("default-spu-duration", "Default SPU duration",
|
||||
"Set the assumed max duration (in seconds) of SPUs with no duration specified",
|
||||
"The assumed max duration (in seconds) of SPUs with no duration specified",
|
||||
0.0f, FLT_MAX, DEFAULT_DEFAULT_SPU_DURATION, G_PARAM_READWRITE));
|
||||
|
||||
gstelement_class->change_state =
|
||||
|
|
|
@ -187,9 +187,15 @@ gst_kate_util_decoder_base_chain_kate_packet (GstKateDecoderBase * decoder,
|
|||
if (decoder->k.ki->language && *decoder->k.ki->language) {
|
||||
GstTagList *old = decoder->tags, *tags = gst_tag_list_new ();
|
||||
if (tags) {
|
||||
gchar *lang_code;
|
||||
|
||||
/* en_GB -> en */
|
||||
lang_code = g_ascii_strdown (decoder->k.ki->language, -1);
|
||||
g_strdelimit (lang_code, NULL, '\0');
|
||||
gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_LANGUAGE_CODE,
|
||||
decoder->k.ki->language, NULL);
|
||||
// TODO: category - where should it go ?
|
||||
lang_code, NULL);
|
||||
g_free (lang_code);
|
||||
/* TODO: category - where should it go ? */
|
||||
decoder->tags =
|
||||
gst_tag_list_merge (decoder->tags, tags, GST_TAG_MERGE_REPLACE);
|
||||
gst_tag_list_free (tags);
|
||||
|
|
|
@ -356,7 +356,7 @@ GST_START_TEST (test_kate_identification_header)
|
|||
GST_TAG_LANGUAGE_CODE), 1);
|
||||
fail_unless (gst_tag_list_get_string (tag_list, GST_TAG_LANGUAGE_CODE,
|
||||
&language));
|
||||
fail_unless_equals_string (language, "en_GB");
|
||||
fail_unless_equals_string (language, "en");
|
||||
g_free (language);
|
||||
fail_unless_equals_int (gst_tag_list_get_tag_size (tag_list, "title"), 1);
|
||||
fail_unless (gst_tag_list_get_string (tag_list, GST_TAG_TITLE, &title));
|
||||
|
|
Loading…
Reference in a new issue