gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_class_init) (gst_mpeg_parse_handle_discont, gst_mpeg_parse_send_newsegm...

Original commit message from CVS:
2005-11-23  Martin Soto  <martinsoto@users.sourceforge.net>

* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_class_init)
(gst_mpeg_parse_handle_discont, gst_mpeg_parse_send_newsegment)
(gst_mpeg_parse_chain):
* gst/mpegstream/gstmpegdemux.c (gst_mpeg_demux_class_init)
(gst_mpeg_demux_send_newsegment):
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegparse.h:
Rename send_discont method to send_newsegment and add parameters
to handle actual segments. Adapt code all around to run with the
new name and signature.
* gst/mpegstream/gstmpegdemux.c:
* gst/mpegstream/gstmpegparse.c:
* gst/mpegstream/gstdvddemux.c:
Convert to GST_BOILERPLATE.
This commit is contained in:
Martin Soto 2005-11-24 13:52:49 +00:00
parent 8e444f09eb
commit f51be26aa8
5 changed files with 115 additions and 149 deletions

View file

@ -1,3 +1,20 @@
2005-11-23 Martin Soto <martinsoto@users.sourceforge.net>
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_class_init)
(gst_mpeg_parse_handle_discont, gst_mpeg_parse_send_newsegment)
(gst_mpeg_parse_chain):
* gst/mpegstream/gstmpegdemux.c (gst_mpeg_demux_class_init)
(gst_mpeg_demux_send_newsegment):
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegparse.h:
Rename send_discont method to send_newsegment and add parameters
to handle actual segments. Adapt code all around to run with the
new name and signature.
* gst/mpegstream/gstmpegdemux.c:
* gst/mpegstream/gstmpegparse.c:
* gst/mpegstream/gstdvddemux.c:
Convert to GST_BOILERPLATE.
2005-11-23 Thomas Vander Stichele <thomas at apestaart dot org> 2005-11-23 Thomas Vander Stichele <thomas at apestaart dot org>
* configure.ac: back to HEAD * configure.ac: back to HEAD
@ -79,6 +96,7 @@
* ext/mad/Makefile.am: * ext/mad/Makefile.am:
libgsttagedit => libgsttag libgsttagedit => libgsttag
>>>>>>> 1.1895
2005-11-22 Edward Hervey <edward@fluendo.com> 2005-11-22 Edward Hervey <edward@fluendo.com>
* ext/lame/gstlame.c: (gst_lame_sink_event): * ext/lame/gstlame.c: (gst_lame_sink_event):

View file

