mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
handle _TIME and _BYTE queries
Original commit message from CVS: handle _TIME and _BYTE queries
This commit is contained in:
parent
2281efe704
commit
7c78fde400
3 changed files with 37 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
2004-03-06 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* ext/vorbis/vorbis.c: (plugin_init):
|
||||
* ext/vorbis/vorbisdec.c: (vorbis_dec_get_formats),
|
||||
(gst_vorbis_dec_init), (vorbis_dec_event):
|
||||
add debug category
|
||||
make vorbisdec handle _BYTE and _TIME queries
|
||||
|
||||
2004-03-06 Christophe Fergeau <teuf@gnome.org>
|
||||
|
||||
* ext/mad/gstmad.c: (gst_mad_chain): send the average bitrate read
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include "vorbisenc.h"
|
||||
#include "vorbisdec.h"
|
||||
|
||||
GST_DEBUG_CATEGORY (vorbisdec_debug);
|
||||
|
||||
extern GType vorbisfile_get_type(void);
|
||||
|
||||
static gboolean
|
||||
|
@ -44,6 +46,7 @@ plugin_init (GstPlugin *plugin)
|
|||
if (!gst_element_register (plugin, "vorbisdec", GST_RANK_PRIMARY, gst_vorbis_dec_get_type ()))
|
||||
return FALSE;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (vorbisdec_debug, "vorbisdec", 0, "vorbis decoding element");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
#include <string.h>
|
||||
#include <gst/tag/tag.h>
|
||||
|
||||
GST_DEBUG_CATEGORY_EXTERN (vorbisdec_debug);
|
||||
#define GST_CAT_DEFAULT vorbisdec_debug
|
||||
|
||||
static GstElementDetails vorbis_dec_details = {
|
||||
"VorbisDec",
|
||||
"Codec/Decoder/Audio",
|
||||
|
@ -78,6 +81,9 @@ static void vorbis_dec_chain (GstPad * pad,
|
|||
GstData * data);
|
||||
static GstElementStateReturn
|
||||
vorbis_dec_change_state (GstElement * element);
|
||||
static const GstFormat*
|
||||
vorbis_dec_get_formats (GstPad *pad);
|
||||
|
||||
static gboolean vorbis_dec_src_event (GstPad * pad,
|
||||
GstEvent * event);
|
||||
static gboolean vorbis_dec_src_query (GstPad * pad,
|
||||
|
@ -106,6 +112,23 @@ gst_vorbis_dec_class_init (GstVorbisDecClass *klass)
|
|||
gstelement_class->change_state = vorbis_dec_change_state;
|
||||
}
|
||||
|
||||
static const GstFormat *
|
||||
vorbis_dec_get_formats (GstPad *pad)
|
||||
{
|
||||
static const GstFormat src_formats[] = {
|
||||
GST_FORMAT_BYTES,
|
||||
GST_FORMAT_DEFAULT,
|
||||
GST_FORMAT_TIME,
|
||||
0
|
||||
};
|
||||
static const GstFormat sink_formats[] = {
|
||||
GST_FORMAT_BYTES,
|
||||
GST_FORMAT_TIME,
|
||||
0
|
||||
};
|
||||
return (GST_PAD_IS_SRC (pad) ? src_formats : sink_formats);
|
||||
}
|
||||
|
||||
static GstPadLinkReturn
|
||||
vorbis_dec_link (GstPad *pad, const GstCaps *caps)
|
||||
{
|
||||
|
@ -143,6 +166,7 @@ gst_vorbis_dec_init (GstVorbisDec *dec)
|
|||
dec->sinkpad = gst_pad_new_from_template(
|
||||
gst_static_pad_template_get (&vorbis_dec_sink_factory), "sink");
|
||||
gst_pad_set_chain_function (dec->sinkpad, vorbis_dec_chain);
|
||||
gst_pad_set_formats_function (dec->sinkpad, vorbis_dec_get_formats);
|
||||
gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
|
||||
|
||||
dec->srcpad = gst_pad_new_from_template(
|
||||
|
@ -151,6 +175,7 @@ gst_vorbis_dec_init (GstVorbisDec *dec)
|
|||
gst_pad_set_getcaps_function (dec->srcpad, vorbis_dec_getcaps);
|
||||
gst_pad_set_event_function (dec->srcpad, vorbis_dec_src_event);
|
||||
gst_pad_set_query_function (dec->srcpad, vorbis_dec_src_query);
|
||||
gst_pad_set_formats_function (dec->srcpad, vorbis_dec_get_formats);
|
||||
gst_element_add_pad (GST_ELEMENT (dec), dec->srcpad);
|
||||
|
||||
GST_FLAG_SET (dec, GST_ELEMENT_EVENT_AWARE);
|
||||
|
@ -254,7 +279,7 @@ vorbis_dec_event (GstVorbisDec *dec, GstEvent *event)
|
|||
case GST_EVENT_DISCONTINUOUS:
|
||||
if (gst_event_discont_get_value (event, GST_FORMAT_DEFAULT, &value)) {
|
||||
dec->granulepos = value;
|
||||
GST_DEBUG_OBJECT (dec, "setting granuleposition to %"G_GUINT64_FORMAT" after discont\n", value);
|
||||
GST_DEBUG_OBJECT (dec, "setting granuleposition to %"G_GUINT64_FORMAT" after discont", value);
|
||||
} else {
|
||||
GST_WARNING_OBJECT (dec,
|
||||
"discont event didn't include offset, we might set it wrong now");
|
||||
|
|
Loading…
Reference in a new issue