mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
API change fix.
Original commit message from CVS: * ext/dv/gstdvdemux.c: (gst_dvdemux_get_src_query_types), (gst_dvdemux_src_query): * ext/flac/gstflacdec.c: (gst_flacdec_length), (gst_flacdec_src_query): * ext/raw1394/gstdv1394src.c: (gst_dv1394src_query): * ext/speex/gstspeexdec.c: (speex_dec_src_query): * gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query): * gst/debug/gstnavseek.c: (gst_navseek_seek): * gst/debug/progressreport.c: (gst_progress_report_report): * gst/matroska/ebml-read.c: (gst_ebml_read_get_length): * gst/matroska/matroska-demux.c: (gst_matroska_demux_handle_src_query): * gst/matroska/matroska-mux.c: (gst_matroska_mux_start): * gst/wavparse/gstwavparse.c: (gst_wavparse_handle_seek), (gst_wavparse_stream_headers), (gst_wavparse_stream_data), (gst_wavparse_pad_convert), (gst_wavparse_pad_query), (gst_wavparse_srcpad_event): API change fix.
This commit is contained in:
parent
97f39d4647
commit
ba7ee6ae6c
12 changed files with 163 additions and 61 deletions
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
2005-10-19 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* ext/dv/gstdvdemux.c: (gst_dvdemux_get_src_query_types),
|
||||
(gst_dvdemux_src_query):
|
||||
* ext/flac/gstflacdec.c: (gst_flacdec_length),
|
||||
(gst_flacdec_src_query):
|
||||
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_query):
|
||||
* ext/speex/gstspeexdec.c: (speex_dec_src_query):
|
||||
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query):
|
||||
* gst/debug/gstnavseek.c: (gst_navseek_seek):
|
||||
* gst/debug/progressreport.c: (gst_progress_report_report):
|
||||
* gst/matroska/ebml-read.c: (gst_ebml_read_get_length):
|
||||
* gst/matroska/matroska-demux.c:
|
||||
(gst_matroska_demux_handle_src_query):
|
||||
* gst/matroska/matroska-mux.c: (gst_matroska_mux_start):
|
||||
* gst/wavparse/gstwavparse.c: (gst_wavparse_handle_seek),
|
||||
(gst_wavparse_stream_headers), (gst_wavparse_stream_data),
|
||||
(gst_wavparse_pad_convert), (gst_wavparse_pad_query),
|
||||
(gst_wavparse_srcpad_event):
|
||||
API change fix.
|
||||
|
||||
2005-10-19 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/goom/filters.c:
|
||||
|
|
|
@ -413,6 +413,7 @@ gst_dvdemux_get_src_query_types (GstPad * pad)
|
|||
{
|
||||
static const GstQueryType src_query_types[] = {
|
||||
GST_QUERY_POSITION,
|
||||
GST_QUERY_DURATION,
|
||||
GST_QUERY_CONVERT,
|
||||
0
|
||||
};
|
||||
|
@ -430,17 +431,32 @@ gst_dvdemux_src_query (GstPad * pad, GstQuery * query)
|
|||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_POSITION:
|
||||
{
|
||||
GstFormat format;
|
||||
gint64 cur;
|
||||
|
||||
/* get target format */
|
||||
gst_query_parse_position (query, &format, NULL);
|
||||
|
||||
/* bring the position to the requested format. */
|
||||
if (!(res = gst_pad_query_convert (pad,
|
||||
GST_FORMAT_TIME, dvdemux->timestamp, &format, &cur)))
|
||||
goto error;
|
||||
gst_query_set_position (query, format, cur);
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_DURATION:
|
||||
{
|
||||
GstFormat format;
|
||||
GstFormat format2;
|
||||
gint64 cur, end;
|
||||
gint64 end;
|
||||
GstPad *peer;
|
||||
|
||||
/* get target format */
|
||||
gst_query_parse_position (query, &format, NULL, NULL);
|
||||
gst_query_parse_duration (query, &format, NULL);
|
||||
|
||||
/* change query to perform on peer */
|
||||
gst_query_set_position (query, GST_FORMAT_BYTES, -1, -1);
|
||||
/* change query to bytes to perform on peer */
|
||||
gst_query_set_duration (query, GST_FORMAT_BYTES, -1);
|
||||
|
||||
if ((peer = gst_pad_get_peer (dvdemux->sinkpad))) {
|
||||
/* ask peer for total length */
|
||||
|
@ -450,28 +466,22 @@ gst_dvdemux_src_query (GstPad * pad, GstQuery * query)
|
|||
}
|
||||
|
||||
/* get peer total length */
|
||||
gst_query_parse_position (query, NULL, NULL, &end);
|
||||
gst_query_parse_duration (query, NULL, &end);
|
||||
|
||||
gst_object_unref (peer);
|
||||
|
||||
/* convert end to requested format */
|
||||
if (end != -1) {
|
||||
format2 = format;
|
||||
if (!(res = gst_pad_query_convert (dvdemux->sinkpad,
|
||||
GST_FORMAT_BYTES, end, &format2, &end))) {
|
||||
gst_object_unref (peer);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
gst_object_unref (peer);
|
||||
} else {
|
||||
end = -1;
|
||||
}
|
||||
/* bring the position to the requested format. */
|
||||
if (!(res = gst_pad_query_convert (pad,
|
||||
GST_FORMAT_TIME, dvdemux->timestamp, &format, &cur)))
|
||||
goto error;
|
||||
if (!(res = gst_pad_query_convert (pad, format2, end, &format, &end)))
|
||||
goto error;
|
||||
gst_query_set_position (query, format, cur, end);
|
||||
gst_query_set_duration (query, format, end);
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_CONVERT:
|
||||
|
|
|
@ -359,7 +359,7 @@ gst_flacdec_length (const FLAC__SeekableStreamDecoder * decoder,
|
|||
|
||||
if (!(peer = gst_pad_get_peer (flacdec->sinkpad)))
|
||||
return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR;
|
||||
gst_pad_query_position (peer, &fmt, NULL, &len);
|
||||
gst_pad_query_duration (peer, &fmt, &len);
|
||||
gst_object_unref (peer);
|
||||
if (fmt != GST_FORMAT_BYTES || len == -1)
|
||||
return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR;
|
||||
|
@ -706,20 +706,30 @@ gst_flacdec_src_query (GstPad * pad, GstQuery * query)
|
|||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_POSITION:{
|
||||
gint64 len, pos;
|
||||
gint64 pos;
|
||||
GstFormat fmt = GST_FORMAT_TIME;
|
||||
|
||||
pos = flacdec->total_samples;
|
||||
|
||||
if (gst_flacdec_convert_src (flacdec->srcpad,
|
||||
GST_FORMAT_DEFAULT, pos, &fmt, &pos))
|
||||
gst_query_set_position (query, GST_FORMAT_TIME, pos);
|
||||
else
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_DURATION:{
|
||||
gint64 len;
|
||||
GstFormat fmt = GST_FORMAT_TIME;
|
||||
|
||||
if (flacdec->stream_samples == 0)
|
||||
len = flacdec->total_samples;
|
||||
else
|
||||
len = flacdec->stream_samples;
|
||||
pos = flacdec->total_samples;
|
||||
|
||||
if (gst_flacdec_convert_src (flacdec->srcpad,
|
||||
GST_FORMAT_DEFAULT, len, &fmt, &len) &&
|
||||
gst_flacdec_convert_src (flacdec->srcpad,
|
||||
GST_FORMAT_DEFAULT, pos, &fmt, &pos))
|
||||
gst_query_set_position (query, GST_FORMAT_TIME, pos, len);
|
||||
GST_FORMAT_DEFAULT, len, &fmt, &len))
|
||||
gst_query_set_duration (query, GST_FORMAT_TIME, len);
|
||||
else
|
||||
res = FALSE;
|
||||
break;
|
||||
|
|
|
@ -789,13 +789,13 @@ gst_dv1394src_query (GstPad * pad, GstQuery * query)
|
|||
GstFormat format;
|
||||
gint64 current;
|
||||
|
||||
gst_query_parse_position (query, &format, NULL, NULL);
|
||||
gst_query_parse_position (query, &format, NULL);
|
||||
|
||||
/* bring our current frame to the requested format */
|
||||
res = gst_pad_query_convert (pad,
|
||||
GST_FORMAT_DEFAULT, src->frame_sequence, &format, ¤t);
|
||||
|
||||
gst_query_set_position (query, format, current, -1);
|
||||
gst_query_set_position (query, format, current);
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_CONVERT:
|
||||
|
|
|
@ -211,23 +211,44 @@ speex_dec_convert (GstPad * pad,
|
|||
static gboolean
|
||||
speex_dec_src_query (GstPad * pad, GstQuery * query)
|
||||
{
|
||||
gint64 samples_out = 0, total_samples;
|
||||
GstSpeexDec *dec = GST_SPEEXDEC (GST_OBJECT_PARENT (pad));
|
||||
GstFormat my_format = GST_FORMAT_TIME;
|
||||
GstPad *peer;
|
||||
|
||||
if (GST_QUERY_TYPE (query) != GST_QUERY_POSITION)
|
||||
return FALSE;
|
||||
if (!(peer = gst_pad_get_peer (dec->sinkpad)))
|
||||
return FALSE;
|
||||
gst_pad_query_position (peer, &my_format, NULL, &total_samples);
|
||||
gst_object_unref (peer);
|
||||
samples_out = dec->samples_out;
|
||||
speex_dec_convert (dec->srcpad, GST_FORMAT_DEFAULT, samples_out,
|
||||
&my_format, &samples_out);
|
||||
speex_dec_convert (dec->srcpad, GST_FORMAT_DEFAULT, total_samples,
|
||||
&my_format, &total_samples);
|
||||
gst_query_set_position (query, GST_FORMAT_TIME, samples_out, total_samples);
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_POSITION:
|
||||
{
|
||||
gint64 cur;
|
||||
GstFormat format;
|
||||
|
||||
gst_query_parse_position (query, &format, NULL);
|
||||
|
||||
speex_dec_convert (dec->srcpad, GST_FORMAT_DEFAULT, dec->samples_out,
|
||||
&format, &cur);
|
||||
|
||||
gst_query_set_position (query, format, cur);
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_DURATION:
|
||||
{
|
||||
GstPad *peer;
|
||||
GstFormat my_format = GST_FORMAT_TIME;
|
||||
gint64 total_samples;
|
||||
|
||||
if (!(peer = gst_pad_get_peer (dec->sinkpad)))
|
||||
return FALSE;
|
||||
|
||||
gst_pad_query_duration (peer, &my_format, &total_samples);
|
||||
gst_object_unref (peer);
|
||||
|
||||
speex_dec_convert (dec->srcpad, GST_FORMAT_DEFAULT, total_samples,
|
||||
&my_format, &total_samples);
|
||||
|
||||
gst_query_set_duration (query, GST_FORMAT_TIME, total_samples);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -390,10 +390,8 @@ gst_avi_demux_handle_src_query (GstPad * pad, GstQuery * query)
|
|||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_POSITION:{
|
||||
gint64 len, pos = 0;
|
||||
gint64 pos = 0;
|
||||
|
||||
len = (((gfloat) stream->strh->scale) * stream->strh->length /
|
||||
stream->strh->rate) * GST_SECOND;
|
||||
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
||||
if (!stream->strh->samplesize) {
|
||||
pos = GST_SECOND * stream->current_frame *
|
||||
|
@ -422,7 +420,16 @@ gst_avi_demux_handle_src_query (GstPad * pad, GstQuery * query)
|
|||
}
|
||||
}
|
||||
if (res)
|
||||
gst_query_set_position (query, GST_FORMAT_TIME, pos, len);
|
||||
gst_query_set_position (query, GST_FORMAT_TIME, pos);
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_DURATION:
|
||||
{
|
||||
gint64 len;
|
||||
|
||||
len = (((gfloat) stream->strh->scale) * stream->strh->length /
|
||||
stream->strh->rate) * GST_SECOND;
|
||||
gst_query_set_duration (query, GST_FORMAT_TIME, len);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -132,7 +132,7 @@ gst_navseek_seek (GstNavSeek * navseek, gint64 offset)
|
|||
|
||||
/* Query for the current time then attempt to set to time + offset */
|
||||
peer_pad = gst_pad_get_peer (GST_BASE_TRANSFORM (navseek)->sinkpad);
|
||||
ret = gst_pad_query_position (peer_pad, &peer_format, &peer_value, NULL);
|
||||
ret = gst_pad_query_position (peer_pad, &peer_format, &peer_value);
|
||||
|
||||
if (ret && peer_format == GST_FORMAT_TIME) {
|
||||
GstEvent *event;
|
||||
|
|
|
@ -182,8 +182,8 @@ gst_progress_report_report (GstProgressReport * filter, GTimeVal cur_time)
|
|||
|
||||
format = try_formats[i];
|
||||
|
||||
if (gst_pad_query_position (peer_pad, &format, &cur_progress,
|
||||
&total_progress)) {
|
||||
if (gst_pad_query_position (peer_pad, &format, &cur_progress) &&
|
||||
gst_pad_query_duration (peer_pad, &format, &total_progress)) {
|
||||
switch (format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
format_name = "bytes";
|
||||
|
|
|
@ -366,9 +366,9 @@ gint64
|
|||
gst_ebml_read_get_length (GstEbmlRead * ebml)
|
||||
{
|
||||
GstFormat fmt = GST_FORMAT_BYTES;
|
||||
gint64 pos, end;
|
||||
gint64 end;
|
||||
|
||||
if (!gst_pad_query_position (GST_PAD_PEER (ebml->sinkpad), &fmt, &pos, &end))
|
||||
if (!gst_pad_query_duration (GST_PAD_PEER (ebml->sinkpad), &fmt, &end))
|
||||
g_return_val_if_reached (0); ///// FIXME /////////
|
||||
|
||||
if (fmt != GST_FORMAT_BYTES || end < 0)
|
||||
|
|
|
@ -972,7 +972,7 @@ gst_matroska_demux_handle_src_query (GstPad * pad, GstQuery * query)
|
|||
{
|
||||
GstFormat format;
|
||||
|
||||
gst_query_parse_position (query, &format, NULL, NULL);
|
||||
gst_query_parse_position (query, &format, NULL);
|
||||
|
||||
if (format != GST_FORMAT_TIME) {
|
||||
GST_DEBUG ("only query position on TIME is supported");
|
||||
|
@ -980,12 +980,25 @@ gst_matroska_demux_handle_src_query (GstPad * pad, GstQuery * query)
|
|||
}
|
||||
|
||||
GST_LOCK (demux);
|
||||
gst_query_set_position (query, GST_FORMAT_TIME, demux->pos);
|
||||
GST_UNLOCK (demux);
|
||||
|
||||
/* mabe we should only fill in the total time and let
|
||||
* decoders fill in the current position? (like oggdemux) */
|
||||
gst_query_set_position (query, GST_FORMAT_TIME, demux->pos,
|
||||
demux->duration);
|
||||
res = TRUE;
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_DURATION:
|
||||
{
|
||||
GstFormat format;
|
||||
|
||||
gst_query_parse_position (query, &format, NULL);
|
||||
|
||||
if (format != GST_FORMAT_TIME) {
|
||||
GST_DEBUG ("only query duration on TIME is supported");
|
||||
break;
|
||||
}
|
||||
|
||||
GST_LOCK (demux);
|
||||
gst_query_set_duration (query, GST_FORMAT_TIME, demux->duration);
|
||||
GST_UNLOCK (demux);
|
||||
|
||||
res = TRUE;
|
||||
|
|
|
@ -1034,12 +1034,12 @@ gst_matroska_mux_start (GstMatroskaMux * mux)
|
|||
thepad = collect_pad->collect.pad;
|
||||
|
||||
/* Query the total length of the track. */
|
||||
query = gst_query_new_position (GST_FORMAT_TIME);
|
||||
query = gst_query_new_duration (GST_FORMAT_TIME);
|
||||
if (gst_pad_query (GST_PAD_PEER (thepad), query)) {
|
||||
GstFormat format;
|
||||
gint64 cur, trackduration;
|
||||
gint64 trackduration;
|
||||
|
||||
gst_query_parse_position (query, &format, &cur, &trackduration);
|
||||
gst_query_parse_duration (query, &format, &trackduration);
|
||||
|
||||
if ((gdouble) trackduration > duration) {
|
||||
duration = (gdouble) trackduration;
|
||||
|
|
|
@ -1163,32 +1163,52 @@ gst_wavparse_pad_query (GstPad * pad, GstQuery * query)
|
|||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_POSITION:
|
||||
{
|
||||
gint64 curb, endb;
|
||||
gint64 cur, end;
|
||||
gint64 curb;
|
||||
gint64 cur;
|
||||
GstFormat format;
|
||||
gboolean res = TRUE;
|
||||
|
||||
curb = wav->offset - wav->datastart;
|
||||
endb = wav->datasize;
|
||||
gst_query_parse_position (query, &format, NULL, NULL);
|
||||
gst_query_parse_position (query, &format, NULL);
|
||||
|
||||
switch (format) {
|
||||
case GST_FORMAT_TIME:
|
||||
res &=
|
||||
gst_wavparse_pad_convert (pad, GST_FORMAT_BYTES, curb,
|
||||
&format, &cur);
|
||||
break;
|
||||
default:
|
||||
format = GST_FORMAT_BYTES;
|
||||
cur = curb;
|
||||
break;
|
||||
}
|
||||
if (res)
|
||||
gst_query_set_position (query, format, cur);
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_DURATION:
|
||||
{
|
||||
gint64 endb;
|
||||
gint64 end;
|
||||
GstFormat format;
|
||||
gboolean res = TRUE;
|
||||
|
||||
endb = wav->datasize;
|
||||
gst_query_parse_duration (query, &format, NULL);
|
||||
|
||||
switch (format) {
|
||||
case GST_FORMAT_TIME:
|
||||
res &=
|
||||
gst_wavparse_pad_convert (pad, GST_FORMAT_BYTES, endb,
|
||||
&format, &end);
|
||||
break;
|
||||
default:
|
||||
format = GST_FORMAT_BYTES;
|
||||
cur = curb;
|
||||
end = endb;
|
||||
break;
|
||||
}
|
||||
if (res)
|
||||
gst_query_set_position (query, format, cur, end);
|
||||
gst_query_set_duration (query, format, end);
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_CONVERT:
|
||||
|
|
Loading…
Reference in a new issue