summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2003-05-24 10:41:21 +0000
committerWim Taymans <wim.taymans@gmail.com>2003-05-24 10:41:21 +0000
commit9dc595c9b9e441c0ff6f4d3dbb550067333e03fb (patch)
tree3ca9a662ba8b074e669047f7140c90e1ee45c403
parentada49e5accf753118806281bc9846648f7d4312f (diff)
UNITS -> DEFAULT
Original commit message from CVS: UNITS -> DEFAULT
-rw-r--r--ext/flac/gstflacdec.c29
-rw-r--r--gst/avi/gstavidemux.c36
-rw-r--r--gst/wavparse/gstwavparse.c11
3 files changed, 35 insertions, 41 deletions
diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
index 21a6e0ca..c46756e1 100644
--- a/ext/flac/gstflacdec.c
+++ b/ext/flac/gstflacdec.c
@@ -436,14 +436,14 @@ gst_flacdec_write (const FLAC__SeekableStreamDecoder *decoder,
GST_DEBUG (0, "send discont");
format = GST_FORMAT_TIME;
- gst_pad_convert (flacdec->srcpad, GST_FORMAT_UNITS, flacdec->total_samples,
+ gst_pad_convert (flacdec->srcpad, GST_FORMAT_DEFAULT, flacdec->total_samples,
&format, &time);
format = GST_FORMAT_BYTES;
- gst_pad_convert (flacdec->srcpad, GST_FORMAT_UNITS, flacdec->total_samples,
+ gst_pad_convert (flacdec->srcpad, GST_FORMAT_DEFAULT, flacdec->total_samples,
&format, &bytes);
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time,
GST_FORMAT_BYTES, bytes,
- GST_FORMAT_UNITS, flacdec->total_samples,
+ GST_FORMAT_DEFAULT, flacdec->total_samples,
NULL);
gst_pad_push (flacdec->srcpad, GST_BUFFER (discont));
@@ -552,11 +552,11 @@ gst_flacdec_loop (GstElement *element)
gst_pad_push (flacdec->srcpad, GST_BUFFER (event));
gst_element_set_eos (element);
}
- GST_DEBUG (GST_CAT_PLUGIN_INFO, "flacdec: _loop end");
+ GST_DEBUG (GST_CAT_PLUGIN_INFO, "flacdec: _loop end");
}
GST_PAD_FORMATS_FUNCTION (gst_flacdec_get_src_formats,
- GST_FORMAT_UNITS,
+ GST_FORMAT_DEFAULT,
GST_FORMAT_BYTES,
GST_FORMAT_TIME
)
@@ -575,13 +575,11 @@ gst_flacdec_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
- case GST_FORMAT_UNITS:
+ case GST_FORMAT_DEFAULT:
if (bytes_per_sample == 0)
return FALSE;
*dest_value = src_value / bytes_per_sample;
break;
- case GST_FORMAT_DEFAULT:
- *dest_format = GST_FORMAT_TIME;
case GST_FORMAT_TIME:
{
gint byterate = bytes_per_sample * flacdec->frequency;
@@ -595,13 +593,11 @@ gst_flacdec_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
res = FALSE;
}
break;
- case GST_FORMAT_UNITS:
+ case GST_FORMAT_DEFAULT:
switch (*dest_format) {
case GST_FORMAT_BYTES:
*dest_value = src_value * bytes_per_sample;
break;
- case GST_FORMAT_DEFAULT:
- *dest_format = GST_FORMAT_TIME;
case GST_FORMAT_TIME:
if (flacdec->frequency == 0)
return FALSE;
@@ -613,11 +609,9 @@ gst_flacdec_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
break;
case GST_FORMAT_TIME:
switch (*dest_format) {
- case GST_FORMAT_DEFAULT:
- *dest_format = GST_FORMAT_BYTES;
case GST_FORMAT_BYTES:
scale = bytes_per_sample;
- case GST_FORMAT_UNITS:
+ case GST_FORMAT_DEFAULT:
*dest_value = src_value * scale * flacdec->frequency / GST_SECOND;
break;
default:
@@ -653,14 +647,14 @@ gst_flacdec_src_query (GstPad *pad, GstQueryType type,
samples = flacdec->stream_samples;
gst_pad_convert (flacdec->srcpad,
- GST_FORMAT_UNITS,
+ GST_FORMAT_DEFAULT,
samples,
format, value);
break;
}
case GST_QUERY_POSITION:
gst_pad_convert (flacdec->srcpad,
- GST_FORMAT_UNITS,
+ GST_FORMAT_DEFAULT,
flacdec->total_samples,
format, value);
break;
@@ -685,7 +679,7 @@ gst_flacdec_src_event (GstPad *pad, GstEvent *event)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:
- format = GST_FORMAT_UNITS;
+ format = GST_FORMAT_DEFAULT;
if (gst_pad_convert (flacdec->srcpad,
GST_EVENT_SEEK_FORMAT (event),
@@ -716,6 +710,7 @@ gst_flacdec_change_state (GstElement *element)
flacdec->total_samples = 0;
flacdec->init = TRUE;
flacdec->eos = FALSE;
+ FLAC__seekable_stream_decoder_reset (flacdec->decoder);
break;
case GST_STATE_PAUSED_TO_PLAYING:
flacdec->eos = FALSE;
diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c
index f7ab3af3..21714c8a 100644
--- a/gst/avi/gstavidemux.c
+++ b/gst/avi/gstavidemux.c
@@ -1048,7 +1048,7 @@ gst_avi_demux_parse_index (GstAviDemux *avi_demux,
}
/* VBR stream */
else {
- gst_pad_convert (stream->pad, GST_FORMAT_UNITS, stream->total_frames,
+ gst_pad_convert (stream->pad, GST_FORMAT_DEFAULT, stream->total_frames,
&format, &target->ts);
}
gst_avi_debug_entry ("index", target);
@@ -1122,12 +1122,12 @@ gst_avi_demux_get_src_formats (GstPad *pad)
static const GstFormat src_a_formats[] = {
GST_FORMAT_TIME,
GST_FORMAT_BYTES,
- GST_FORMAT_UNITS,
+ GST_FORMAT_DEFAULT,
0
};
static const GstFormat src_v_formats[] = {
GST_FORMAT_TIME,
- GST_FORMAT_UNITS,
+ GST_FORMAT_DEFAULT,
0
};
@@ -1152,8 +1152,6 @@ gst_avi_demux_src_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
*dest_value = src_value * stream->strh.rate / (stream->strh.scale * GST_SECOND);
break;
case GST_FORMAT_DEFAULT:
- *dest_format = GST_FORMAT_UNITS;
- case GST_FORMAT_UNITS:
*dest_value = src_value * stream->strh.rate / (stream->strh.scale * GST_SECOND);
break;
default:
@@ -1162,7 +1160,16 @@ gst_avi_demux_src_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
}
break;
case GST_FORMAT_BYTES:
- case GST_FORMAT_UNITS:
+ switch (*dest_format) {
+ case GST_FORMAT_TIME:
+ *dest_value = ((gfloat)src_value) * GST_SECOND / stream->strh.rate;
+ break;
+ default:
+ res = FALSE;
+ break;
+ }
+ break;
+ case GST_FORMAT_DEFAULT:
switch (*dest_format) {
case GST_FORMAT_TIME:
*dest_value = ((((gfloat)src_value) * stream->strh.scale) / stream->strh.rate) * GST_SECOND;
@@ -1202,9 +1209,6 @@ gst_avi_demux_handle_src_query (GstPad *pad, GstQueryType type,
switch (type) {
case GST_QUERY_TOTAL:
switch (*format) {
- case GST_FORMAT_DEFAULT:
- *format = GST_FORMAT_TIME;
- /* fall through */
case GST_FORMAT_TIME:
*value = (((gfloat)stream->strh.scale) * stream->strh.length / stream->strh.rate) * GST_SECOND;
break;
@@ -1215,7 +1219,7 @@ gst_avi_demux_handle_src_query (GstPad *pad, GstQueryType type,
else
res = FALSE;
break;
- case GST_FORMAT_UNITS:
+ case GST_FORMAT_DEFAULT:
if (stream->strh.type == GST_RIFF_FCC_auds)
*value = stream->strh.length * stream->strh.samplesize;
else if (stream->strh.type == GST_RIFF_FCC_vids)
@@ -1230,12 +1234,10 @@ gst_avi_demux_handle_src_query (GstPad *pad, GstQueryType type,
break;
case GST_QUERY_POSITION:
switch (*format) {
- case GST_FORMAT_DEFAULT:
- *format = GST_FORMAT_TIME;
- /* fall through */
case GST_FORMAT_TIME:
if (stream->strh.samplesize && stream->strh.type == GST_RIFF_FCC_auds) {
- *value = (((gfloat)stream->current_byte) * stream->strh.scale / stream->strh.rate) * GST_SECOND;
+ //*value = (((gfloat)stream->current_byte) * stream->strh.scale / stream->strh.rate) * GST_SECOND;
+ *value = ((gfloat)stream->current_byte) * GST_SECOND / stream->strh.rate;
}
else {
*value = (((gfloat)stream->current_frame) * stream->strh.scale / stream->strh.rate) * GST_SECOND;
@@ -1244,7 +1246,7 @@ gst_avi_demux_handle_src_query (GstPad *pad, GstQueryType type,
case GST_FORMAT_BYTES:
*value = stream->current_byte;
break;
- case GST_FORMAT_UNITS:
+ case GST_FORMAT_DEFAULT:
if (stream->strh.samplesize && stream->strh.type == GST_RIFF_FCC_auds)
*value = stream->current_byte * stream->strh.samplesize;
else
@@ -1363,7 +1365,7 @@ gst_avi_demux_handle_src_event (GstPad *pad, GstEvent *event)
GST_DEBUG (0, "seek format %d, %08x", GST_EVENT_SEEK_FORMAT (event), stream->strh.type);
switch (GST_EVENT_SEEK_FORMAT (event)) {
case GST_FORMAT_BYTES:
- case GST_FORMAT_UNITS:
+ case GST_FORMAT_DEFAULT:
break;
case GST_FORMAT_TIME:
{
@@ -1646,7 +1648,7 @@ gst_avi_demux_loop (GstElement *element)
format = GST_FORMAT_TIME;
gst_pad_query (stream->pad, GST_QUERY_POSITION, &format, &next_ts);
- if (stream->strh.init_frames == stream->current_frame && stream->delay==0)
+ if (stream->strh.init_frames == stream->current_frame && stream->delay == 0)
stream->delay = next_ts;
stream->current_frame++;
diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c
index 3dcfacf3..970018cc 100644
--- a/gst/wavparse/gstwavparse.c
+++ b/gst/wavparse/gstwavparse.c
@@ -486,7 +486,7 @@ gst_wavparse_get_formats (GstPad *pad)
static GstFormat formats[] = {
GST_FORMAT_TIME,
GST_FORMAT_BYTES,
- GST_FORMAT_UNITS, /* a "frame", ie a set of samples per Hz */
+ GST_FORMAT_DEFAULT, /* a "frame", ie a set of samples per Hz */
0,
0
};
@@ -503,9 +503,6 @@ gst_wavparse_pad_convert (GstPad *pad,
GstWavParse *wavparse;
wavparse = GST_WAVPARSE (gst_pad_get_parent (pad));
- /* FIXME default should be samples in this case IMO */
- if (*dest_format == GST_FORMAT_DEFAULT)
- *dest_format = GST_FORMAT_TIME;
bytes_per_sample = wavparse->channels * wavparse->width / 8;
if (bytes_per_sample == 0) {
@@ -522,14 +519,14 @@ gst_wavparse_pad_convert (GstPad *pad,
switch (src_format) {
case GST_FORMAT_BYTES:
- if (*dest_format == GST_FORMAT_UNITS)
+ if (*dest_format == GST_FORMAT_DEFAULT)
*dest_value = src_value / bytes_per_sample;
else if (*dest_format == GST_FORMAT_TIME)
*dest_value = src_value * GST_SECOND / byterate;
else
return FALSE;
break;
- case GST_FORMAT_UNITS:
+ case GST_FORMAT_DEFAULT:
if (*dest_format == GST_FORMAT_BYTES)
*dest_value = src_value * bytes_per_sample;
else if (*dest_format == GST_FORMAT_TIME)
@@ -540,7 +537,7 @@ gst_wavparse_pad_convert (GstPad *pad,
case GST_FORMAT_TIME:
if (*dest_format == GST_FORMAT_BYTES)
*dest_value = src_value * byterate / GST_SECOND;
- else if (*dest_format == GST_FORMAT_UNITS)
+ else if (*dest_format == GST_FORMAT_DEFAULT)
*dest_value = src_value * wavparse->rate / GST_SECOND;
else
return FALSE;