- small cleanups
Original commit message from CVS: - small cleanups - fix offset - added blocksize property
This commit is contained in:
parent
ca27144625
commit
3faa5fd3df
@ -40,7 +40,8 @@ typedef struct _VorbisFileClass VorbisFileClass;
|
|||||||
struct _VorbisFile {
|
struct _VorbisFile {
|
||||||
GstElement element;
|
GstElement element;
|
||||||
|
|
||||||
GstPad *sinkpad,*srcpad;
|
GstPad *sinkpad,
|
||||||
|
*srcpad;
|
||||||
GstByteStream *bs;
|
GstByteStream *bs;
|
||||||
|
|
||||||
OggVorbis_File vf;
|
OggVorbis_File vf;
|
||||||
@ -57,6 +58,7 @@ struct _VorbisFile {
|
|||||||
gboolean may_eos;
|
gboolean may_eos;
|
||||||
guint64 total_bytes;
|
guint64 total_bytes;
|
||||||
guint64 offset;
|
guint64 offset;
|
||||||
|
gulong blocksize;
|
||||||
|
|
||||||
GstCaps *metadata;
|
GstCaps *metadata;
|
||||||
GstCaps *streaminfo;
|
GstCaps *streaminfo;
|
||||||
@ -90,9 +92,12 @@ enum
|
|||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define DEFAULT_BLOCKSIZE 4096
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ARG_0,
|
ARG_0,
|
||||||
|
ARG_BLOCKSIZE,
|
||||||
ARG_METADATA,
|
ARG_METADATA,
|
||||||
ARG_STREAMINFO
|
ARG_STREAMINFO
|
||||||
};
|
};
|
||||||
@ -175,6 +180,9 @@ gst_vorbisfile_class_init (VorbisFileClass * klass)
|
|||||||
|
|
||||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
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_object_class_install_property (gobject_class, ARG_METADATA,
|
||||||
g_param_spec_boxed ("metadata", "Metadata", "(logical) Stream metadata",
|
g_param_spec_boxed ("metadata", "Metadata", "(logical) Stream metadata",
|
||||||
GST_TYPE_CAPS, G_PARAM_READABLE));
|
GST_TYPE_CAPS, G_PARAM_READABLE));
|
||||||
@ -217,6 +225,7 @@ gst_vorbisfile_init (VorbisFile * vorbisfile)
|
|||||||
vorbisfile->metadata = NULL;
|
vorbisfile->metadata = NULL;
|
||||||
vorbisfile->streaminfo = NULL;
|
vorbisfile->streaminfo = NULL;
|
||||||
vorbisfile->current_link = -1;
|
vorbisfile->current_link = -1;
|
||||||
|
vorbisfile->blocksize = DEFAULT_BLOCKSIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the next four functions are the ov callbacks we provide to vorbisfile
|
/* the next four functions are the ov callbacks we provide to vorbisfile
|
||||||
@ -564,9 +573,7 @@ gst_vorbisfile_loop (GstElement *element)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
outbuf = gst_buffer_new ();
|
outbuf = gst_buffer_new_and_alloc (vorbisfile->blocksize);
|
||||||
GST_BUFFER_DATA (outbuf) = g_malloc (4096);
|
|
||||||
GST_BUFFER_SIZE (outbuf) = 4096;
|
|
||||||
|
|
||||||
/* get current time for discont and buffer timestamp */
|
/* get current time for discont and buffer timestamp */
|
||||||
time = (GstClockTime) (ov_time_tell (&vorbisfile->vf) * GST_SECOND);
|
time = (GstClockTime) (ov_time_tell (&vorbisfile->vf) * GST_SECOND);
|
||||||
@ -615,6 +622,7 @@ gst_vorbisfile_loop (GstElement *element)
|
|||||||
|
|
||||||
GST_BUFFER_SIZE (outbuf) = ret;
|
GST_BUFFER_SIZE (outbuf) = ret;
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) = time;
|
GST_BUFFER_TIMESTAMP (outbuf) = time;
|
||||||
|
GST_BUFFER_OFFSET (outbuf) = ov_pcm_tell (&vorbisfile->vf);
|
||||||
|
|
||||||
vorbisfile->may_eos = TRUE;
|
vorbisfile->may_eos = TRUE;
|
||||||
|
|
||||||
@ -1039,6 +1047,9 @@ gst_vorbisfile_set_property (GObject *object, guint prop_id,
|
|||||||
vorbisfile = GST_VORBISFILE (object);
|
vorbisfile = GST_VORBISFILE (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
|
case ARG_BLOCKSIZE:
|
||||||
|
vorbisfile->blocksize = g_value_get_ulong (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
g_warning ("Unknown property id\n");
|
g_warning ("Unknown property id\n");
|
||||||
}
|
}
|
||||||
@ -1055,6 +1066,9 @@ gst_vorbisfile_get_property (GObject *object, guint prop_id,
|
|||||||
vorbisfile = GST_VORBISFILE (object);
|
vorbisfile = GST_VORBISFILE (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
|
case ARG_BLOCKSIZE:
|
||||||
|
g_value_set_ulong (value, vorbisfile->blocksize);
|
||||||
|
break;
|
||||||
case ARG_METADATA:
|
case ARG_METADATA:
|
||||||
g_value_set_boxed (value, vorbisfile->metadata);
|
g_value_set_boxed (value, vorbisfile->metadata);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user