typedef struct _VorbisFileClass VorbisFileClass;
struct _VorbisFile {
- GstElement element;
+ GstElement element;
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad,
+ *srcpad;
GstByteStream *bs;
OggVorbis_File vf;
- gint current_link;
-
- gboolean restart;
- gboolean need_discont;
- gboolean eos;
- gboolean seek_pending;
- gint64 seek_value;
- GstFormat seek_format;
- gboolean seek_accurate;
-
- gboolean may_eos;
- guint64 total_bytes;
- guint64 offset;
-
- GstCaps *metadata;
- GstCaps *streaminfo;
+ gint current_link;
+
+ gboolean restart;
+ gboolean need_discont;
+ gboolean eos;
+ gboolean seek_pending;
+ gint64 seek_value;
+ GstFormat seek_format;
+ gboolean seek_accurate;
+
+ gboolean may_eos;
+ guint64 total_bytes;
+ guint64 offset;
+ gulong blocksize;
+
+ GstCaps *metadata;
+ GstCaps *streaminfo;
};
struct _VorbisFileClass {
LAST_SIGNAL
};
+#define DEFAULT_BLOCKSIZE 4096
+
enum
{
ARG_0,
+ ARG_BLOCKSIZE,
ARG_METADATA,
ARG_STREAMINFO
};
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCKSIZE,
+ g_param_spec_ulong ("blocksize", "Block size", "Size in bytes to read per buffer",
+ 1, G_MAXULONG, DEFAULT_BLOCKSIZE, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_METADATA,
g_param_spec_boxed ("metadata", "Metadata", "(logical) Stream metadata",
GST_TYPE_CAPS, G_PARAM_READABLE));
vorbisfile->metadata = NULL;
vorbisfile->streaminfo = NULL;
vorbisfile->current_link = -1;
+ vorbisfile->blocksize = DEFAULT_BLOCKSIZE;
}
/* the next four functions are the ov callbacks we provide to vorbisfile
return;
}
- outbuf = gst_buffer_new ();
- GST_BUFFER_DATA (outbuf) = g_malloc (4096);
- GST_BUFFER_SIZE (outbuf) = 4096;
+ outbuf = gst_buffer_new_and_alloc (vorbisfile->blocksize);
/* get current time for discont and buffer timestamp */
time = (GstClockTime) (ov_time_tell (&vorbisfile->vf) * GST_SECOND);
GST_BUFFER_SIZE (outbuf) = ret;
GST_BUFFER_TIMESTAMP (outbuf) = time;
+ GST_BUFFER_OFFSET (outbuf) = ov_pcm_tell (&vorbisfile->vf);
vorbisfile->may_eos = TRUE;
vorbisfile = GST_VORBISFILE (object);
switch (prop_id) {
+ case ARG_BLOCKSIZE:
+ vorbisfile->blocksize = g_value_get_ulong (value);
+ break;
default:
g_warning ("Unknown property id\n");
}
vorbisfile = GST_VORBISFILE (object);
switch (prop_id) {
+ case ARG_BLOCKSIZE:
+ g_value_set_ulong (value, vorbisfile->blocksize);
+ break;
case ARG_METADATA:
g_value_set_boxed (value, vorbisfile->metadata);
break;