mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 16:08:51 +00:00
mpegtsbase: Check before getting descriptors from structure
Avoids spurious warnings. Not having those descriptors is nothing fatal, so check their presence before trying to get them.
This commit is contained in:
parent
b6732a27d3
commit
7784c0d350
1 changed files with 36 additions and 25 deletions
|
@ -322,21 +322,26 @@ mpegts_get_descriptor_from_stream (MpegTSBaseStream * stream, guint8 tag)
|
||||||
guint8 *retval = NULL;
|
guint8 *retval = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (!gst_structure_has_field_typed (stream_info, "descriptors",
|
||||||
|
G_TYPE_VALUE_ARRAY))
|
||||||
|
goto beach;
|
||||||
|
|
||||||
gst_structure_get (stream_info, "descriptors", G_TYPE_VALUE_ARRAY,
|
gst_structure_get (stream_info, "descriptors", G_TYPE_VALUE_ARRAY,
|
||||||
&descriptors, NULL);
|
&descriptors, NULL);
|
||||||
if (descriptors) {
|
|
||||||
for (i = 0; i < descriptors->n_values; i++) {
|
for (i = 0; i < descriptors->n_values; i++) {
|
||||||
GValue *value = g_value_array_get_nth (descriptors, i);
|
GValue *value = g_value_array_get_nth (descriptors, i);
|
||||||
GString *desc = g_value_dup_boxed (value);
|
GString *desc = g_value_dup_boxed (value);
|
||||||
if (DESC_TAG (desc->str) == tag) {
|
if (DESC_TAG (desc->str) == tag) {
|
||||||
retval = (guint8 *) desc->str;
|
retval = (guint8 *) desc->str;
|
||||||
g_string_free (desc, FALSE);
|
g_string_free (desc, FALSE);
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
g_string_free (desc, FALSE);
|
g_string_free (desc, FALSE);
|
||||||
}
|
|
||||||
g_value_array_free (descriptors);
|
|
||||||
}
|
}
|
||||||
|
g_value_array_free (descriptors);
|
||||||
|
|
||||||
|
beach:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,23 +386,29 @@ mpegts_get_descriptor_from_program (MpegTSBaseProgram * program, guint8 tag)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (G_UNLIKELY (program == NULL))
|
if (G_UNLIKELY (program == NULL))
|
||||||
return NULL;
|
goto beach;
|
||||||
|
|
||||||
program_info = program->pmt_info;
|
program_info = program->pmt_info;
|
||||||
|
if (!gst_structure_has_field_typed (program_info, "descriptors",
|
||||||
|
G_TYPE_VALUE_ARRAY))
|
||||||
|
goto beach;
|
||||||
|
|
||||||
gst_structure_get (program_info, "descriptors", G_TYPE_VALUE_ARRAY,
|
gst_structure_get (program_info, "descriptors", G_TYPE_VALUE_ARRAY,
|
||||||
&descriptors, NULL);
|
&descriptors, NULL);
|
||||||
if (descriptors) {
|
|
||||||
for (i = 0; i < descriptors->n_values; i++) {
|
for (i = 0; i < descriptors->n_values; i++) {
|
||||||
GValue *value = g_value_array_get_nth (descriptors, i);
|
GValue *value = g_value_array_get_nth (descriptors, i);
|
||||||
GString *desc = g_value_dup_boxed (value);
|
GString *desc = g_value_dup_boxed (value);
|
||||||
if (DESC_TAG (desc->str) == tag) {
|
if (DESC_TAG (desc->str) == tag) {
|
||||||
retval = (guint8 *) desc->str;
|
retval = (guint8 *) desc->str;
|
||||||
g_string_free (desc, FALSE);
|
g_string_free (desc, FALSE);
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
g_string_free (desc, FALSE);
|
g_string_free (desc, FALSE);
|
||||||
}
|
|
||||||
g_value_array_free (descriptors);
|
|
||||||
}
|
}
|
||||||
|
g_value_array_free (descriptors);
|
||||||
|
|
||||||
|
beach:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue