API change fixen.

Original commit message from CVS:
* ext/amrnb/amrnbparse.c: (gst_amrnbparse_query),
(gst_amrnbparse_state_change):
* ext/mad/gstid3tag.c: (gst_id3_tag_src_query):
* ext/mad/gstmad.c: (gst_mad_get_query_types), (gst_mad_src_query):
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/sidplay/gstsiddec.cc:
* gst/realmedia/rmdemux.c: (gst_rmdemux_validate_offset),
(gst_rmdemux_src_query), (gst_rmdemux_src_query_types):
API change fixen.
This commit is contained in:
Wim Taymans 2005-10-19 16:01:35 +00:00
parent da23b1f541
commit dcd58b7551
7 changed files with 139 additions and 52 deletions

View file

@ -1,3 +1,15 @@
2005-10-19 Wim Taymans <wim@fluendo.com>
* ext/amrnb/amrnbparse.c: (gst_amrnbparse_query),
(gst_amrnbparse_state_change):
* ext/mad/gstid3tag.c: (gst_id3_tag_src_query):
* ext/mad/gstmad.c: (gst_mad_get_query_types), (gst_mad_src_query):
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/sidplay/gstsiddec.cc:
* gst/realmedia/rmdemux.c: (gst_rmdemux_validate_offset),
(gst_rmdemux_src_query), (gst_rmdemux_src_query_types):
API change fixen.
2005-10-19 Tim-Philipp Müller <tim at centricular dot net>
* configure.ac:

View file

@ -192,10 +192,26 @@ gst_amrnbparse_query (GstPad * pad, GstQuery * query)
case GST_QUERY_POSITION:
{
GstFormat format;
gint64 cur, tot;
gint64 cur;
gst_query_parse_position (query, &format, NULL);
if (format != GST_FORMAT_TIME)
return FALSE;
cur = amrnbparse->ts;
gst_query_set_position (query, GST_FORMAT_TIME, cur);
res = TRUE;
break;
}
case GST_QUERY_DURATION:
{
GstFormat format;
gint64 tot;
GstPad *peer;
gst_query_parse_position (query, &format, NULL, NULL);
gst_query_parse_duration (query, &format, NULL);
if (format != GST_FORMAT_TIME)
return FALSE;
@ -208,15 +224,14 @@ gst_amrnbparse_query (GstPad * pad, GstQuery * query)
gint64 pcur, ptot;
pformat = GST_FORMAT_BYTES;
res = gst_pad_query_position (peer, &pformat, &pcur, &ptot);
res = gst_pad_query_position (peer, &pformat, &pcur);
res = gst_pad_query_duration (peer, &pformat, &ptot);
gst_object_unref (GST_OBJECT (peer));
if (res) {
tot = amrnbparse->ts * ((gdouble) ptot / pcur);
}
}
cur = amrnbparse->ts;
gst_query_set_position (query, GST_FORMAT_TIME, cur, tot);
gst_query_set_duration (query, GST_FORMAT_TIME, tot);
res = TRUE;
break;
}

View file

