mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
UNITS -> DEFAULT
Original commit message from CVS: UNITS -> DEFAULT
This commit is contained in:
parent
ada49e5acc
commit
9dc595c9b9
3 changed files with 35 additions and 41 deletions
|
@ -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));
|
||||
|
@ -556,7 +556,7 @@ gst_flacdec_loop (GstElement *element)
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -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:
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue