generate real timestamps

Original commit message from CVS:
generate real timestamps
This commit is contained in:
Steve Baker 2001-09-14 19:18:53 +00:00
parent 4e4f06b50e
commit 7f47be399d
4 changed files with 16 additions and 6 deletions

View file

@ -168,6 +168,7 @@ gst_sinesrc_init (GstSineSrc *src)
src->table_pos = 0.0; src->table_pos = 0.0;
src->table_size = 1024; src->table_size = 1024;
src->buffer_size=1024; src->buffer_size=1024;
src->timestamp=0LL;
src->seq = 0; src->seq = 0;
@ -224,7 +225,9 @@ gst_sinesrc_get(GstPad *pad)
GST_BUFFER_SIZE(buf) = 2 * src->buffer_size; GST_BUFFER_SIZE(buf) = 2 * src->buffer_size;
dpman = GST_ELEMENT_DPARAM_MANAGER(GST_ELEMENT(src)); dpman = GST_ELEMENT_DPARAM_MANAGER(GST_ELEMENT(src));
frame_countdown = GST_DPMAN_PREPROCESS(dpman, src->buffer_size, 0LL); frame_countdown = GST_DPMAN_PREPROCESS(dpman, src->buffer_size, src->timestamp);
src->timestamp += (gint64)src->buffer_size * 1000000000LL / (gint64)src->samplerate;
// GST_DEBUG(GST_CAT_PARAMS, "vol_scale = %f\n", src->vol_scale); // GST_DEBUG(GST_CAT_PARAMS, "vol_scale = %f\n", src->vol_scale);
while(GST_DPMAN_PROCESS_COUNTDOWN(dpman, frame_countdown, i)) { while(GST_DPMAN_PROCESS_COUNTDOWN(dpman, frame_countdown, i)) {
@ -369,7 +372,7 @@ gst_sinesrc_update_volume(GValue *value, gpointer data)
src->volume = g_value_get_float(value); src->volume = g_value_get_float(value);
src->vol_scale = 32767.0 * src->volume; src->vol_scale = 32767.0 * src->volume;
GST_DEBUG(GST_CAT_PARAMS, "volume %f\n", src->volume); //GST_DEBUG(GST_CAT_PARAMS, "volume %f\n", src->volume);
} }
@ -382,7 +385,7 @@ gst_sinesrc_update_freq(GValue *value, gpointer data)
src->freq = g_value_get_float(value); src->freq = g_value_get_float(value);
src->table_inc = src->table_size * src->freq / src->samplerate; src->table_inc = src->table_size * src->freq / src->samplerate;
GST_DEBUG(GST_CAT_PARAMS, "freq %f\n", src->freq); //GST_DEBUG(GST_CAT_PARAMS, "freq %f\n", src->freq);
} }
static inline void static inline void

View file

@ -76,6 +76,8 @@ struct _GstSineSrc {
gint buffer_size; gint buffer_size;
gulong seq; gulong seq;
gint64 timestamp;
gboolean newcaps; gboolean newcaps;

View file

@ -168,6 +168,7 @@ gst_sinesrc_init (GstSineSrc *src)
src->table_pos = 0.0; src->table_pos = 0.0;
src->table_size = 1024; src->table_size = 1024;
src->buffer_size=1024; src->buffer_size=1024;
src->timestamp=0LL;
src->seq = 0; src->seq = 0;
@ -224,7 +225,9 @@ gst_sinesrc_get(GstPad *pad)
GST_BUFFER_SIZE(buf) = 2 * src->buffer_size; GST_BUFFER_SIZE(buf) = 2 * src->buffer_size;
dpman = GST_ELEMENT_DPARAM_MANAGER(GST_ELEMENT(src)); dpman = GST_ELEMENT_DPARAM_MANAGER(GST_ELEMENT(src));
frame_countdown = GST_DPMAN_PREPROCESS(dpman, src->buffer_size, 0LL); frame_countdown = GST_DPMAN_PREPROCESS(dpman, src->buffer_size, src->timestamp);
src->timestamp += (gint64)src->buffer_size * 1000000000LL / (gint64)src->samplerate;
// GST_DEBUG(GST_CAT_PARAMS, "vol_scale = %f\n", src->vol_scale); // GST_DEBUG(GST_CAT_PARAMS, "vol_scale = %f\n", src->vol_scale);
while(GST_DPMAN_PROCESS_COUNTDOWN(dpman, frame_countdown, i)) { while(GST_DPMAN_PROCESS_COUNTDOWN(dpman, frame_countdown, i)) {
@ -369,7 +372,7 @@ gst_sinesrc_update_volume(GValue *value, gpointer data)
src->volume = g_value_get_float(value); src->volume = g_value_get_float(value);
src->vol_scale = 32767.0 * src->volume; src->vol_scale = 32767.0 * src->volume;
GST_DEBUG(GST_CAT_PARAMS, "volume %f\n", src->volume); //GST_DEBUG(GST_CAT_PARAMS, "volume %f\n", src->volume);
} }
@ -382,7 +385,7 @@ gst_sinesrc_update_freq(GValue *value, gpointer data)
src->freq = g_value_get_float(value); src->freq = g_value_get_float(value);
src->table_inc = src->table_size * src->freq / src->samplerate; src->table_inc = src->table_size * src->freq / src->samplerate;
GST_DEBUG(GST_CAT_PARAMS, "freq %f\n", src->freq); //GST_DEBUG(GST_CAT_PARAMS, "freq %f\n", src->freq);
} }
static inline void static inline void

View file

@ -76,6 +76,8 @@ struct _GstSineSrc {
gint buffer_size; gint buffer_size;
gulong seq; gulong seq;
gint64 timestamp;
gboolean newcaps; gboolean newcaps;