@ -428,9 +428,9 @@ gst_id3_tag_src_query (GstPad * pad, GstQuery * query)
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:{
GstFormat format;
gint64 current, total;
gint64 current;
gst_query_parse_position (query, &format, NULL, NULL);
gst_query_parse_position (query, &format, NULL);
switch (format) {
case GST_FORMAT_BYTES:{
GstPad *peer;
@ -439,15 +439,42 @@ gst_id3_tag_src_query (GstPad * pad, GstQuery * query)
break;
if (tag->state == GST_ID3_TAG_STATE_NORMAL &&
gst_pad_query_position (peer, &format, &current, &total)) {
total -= tag->v2tag_size + tag->v1tag_size;
total += tag->v2tag_size_new + tag->v1tag_size_new;
gst_pad_query_position (peer, &format, &current)) {
if (tag->state == GST_ID3_TAG_STATE_NORMAL) {
current -= tag->v2tag_size + tag->v2tag_size_new;
} else {
current = 0;
}
gst_query_set_position (query, format, current, total);
gst_query_set_position (query, format, current);
res = TRUE;
}
gst_object_unref (peer);
break;
}
default:
break;
}
break;
}
case GST_QUERY_DURATION:{
GstFormat format;
gint64 total;
gst_query_parse_duration (query, &format, NULL);
switch (format) {
case GST_FORMAT_BYTES:{
GstPad *peer;
if ((peer = gst_pad_get_peer (tag->sinkpad)) == NULL)
break;
if (tag->state == GST_ID3_TAG_STATE_NORMAL &&
gst_pad_query_duration (peer, &format, &total)) {
total -= tag->v2tag_size + tag->v1tag_size;
total += tag->v2tag_size_new + tag->v1tag_size_new;
gst_query_set_duration (query, format, total);
res = TRUE;
}

View file

@ -535,6 +535,8 @@ gst_mad_get_query_types (GstPad * pad)
{
static const GstQueryType gst_mad_src_query_types[] = {
GST_QUERY_POSITION,
GST_QUERY_DURATION,
GST_QUERY_CONVERT,
0
};
@ -551,17 +553,40 @@ gst_mad_src_query (GstPad * pad, GstQuery * query)
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
{
GstFormat format;
gint64 cur;
/* save requested format */
gst_query_parse_position (query, &format, NULL);
/* and convert to the requested format */
if (format != GST_FORMAT_DEFAULT) {
if (!gst_mad_convert_src (pad, GST_FORMAT_DEFAULT, mad->total_samples,
&format, &cur))
goto error;
} else {
cur = mad->total_samples;
}
gst_query_set_position (query, format, cur);
GST_LOG_OBJECT (mad,
"position query: we return %llu (format %u)", cur, format);
break;
}
case GST_QUERY_DURATION:
{
GstFormat format;
GstFormat rformat;
gint64 cur, total, total_bytes;
gint64 total, total_bytes;
GstPad *peer;
/* save requested format */
gst_query_parse_position (query, &format, NULL, NULL);
gst_query_parse_duration (query, &format, NULL);
/* query peer for total length in bytes */
gst_query_set_position (query, GST_FORMAT_BYTES, -1, -1);
gst_query_set_duration (query, GST_FORMAT_BYTES, -1);
if ((peer = gst_pad_get_peer (mad->sinkpad)) == NULL)
goto error;
@ -573,7 +598,7 @@ gst_mad_src_query (GstPad * pad, GstQuery * query)
gst_object_unref (peer);
/* get the returned format */
gst_query_parse_position (query, &rformat, NULL, &total_bytes);
gst_query_parse_duration (query, &rformat, &total_bytes);
if (rformat == GST_FORMAT_BYTES)
GST_LOG_OBJECT (mad, "peer pad returned total=%lld bytes", total_bytes);
else if (rformat == GST_FORMAT_TIME)
@ -583,15 +608,6 @@ gst_mad_src_query (GstPad * pad, GstQuery * query)
if (format == rformat)
return TRUE;
/* and convert to the requested format */
if (format != GST_FORMAT_DEFAULT) {
if (!gst_mad_convert_src (pad, GST_FORMAT_DEFAULT, mad->total_samples,
&format, &cur))
goto error;
} else {
cur = mad->total_samples;
}
if (total_bytes != -1) {
if (format != GST_FORMAT_BYTES) {
if (!gst_mad_convert_sink (pad, GST_FORMAT_BYTES, total_bytes,
@ -604,12 +620,10 @@ gst_mad_src_query (GstPad * pad, GstQuery * query)
total = -1;
}
gst_query_set_position (query, format, cur, total);
gst_query_set_duration (query, format, total);
GST_LOG_OBJECT (mad,
"position query: peer returned total: %llu - we return %llu (format %u)",
total, cur, format);
"position query: we return %llu (format %u)", total, format);
break;
}
case GST_QUERY_CONVERT:

View file

@ -732,6 +732,7 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
GstBuffer *outbuf = NULL;
gboolean skip = FALSE;
GST_DEBUG_OBJECT (mpeg2dec, "picture slice/end %p %p %p %p",
info->display_fbuf,
info->display_picture, info->current_picture,
@ -857,6 +858,7 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
if (info->discard_fbuf && info->discard_fbuf->id) {
if (free_buffer (mpeg2dec, GST_BUFFER (info->discard_fbuf->id))) {
GST_DEBUG_OBJECT (mpeg2dec, "Discarded buffer %p",
info->discard_fbuf->id);
} else {
@ -1156,6 +1158,8 @@ gst_mpeg2dec_sink_event (GstPad * pad, GstEvent * event)
}
*/
mpeg2dec->next_time = -1;;
ret = gst_pad_event_default (pad, event);
GST_STREAM_UNLOCK (pad);
break;
@ -1343,6 +1347,7 @@ gst_mpeg2dec_get_src_query_types (GstPad * pad)
{
static const GstQueryType types[] = {
GST_QUERY_POSITION,
GST_QUERY_DURATION,
0
};
@ -1359,17 +1364,40 @@ gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query)
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
{
GstFormat format;
gint64 cur;
/* save requested format */
gst_query_parse_position (query, &format, NULL);
/* and convert to the requested format */
if (format != GST_FORMAT_DEFAULT) {
if (!gst_mpeg2dec_src_convert (pad, GST_FORMAT_DEFAULT,
mpeg2dec->next_time, &format, &cur))
goto error;
} else {
cur = mpeg2dec->next_time;
}
gst_query_set_position (query, format, cur);
GST_LOG_OBJECT (mpeg2dec,
"position query: we return %llu (format %u)", cur, format);
break;
}
case GST_QUERY_DURATION:
{
GstFormat format;
GstFormat rformat;
gint64 cur, total, total_bytes;
gint64 total, total_bytes;
GstPad *peer;
/* save requested format */
gst_query_parse_position (query, &format, NULL, NULL);
gst_query_parse_duration (query, &format, NULL);
/* query peer for total length in bytes */
gst_query_set_position (query, GST_FORMAT_BYTES, -1, -1);
gst_query_set_duration (query, GST_FORMAT_BYTES, -1);
if ((peer = gst_pad_get_peer (mpeg2dec->sinkpad)) == NULL)
goto error;
@ -1381,7 +1409,7 @@ gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query)
gst_object_unref (peer);
/* get the returned format */
gst_query_parse_position (query, &rformat, NULL, &total_bytes);
gst_query_parse_duration (query, &rformat, &total_bytes);
if (rformat == GST_FORMAT_BYTES)
GST_LOG_OBJECT (mpeg2dec, "peer pad returned total=%lld bytes",
total_bytes);
@ -1392,15 +1420,6 @@ gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query)
if (format == rformat)
return TRUE;
/* and convert to the requested format */
if (format != GST_FORMAT_DEFAULT) {
if (!gst_mpeg2dec_src_convert (pad, GST_FORMAT_DEFAULT,
mpeg2dec->next_time, &format, &cur))
goto error;
} else {
cur = mpeg2dec->next_time;
}
if (total_bytes != -1) {
if (format != GST_FORMAT_BYTES) {
if (!gst_mpeg2dec_sink_convert (pad, GST_FORMAT_BYTES, total_bytes,
@ -1413,12 +1432,10 @@ gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query)
total = -1;
}
gst_query_set_position (query, format, cur, total);
gst_query_set_duration (query, format, total);
GST_LOG_OBJECT (mpeg2dec,
"position query: peer returned total: %llu - we return %llu (format %u)",
total, cur, format);
"position query: we return %llu (format %u)", total, format);
break;
}
default:

View file

@ -592,13 +592,13 @@ gst_siddec_src_query (GstPad * pad, GstQuery * query)
GstFormat format;
gint64 current;
gst_query_parse_position (query, &format, NULL, NULL);
gst_query_parse_position (query, &format, NULL);
/* we only know about our bytes, convert to requested format */
res &= gst_siddec_src_convert (pad,
GST_FORMAT_BYTES, siddec->total_bytes, &format, &current);
if (res) {
gst_query_set_position (query, format, current, -1);
gst_query_set_position (query, format, current);
}
break;
}

View file

@ -624,11 +624,12 @@ gst_rmdemux_src_query (GstPad * pad, GstQuery * query)
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
GST_DEBUG_OBJECT (rmdemux, "src_query position");
gst_query_set_position (query, GST_FORMAT_TIME, -1, //rmdemux->cur_timestamp,
rmdemux->duration);
gst_query_set_position (query, GST_FORMAT_TIME, -1); //rmdemux->cur_timestamp,
break;
case GST_QUERY_CONVERT:
res = FALSE;
case GST_QUERY_DURATION:
GST_DEBUG_OBJECT (rmdemux, "src_query duration");
gst_query_set_duration (query, GST_FORMAT_TIME, //rmdemux->cur_timestamp,
rmdemux->duration);
break;
default:
res = FALSE;
@ -643,6 +644,7 @@ gst_rmdemux_src_query_types (GstPad * pad)
{
static const GstQueryType query_types[] = {
GST_QUERY_POSITION,
GST_QUERY_DURATION,
0
};