mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
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:
parent
da23b1f541
commit
dcd58b7551
7 changed files with 139 additions and 52 deletions
12
ChangeLog
12
ChangeLog
|
@ -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>
|
2005-10-19 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* configure.ac:
|
* configure.ac:
|
||||||
|
|
|
@ -192,10 +192,26 @@ gst_amrnbparse_query (GstPad * pad, GstQuery * query)
|
||||||
case GST_QUERY_POSITION:
|
case GST_QUERY_POSITION:
|
||||||
{
|
{
|
||||||
GstFormat format;
|
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;
|
GstPad *peer;
|
||||||
|
|
||||||
gst_query_parse_position (query, &format, NULL, NULL);
|
gst_query_parse_duration (query, &format, NULL);
|
||||||
|
|
||||||
if (format != GST_FORMAT_TIME)
|
if (format != GST_FORMAT_TIME)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -208,15 +224,14 @@ gst_amrnbparse_query (GstPad * pad, GstQuery * query)
|
||||||
gint64 pcur, ptot;
|
gint64 pcur, ptot;
|
||||||
|
|
||||||
pformat = GST_FORMAT_BYTES;
|
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));
|
gst_object_unref (GST_OBJECT (peer));
|
||||||
if (res) {
|
if (res) {
|
||||||
tot = amrnbparse->ts * ((gdouble) ptot / pcur);
|
tot = amrnbparse->ts * ((gdouble) ptot / pcur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cur = amrnbparse->ts;
|
gst_query_set_duration (query, GST_FORMAT_TIME, tot);
|
||||||
|
|
||||||
gst_query_set_position (query, GST_FORMAT_TIME, cur, tot);
|
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,9 +428,9 @@ gst_id3_tag_src_query (GstPad * pad, GstQuery * query)
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_POSITION:{
|
case GST_QUERY_POSITION:{
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
gint64 current, total;
|
gint64 current;
|
||||||
|
|
||||||
gst_query_parse_position (query, &format, NULL, NULL);
|
gst_query_parse_position (query, &format, NULL);
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case GST_FORMAT_BYTES:{
|
case GST_FORMAT_BYTES:{
|
||||||
GstPad *peer;
|
GstPad *peer;
|
||||||
|
@ -439,15 +439,42 @@ gst_id3_tag_src_query (GstPad * pad, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (tag->state == GST_ID3_TAG_STATE_NORMAL &&
|
if (tag->state == GST_ID3_TAG_STATE_NORMAL &&
|
||||||
gst_pad_query_position (peer, &format, ¤t, &total)) {
|
gst_pad_query_position (peer, &format, ¤t)) {
|
||||||
total -= tag->v2tag_size + tag->v1tag_size;
|
|
||||||
total += tag->v2tag_size_new + tag->v1tag_size_new;
|
|
||||||
if (tag->state == GST_ID3_TAG_STATE_NORMAL) {
|
if (tag->state == GST_ID3_TAG_STATE_NORMAL) {
|
||||||
current -= tag->v2tag_size + tag->v2tag_size_new;
|
current -= tag->v2tag_size + tag->v2tag_size_new;
|
||||||
} else {
|
} else {
|
||||||
current = 0;
|
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;
|
res = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -535,6 +535,8 @@ gst_mad_get_query_types (GstPad * pad)
|
||||||
{
|
{
|
||||||
static const GstQueryType gst_mad_src_query_types[] = {
|
static const GstQueryType gst_mad_src_query_types[] = {
|
||||||
GST_QUERY_POSITION,
|
GST_QUERY_POSITION,
|
||||||
|
GST_QUERY_DURATION,
|
||||||
|
GST_QUERY_CONVERT,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -551,17 +553,40 @@ gst_mad_src_query (GstPad * pad, GstQuery * query)
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_POSITION:
|
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 format;
|
||||||
GstFormat rformat;
|
GstFormat rformat;
|
||||||
gint64 cur, total, total_bytes;
|
gint64 total, total_bytes;
|
||||||
GstPad *peer;
|
GstPad *peer;
|
||||||
|
|
||||||
/* save requested format */
|
/* 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 */
|
/* 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)
|
if ((peer = gst_pad_get_peer (mad->sinkpad)) == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -573,7 +598,7 @@ gst_mad_src_query (GstPad * pad, GstQuery * query)
|
||||||
gst_object_unref (peer);
|
gst_object_unref (peer);
|
||||||
|
|
||||||
/* get the returned format */
|
/* 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)
|
if (rformat == GST_FORMAT_BYTES)
|
||||||
GST_LOG_OBJECT (mad, "peer pad returned total=%lld bytes", total_bytes);
|
GST_LOG_OBJECT (mad, "peer pad returned total=%lld bytes", total_bytes);
|
||||||
else if (rformat == GST_FORMAT_TIME)
|
else if (rformat == GST_FORMAT_TIME)
|
||||||
|
@ -583,15 +608,6 @@ gst_mad_src_query (GstPad * pad, GstQuery * query)
|
||||||
if (format == rformat)
|
if (format == rformat)
|
||||||
return TRUE;
|
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 (total_bytes != -1) {
|
||||||
if (format != GST_FORMAT_BYTES) {
|
if (format != GST_FORMAT_BYTES) {
|
||||||
if (!gst_mad_convert_sink (pad, GST_FORMAT_BYTES, total_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;
|
total = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_query_set_position (query, format, cur, total);
|
gst_query_set_duration (query, format, total);
|
||||||
|
|
||||||
GST_LOG_OBJECT (mad,
|
GST_LOG_OBJECT (mad,
|
||||||
"position query: peer returned total: %llu - we return %llu (format %u)",
|
"position query: we return %llu (format %u)", total, format);
|
||||||
total, cur, format);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_QUERY_CONVERT:
|
case GST_QUERY_CONVERT:
|
||||||
|
|
|
@ -732,6 +732,7 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
|
||||||
GstBuffer *outbuf = NULL;
|
GstBuffer *outbuf = NULL;
|
||||||
gboolean skip = FALSE;
|
gboolean skip = FALSE;
|
||||||
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (mpeg2dec, "picture slice/end %p %p %p %p",
|
GST_DEBUG_OBJECT (mpeg2dec, "picture slice/end %p %p %p %p",
|
||||||
info->display_fbuf,
|
info->display_fbuf,
|
||||||
info->display_picture, info->current_picture,
|
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 (info->discard_fbuf && info->discard_fbuf->id) {
|
||||||
if (free_buffer (mpeg2dec, GST_BUFFER (info->discard_fbuf->id))) {
|
if (free_buffer (mpeg2dec, GST_BUFFER (info->discard_fbuf->id))) {
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (mpeg2dec, "Discarded buffer %p",
|
GST_DEBUG_OBJECT (mpeg2dec, "Discarded buffer %p",
|
||||||
info->discard_fbuf->id);
|
info->discard_fbuf->id);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1156,6 +1158,8 @@ gst_mpeg2dec_sink_event (GstPad * pad, GstEvent * event)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
mpeg2dec->next_time = -1;;
|
||||||
|
|
||||||
ret = gst_pad_event_default (pad, event);
|
ret = gst_pad_event_default (pad, event);
|
||||||
GST_STREAM_UNLOCK (pad);
|
GST_STREAM_UNLOCK (pad);
|
||||||
break;
|
break;
|
||||||
|
@ -1343,6 +1347,7 @@ gst_mpeg2dec_get_src_query_types (GstPad * pad)
|
||||||
{
|
{
|
||||||
static const GstQueryType types[] = {
|
static const GstQueryType types[] = {
|
||||||
GST_QUERY_POSITION,
|
GST_QUERY_POSITION,
|
||||||
|
GST_QUERY_DURATION,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1359,17 +1364,40 @@ gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query)
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_POSITION:
|
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 format;
|
||||||
GstFormat rformat;
|
GstFormat rformat;
|
||||||
gint64 cur, total, total_bytes;
|
gint64 total, total_bytes;
|
||||||
GstPad *peer;
|
GstPad *peer;
|
||||||
|
|
||||||
/* save requested format */
|
/* 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 */
|
/* 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)
|
if ((peer = gst_pad_get_peer (mpeg2dec->sinkpad)) == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -1381,7 +1409,7 @@ gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query)
|
||||||
gst_object_unref (peer);
|
gst_object_unref (peer);
|
||||||
|
|
||||||
/* get the returned format */
|
/* 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)
|
if (rformat == GST_FORMAT_BYTES)
|
||||||
GST_LOG_OBJECT (mpeg2dec, "peer pad returned total=%lld bytes",
|
GST_LOG_OBJECT (mpeg2dec, "peer pad returned total=%lld bytes",
|
||||||
total_bytes);
|
total_bytes);
|
||||||
|
@ -1392,15 +1420,6 @@ gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query)
|
||||||
if (format == rformat)
|
if (format == rformat)
|
||||||
return TRUE;
|
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 (total_bytes != -1) {
|
||||||
if (format != GST_FORMAT_BYTES) {
|
if (format != GST_FORMAT_BYTES) {
|
||||||
if (!gst_mpeg2dec_sink_convert (pad, GST_FORMAT_BYTES, total_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;
|
total = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_query_set_position (query, format, cur, total);
|
gst_query_set_duration (query, format, total);
|
||||||
|
|
||||||
GST_LOG_OBJECT (mpeg2dec,
|
GST_LOG_OBJECT (mpeg2dec,
|
||||||
"position query: peer returned total: %llu - we return %llu (format %u)",
|
"position query: we return %llu (format %u)", total, format);
|
||||||
total, cur, format);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -592,13 +592,13 @@ gst_siddec_src_query (GstPad * pad, GstQuery * query)
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
gint64 current;
|
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 */
|
/* we only know about our bytes, convert to requested format */
|
||||||
res &= gst_siddec_src_convert (pad,
|
res &= gst_siddec_src_convert (pad,
|
||||||
GST_FORMAT_BYTES, siddec->total_bytes, &format, ¤t);
|
GST_FORMAT_BYTES, siddec->total_bytes, &format, ¤t);
|
||||||
if (res) {
|
if (res) {
|
||||||
gst_query_set_position (query, format, current, -1);
|
gst_query_set_position (query, format, current);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -624,11 +624,12 @@ gst_rmdemux_src_query (GstPad * pad, GstQuery * query)
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_POSITION:
|
case GST_QUERY_POSITION:
|
||||||
GST_DEBUG_OBJECT (rmdemux, "src_query position");
|
GST_DEBUG_OBJECT (rmdemux, "src_query position");
|
||||||
gst_query_set_position (query, GST_FORMAT_TIME, -1, //rmdemux->cur_timestamp,
|
gst_query_set_position (query, GST_FORMAT_TIME, -1); //rmdemux->cur_timestamp,
|
||||||
rmdemux->duration);
|
|
||||||
break;
|
break;
|
||||||
case GST_QUERY_CONVERT:
|
case GST_QUERY_DURATION:
|
||||||
res = FALSE;
|
GST_DEBUG_OBJECT (rmdemux, "src_query duration");
|
||||||
|
gst_query_set_duration (query, GST_FORMAT_TIME, //rmdemux->cur_timestamp,
|
||||||
|
rmdemux->duration);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
|
@ -643,6 +644,7 @@ gst_rmdemux_src_query_types (GstPad * pad)
|
||||||
{
|
{
|
||||||
static const GstQueryType query_types[] = {
|
static const GstQueryType query_types[] = {
|
||||||
GST_QUERY_POSITION,
|
GST_QUERY_POSITION,
|
||||||
|
GST_QUERY_DURATION,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue