UNITS -> DEFAULT

Original commit message from CVS:
UNITS -> DEFAULT
This commit is contained in:
Wim Taymans 2003-05-24 10:41:58 +00:00
parent cbc3d8eca8
commit 8e7b367524
5 changed files with 21 additions and 49 deletions

View file

@ -572,7 +572,7 @@ gst_alsa_sink_check_event (GstAlsaSink *sink, gint pad_nr)
if (!gst_clock_handle_discont (GST_ELEMENT (this)->clock, value))
g_printerr ("GstAlsa: clock couldn't handle discontinuity\n");
}
if (!gst_event_discont_get_value (event, GST_FORMAT_UNITS, &value)) {
if (!gst_event_discont_get_value (event, GST_FORMAT_DEFAULT, &value)) {
if (!gst_event_discont_get_value (event, GST_FORMAT_BYTES, &value)) {
if (!gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
g_warning ("GstAlsa: Could not acquire samplecount after seek, the clock might screw your pipeline now");

View file

@ -585,7 +585,7 @@ add_index_associations (CDParanoia *src)
sector_format, sector,
GST_FORMAT_TIME, (gint64) (((CD_FRAMESIZE_RAW >> 2) * sector * GST_SECOND) / 44100),
GST_FORMAT_BYTES, (gint64) (sector << 2),
GST_FORMAT_UNITS, (gint64) ((CD_FRAMESIZE_RAW >> 2) * sector),
GST_FORMAT_DEFAULT, (gint64) ((CD_FRAMESIZE_RAW >> 2) * sector),
NULL);
#if 0
g_print ("Added association for track %d\n", i + 1);
@ -889,7 +889,7 @@ cdparanoia_get_formats (GstPad *pad)
static GstFormat formats[] = {
GST_FORMAT_TIME,
GST_FORMAT_BYTES,
GST_FORMAT_UNITS,
GST_FORMAT_DEFAULT,
0, /* filled later */
0, /* filled later */
0
@ -919,7 +919,7 @@ cdparanoia_convert (GstPad *pad,
switch (*dest_format) {
case GST_FORMAT_BYTES:
src_value <<= 2; /* 4 bytes per sample */
case GST_FORMAT_UNITS:
case GST_FORMAT_DEFAULT:
*dest_value = src_value * 44100 / GST_SECOND;
break;
default:
@ -940,7 +940,7 @@ cdparanoia_convert (GstPad *pad,
break;
case GST_FORMAT_BYTES:
src_value >>= 2;
case GST_FORMAT_UNITS:
case GST_FORMAT_DEFAULT:
switch (*dest_format) {
case GST_FORMAT_BYTES:
*dest_value = src_value * 4;
@ -988,7 +988,7 @@ cdparanoia_convert (GstPad *pad,
break;
case GST_FORMAT_BYTES:
sector <<= 2;
case GST_FORMAT_UNITS:
case GST_FORMAT_DEFAULT:
*dest_value = (CD_FRAMESIZE_RAW >> 2) * sector;
break;
default:

View file

@ -69,7 +69,7 @@ gst_vorbisenc_get_formats (GstPad *pad)
};
static const GstFormat sink_formats[] = {
GST_FORMAT_BYTES,
GST_FORMAT_UNITS,
GST_FORMAT_DEFAULT,
GST_FORMAT_TIME,
0
};
@ -209,8 +209,6 @@ gst_vorbisenc_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
case GST_FORMAT_DEFAULT:
*dest_format = GST_FORMAT_TIME;
case GST_FORMAT_TIME:
*dest_value = src_value * GST_SECOND / avg;
break;
@ -220,8 +218,6 @@ gst_vorbisenc_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:
*dest_value = src_value * avg / GST_SECOND;
break;
@ -251,13 +247,11 @@ gst_vorbisenc_convert_sink (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 * vorbisenc->frequency;
@ -271,13 +265,11 @@ gst_vorbisenc_convert_sink (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 (vorbisenc->frequency == 0)
return FALSE;
@ -289,12 +281,10 @@ gst_vorbisenc_convert_sink (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;
/* fallthrough */
case GST_FORMAT_UNITS:
case GST_FORMAT_DEFAULT:
*dest_value = src_value * scale * vorbisenc->frequency / GST_SECOND;
break;
default:
@ -331,9 +321,6 @@ gst_vorbisenc_src_query (GstPad *pad, GstQueryType type,
case GST_QUERY_TOTAL:
{
switch (*format) {
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
/* fallthrough */
case GST_FORMAT_BYTES:
case GST_FORMAT_TIME:
{
@ -375,9 +362,6 @@ gst_vorbisenc_src_query (GstPad *pad, GstQueryType type,
}
case GST_QUERY_POSITION:
switch (*format) {
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
/* fall through */
default:
{
/* we only know about our samples, convert to requested format */

View file

@ -523,7 +523,7 @@ gst_vorbisfile_loop (GstElement *element)
}
break;
}
case GST_FORMAT_UNITS:
case GST_FORMAT_DEFAULT:
if (vorbisfile->seek_accurate) {
if (ov_pcm_seek (&vorbisfile->vf, vorbisfile->seek_value) == 0) {
vorbisfile->need_discont = TRUE;
@ -607,7 +607,7 @@ gst_vorbisfile_loop (GstElement *element)
samples = (gint64) (ov_pcm_tell (&vorbisfile->vf));
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time,
GST_FORMAT_UNITS, samples, NULL);
GST_FORMAT_DEFAULT, samples, NULL);
gst_pad_push (vorbisfile->srcpad, GST_BUFFER (discont));
}
@ -635,7 +635,7 @@ gst_vorbisfile_get_formats (GstPad *pad)
static GstFormat src_formats[] = {
GST_FORMAT_TIME,
GST_FORMAT_BYTES,
GST_FORMAT_UNITS,
GST_FORMAT_DEFAULT,
0,
0
};
@ -665,16 +665,13 @@ gst_vorbisfile_src_convert (GstPad *pad,
vorbisfile = GST_VORBISFILE (gst_pad_get_parent (pad));
if (*dest_format == GST_FORMAT_DEFAULT)
*dest_format = GST_FORMAT_TIME;
vi = ov_info (&vorbisfile->vf, -1);
bytes_per_sample = vi->channels * 2;
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
case GST_FORMAT_UNITS:
case GST_FORMAT_DEFAULT:
*dest_value = src_value / (vi->channels * 2);
break;
case GST_FORMAT_TIME:
@ -689,7 +686,7 @@ gst_vorbisfile_src_convert (GstPad *pad,
default:
res = FALSE;
}
case GST_FORMAT_UNITS:
case GST_FORMAT_DEFAULT:
switch (*dest_format) {
case GST_FORMAT_BYTES:
*dest_value = src_value * bytes_per_sample;
@ -707,7 +704,7 @@ gst_vorbisfile_src_convert (GstPad *pad,
switch (*dest_format) {
case GST_FORMAT_BYTES:
scale = bytes_per_sample;
case GST_FORMAT_UNITS:
case GST_FORMAT_DEFAULT:
*dest_value = src_value * scale * vi->rate / GST_SECOND;
break;
default:
@ -725,7 +722,7 @@ gst_vorbisfile_src_convert (GstPad *pad,
case GST_FORMAT_BYTES:
res = FALSE;
break;
case GST_FORMAT_UNITS:
case GST_FORMAT_DEFAULT:
if (src_value > vorbisfile->vf.links) {
src_value = vorbisfile->vf.links;
}
@ -773,9 +770,6 @@ gst_vorbisfile_sink_convert (GstPad *pad,
vorbisfile = GST_VORBISFILE (gst_pad_get_parent (pad));
if (*dest_format == GST_FORMAT_DEFAULT)
*dest_format = GST_FORMAT_TIME;
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
@ -844,7 +838,7 @@ gst_vorbisfile_src_query (GstPad *pad, GstQueryType type,
case GST_QUERY_TOTAL:
{
switch (*format) {
case GST_FORMAT_UNITS:
case GST_FORMAT_DEFAULT:
if (vorbisfile->vf.seekable)
*value = ov_pcm_total (&vorbisfile->vf, -1);
else
@ -856,9 +850,6 @@ gst_vorbisfile_src_query (GstPad *pad, GstQueryType type,
else
return FALSE;
break;
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
/* fall through */
case GST_FORMAT_TIME:
if (vorbisfile->vf.seekable)
*value = (gint64) (ov_time_total (&vorbisfile->vf, -1) * GST_SECOND);
@ -880,9 +871,6 @@ gst_vorbisfile_src_query (GstPad *pad, GstQueryType type,
}
case GST_QUERY_POSITION:
switch (*format) {
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
/* fall through */
case GST_FORMAT_TIME:
if (vorbisfile->vf.seekable)
*value = (gint64) (ov_time_tell (&vorbisfile->vf) * GST_SECOND);
@ -896,7 +884,7 @@ gst_vorbisfile_src_query (GstPad *pad, GstQueryType type,
else
*value = vorbisfile->total_bytes;
break;
case GST_FORMAT_UNITS:
case GST_FORMAT_DEFAULT:
if (vorbisfile->vf.seekable)
*value = ov_pcm_tell (&vorbisfile->vf);
else
@ -976,7 +964,7 @@ gst_vorbisfile_src_event (GstPad *pad, GstEvent *event)
}
offset /= vi->channels * 2;
/* fallthrough */
case GST_FORMAT_UNITS:
case GST_FORMAT_DEFAULT:
vorbisfile->seek_pending = TRUE;
vorbisfile->seek_value = offset;
vorbisfile->seek_format = format;

View file

@ -27,7 +27,7 @@
gdouble
gst_video_frame_rate (GstPad *pad)
{
GstFormat dest_format = GST_FORMAT_UNITS;
GstFormat dest_format = GST_FORMAT_DEFAULT;
gint64 dest_value = 0;
gdouble fps;