@ -1,5 +1,5 @@
/* GStreamer /* GStreamer
* Copyright (C) 2004 Martin Soto <martinsoto@users.sourceforge.net> * Copyright (C) 2005 Martin Soto <martinsoto@users.sourceforge.net>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -47,7 +47,7 @@ static GstElementDetails dvd_demux_details = {
"DVD Demuxer", "DVD Demuxer",
"Codec/Demuxer", "Codec/Demuxer",
"Demultiplexes DVD (VOB) MPEG2 streams", "Demultiplexes DVD (VOB) MPEG2 streams",
"Martin Soto <soto@informatik.uni-kl.de>" "Martin Soto <martinsoto@users.sourceforge.net>"
}; };
/* DVDDemux signals and args */ /* DVDDemux signals and args */
@ -127,9 +127,17 @@ GST_STATIC_PAD_TEMPLATE ("current_subpicture",
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
SUBPICTURE_CAPS); SUBPICTURE_CAPS);
#define _do_init(bla) \
GST_DEBUG_CATEGORY_INIT (gstdvddemux_debug, "dvddemux", 0, \
"DVD (VOB) demultiplexer element");
GST_BOILERPLATE_FULL (GstDVDDemux, gst_dvd_demux, GstMPEGDemux,
GST_TYPE_MPEG_DEMUX, _do_init);
static void gst_dvd_demux_class_init (GstDVDDemuxClass * klass); static void gst_dvd_demux_class_init (GstDVDDemuxClass * klass);
static void gst_dvd_demux_base_init (GstDVDDemuxClass * klass); static void gst_dvd_demux_base_init (gpointer klass);
static void gst_dvd_demux_init (GstDVDDemux * dvd_demux); static void gst_dvd_demux_init (GstDVDDemux * dvd_demux,
GstDVDDemuxClass * klass);
static GstFlowReturn gst_dvd_demux_send_buffer (GstMPEGParse * mpeg_parse, static GstFlowReturn gst_dvd_demux_send_buffer (GstMPEGParse * mpeg_parse,
GstBuffer * buffer, GstClockTime time); GstBuffer * buffer, GstClockTime time);
@ -181,46 +189,16 @@ static void gst_dvd_demux_sync_stream_to_time (GstMPEGDemux * mpeg_demux,
static GstStateChangeReturn gst_dvd_demux_change_state (GstElement * element, static GstStateChangeReturn gst_dvd_demux_change_state (GstElement * element,
GstStateChange transition); GstStateChange transition);
static GstMPEGDemuxClass *parent_class = NULL;
/*static guint gst_dvd_demux_signals[LAST_SIGNAL] = { 0 };*/ /*static guint gst_dvd_demux_signals[LAST_SIGNAL] = { 0 };*/
GType
gst_dvd_demux_get_type (void)
{
static GType dvd_demux_type = 0;
if (!dvd_demux_type) {
static const GTypeInfo dvd_demux_info = {
sizeof (GstDVDDemuxClass),
(GBaseInitFunc) gst_dvd_demux_base_init,
NULL,
(GClassInitFunc) gst_dvd_demux_class_init,
NULL,
NULL,
sizeof (GstDVDDemux),
0,
(GInstanceInitFunc) gst_dvd_demux_init,
};
dvd_demux_type = g_type_register_static (GST_TYPE_MPEG_DEMUX,
"GstDVDDemux", &dvd_demux_info, 0);
GST_DEBUG_CATEGORY_INIT (gstdvddemux_debug, "dvddemux", 0,
"DVD (VOB) demultiplexer element");
}
return dvd_demux_type;
}
static void static void
gst_dvd_demux_base_init (GstDVDDemuxClass * klass) gst_dvd_demux_base_init (gpointer klass)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstMPEGParseClass *mpeg_parse_class = GST_MPEG_PARSE_CLASS (klass);
GstMPEGDemuxClass *demux_class = GST_MPEG_DEMUX_CLASS (klass); GstMPEGDemuxClass *demux_class = GST_MPEG_DEMUX_CLASS (klass);
GstMPEGParseClass *mpeg_parse_class = (GstMPEGParseClass *) klass; GstDVDDemuxClass *dvd_demux_class = GST_DVD_DEMUX_CLASS (klass);
mpeg_parse_class->send_buffer = gst_dvd_demux_send_buffer; mpeg_parse_class->send_buffer = gst_dvd_demux_send_buffer;
mpeg_parse_class->process_event = gst_dvd_demux_process_event; mpeg_parse_class->process_event = gst_dvd_demux_process_event;
@ -231,23 +209,27 @@ gst_dvd_demux_base_init (GstDVDDemuxClass * klass)
demux_class->audio_template = gst_static_pad_template_get (&audio_template); demux_class->audio_template = gst_static_pad_template_get (&audio_template);
klass->cur_video_template = gst_static_pad_template_get (&cur_video_template); dvd_demux_class->cur_video_template =
klass->cur_audio_template = gst_static_pad_template_get (&cur_audio_template); gst_static_pad_template_get (&cur_video_template);
klass->subpicture_template = dvd_demux_class->cur_audio_template =
gst_static_pad_template_get (&cur_audio_template);
dvd_demux_class->subpicture_template =
gst_static_pad_template_get (&subpicture_template); gst_static_pad_template_get (&subpicture_template);
klass->cur_subpicture_template = dvd_demux_class->cur_subpicture_template =
gst_static_pad_template_get (&cur_subpicture_template); gst_static_pad_template_get (&cur_subpicture_template);
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
demux_class->audio_template); demux_class->audio_template);
gst_element_class_add_pad_template (element_class, klass->cur_video_template); gst_element_class_add_pad_template (element_class,
gst_element_class_add_pad_template (element_class, klass->cur_audio_template); dvd_demux_class->cur_video_template);
gst_element_class_add_pad_template (element_class,
dvd_demux_class->cur_audio_template);
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
klass->subpicture_template); dvd_demux_class->subpicture_template);
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
klass->cur_subpicture_template); dvd_demux_class->cur_subpicture_template);
gst_element_class_set_details (element_class, &dvd_demux_details); gst_element_class_set_details (element_class, &dvd_demux_details);
} }
@ -283,7 +265,7 @@ gst_dvd_demux_class_init (GstDVDDemuxClass * klass)
static void static void
gst_dvd_demux_init (GstDVDDemux * dvd_demux) gst_dvd_demux_init (GstDVDDemux * dvd_demux, GstDVDDemuxClass * klass)
{ {
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (dvd_demux); GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (dvd_demux);
gint i; gint i;
@ -1084,8 +1066,8 @@ gst_dvd_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
GST_ERROR ("DVD Discont < 0! % " G_GINT64_FORMAT, GST_ERROR ("DVD Discont < 0! % " G_GINT64_FORMAT,
(gint64) dvd_demux->discont_time); (gint64) dvd_demux->discont_time);
} }
PARSE_CLASS (mpeg_demux)->send_discont (mpeg_parse, PARSE_CLASS (mpeg_demux)->send_newsegment (mpeg_parse, 1.0,
dvd_demux->discont_time); dvd_demux->discont_time, GST_CLOCK_TIME_NONE);
dvd_demux->discont_time = GST_CLOCK_TIME_NONE; dvd_demux->discont_time = GST_CLOCK_TIME_NONE;
} }

View file

@ -83,16 +83,21 @@ GST_STATIC_PAD_TEMPLATE ("private_%d",
GST_PAD_SOMETIMES, GST_PAD_SOMETIMES,
GST_STATIC_CAPS_ANY); GST_STATIC_CAPS_ANY);
static void gst_mpeg_demux_base_init (GstMPEGDemuxClass * klass); #define _do_init(bla) \
GST_DEBUG_CATEGORY_INIT (gstmpegdemux_debug, "mpegdemux", 0, \
"MPEG demuxer element");
GST_BOILERPLATE_FULL (GstMPEGDemux, gst_mpeg_demux, GstMPEGParse,
GST_TYPE_MPEG_PARSE, _do_init);
static void gst_mpeg_demux_class_init (GstMPEGDemuxClass * klass); static void gst_mpeg_demux_class_init (GstMPEGDemuxClass * klass);
static void gst_mpeg_demux_init (GstMPEGDemux * mpeg_demux);
static GstFlowReturn gst_mpeg_demux_send_buffer (GstMPEGParse * mpeg_parse, static GstFlowReturn gst_mpeg_demux_send_buffer (GstMPEGParse * mpeg_parse,
GstBuffer * buffer, GstClockTime time); GstBuffer * buffer, GstClockTime time);
static gboolean gst_mpeg_demux_process_event (GstMPEGParse * mpeg_parse, static gboolean gst_mpeg_demux_process_event (GstMPEGParse * mpeg_parse,
GstEvent * event, GstClockTime time); GstEvent * event, GstClockTime time);
static gboolean gst_mpeg_demux_send_discont (GstMPEGParse * mpeg_parse, static gboolean gst_mpeg_demux_send_newsegment (GstMPEGParse * parse,
GstClockTime time); gdouble rate, GstClockTime start_time, GstClockTime stop_time);
static gboolean gst_mpeg_demux_handle_discont (GstMPEGParse * mpeg_parse, static gboolean gst_mpeg_demux_handle_discont (GstMPEGParse * mpeg_parse,
GstEvent * event); GstEvent * event);
static gboolean gst_mpeg_demux_send_event (GstMPEGParse * mpeg_parse, static gboolean gst_mpeg_demux_send_event (GstMPEGParse * mpeg_parse,
@ -154,43 +159,13 @@ static void gst_mpeg_demux_set_index (GstElement * element, GstIndex * index);
static GstIndex *gst_mpeg_demux_get_index (GstElement * element); static GstIndex *gst_mpeg_demux_get_index (GstElement * element);
static GstMPEGParseClass *parent_class = NULL;
/*static guint gst_mpeg_demux_signals[LAST_SIGNAL] = { 0 };*/ /*static guint gst_mpeg_demux_signals[LAST_SIGNAL] = { 0 };*/
GType
gst_mpeg_demux_get_type (void)
{
static GType mpeg_demux_type = 0;
if (!mpeg_demux_type) {
static const GTypeInfo mpeg_demux_info = {
sizeof (GstMPEGDemuxClass),
(GBaseInitFunc) gst_mpeg_demux_base_init,
NULL,
(GClassInitFunc) gst_mpeg_demux_class_init,
NULL,
NULL,
sizeof (GstMPEGDemux),
0,
(GInstanceInitFunc) gst_mpeg_demux_init,
};
mpeg_demux_type =
g_type_register_static (GST_TYPE_MPEG_PARSE, "GstMPEGDemux",
&mpeg_demux_info, 0);
GST_DEBUG_CATEGORY_INIT (gstmpegdemux_debug, "mpegdemux", 0,
"MPEG demultiplexer element");
}
return mpeg_demux_type;
}
static void static void
gst_mpeg_demux_base_init (GstMPEGDemuxClass * klass) gst_mpeg_demux_base_init (gpointer klass_ptr)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstMPEGDemuxClass *klass = GST_MPEG_DEMUX_CLASS (klass_ptr);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass_ptr);
klass->video_template = gst_static_pad_template_get (&video_template); klass->video_template = gst_static_pad_template_get (&video_template);
klass->audio_template = gst_static_pad_template_get (&audio_template); klass->audio_template = gst_static_pad_template_get (&audio_template);
@ -225,7 +200,7 @@ gst_mpeg_demux_class_init (GstMPEGDemuxClass * klass)
mpeg_parse_class->parse_pes = gst_mpeg_demux_parse_pes; mpeg_parse_class->parse_pes = gst_mpeg_demux_parse_pes;
mpeg_parse_class->send_buffer = gst_mpeg_demux_send_buffer; mpeg_parse_class->send_buffer = gst_mpeg_demux_send_buffer;
mpeg_parse_class->process_event = gst_mpeg_demux_process_event; mpeg_parse_class->process_event = gst_mpeg_demux_process_event;
mpeg_parse_class->send_discont = gst_mpeg_demux_send_discont; mpeg_parse_class->send_newsegment = gst_mpeg_demux_send_newsegment;
mpeg_parse_class->handle_discont = gst_mpeg_demux_handle_discont; mpeg_parse_class->handle_discont = gst_mpeg_demux_handle_discont;
mpeg_parse_class->send_event = gst_mpeg_demux_send_event; mpeg_parse_class->send_event = gst_mpeg_demux_send_event;
@ -245,7 +220,7 @@ gst_mpeg_demux_class_init (GstMPEGDemuxClass * klass)
} }
static void static void
gst_mpeg_demux_init (GstMPEGDemux * mpeg_demux) gst_mpeg_demux_init (GstMPEGDemux * mpeg_demux, GstMPEGDemuxClass * klass)
{ {
gint i; gint i;
@ -298,25 +273,31 @@ gst_mpeg_demux_process_event (GstMPEGParse * mpeg_parse, GstEvent * event,
} }
static gboolean static gboolean
gst_mpeg_demux_send_discont (GstMPEGParse * mpeg_parse, GstClockTime time) gst_mpeg_demux_send_newsegment (GstMPEGParse * mpeg_parse, gdouble rate,
GstClockTime start_time, GstClockTime stop_time)
{ {
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse); GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
if (GST_CLOCK_TIME_IS_VALID (time)) g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (start_time), FALSE);
time += mpeg_demux->adjust;
start_time += mpeg_demux->adjust;
stop_time += mpeg_demux->adjust;
if (!mpeg_demux->just_flushed) { if (!mpeg_demux->just_flushed) {
GST_DEBUG_OBJECT (mpeg_parse, "Discont without flush, ts = %llu", time); GST_DEBUG_OBJECT (mpeg_parse, "NEWSEGMENT without flush, st = %llu",
start_time);
/* Add padding to the end to make sure all streams end at the same timestamp */ /* Add padding to the end to make sure all streams end at the same timestamp */
CLASS (mpeg_demux)->synchronise_pads (mpeg_demux, CLASS (mpeg_demux)->synchronise_pads (mpeg_demux,
mpeg_parse->current_ts + mpeg_demux->adjust + (GST_SECOND / 20), mpeg_parse->current_ts + mpeg_demux->adjust + (GST_SECOND / 20),
mpeg_parse->current_ts + mpeg_demux->adjust + (GST_SECOND / 20)); mpeg_parse->current_ts + mpeg_demux->adjust + (GST_SECOND / 20));
} else { } else {
GST_DEBUG_OBJECT (mpeg_parse, "Discont after flush, ts = %llu", time); GST_DEBUG_OBJECT (mpeg_parse, "NEWSEGMENT after flush, st = %llu",
start_time);
} }
mpeg_demux->just_flushed = FALSE; mpeg_demux->just_flushed = FALSE;
return parent_class->send_discont (mpeg_parse, time); return parent_class->send_newsegment (mpeg_parse, rate, start_time,
stop_time);
} }
static gboolean static gboolean
@ -1054,7 +1035,6 @@ gst_mpeg_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
GST_BUFFER_TIMESTAMP (outbuf) = timestamp; GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET (buffer) + offset; GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET (buffer) + offset;
g_print ("pushing buffer %p\n", GST_BUFFER (outbuf));
ret = gst_pad_push (outstream->pad, outbuf); ret = gst_pad_push (outstream->pad, outbuf);
if (GST_CLOCK_TIME_IS_VALID (mpeg_demux->max_gap) && if (GST_CLOCK_TIME_IS_VALID (mpeg_demux->max_gap) &&

View file

@ -86,9 +86,14 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
"mpegversion = (int) [ 1, 2 ], " "systemstream = (boolean) TRUE") "mpegversion = (int) [ 1, 2 ], " "systemstream = (boolean) TRUE")
); );
#define _do_init(bla) \
GST_DEBUG_CATEGORY_INIT (gstmpegparse_debug, "mpegparse", 0, \
"MPEG parser element");
GST_BOILERPLATE_FULL (GstMPEGParse, gst_mpeg_parse, GstElement,
GST_TYPE_ELEMENT, _do_init);
static void gst_mpeg_parse_class_init (GstMPEGParseClass * klass); static void gst_mpeg_parse_class_init (GstMPEGParseClass * klass);
static void gst_mpeg_parse_base_init (GstMPEGParseClass * klass);
static void gst_mpeg_parse_init (GstMPEGParse * mpeg_parse);
static GstStateChangeReturn gst_mpeg_parse_change_state (GstElement * element, static GstStateChangeReturn gst_mpeg_parse_change_state (GstElement * element,
GstStateChange transition); GstStateChange transition);
@ -106,8 +111,8 @@ static GstFlowReturn gst_mpeg_parse_send_buffer (GstMPEGParse * mpeg_parse,
GstBuffer * buffer, GstClockTime time); GstBuffer * buffer, GstClockTime time);
static GstFlowReturn gst_mpeg_parse_process_event (GstMPEGParse * mpeg_parse, static GstFlowReturn gst_mpeg_parse_process_event (GstMPEGParse * mpeg_parse,
GstEvent * event, GstClockTime time); GstEvent * event, GstClockTime time);
static GstFlowReturn gst_mpeg_parse_send_discont (GstMPEGParse * mpeg_parse, static GstFlowReturn gst_mpeg_parse_send_newsegment (GstMPEGParse * parse,
GstClockTime time); gdouble rate, GstClockTime start_time, GstClockTime stop_time);
static gboolean gst_mpeg_parse_send_event (GstMPEGParse * mpeg_parse, static gboolean gst_mpeg_parse_send_event (GstMPEGParse * mpeg_parse,
GstEvent * event, GstClockTime time); GstEvent * event, GstClockTime time);
@ -123,40 +128,10 @@ static void gst_mpeg_parse_set_property (GObject * object, guint prop_id,
static void gst_mpeg_parse_set_index (GstElement * element, GstIndex * index); static void gst_mpeg_parse_set_index (GstElement * element, GstIndex * index);
static GstIndex *gst_mpeg_parse_get_index (GstElement * element); static GstIndex *gst_mpeg_parse_get_index (GstElement * element);
static GstElementClass *parent_class = NULL;
static guint gst_mpeg_parse_signals[LAST_SIGNAL] = { 0 }; static guint gst_mpeg_parse_signals[LAST_SIGNAL] = { 0 };
GType
gst_mpeg_parse_get_type (void)
{
static GType mpeg_parse_type = 0;
if (!mpeg_parse_type) {
static const GTypeInfo mpeg_parse_info = {
sizeof (GstMPEGParseClass),
(GBaseInitFunc) gst_mpeg_parse_base_init,
NULL,
(GClassInitFunc) gst_mpeg_parse_class_init,
NULL,
NULL,
sizeof (GstMPEGParse),
0,
(GInstanceInitFunc) gst_mpeg_parse_init,
};
mpeg_parse_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstMPEGParse",
&mpeg_parse_info, 0);
GST_DEBUG_CATEGORY_INIT (gstmpegparse_debug, "mpegparse", 0,
"MPEG parser element");
}
return mpeg_parse_type;
}
static void static void
gst_mpeg_parse_base_init (GstMPEGParseClass * klass) gst_mpeg_parse_base_init (gpointer klass)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@ -195,7 +170,7 @@ gst_mpeg_parse_class_init (GstMPEGParseClass * klass)
klass->handle_discont = gst_mpeg_parse_handle_discont; klass->handle_discont = gst_mpeg_parse_handle_discont;
klass->send_buffer = gst_mpeg_parse_send_buffer; klass->send_buffer = gst_mpeg_parse_send_buffer;
klass->process_event = gst_mpeg_parse_process_event; klass->process_event = gst_mpeg_parse_process_event;
klass->send_discont = gst_mpeg_parse_send_discont; klass->send_newsegment = gst_mpeg_parse_send_newsegment;
klass->send_event = gst_mpeg_parse_send_event; klass->send_event = gst_mpeg_parse_send_event;
/* FIXME: this is a hack. We add the pad templates here instead /* FIXME: this is a hack. We add the pad templates here instead
@ -229,16 +204,18 @@ gst_mpeg_parse_class_init (GstMPEGParseClass * klass)
} }
static void static void
gst_mpeg_parse_init (GstMPEGParse * mpeg_parse) gst_mpeg_parse_init (GstMPEGParse * mpeg_parse, GstMPEGParseClass * klass)
{ {
GstElementClass *klass = GST_ELEMENT_GET_CLASS (mpeg_parse); GstElementClass *gstelement_class;
GstPadTemplate *templ; GstPadTemplate *templ;
templ = gst_element_class_get_pad_template (klass, "sink"); gstelement_class = GST_ELEMENT_GET_CLASS (mpeg_parse);
templ = gst_element_class_get_pad_template (gstelement_class, "sink");
mpeg_parse->sinkpad = gst_pad_new_from_template (templ, "sink"); mpeg_parse->sinkpad = gst_pad_new_from_template (templ, "sink");
gst_element_add_pad (GST_ELEMENT (mpeg_parse), mpeg_parse->sinkpad); gst_element_add_pad (GST_ELEMENT (mpeg_parse), mpeg_parse->sinkpad);
if ((templ = gst_element_class_get_pad_template (klass, "src"))) { if ((templ = gst_element_class_get_pad_template (gstelement_class, "src"))) {
mpeg_parse->srcpad = gst_pad_new_from_template (templ, "src"); mpeg_parse->srcpad = gst_pad_new_from_template (templ, "src");
gst_element_add_pad (GST_ELEMENT (mpeg_parse), mpeg_parse->srcpad); gst_element_add_pad (GST_ELEMENT (mpeg_parse), mpeg_parse->srcpad);
gst_pad_set_event_function (mpeg_parse->srcpad, gst_pad_set_event_function (mpeg_parse->srcpad,
@ -348,8 +325,9 @@ gst_mpeg_parse_handle_discont (GstMPEGParse * mpeg_parse, GstEvent * event)
GST_DEBUG_OBJECT (mpeg_parse, "forwarding discontinuity, time: %0.3fs", GST_DEBUG_OBJECT (mpeg_parse, "forwarding discontinuity, time: %0.3fs",
(double) time / GST_SECOND); (double) time / GST_SECOND);
if (CLASS (mpeg_parse)->send_discont) if (CLASS (mpeg_parse)->send_newsegment)
ret = CLASS (mpeg_parse)->send_discont (mpeg_parse, time); ret = CLASS (mpeg_parse)->send_newsegment (mpeg_parse, 1.0, time,
GST_CLOCK_TIME_NONE);
} else { } else {
/* Use the next SCR to send a discontinuous event. */ /* Use the next SCR to send a discontinuous event. */
GST_DEBUG_OBJECT (mpeg_parse, "Using next SCR to send discont"); GST_DEBUG_OBJECT (mpeg_parse, "Using next SCR to send discont");
@ -402,15 +380,17 @@ gst_mpeg_parse_process_event (GstMPEGParse * mpeg_parse, GstEvent * event,
} }
static gboolean static gboolean
gst_mpeg_parse_send_discont (GstMPEGParse * mpeg_parse, GstClockTime time) gst_mpeg_parse_send_newsegment (GstMPEGParse * mpeg_parse, gdouble rate,
GstClockTime start_time, GstClockTime stop_time)
{ {
GstEvent *event; GstEvent *event;
event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, time, event = gst_event_new_new_segment (FALSE, rate, GST_FORMAT_TIME, start_time,
GST_CLOCK_TIME_NONE, (gint64) 0); stop_time, (gint64) 0);
if (CLASS (mpeg_parse)->send_event) if (CLASS (mpeg_parse)->send_event) {
return CLASS (mpeg_parse)->send_event (mpeg_parse, event, time); return CLASS (mpeg_parse)->send_event (mpeg_parse, event, start_time);
}
return FALSE; return FALSE;
} }
@ -709,10 +689,10 @@ gst_mpeg_parse_chain (GstPad * pad, GstBuffer * buffer)
MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr)); MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr));
} }
#endif #endif
if (CLASS (mpeg_parse)->send_discont) { if (CLASS (mpeg_parse)->send_newsegment) {
CLASS (mpeg_parse)->send_discont (mpeg_parse, CLASS (mpeg_parse)->send_newsegment (mpeg_parse, 1.0,
MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr + MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr +
mpeg_parse->adjust)); mpeg_parse->adjust), GST_CLOCK_TIME_NONE);
} }
mpeg_parse->discont_pending = FALSE; mpeg_parse->discont_pending = FALSE;
} else { } else {

View file

@ -117,13 +117,19 @@ G_BEGIN_DECLS
GstFlowReturn (*handle_discont) (GstMPEGParse * parse, GstEvent * event); GstFlowReturn (*handle_discont) (GstMPEGParse * parse, GstEvent * event);
/* optional method to send out the data */ /* optional method to send out the data */
GstFlowReturn (*send_buffer) (GstMPEGParse * parse, GstBuffer * buffer, GstClockTime time); GstFlowReturn (*send_buffer) (GstMPEGParse * parse,
gboolean (*process_event) (GstMPEGParse * parse, GstEvent * event, GstClockTime time); GstBuffer * buffer, GstClockTime time);
gboolean (*send_discont) (GstMPEGParse * parse, GstClockTime time); gboolean (*process_event) (GstMPEGParse * parse,
gboolean (*send_event) (GstMPEGParse * parse, GstEvent *event, GstClockTime time); GstEvent * event, GstClockTime time);
gboolean (*send_newsegment)(GstMPEGParse * parse, gdouble rate,
GstClockTime start_time,
GstClockTime stop_time);
gboolean (*send_event) (GstMPEGParse * parse, GstEvent *event,
GstClockTime time);
/* signals */ /* signals */
void (*reached_offset) (GstMPEGParse *parse, GstClockTime timeval); void (*reached_offset) (GstMPEGParse *parse,
GstClockTime timeval);
}; };
GType gst_mpeg_parse_get_type (void); GType gst_mpeg_parse_get_type (void);