summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Simon <jsimon13@yahoo.fr>2002-06-22 16:20:25 +0000
committerJeremy Simon <jsimon13@yahoo.fr>2002-06-22 16:20:25 +0000
commitc3c167f8efb756103a02cf1ca8fb9a450e968dc1 (patch)
treebe2b168565d44e41350629325afe3e88fda3654d
parentf981517414341389bb6e2c664c6b739c5ae21024 (diff)
Add timestamp, mikmod work now
Original commit message from CVS: Add timestamp, mikmod work now Put mikmod to secondary rank ( modplug first )
-rw-r--r--ext/mikmod/drv_gst.c4
-rw-r--r--ext/mikmod/gstmikmod.c23
-rw-r--r--ext/mikmod/gstmikmod.h1
3 files changed, 17 insertions, 11 deletions
diff --git a/ext/mikmod/drv_gst.c b/ext/mikmod/drv_gst.c
index a924380c7..570804628 100644
--- a/ext/mikmod/drv_gst.c
+++ b/ext/mikmod/drv_gst.c
@@ -40,10 +40,12 @@ static void mikmod_Update( void )
length = VC_WriteBytes((SBYTE *) audiobuffer, buffer_size);
outdata = gst_buffer_new();
-
+
GST_BUFFER_DATA( outdata ) = g_memdup( audiobuffer, length );
GST_BUFFER_SIZE( outdata ) = length;
+ GST_BUFFER_TIMESTAMP( outdata ) = timestamp;
+
if ( need_sync == 1 )
{
/* FIXME, send a flush event or something */
diff --git a/ext/mikmod/gstmikmod.c b/ext/mikmod/gstmikmod.c
index 655427b5f..04a5eb312 100644
--- a/ext/mikmod/gstmikmod.c
+++ b/ext/mikmod/gstmikmod.c
@@ -332,13 +332,15 @@ gst_mikmod_loop (GstElement *element)
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS)
break;
}
-
- if ( mikmod->Buffer ) {
- mikmod->Buffer = gst_buffer_append( mikmod->Buffer, buffer_in );
- gst_buffer_unref( buffer_in );
+ else
+ {
+ if ( mikmod->Buffer ) {
+ mikmod->Buffer = gst_buffer_append( mikmod->Buffer, buffer_in );
+ gst_buffer_unref( buffer_in );
+ }
+ else
+ mikmod->Buffer = buffer_in;
}
- else
- mikmod->Buffer = buffer_in;
}
if ( mikmod->_16bit )
@@ -346,6 +348,8 @@ gst_mikmod_loop (GstElement *element)
else
mode16bits = 8;
+ gst_mikmod_setup( mikmod );
+
MikMod_RegisterDriver(&drv_gst);
MikMod_RegisterAllLoaders();
@@ -373,8 +377,9 @@ gst_mikmod_loop (GstElement *element)
do {
if ( Player_Active() ) {
- drv_gst.Update();
+ timestamp = ( module->sngtime / 1024.0 ) * GST_SECOND;
+ drv_gst.Update();
gst_element_yield (element);
}
else {
@@ -438,7 +443,6 @@ GstMikMod *mikmod;
GST_DEBUG (0,"state pending %d", GST_STATE_PENDING (element));
- /* if going down into NULL state, close the file if it's open */
if (GST_STATE_PENDING (element) == GST_STATE_READY)
{
gst_mikmod_setup(mikmod);
@@ -469,7 +473,6 @@ GstMikMod *mikmod;
MikMod_Exit();
- /* if we haven't failed already, give the parent class a chance to ;-) */
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
@@ -611,7 +614,7 @@ plugin_init (GModule *module, GstPlugin *plugin)
factory = gst_element_factory_new("mikmod",GST_TYPE_MIKMOD,
&mikmod_details);
g_return_val_if_fail(factory != NULL, FALSE);
- gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_PRIMARY);
+ gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_SECONDARY);
gst_element_factory_add_pad_template (factory, mikmod_src_factory ());
gst_element_factory_add_pad_template (factory, mikmod_sink_factory ());
diff --git a/ext/mikmod/gstmikmod.h b/ext/mikmod/gstmikmod.h
index 94d5eed16..686c484a0 100644
--- a/ext/mikmod/gstmikmod.h
+++ b/ext/mikmod/gstmikmod.h
@@ -76,6 +76,7 @@ typedef struct _GstMikModClass GstMikModClass;
MODULE *module;
MREADER *reader;
GstPad *srcpad;
+gint64 timestamp;
int need_sync;
GType gst_mikmod_get_type(void);