gst/mpegstream/gstmpegparse.c: Reflow code so that compiler doesn't complain about possible use of uninitialised vari...

Original commit message from CVS:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_handle_src_query):
Reflow code so that compiler doesn't complain about possible use
of uninitialised variable any longer; but just in case, initialise
it anyway; also take object ref in query function and do peer pad
stuff in a more thread-safe way.
This commit is contained in:
Tim-Philipp Müller 2006-09-28 09:16:38 +00:00
parent cb7487cc45
commit 53ce6d70d6
2 changed files with 27 additions and 28 deletions

View file

@ -1,3 +1,11 @@
2006-09-28 Tim-Philipp Müller <tim at centricular dot net>
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_handle_src_query):
Reflow code so that compiler doesn't complain about possible use
of uninitialised variable any longer; but just in case, initialise
it anyway; also take object ref in query function and do peer pad
stuff in a more thread-safe way.
2006-09-27 Wim Taymans <wim@fluendo.com> 2006-09-27 Wim Taymans <wim@fluendo.com>
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_do_convert_query): * ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_do_convert_query):

View file

@ -988,13 +988,14 @@ gboolean
gst_mpeg_parse_handle_src_query (GstPad * pad, GstQuery * query) gst_mpeg_parse_handle_src_query (GstPad * pad, GstQuery * query)
{ {
gboolean res = TRUE; gboolean res = TRUE;
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (GST_PAD_PARENT (pad)); GstMPEGParse *mpeg_parse;
GstFormat src_format = GST_FORMAT_UNDEFINED, format; GstFormat src_format = GST_FORMAT_UNDEFINED, format;
gint64 src_value = 0, value; gint64 src_value = 0, value = -1;
mpeg_parse = GST_MPEG_PARSE (gst_pad_get_parent (pad));
switch (GST_QUERY_TYPE (query)) { switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_DURATION: case GST_QUERY_DURATION:{
{
gst_query_parse_duration (query, &format, NULL); gst_query_parse_duration (query, &format, NULL);
switch (format) { switch (format) {
@ -1005,7 +1006,7 @@ gst_mpeg_parse_handle_src_query (GstPad * pad, GstQuery * query)
/* Try asking upstream if it knows the time - a DVD might /* Try asking upstream if it knows the time - a DVD might
know */ know */
src_format = GST_FORMAT_TIME; src_format = GST_FORMAT_TIME;
if (gst_pad_query_duration (GST_PAD_PEER (mpeg_parse->sinkpad), if (gst_pad_query_peer_duration (mpeg_parse->sinkpad,
&src_format, &src_value)) { &src_format, &src_value)) {
res = TRUE; res = TRUE;
break; break;
@ -1013,7 +1014,7 @@ gst_mpeg_parse_handle_src_query (GstPad * pad, GstQuery * query)
/* Otherwise fallthrough */ /* Otherwise fallthrough */
default: default:
src_format = GST_FORMAT_BYTES; src_format = GST_FORMAT_BYTES;
if (!gst_pad_query_duration (GST_PAD_PEER (mpeg_parse->sinkpad), if (!gst_pad_query_peer_duration (mpeg_parse->sinkpad,
&src_format, &src_value)) { &src_format, &src_value)) {
res = FALSE; res = FALSE;
goto done; goto done;
@ -1022,17 +1023,13 @@ gst_mpeg_parse_handle_src_query (GstPad * pad, GstQuery * query)
} }
/* Convert the value to the desired format. */ /* Convert the value to the desired format. */
if (!gst_mpeg_parse_convert (mpeg_parse, src_format, src_value, if ((res = gst_mpeg_parse_convert (mpeg_parse, src_format, src_value,
&format, &value)) { &format, &value))) {
res = FALSE;
goto done;
}
gst_query_set_duration (query, format, value); gst_query_set_duration (query, format, value);
}
break; break;
} }
case GST_QUERY_POSITION: case GST_QUERY_POSITION:{
{
gint64 cur; gint64 cur;
gst_query_parse_position (query, &format, NULL); gst_query_parse_position (query, &format, NULL);
@ -1055,26 +1052,19 @@ gst_mpeg_parse_handle_src_query (GstPad * pad, GstQuery * query)
} }
/* Convert the value to the desired format. */ /* Convert the value to the desired format. */
if (!gst_mpeg_parse_convert (mpeg_parse, src_format, src_value, if ((res = gst_mpeg_parse_convert (mpeg_parse, src_format, src_value,
&format, &value)) { &format, &value))) {
res = FALSE;
goto done;
}
gst_query_set_position (query, format, value); gst_query_set_position (query, format, value);
}
break; break;
} }
case GST_QUERY_CONVERT: case GST_QUERY_CONVERT:{
{
gst_query_parse_convert (query, &src_format, &src_value, &format, NULL); gst_query_parse_convert (query, &src_format, &src_value, &format, NULL);
if (!gst_mpeg_parse_convert (mpeg_parse, src_format, src_value, if ((res = gst_mpeg_parse_convert (mpeg_parse, src_format, src_value,
&format, &value)) { &format, &value))) {
res = FALSE;
goto done;
}
gst_query_set_convert (query, src_format, src_value, format, value); gst_query_set_convert (query, src_format, src_value, format, value);
}
break; break;
} }
default: default:
@ -1083,6 +1073,7 @@ gst_mpeg_parse_handle_src_query (GstPad * pad, GstQuery * query)
} }
done: done:
gst_object_unref (mpeg_parse);
return res; return res;
} }