mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
somewhat fix modplug
Original commit message from CVS: somewhat fix modplug
This commit is contained in:
parent
8f7f77e5e6
commit
52838dd8aa
2 changed files with 16 additions and 86 deletions
|
@ -345,12 +345,6 @@ gst_modplug_init (GstModPlug *modplug)
|
||||||
modplug->channel = 2;
|
modplug->channel = 2;
|
||||||
modplug->frequency = 44100;
|
modplug->frequency = 44100;
|
||||||
|
|
||||||
modplug->buffer_in = (guint8 *) g_malloc( 1024 *1024 * 2 );
|
|
||||||
modplug->state = MODPLUG_STATE_NEED_TUNE;
|
|
||||||
|
|
||||||
modplug->metadata = NULL;
|
|
||||||
modplug->streaminfo = NULL;
|
|
||||||
|
|
||||||
/*modplug->bs = NULL;*/
|
/*modplug->bs = NULL;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,9 +459,6 @@ gst_modplug_src_event (GstPad *pad, GstEvent *event)
|
||||||
/* shave off the flush flag, we'll need it later */
|
/* shave off the flush flag, we'll need it later */
|
||||||
flush = GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH;
|
flush = GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH;
|
||||||
|
|
||||||
/* assume the worst */
|
|
||||||
res = FALSE;
|
|
||||||
|
|
||||||
modplug->seek_at = GST_EVENT_SEEK_OFFSET (event);
|
modplug->seek_at = GST_EVENT_SEEK_OFFSET (event);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -606,52 +597,6 @@ modplug_negotiate (GstModPlug *modplug)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gst_modplug_handle_event (GstPad *pad, GstBuffer *buffer)
|
|
||||||
{
|
|
||||||
GstEvent *event = GST_EVENT (buffer);
|
|
||||||
GstModPlug *modplug = GST_MODPLUG (gst_pad_get_parent (pad));
|
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event))
|
|
||||||
{
|
|
||||||
case GST_EVENT_DISCONTINUOUS:
|
|
||||||
{
|
|
||||||
gint n = GST_EVENT_DISCONT_OFFSET_LEN (event);
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
const GstFormat *formats;
|
|
||||||
|
|
||||||
formats = gst_pad_get_formats (pad);
|
|
||||||
|
|
||||||
if (gst_formats_contains (formats,
|
|
||||||
GST_EVENT_DISCONT_OFFSET(event, i).format))
|
|
||||||
{
|
|
||||||
gint64 value = GST_EVENT_DISCONT_OFFSET (event, i).value;
|
|
||||||
GstEvent *discont;
|
|
||||||
|
|
||||||
gst_event_unref (event);
|
|
||||||
|
|
||||||
if (GST_PAD_IS_USABLE (modplug->srcpad))
|
|
||||||
{
|
|
||||||
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
|
|
||||||
value, NULL);
|
|
||||||
gst_pad_push (modplug->srcpad, GST_BUFFER (discont));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
modplug->state = MODPLUG_STATE_NEED_TUNE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_modplug_loop (GstElement *element)
|
gst_modplug_loop (GstElement *element)
|
||||||
{
|
{
|
||||||
|
@ -698,13 +643,6 @@ gst_modplug_loop (GstElement *element)
|
||||||
|
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* modplug->song_size = gst_bytestream_length (modplug->bs);
|
|
||||||
modplug->bytes_read = gst_bytestream_peek_bytes (modplug->bs, &modplug->buffer_in, modplug->song_size);
|
|
||||||
if (modplug->bytes_read != modplug->song_size )
|
|
||||||
gst_element_error (GST_ELEMENT (modplug), "could not read data %lld asked, %lld gotten", modplug->song_size, modplug->bytes_read);
|
|
||||||
|
|
||||||
modplug->state = MODPLUG_STATE_LOAD_TUNE;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modplug->state == MODPLUG_STATE_LOAD_TUNE)
|
if (modplug->state == MODPLUG_STATE_LOAD_TUNE)
|
||||||
|
@ -728,13 +666,6 @@ gst_modplug_loop (GstElement *element)
|
||||||
|
|
||||||
if (modplug->state == MODPLUG_STATE_PLAY_TUNE)
|
if (modplug->state == MODPLUG_STATE_PLAY_TUNE)
|
||||||
{
|
{
|
||||||
GstBuffer *buf;
|
|
||||||
|
|
||||||
/* Pull a buffer to handle events */
|
|
||||||
buf = gst_pad_pull (modplug->sinkpad);
|
|
||||||
if (GST_IS_EVENT (buf))
|
|
||||||
gst_modplug_handle_event (modplug->sinkpad, buf);
|
|
||||||
|
|
||||||
if (modplug->seek_at != -1)
|
if (modplug->seek_at != -1)
|
||||||
{
|
{
|
||||||
gint seek_to_pos;
|
gint seek_to_pos;
|
||||||
|
@ -799,8 +730,10 @@ gst_modplug_change_state (GstElement *element)
|
||||||
case GST_STATE_NULL_TO_READY:
|
case GST_STATE_NULL_TO_READY:
|
||||||
case GST_STATE_READY_TO_PAUSED:
|
case GST_STATE_READY_TO_PAUSED:
|
||||||
modplug->song_size = 0;
|
modplug->song_size = 0;
|
||||||
/* if ( modplug->bs == NULL )
|
modplug->buffer_in = (guint8 *) g_malloc( 1024 *1024 * 2 );
|
||||||
modplug->bs = gst_bytestream_new (modplug->sinkpad);*/
|
modplug->state = MODPLUG_STATE_NEED_TUNE;
|
||||||
|
modplug->metadata = NULL;
|
||||||
|
modplug->streaminfo = NULL;
|
||||||
break;
|
break;
|
||||||
case GST_STATE_PAUSED_TO_PLAYING:
|
case GST_STATE_PAUSED_TO_PLAYING:
|
||||||
break;
|
break;
|
||||||
|
@ -810,7 +743,6 @@ gst_modplug_change_state (GstElement *element)
|
||||||
/*gst_bytestream_destroy (modplug->bs);*/
|
/*gst_bytestream_destroy (modplug->bs);*/
|
||||||
modplug->mSoundFile->Destroy ();
|
modplug->mSoundFile->Destroy ();
|
||||||
g_free (modplug->audiobuffer);
|
g_free (modplug->audiobuffer);
|
||||||
/* modplug->bs = NULL;*/
|
|
||||||
modplug->audiobuffer = NULL;
|
modplug->audiobuffer = NULL;
|
||||||
break;
|
break;
|
||||||
case GST_STATE_READY_TO_NULL:
|
case GST_STATE_READY_TO_NULL:
|
||||||
|
|
|
@ -28,7 +28,6 @@ extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
/*#include <gst/bytestream/bytestream.h>*/
|
|
||||||
|
|
||||||
#include "modplug_types.h"
|
#include "modplug_types.h"
|
||||||
|
|
||||||
|
@ -48,7 +47,6 @@ struct _GstModPlug {
|
||||||
GstElement element;
|
GstElement element;
|
||||||
GstPad *sinkpad, *srcpad;
|
GstPad *sinkpad, *srcpad;
|
||||||
guint8 *buffer_in;
|
guint8 *buffer_in;
|
||||||
/*GstByteStream *bs;*/
|
|
||||||
GstCaps *metadata;
|
GstCaps *metadata;
|
||||||
GstCaps *streaminfo;
|
GstCaps *streaminfo;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue