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 fe40d42ec3
commit ed75cd44e4
4 changed files with 15 additions and 47 deletions

View file

@ -523,7 +523,7 @@ gst_ivorbisfile_loop (GstElement *element)
} }
break; break;
} }
case GST_FORMAT_UNITS: case GST_FORMAT_DEFAULT:
if (ivorbisfile->seek_accurate) { if (ivorbisfile->seek_accurate) {
if (ov_pcm_seek (&ivorbisfile->vf, ivorbisfile->seek_value) == 0) { if (ov_pcm_seek (&ivorbisfile->vf, ivorbisfile->seek_value) == 0) {
ivorbisfile->need_discont = TRUE; ivorbisfile->need_discont = TRUE;
@ -606,7 +606,7 @@ gst_ivorbisfile_loop (GstElement *element)
samples = (gint64) (ov_pcm_tell (&ivorbisfile->vf)); samples = (gint64) (ov_pcm_tell (&ivorbisfile->vf));
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time, discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time,
GST_FORMAT_UNITS, samples, NULL); GST_FORMAT_DEFAULT, samples, NULL);
gst_pad_push (ivorbisfile->srcpad, GST_BUFFER (discont)); gst_pad_push (ivorbisfile->srcpad, GST_BUFFER (discont));
} }
@ -634,7 +634,7 @@ gst_ivorbisfile_get_formats (GstPad *pad)
static GstFormat src_formats[] = { static GstFormat src_formats[] = {
GST_FORMAT_TIME, GST_FORMAT_TIME,
GST_FORMAT_BYTES, GST_FORMAT_BYTES,
GST_FORMAT_UNITS, GST_FORMAT_DEFAULT,
0, 0,
0 0
}; };
@ -664,16 +664,13 @@ gst_ivorbisfile_src_convert (GstPad *pad,
ivorbisfile = GST_IVORBISFILE (gst_pad_get_parent (pad)); ivorbisfile = GST_IVORBISFILE (gst_pad_get_parent (pad));
if (*dest_format == GST_FORMAT_DEFAULT)
*dest_format = GST_FORMAT_TIME;
vi = ov_info (&ivorbisfile->vf, -1); vi = ov_info (&ivorbisfile->vf, -1);
bytes_per_sample = vi->channels * 2; bytes_per_sample = vi->channels * 2;
switch (src_format) { switch (src_format) {
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
switch (*dest_format) { switch (*dest_format) {
case GST_FORMAT_UNITS: case GST_FORMAT_DEFAULT:
*dest_value = src_value / (vi->channels * 2); *dest_value = src_value / (vi->channels * 2);
break; break;
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
@ -688,7 +685,7 @@ gst_ivorbisfile_src_convert (GstPad *pad,
default: default:
res = FALSE; res = FALSE;
} }
case GST_FORMAT_UNITS: case GST_FORMAT_DEFAULT:
switch (*dest_format) { switch (*dest_format) {
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
*dest_value = src_value * bytes_per_sample; *dest_value = src_value * bytes_per_sample;
@ -706,7 +703,7 @@ gst_ivorbisfile_src_convert (GstPad *pad,
switch (*dest_format) { switch (*dest_format) {
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
scale = bytes_per_sample; scale = bytes_per_sample;
case GST_FORMAT_UNITS: case GST_FORMAT_DEFAULT:
*dest_value = src_value * scale * vi->rate / GST_SECOND; *dest_value = src_value * scale * vi->rate / GST_SECOND;
break; break;
default: default:
@ -724,7 +721,7 @@ gst_ivorbisfile_src_convert (GstPad *pad,
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
res = FALSE; res = FALSE;
break; break;
case GST_FORMAT_UNITS: case GST_FORMAT_DEFAULT:
if (src_value > ivorbisfile->vf.links) { if (src_value > ivorbisfile->vf.links) {
src_value = ivorbisfile->vf.links; src_value = ivorbisfile->vf.links;
} }
@ -772,9 +769,6 @@ gst_ivorbisfile_sink_convert (GstPad *pad,
ivorbisfile = GST_IVORBISFILE (gst_pad_get_parent (pad)); ivorbisfile = GST_IVORBISFILE (gst_pad_get_parent (pad));
if (*dest_format == GST_FORMAT_DEFAULT)
*dest_format = GST_FORMAT_TIME;
switch (src_format) { switch (src_format) {
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
switch (*dest_format) { switch (*dest_format) {
@ -843,7 +837,7 @@ gst_ivorbisfile_src_query (GstPad *pad, GstQueryType type,
case GST_QUERY_TOTAL: case GST_QUERY_TOTAL:
{ {
switch (*format) { switch (*format) {
case GST_FORMAT_UNITS: case GST_FORMAT_DEFAULT:
if (ivorbisfile->vf.seekable) if (ivorbisfile->vf.seekable)
*value = ov_pcm_total (&ivorbisfile->vf, -1); *value = ov_pcm_total (&ivorbisfile->vf, -1);
else else
@ -855,9 +849,6 @@ gst_ivorbisfile_src_query (GstPad *pad, GstQueryType type,
else else
return FALSE; return FALSE;
break; break;
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
/* fall through */
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
if (ivorbisfile->vf.seekable) if (ivorbisfile->vf.seekable)
*value = (gint64) (ov_time_total (&ivorbisfile->vf, -1) * GST_SECOND); *value = (gint64) (ov_time_total (&ivorbisfile->vf, -1) * GST_SECOND);
@ -879,9 +870,6 @@ gst_ivorbisfile_src_query (GstPad *pad, GstQueryType type,
} }
case GST_QUERY_POSITION: case GST_QUERY_POSITION:
switch (*format) { switch (*format) {
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
/* fall through */
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
if (ivorbisfile->vf.seekable) if (ivorbisfile->vf.seekable)
*value = (gint64) (ov_time_tell (&ivorbisfile->vf) * GST_SECOND); *value = (gint64) (ov_time_tell (&ivorbisfile->vf) * GST_SECOND);
@ -895,7 +883,7 @@ gst_ivorbisfile_src_query (GstPad *pad, GstQueryType type,
else else
*value = ivorbisfile->total_bytes; *value = ivorbisfile->total_bytes;
break; break;
case GST_FORMAT_UNITS: case GST_FORMAT_DEFAULT:
if (ivorbisfile->vf.seekable) if (ivorbisfile->vf.seekable)
*value = ov_pcm_tell (&ivorbisfile->vf); *value = ov_pcm_tell (&ivorbisfile->vf);
else else
@ -975,7 +963,7 @@ gst_ivorbisfile_src_event (GstPad *pad, GstEvent *event)
} }
offset /= vi->channels * 2; offset /= vi->channels * 2;
/* fallthrough */ /* fallthrough */
case GST_FORMAT_UNITS: case GST_FORMAT_DEFAULT:
ivorbisfile->seek_pending = TRUE; ivorbisfile->seek_pending = TRUE;
ivorbisfile->seek_value = offset; ivorbisfile->seek_value = offset;
ivorbisfile->seek_format = format; ivorbisfile->seek_format = format;

View file

@ -345,8 +345,6 @@ gst_swfdec_convert_sink (GstPad *pad, GstFormat src_format, gint64 src_value,
switch (src_format) { switch (src_format) {
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
switch (*dest_format) { switch (*dest_format) {
case GST_FORMAT_DEFAULT:
*dest_format = GST_FORMAT_TIME;
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
default: default:
res = FALSE; res = FALSE;
@ -354,8 +352,6 @@ gst_swfdec_convert_sink (GstPad *pad, GstFormat src_format, gint64 src_value,
break; break;
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
switch (*dest_format) { switch (*dest_format) {
case GST_FORMAT_DEFAULT:
*dest_format = GST_FORMAT_BYTES;
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
default: default:
res = FALSE; res = FALSE;
@ -381,8 +377,6 @@ gst_swfdec_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
switch (src_format) { switch (src_format) {
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
switch (*dest_format) { switch (*dest_format) {
case GST_FORMAT_DEFAULT:
*dest_format = GST_FORMAT_TIME;
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
default: default:
res = FALSE; res = FALSE;
@ -390,23 +384,19 @@ gst_swfdec_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
break; break;
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
switch (*dest_format) { switch (*dest_format) {
case GST_FORMAT_DEFAULT:
*dest_format = GST_FORMAT_BYTES;
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
*dest_value = src_value * 6 * (swfdec->width * swfdec->height >> 2) * *dest_value = src_value * 6 * (swfdec->width * swfdec->height >> 2) *
video_rates[swfdec->decoder->frame_rate_code] / GST_SECOND; video_rates[swfdec->decoder->frame_rate_code] / GST_SECOND;
break; break;
case GST_FORMAT_UNITS: case GST_FORMAT_DEFAULT:
*dest_value = src_value * video_rates[swfdec->decoder->frame_rate_code] / GST_SECOND; *dest_value = src_value * video_rates[swfdec->decoder->frame_rate_code] / GST_SECOND;
break; break;
default: default:
res = FALSE; res = FALSE;
} }
break; break;
case GST_FORMAT_UNITS:
switch (*dest_format) {
case GST_FORMAT_DEFAULT: case GST_FORMAT_DEFAULT:
*dest_format = GST_FORMAT_TIME; switch (*dest_format) {
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
if (video_rates[swfdec->decoder->frame_rate_code] != 0.0) { if (video_rates[swfdec->decoder->frame_rate_code] != 0.0) {
*dest_value = src_value * GST_SECOND / *dest_value = src_value * GST_SECOND /
@ -418,7 +408,7 @@ gst_swfdec_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
*dest_value = src_value * 6 * (swfdec->width * swfdec->height >> 2); *dest_value = src_value * 6 * (swfdec->width * swfdec->height >> 2);
break; break;
case GST_FORMAT_UNITS: case GST_FORMAT_DEFAULT:
*dest_value = src_value; *dest_value = src_value;
break; break;
default: default:
@ -445,9 +435,6 @@ gst_swfdec_src_query (GstPad *pad, GstQueryType type,
case GST_QUERY_TOTAL: case GST_QUERY_TOTAL:
{ {
switch (*format) { switch (*format) {
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
/* fallthrough */
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
{ {
int n_frames; int n_frames;
@ -470,9 +457,6 @@ gst_swfdec_src_query (GstPad *pad, GstQueryType type,
case GST_QUERY_POSITION: case GST_QUERY_POSITION:
{ {
switch (*format) { switch (*format) {
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
/* fallthrough */
default: default:
res = FALSE; res = FALSE;
break; break;

View file

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

View file

@ -402,7 +402,7 @@ gst_modplug_get_formats (GstPad *pad)
{ {
static const GstFormat src_formats[] = { static const GstFormat src_formats[] = {
/* GST_FORMAT_BYTES, /* GST_FORMAT_BYTES,
GST_FORMAT_UNITS,*/ GST_FORMAT_DEFAULT,*/
GST_FORMAT_TIME, GST_FORMAT_TIME,
(GstFormat)0 (GstFormat)0
}; };
@ -441,8 +441,6 @@ gst_modplug_src_query (GstPad *pad, GstQueryType type,
switch (type) { switch (type) {
case GST_QUERY_TOTAL: case GST_QUERY_TOTAL:
switch (*format) { switch (*format) {
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
*value=(gint64)modplug->mSoundFile->GetSongTime() * GST_SECOND; *value=(gint64)modplug->mSoundFile->GetSongTime() * GST_SECOND;
break; break;
@ -453,8 +451,6 @@ gst_modplug_src_query (GstPad *pad, GstQueryType type,
break; break;
case GST_QUERY_POSITION: case GST_QUERY_POSITION:
switch (*format) { switch (*format) {
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
default: default:
tmp = ((float)( modplug->mSoundFile->GetSongTime() * modplug->mSoundFile->GetCurrentPos() ) / (float)modplug->mSoundFile->GetMaxPosition() ); tmp = ((float)( modplug->mSoundFile->GetSongTime() * modplug->mSoundFile->GetCurrentPos() ) / (float)modplug->mSoundFile->GetMaxPosition() );
*value=(gint64)(tmp * GST_SECOND); *value=(gint64)(tmp * GST_SECOND);