mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
ext/mpeg2dec/gstmpeg2dec.c: Set DELTA_UNIT flag on outgoing buffers if this is NOT a keyframe; nice-ify debug message...
Original commit message from CVS: * ext/mpeg2dec/gstmpeg2dec.c: (handle_slice), (gst_mpeg2dec_sink_event): Set DELTA_UNIT flag on outgoing buffers if this is NOT a keyframe; nice-ify debug message in event handler; add CHECKME. * gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_process_event), (gst_dvd_demux_send_event), (gst_dvd_demux_process_private), (gst_dvd_demux_send_subbuffer), (gst_dvd_demux_reset), (gst_dvd_demux_sync_stream_to_time): * gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init), (gst_mpeg_demux_process_event), (gst_mpeg_demux_send_event), (gst_mpeg_demux_handle_discont), (gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_parse_packet), (gst_mpeg_demux_parse_pes), (gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_process_private), (gst_mpeg_demux_sync_stream_to_time), (gst_mpeg_demux_handle_src_event), (gst_mpeg_demux_reset): * gst/mpegstream/gstmpegdemux.h: * gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_init), (gst_mpeg_parse_handle_discont), (gst_mpeg_parse_send_buffer), (gst_mpeg_parse_process_event), (gst_mpeg_parse_send_discont), (gst_mpeg_parse_send_event), (gst_mpeg_parse_event), (gst_mpeg_parse_chain): * gst/mpegstream/gstmpegparse.h: Get rid of GST_PAD_IS_USABLE and fix GstFlowReturn vs. gboolean return value confusion (gst_pad_push vs. gst_pad_send_event and gst_pad_push_event); pass flow return values to caller; miscellaneous fixes and clean-ups.
This commit is contained in:
parent
6bd2b6cc59
commit
cbc750649e
7 changed files with 214 additions and 195 deletions
30
ChangeLog
30
ChangeLog
|
@ -1,3 +1,33 @@
|
||||||
|
2005-11-15 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* ext/mpeg2dec/gstmpeg2dec.c: (handle_slice),
|
||||||
|
(gst_mpeg2dec_sink_event):
|
||||||
|
Set DELTA_UNIT flag on outgoing buffers if this is NOT a keyframe;
|
||||||
|
nice-ify debug message in event handler; add CHECKME.
|
||||||
|
|
||||||
|
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_process_event),
|
||||||
|
(gst_dvd_demux_send_event), (gst_dvd_demux_process_private),
|
||||||
|
(gst_dvd_demux_send_subbuffer), (gst_dvd_demux_reset),
|
||||||
|
(gst_dvd_demux_sync_stream_to_time):
|
||||||
|
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
|
||||||
|
(gst_mpeg_demux_process_event), (gst_mpeg_demux_send_event),
|
||||||
|
(gst_mpeg_demux_handle_discont), (gst_mpeg_demux_new_output_pad),
|
||||||
|
(gst_mpeg_demux_parse_packet), (gst_mpeg_demux_parse_pes),
|
||||||
|
(gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_process_private),
|
||||||
|
(gst_mpeg_demux_sync_stream_to_time),
|
||||||
|
(gst_mpeg_demux_handle_src_event), (gst_mpeg_demux_reset):
|
||||||
|
* gst/mpegstream/gstmpegdemux.h:
|
||||||
|
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_init),
|
||||||
|
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_send_buffer),
|
||||||
|
(gst_mpeg_parse_process_event), (gst_mpeg_parse_send_discont),
|
||||||
|
(gst_mpeg_parse_send_event), (gst_mpeg_parse_event),
|
||||||
|
(gst_mpeg_parse_chain):
|
||||||
|
* gst/mpegstream/gstmpegparse.h:
|
||||||
|
Get rid of GST_PAD_IS_USABLE and fix GstFlowReturn vs. gboolean
|
||||||
|
return value confusion (gst_pad_push vs. gst_pad_send_event and
|
||||||
|
gst_pad_push_event); pass flow return values to caller;
|
||||||
|
miscellaneous fixes and clean-ups.
|
||||||
|
|
||||||
2005-11-14 Martin Soto <soto@localhost.localdomain>
|
2005-11-14 Martin Soto <soto@localhost.localdomain>
|
||||||
|
|
||||||
* gst/mpegstream/Makefile.am (noinst_HEADERS): Add
|
* gst/mpegstream/Makefile.am (noinst_HEADERS): Add
|
||||||
|
|
|
@ -633,7 +633,7 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (mpeg2dec, "picture keyframe %d", key_frame);
|
GST_DEBUG_OBJECT (mpeg2dec, "picture keyframe %d", key_frame);
|
||||||
|
|
||||||
if (key_frame)
|
if (!key_frame)
|
||||||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||||
else
|
else
|
||||||
GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
|
GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||||
|
@ -706,8 +706,11 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
|
||||||
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)));
|
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)));
|
||||||
|
|
||||||
if ((mpeg2dec->decoded_height > mpeg2dec->height) ||
|
if ((mpeg2dec->decoded_height > mpeg2dec->height) ||
|
||||||
(mpeg2dec->decoded_width > mpeg2dec->width))
|
(mpeg2dec->decoded_width > mpeg2dec->width)) {
|
||||||
|
/* CHECKME: this might unref outbuf and return a new buffer.
|
||||||
|
* Does this affect the info->discard_fbuf stuff below? */
|
||||||
outbuf = crop_buffer (mpeg2dec, outbuf);
|
outbuf = crop_buffer (mpeg2dec, outbuf);
|
||||||
|
}
|
||||||
|
|
||||||
gst_buffer_ref (outbuf);
|
gst_buffer_ref (outbuf);
|
||||||
ret = gst_pad_push (mpeg2dec->srcpad, outbuf);
|
ret = gst_pad_push (mpeg2dec->srcpad, outbuf);
|
||||||
|
@ -883,6 +886,9 @@ gst_mpeg2dec_sink_event (GstPad * pad, GstEvent * event)
|
||||||
GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (GST_PAD_PARENT (pad));
|
GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (GST_PAD_PARENT (pad));
|
||||||
gboolean ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (mpeg2dec, "Got %s event on sink pad",
|
||||||
|
GST_EVENT_TYPE_NAME (event));
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_NEWSEGMENT:
|
case GST_EVENT_NEWSEGMENT:
|
||||||
{
|
{
|
||||||
|
@ -913,8 +919,6 @@ gst_mpeg2dec_sink_event (GstPad * pad, GstEvent * event)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
GST_DEBUG_OBJECT (mpeg2dec, "Got event of type %d on sink pad",
|
|
||||||
GST_EVENT_TYPE (event));
|
|
||||||
ret = gst_pad_event_default (pad, event);
|
ret = gst_pad_event_default (pad, event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,16 +133,16 @@ static void gst_dvd_demux_init (GstDVDDemux * dvd_demux);
|
||||||
|
|
||||||
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);
|
||||||
static GstFlowReturn gst_dvd_demux_process_event (GstMPEGParse * mpeg_parse,
|
static gboolean gst_dvd_demux_process_event (GstMPEGParse * mpeg_parse,
|
||||||
GstEvent * event, GstClockTime time);
|
GstEvent * event, GstClockTime time);
|
||||||
|
|
||||||
static GstFlowReturn gst_dvd_demux_handle_discont
|
static gboolean gst_dvd_demux_handle_discont
|
||||||
(GstMPEGParse * mpeg_parse, GstEvent * event);
|
(GstMPEGParse * mpeg_parse, GstEvent * event);
|
||||||
#if 0
|
#if 0
|
||||||
static GstFlowReturn gst_dvd_demux_handle_dvd_event
|
static gboolean gst_dvd_demux_handle_dvd_event
|
||||||
(GstDVDDemux * dvd_demux, GstEvent * event);
|
(GstDVDDemux * dvd_demux, GstEvent * event);
|
||||||
#endif
|
#endif
|
||||||
static GstFlowReturn gst_dvd_demux_send_event
|
static gboolean gst_dvd_demux_send_event
|
||||||
(GstMPEGParse * mpeg_parse, GstEvent * event, GstClockTime time);
|
(GstMPEGParse * mpeg_parse, GstEvent * event, GstClockTime time);
|
||||||
|
|
||||||
static GstMPEGStream *gst_dvd_demux_get_video_stream
|
static GstMPEGStream *gst_dvd_demux_get_video_stream
|
||||||
|
@ -155,12 +155,12 @@ static GstMPEGStream *gst_dvd_demux_get_subpicture_stream
|
||||||
(GstMPEGDemux * dvd_demux,
|
(GstMPEGDemux * dvd_demux,
|
||||||
guint8 stream_nr, gint type, const gpointer info);
|
guint8 stream_nr, gint type, const gpointer info);
|
||||||
|
|
||||||
static void gst_dvd_demux_process_private
|
static GstFlowReturn gst_dvd_demux_process_private
|
||||||
(GstMPEGDemux * mpeg_demux,
|
(GstMPEGDemux * mpeg_demux,
|
||||||
GstBuffer * buffer,
|
GstBuffer * buffer,
|
||||||
guint stream_nr, GstClockTime timestamp, guint headerlen, guint datalen);
|
guint stream_nr, GstClockTime timestamp, guint headerlen, guint datalen);
|
||||||
|
|
||||||
static void gst_dvd_demux_send_subbuffer
|
static GstFlowReturn gst_dvd_demux_send_subbuffer
|
||||||
(GstMPEGDemux * mpeg_demux,
|
(GstMPEGDemux * mpeg_demux,
|
||||||
GstMPEGStream * outstream,
|
GstMPEGStream * outstream,
|
||||||
GstBuffer * buffer, GstClockTime timestamp, guint offset, guint size);
|
GstBuffer * buffer, GstClockTime timestamp, guint offset, guint size);
|
||||||
|
@ -327,11 +327,12 @@ gst_dvd_demux_send_buffer (GstMPEGParse * mpeg_parse, GstBuffer * buffer,
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static gboolean
|
||||||
gst_dvd_demux_process_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
gst_dvd_demux_process_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
||||||
GstClockTime time)
|
GstClockTime time)
|
||||||
{
|
{
|
||||||
GstDVDDemux *dvd_demux = GST_DVD_DEMUX (mpeg_parse);
|
GstDVDDemux *dvd_demux = GST_DVD_DEMUX (mpeg_parse);
|
||||||
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -345,16 +346,16 @@ gst_dvd_demux_process_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
||||||
case GST_EVENT_NEWSEGMENT:
|
case GST_EVENT_NEWSEGMENT:
|
||||||
case GST_EVENT_FLUSH_START:
|
case GST_EVENT_FLUSH_START:
|
||||||
case GST_EVENT_FLUSH_STOP:
|
case GST_EVENT_FLUSH_STOP:
|
||||||
return PARSE_CLASS (dvd_demux)->send_event (mpeg_parse, event,
|
ret = PARSE_CLASS (dvd_demux)->send_event (mpeg_parse, event,
|
||||||
GST_CLOCK_TIME_NONE);
|
GST_CLOCK_TIME_NONE);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
/* Propagate the event normally. */
|
/* Propagate the event normally. */
|
||||||
if (!gst_pad_event_default (mpeg_parse->sinkpad, event))
|
ret = gst_pad_event_default (mpeg_parse->sinkpad, event);
|
||||||
return GST_FLOW_ERROR;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -569,30 +570,22 @@ gst_dvd_demux_send_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
||||||
|
|
||||||
for (i = 0; i < GST_DVD_DEMUX_NUM_SUBPICTURE_STREAMS; i++) {
|
for (i = 0; i < GST_DVD_DEMUX_NUM_SUBPICTURE_STREAMS; i++) {
|
||||||
if (dvd_demux->subpicture_stream[i]) {
|
if (dvd_demux->subpicture_stream[i]) {
|
||||||
if (GST_PAD_IS_USABLE (dvd_demux->subpicture_stream[i]->pad)) {
|
gst_event_ref (event);
|
||||||
gst_event_ref (event);
|
gst_pad_push_event (dvd_demux->subpicture_stream[i]->pad, event);
|
||||||
gst_pad_push_event (dvd_demux->subpicture_stream[i]->pad, event);
|
|
||||||
}
|
|
||||||
if (GST_CLOCK_TIME_IS_VALID (ts))
|
if (GST_CLOCK_TIME_IS_VALID (ts))
|
||||||
dvd_demux->subpicture_stream[i]->cur_ts = ts;
|
dvd_demux->subpicture_stream[i]->cur_ts = ts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Distribute the event to the "current" pads. */
|
/* Distribute the event to the "current" pads. */
|
||||||
if (GST_PAD_IS_USABLE (dvd_demux->cur_video)) {
|
gst_event_ref (event);
|
||||||
gst_event_ref (event);
|
gst_pad_push_event (dvd_demux->cur_video, event);
|
||||||
gst_pad_push_event (dvd_demux->cur_video, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GST_PAD_IS_USABLE (dvd_demux->cur_audio)) {
|
gst_event_ref (event);
|
||||||
gst_event_ref (event);
|
gst_pad_push_event (dvd_demux->cur_audio, event);
|
||||||
gst_pad_push_event (dvd_demux->cur_audio, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GST_PAD_IS_USABLE (dvd_demux->cur_subpicture)) {
|
gst_event_ref (event);
|
||||||
gst_event_ref (event);
|
gst_pad_push_event (dvd_demux->cur_subpicture, event);
|
||||||
gst_pad_push_event (dvd_demux->cur_subpicture, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_MPEG_PARSE_CLASS (parent_class)->send_event (mpeg_parse, event, ts);
|
GST_MPEG_PARSE_CLASS (parent_class)->send_event (mpeg_parse, event, ts);
|
||||||
|
|
||||||
|
@ -918,12 +911,13 @@ gst_dvd_demux_get_subpicture_stream (GstMPEGDemux * mpeg_demux,
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstFlowReturn
|
||||||
gst_dvd_demux_process_private (GstMPEGDemux * mpeg_demux,
|
gst_dvd_demux_process_private (GstMPEGDemux * mpeg_demux,
|
||||||
GstBuffer * buffer,
|
GstBuffer * buffer,
|
||||||
guint stream_nr, GstClockTime timestamp, guint headerlen, guint datalen)
|
guint stream_nr, GstClockTime timestamp, guint headerlen, guint datalen)
|
||||||
{
|
{
|
||||||
GstDVDDemux *dvd_demux = GST_DVD_DEMUX (mpeg_demux);
|
GstDVDDemux *dvd_demux = GST_DVD_DEMUX (mpeg_demux);
|
||||||
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
guint8 *basebuf;
|
guint8 *basebuf;
|
||||||
guint8 ps_id_code;
|
guint8 ps_id_code;
|
||||||
GstMPEGStream *outstream = NULL;
|
GstMPEGStream *outstream = NULL;
|
||||||
|
@ -1031,12 +1025,12 @@ gst_dvd_demux_process_private (GstMPEGDemux * mpeg_demux,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_return_if_reached ();
|
g_return_val_if_reached (GST_FLOW_UNEXPECTED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outstream == NULL) {
|
if (outstream == NULL) {
|
||||||
return;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timestamp != GST_CLOCK_TIME_NONE && first_access > 1) {
|
if (timestamp != GST_CLOCK_TIME_NONE && first_access > 1) {
|
||||||
|
@ -1048,14 +1042,14 @@ gst_dvd_demux_process_private (GstMPEGDemux * mpeg_demux,
|
||||||
len = first_access - 1;
|
len = first_access - 1;
|
||||||
len -= len % align;
|
len -= len % align;
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
DEMUX_CLASS (dvd_demux)->send_subbuffer (mpeg_demux, outstream,
|
ret = DEMUX_CLASS (dvd_demux)->send_subbuffer (mpeg_demux, outstream,
|
||||||
buffer, GST_CLOCK_TIME_NONE, off, len);
|
buffer, GST_CLOCK_TIME_NONE, off, len);
|
||||||
}
|
}
|
||||||
off += len;
|
off += len;
|
||||||
len = datalen - len;
|
len = datalen - len;
|
||||||
len -= len % align;
|
len -= len % align;
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
DEMUX_CLASS (dvd_demux)->send_subbuffer (mpeg_demux, outstream,
|
ret = DEMUX_CLASS (dvd_demux)->send_subbuffer (mpeg_demux, outstream,
|
||||||
buffer, timestamp, off, len);
|
buffer, timestamp, off, len);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1063,19 +1057,22 @@ gst_dvd_demux_process_private (GstMPEGDemux * mpeg_demux,
|
||||||
len = datalen;
|
len = datalen;
|
||||||
len -= len % align;
|
len -= len % align;
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
DEMUX_CLASS (dvd_demux)->send_subbuffer (mpeg_demux, outstream,
|
ret = DEMUX_CLASS (dvd_demux)->send_subbuffer (mpeg_demux, outstream,
|
||||||
buffer, timestamp, off, len);
|
buffer, timestamp, off, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstFlowReturn
|
||||||
gst_dvd_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
|
gst_dvd_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
|
||||||
GstMPEGStream * outstream, GstBuffer * buffer,
|
GstMPEGStream * outstream, GstBuffer * buffer,
|
||||||
GstClockTime timestamp, guint offset, guint size)
|
GstClockTime timestamp, guint offset, guint size)
|
||||||
{
|
{
|
||||||
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (mpeg_demux);
|
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (mpeg_demux);
|
||||||
GstDVDDemux *dvd_demux = GST_DVD_DEMUX (mpeg_demux);
|
GstDVDDemux *dvd_demux = GST_DVD_DEMUX (mpeg_demux);
|
||||||
|
GstFlowReturn ret;
|
||||||
GstPad *outpad;
|
GstPad *outpad;
|
||||||
gint cur_nr;
|
gint cur_nr;
|
||||||
|
|
||||||
|
@ -1100,7 +1097,7 @@ gst_dvd_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
|
||||||
gst_buffer_ref (buffer);
|
gst_buffer_ref (buffer);
|
||||||
|
|
||||||
/* Send the buffer to the standard output pad. */
|
/* Send the buffer to the standard output pad. */
|
||||||
parent_class->send_subbuffer (mpeg_demux, outstream, buffer,
|
ret = parent_class->send_subbuffer (mpeg_demux, outstream, buffer,
|
||||||
timestamp, offset, size);
|
timestamp, offset, size);
|
||||||
|
|
||||||
/* Determine the current output pad and stream number for the given
|
/* Determine the current output pad and stream number for the given
|
||||||
|
@ -1123,24 +1120,27 @@ gst_dvd_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
|
||||||
cur_nr = dvd_demux->cur_subpicture_nr;
|
cur_nr = dvd_demux->cur_subpicture_nr;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_return_if_reached ();
|
g_return_val_if_reached (GST_FLOW_UNEXPECTED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((outpad != NULL) && (cur_nr == outstream->number) && (size > 0)) {
|
if (outpad != NULL && cur_nr == outstream->number && size > 0) {
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
|
|
||||||
/* We have a packet of the current stream. Send it to the
|
/* We have a packet of the current stream. Send it to the
|
||||||
corresponding pad as well. */
|
corresponding pad as well. */
|
||||||
outbuf = gst_buffer_create_sub (buffer, offset, size);
|
outbuf = gst_buffer_create_sub (buffer, offset, size);
|
||||||
|
g_return_val_if_fail (outbuf != NULL, GST_FLOW_UNEXPECTED);
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
gst_pad_push (outpad, outbuf);
|
ret = gst_pad_push (outpad, outbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_buffer_unref (buffer);
|
gst_buffer_unref (buffer);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -1210,10 +1210,9 @@ gst_dvd_demux_reset (GstDVDDemux * dvd_demux)
|
||||||
GST_INFO ("Resetting the dvd demuxer");
|
GST_INFO ("Resetting the dvd demuxer");
|
||||||
for (i = 0; i < GST_DVD_DEMUX_NUM_SUBPICTURE_STREAMS; i++) {
|
for (i = 0; i < GST_DVD_DEMUX_NUM_SUBPICTURE_STREAMS; i++) {
|
||||||
if (dvd_demux->subpicture_stream[i]) {
|
if (dvd_demux->subpicture_stream[i]) {
|
||||||
if (GST_PAD_IS_USABLE (dvd_demux->subpicture_stream[i]->pad)) {
|
gst_pad_push_event (dvd_demux->subpicture_stream[i]->pad,
|
||||||
gst_pad_push_event (dvd_demux->subpicture_stream[i]->pad,
|
gst_event_new_eos ());
|
||||||
gst_event_new_eos ());
|
|
||||||
}
|
|
||||||
gst_element_remove_pad (GST_ELEMENT (dvd_demux),
|
gst_element_remove_pad (GST_ELEMENT (dvd_demux),
|
||||||
dvd_demux->subpicture_stream[i]->pad);
|
dvd_demux->subpicture_stream[i]->pad);
|
||||||
g_free (dvd_demux->subpicture_stream[i]);
|
g_free (dvd_demux->subpicture_stream[i]);
|
||||||
|
@ -1303,7 +1302,7 @@ gst_dvd_demux_sync_stream_to_time (GstMPEGDemux * mpeg_demux,
|
||||||
filler = gst_event_new_filler_stamped (last_ts, GST_CLOCK_TIME_NONE);
|
filler = gst_event_new_filler_stamped (last_ts, GST_CLOCK_TIME_NONE);
|
||||||
|
|
||||||
if (filler) {
|
if (filler) {
|
||||||
if (gst_pad_push_event (stream->pad, filler) != GST_FLOW_OK)
|
if (!gst_pad_push_event (stream->pad, filler))
|
||||||
gst_event_unref (filler);
|
gst_event_unref (filler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,13 +89,13 @@ 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 GstFlowReturn 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 GstFlowReturn gst_mpeg_demux_send_discont (GstMPEGParse * mpeg_parse,
|
static gboolean gst_mpeg_demux_send_discont (GstMPEGParse * mpeg_parse,
|
||||||
GstClockTime time);
|
GstClockTime time);
|
||||||
static GstFlowReturn gst_mpeg_demux_handle_discont (GstMPEGParse * mpeg_parse,
|
static gboolean gst_mpeg_demux_handle_discont (GstMPEGParse * mpeg_parse,
|
||||||
GstEvent * event);
|
GstEvent * event);
|
||||||
static GstFlowReturn gst_mpeg_demux_send_event (GstMPEGParse * mpeg_parse,
|
static gboolean gst_mpeg_demux_send_event (GstMPEGParse * mpeg_parse,
|
||||||
GstEvent * event, GstClockTime time);
|
GstEvent * event, GstClockTime time);
|
||||||
|
|
||||||
static GstPad *gst_mpeg_demux_new_output_pad (GstMPEGDemux * mpeg_demux,
|
static GstPad *gst_mpeg_demux_new_output_pad (GstMPEGDemux * mpeg_demux,
|
||||||
|
@ -115,23 +115,23 @@ static gboolean gst_mpeg_demux_parse_packhead (GstMPEGParse * mpeg_parse,
|
||||||
GstBuffer * buffer);
|
GstBuffer * buffer);
|
||||||
static gboolean gst_mpeg_demux_parse_syshead (GstMPEGParse * mpeg_parse,
|
static gboolean gst_mpeg_demux_parse_syshead (GstMPEGParse * mpeg_parse,
|
||||||
GstBuffer * buffer);
|
GstBuffer * buffer);
|
||||||
static gboolean gst_mpeg_demux_parse_packet (GstMPEGParse * mpeg_parse,
|
static GstFlowReturn gst_mpeg_demux_parse_packet (GstMPEGParse * mpeg_parse,
|
||||||
GstBuffer * buffer);
|
GstBuffer * buffer);
|
||||||
static gboolean gst_mpeg_demux_parse_pes (GstMPEGParse * mpeg_parse,
|
static GstFlowReturn gst_mpeg_demux_parse_pes (GstMPEGParse * mpeg_parse,
|
||||||
GstBuffer * buffer);
|
GstBuffer * buffer);
|
||||||
|
|
||||||
static void gst_mpeg_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
|
static GstFlowReturn gst_mpeg_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
|
||||||
GstMPEGStream * outstream, GstBuffer * buffer,
|
GstMPEGStream * outstream, GstBuffer * buffer,
|
||||||
GstClockTime timestamp, guint offset, guint size);
|
GstClockTime timestamp, guint offset, guint size);
|
||||||
static void gst_mpeg_demux_process_private (GstMPEGDemux * mpeg_demux,
|
static GstFlowReturn gst_mpeg_demux_process_private (GstMPEGDemux * mpeg_demux,
|
||||||
GstBuffer * buffer,
|
GstBuffer * buffer,
|
||||||
guint stream_nr, GstClockTime timestamp, guint headerlen, guint datalen);
|
guint stream_nr, GstClockTime timestamp, guint headerlen, guint datalen);
|
||||||
static void gst_mpeg_demux_synchronise_pads (GstMPEGDemux * mpeg_demux,
|
static void gst_mpeg_demux_synchronise_pads (GstMPEGDemux * mpeg_demux,
|
||||||
GstClockTime threshold, GstClockTime new_ts);
|
GstClockTime threshold, GstClockTime new_ts);
|
||||||
#if 0
|
|
||||||
static void gst_mpeg_demux_sync_stream_to_time (GstMPEGDemux * mpeg_demux,
|
static void gst_mpeg_demux_sync_stream_to_time (GstMPEGDemux * mpeg_demux,
|
||||||
GstMPEGStream * stream, GstClockTime last_ts);
|
GstMPEGStream * stream, GstClockTime last_ts);
|
||||||
|
|
||||||
|
#if 0
|
||||||
const GstFormat *gst_mpeg_demux_get_src_formats (GstPad * pad);
|
const GstFormat *gst_mpeg_demux_get_src_formats (GstPad * pad);
|
||||||
|
|
||||||
static gboolean index_seek (GstPad * pad, GstEvent * event, gint64 * offset);
|
static gboolean index_seek (GstPad * pad, GstEvent * event, gint64 * offset);
|
||||||
|
@ -214,9 +214,10 @@ gst_mpeg_demux_class_init (GstMPEGDemuxClass * klass)
|
||||||
gstelement_class = (GstElementClass *) klass;
|
gstelement_class = (GstElementClass *) klass;
|
||||||
mpeg_parse_class = (GstMPEGParseClass *) klass;
|
mpeg_parse_class = (GstMPEGParseClass *) klass;
|
||||||
|
|
||||||
gstelement_class->change_state = gst_mpeg_demux_change_state;
|
gstelement_class->change_state =
|
||||||
gstelement_class->set_index = gst_mpeg_demux_set_index;
|
GST_DEBUG_FUNCPTR (gst_mpeg_demux_change_state);
|
||||||
gstelement_class->get_index = gst_mpeg_demux_get_index;
|
gstelement_class->set_index = GST_DEBUG_FUNCPTR (gst_mpeg_demux_set_index);
|
||||||
|
gstelement_class->get_index = GST_DEBUG_FUNCPTR (gst_mpeg_demux_get_index);
|
||||||
|
|
||||||
mpeg_parse_class->parse_packhead = gst_mpeg_demux_parse_packhead;
|
mpeg_parse_class->parse_packhead = gst_mpeg_demux_parse_packhead;
|
||||||
mpeg_parse_class->parse_syshead = gst_mpeg_demux_parse_syshead;
|
mpeg_parse_class->parse_syshead = gst_mpeg_demux_parse_syshead;
|
||||||
|
@ -236,9 +237,7 @@ gst_mpeg_demux_class_init (GstMPEGDemuxClass * klass)
|
||||||
klass->send_subbuffer = gst_mpeg_demux_send_subbuffer;
|
klass->send_subbuffer = gst_mpeg_demux_send_subbuffer;
|
||||||
klass->process_private = gst_mpeg_demux_process_private;
|
klass->process_private = gst_mpeg_demux_process_private;
|
||||||
klass->synchronise_pads = gst_mpeg_demux_synchronise_pads;
|
klass->synchronise_pads = gst_mpeg_demux_synchronise_pads;
|
||||||
#if 0
|
|
||||||
klass->sync_stream_to_time = gst_mpeg_demux_sync_stream_to_time;
|
klass->sync_stream_to_time = gst_mpeg_demux_sync_stream_to_time;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* we have our own sink pad template, but don't use it in subclasses */
|
/* we have our own sink pad template, but don't use it in subclasses */
|
||||||
gst_element_class_add_pad_template (gstelement_class,
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
|
@ -275,28 +274,30 @@ gst_mpeg_demux_send_buffer (GstMPEGParse * mpeg_parse, GstBuffer * buffer,
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static gboolean
|
||||||
gst_mpeg_demux_process_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
gst_mpeg_demux_process_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
||||||
GstClockTime time)
|
GstClockTime time)
|
||||||
{
|
{
|
||||||
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_FILLER:
|
case GST_EVENT_FILLER:
|
||||||
case GST_EVENT_NEWSEGMENT:
|
case GST_EVENT_NEWSEGMENT:
|
||||||
case GST_EVENT_FLUSH_START:
|
case GST_EVENT_FLUSH_START:
|
||||||
case GST_EVENT_FLUSH_STOP:
|
case GST_EVENT_FLUSH_STOP:
|
||||||
return PARSE_CLASS (mpeg_parse)->send_event (mpeg_parse, event,
|
ret = PARSE_CLASS (mpeg_parse)->send_event (mpeg_parse, event,
|
||||||
GST_CLOCK_TIME_NONE);
|
GST_CLOCK_TIME_NONE);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
/* Propagate the event normally. */
|
/* Propagate the event normally. */
|
||||||
if (!gst_pad_event_default (mpeg_parse->sinkpad, event))
|
ret = gst_pad_event_default (mpeg_parse->sinkpad, event);
|
||||||
return GST_FLOW_ERROR;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static gboolean
|
||||||
gst_mpeg_demux_send_discont (GstMPEGParse * mpeg_parse, GstClockTime time)
|
gst_mpeg_demux_send_discont (GstMPEGParse * mpeg_parse, GstClockTime time)
|
||||||
{
|
{
|
||||||
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
|
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
|
||||||
|
@ -318,7 +319,7 @@ gst_mpeg_demux_send_discont (GstMPEGParse * mpeg_parse, GstClockTime time)
|
||||||
return parent_class->send_discont (mpeg_parse, time);
|
return parent_class->send_discont (mpeg_parse, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static gboolean
|
||||||
gst_mpeg_demux_send_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
gst_mpeg_demux_send_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
||||||
GstClockTime time)
|
GstClockTime time)
|
||||||
{
|
{
|
||||||
|
@ -328,17 +329,16 @@ gst_mpeg_demux_send_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
||||||
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
|
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_START) {
|
GST_DEBUG_OBJECT (mpeg_demux, "Sending %s event",
|
||||||
GST_DEBUG_OBJECT (mpeg_demux, "Sending flush event");
|
GST_EVENT_TYPE_NAME (event));
|
||||||
|
|
||||||
|
if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_START)
|
||||||
mpeg_demux->just_flushed = TRUE;
|
mpeg_demux->just_flushed = TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < GST_MPEG_DEMUX_NUM_VIDEO_STREAMS; i++) {
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_VIDEO_STREAMS; i++) {
|
||||||
if (mpeg_demux->video_stream[i]) {
|
if (mpeg_demux->video_stream[i]) {
|
||||||
if (GST_PAD_IS_USABLE (mpeg_demux->video_stream[i]->pad)) {
|
gst_event_ref (event);
|
||||||
gst_event_ref (event);
|
gst_pad_push_event (mpeg_demux->video_stream[i]->pad, event);
|
||||||
gst_pad_push_event (mpeg_demux->video_stream[i]->pad, event);
|
|
||||||
}
|
|
||||||
if (GST_CLOCK_TIME_IS_VALID (time))
|
if (GST_CLOCK_TIME_IS_VALID (time))
|
||||||
mpeg_demux->video_stream[i]->cur_ts = time;
|
mpeg_demux->video_stream[i]->cur_ts = time;
|
||||||
}
|
}
|
||||||
|
@ -346,10 +346,8 @@ gst_mpeg_demux_send_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
||||||
|
|
||||||
for (i = 0; i < GST_MPEG_DEMUX_NUM_AUDIO_STREAMS; i++) {
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_AUDIO_STREAMS; i++) {
|
||||||
if (mpeg_demux->audio_stream[i]) {
|
if (mpeg_demux->audio_stream[i]) {
|
||||||
if (GST_PAD_IS_USABLE (mpeg_demux->audio_stream[i]->pad)) {
|
gst_event_ref (event);
|
||||||
gst_event_ref (event);
|
gst_pad_push_event (mpeg_demux->audio_stream[i]->pad, event);
|
||||||
gst_pad_push_event (mpeg_demux->audio_stream[i]->pad, event);
|
|
||||||
}
|
|
||||||
if (GST_CLOCK_TIME_IS_VALID (time))
|
if (GST_CLOCK_TIME_IS_VALID (time))
|
||||||
mpeg_demux->audio_stream[i]->cur_ts = time;
|
mpeg_demux->audio_stream[i]->cur_ts = time;
|
||||||
}
|
}
|
||||||
|
@ -357,22 +355,23 @@ gst_mpeg_demux_send_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
||||||
|
|
||||||
for (i = 0; i < GST_MPEG_DEMUX_NUM_PRIVATE_STREAMS; i++) {
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_PRIVATE_STREAMS; i++) {
|
||||||
if (mpeg_demux->private_stream[i]) {
|
if (mpeg_demux->private_stream[i]) {
|
||||||
if (GST_PAD_IS_USABLE (mpeg_demux->private_stream[i]->pad)) {
|
gst_event_ref (event);
|
||||||
gst_event_ref (event);
|
gst_pad_push_event (mpeg_demux->private_stream[i]->pad, event);
|
||||||
gst_pad_push_event (mpeg_demux->private_stream[i]->pad, event);
|
|
||||||
}
|
|
||||||
if (GST_CLOCK_TIME_IS_VALID (time))
|
if (GST_CLOCK_TIME_IS_VALID (time))
|
||||||
mpeg_demux->private_stream[i]->cur_ts = time;
|
mpeg_demux->private_stream[i]->cur_ts = time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent_class->send_event (mpeg_parse, event, time);
|
if (parent_class->send_event)
|
||||||
|
return parent_class->send_event (mpeg_parse, event, time);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static gboolean
|
||||||
gst_mpeg_demux_handle_discont (GstMPEGParse * mpeg_parse, GstEvent * event)
|
gst_mpeg_demux_handle_discont (GstMPEGParse * mpeg_parse, GstEvent * event)
|
||||||
{
|
{
|
||||||
GstFlowReturn result = GST_FLOW_OK;
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
|
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
|
||||||
|
@ -383,9 +382,9 @@ gst_mpeg_demux_handle_discont (GstMPEGParse * mpeg_parse, GstEvent * event)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (parent_class->handle_discont != NULL)
|
if (parent_class->handle_discont != NULL)
|
||||||
result = parent_class->handle_discont (mpeg_parse, event);
|
ret = parent_class->handle_discont (mpeg_parse, event);
|
||||||
|
|
||||||
return result;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
|
@ -413,9 +412,12 @@ gst_mpeg_demux_new_output_pad (GstMPEGDemux * mpeg_demux,
|
||||||
pad = gst_pad_new_from_template (temp, name);
|
pad = gst_pad_new_from_template (temp, name);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
gst_pad_set_event_function (pad, gst_mpeg_demux_handle_src_event);
|
gst_pad_set_event_function (pad,
|
||||||
gst_pad_set_query_type_function (pad, gst_mpeg_parse_get_src_query_types);
|
GST_DEBUG_FUNCPTR (gst_mpeg_demux_handle_src_event));
|
||||||
gst_pad_set_query_function (pad, gst_mpeg_demux_handle_src_query);
|
gst_pad_set_query_type_function (pad,
|
||||||
|
GST_DEBUG_FUNCPTR (gst_mpeg_parse_get_src_query_types));
|
||||||
|
gst_pad_set_query_function (pad,
|
||||||
|
GST_DEBUG_FUNCPTR (gst_mpeg_demux_handle_src_query));
|
||||||
#endif
|
#endif
|
||||||
gst_pad_use_fixed_caps (pad);
|
gst_pad_use_fixed_caps (pad);
|
||||||
|
|
||||||
|
@ -721,7 +723,7 @@ gst_mpeg_demux_parse_syshead (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstFlowReturn
|
||||||
gst_mpeg_demux_parse_packet (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
gst_mpeg_demux_parse_packet (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
|
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
|
||||||
|
@ -740,6 +742,8 @@ gst_mpeg_demux_parse_packet (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
||||||
guint8 *buf, *basebuf;
|
guint8 *buf, *basebuf;
|
||||||
gint64 timestamp;
|
gint64 timestamp;
|
||||||
|
|
||||||
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
|
||||||
basebuf = buf = GST_BUFFER_DATA (buffer);
|
basebuf = buf = GST_BUFFER_DATA (buffer);
|
||||||
id = *(buf + 3);
|
id = *(buf + 3);
|
||||||
buf += 4;
|
buf += 4;
|
||||||
|
@ -858,7 +862,7 @@ done:
|
||||||
GST_DEBUG_OBJECT (mpeg_demux, "we have an audio packet");
|
GST_DEBUG_OBJECT (mpeg_demux, "we have an audio packet");
|
||||||
outstream = CLASS (mpeg_demux)->get_audio_stream (mpeg_demux,
|
outstream = CLASS (mpeg_demux)->get_audio_stream (mpeg_demux,
|
||||||
id - 0xC0, GST_MPEG_DEMUX_AUDIO_MPEG, NULL);
|
id - 0xC0, GST_MPEG_DEMUX_AUDIO_MPEG, NULL);
|
||||||
CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
ret = CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
||||||
timestamp, headerlen + 4, datalen);
|
timestamp, headerlen + 4, datalen);
|
||||||
} else if (id >= 0xE0 && id <= 0xEF) {
|
} else if (id >= 0xE0 && id <= 0xEF) {
|
||||||
/* Video. */
|
/* Video. */
|
||||||
|
@ -868,16 +872,16 @@ done:
|
||||||
|
|
||||||
outstream = CLASS (mpeg_demux)->get_video_stream (mpeg_demux,
|
outstream = CLASS (mpeg_demux)->get_video_stream (mpeg_demux,
|
||||||
id - 0xE0, GST_MPEG_DEMUX_VIDEO_MPEG, &mpeg_version);
|
id - 0xE0, GST_MPEG_DEMUX_VIDEO_MPEG, &mpeg_version);
|
||||||
CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
ret = CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
||||||
timestamp, headerlen + 4, datalen);
|
timestamp, headerlen + 4, datalen);
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING_OBJECT (mpeg_demux, "unknown stream id 0x%02x", id);
|
GST_WARNING_OBJECT (mpeg_demux, "unknown stream id 0x%02x", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstFlowReturn
|
||||||
gst_mpeg_demux_parse_pes (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
gst_mpeg_demux_parse_pes (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
|
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
|
||||||
|
@ -890,6 +894,8 @@ gst_mpeg_demux_parse_pes (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
||||||
guint16 headerlen;
|
guint16 headerlen;
|
||||||
GstClockTime timestamp;
|
GstClockTime timestamp;
|
||||||
|
|
||||||
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
|
||||||
GstMPEGStream *outstream = NULL;
|
GstMPEGStream *outstream = NULL;
|
||||||
guint8 *buf;
|
guint8 *buf;
|
||||||
|
|
||||||
|
@ -990,7 +996,7 @@ gst_mpeg_demux_parse_pes (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
||||||
GST_DEBUG_OBJECT (mpeg_demux, "we have an audio packet");
|
GST_DEBUG_OBJECT (mpeg_demux, "we have an audio packet");
|
||||||
outstream = CLASS (mpeg_demux)->get_audio_stream (mpeg_demux,
|
outstream = CLASS (mpeg_demux)->get_audio_stream (mpeg_demux,
|
||||||
id - 0xC0, GST_MPEG_DEMUX_AUDIO_MPEG, NULL);
|
id - 0xC0, GST_MPEG_DEMUX_AUDIO_MPEG, NULL);
|
||||||
CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
ret = CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
||||||
timestamp, headerlen + 4, datalen);
|
timestamp, headerlen + 4, datalen);
|
||||||
} else if (id >= 0xE0 && id <= 0xEF) {
|
} else if (id >= 0xE0 && id <= 0xEF) {
|
||||||
/* Video. */
|
/* Video. */
|
||||||
|
@ -1000,21 +1006,22 @@ gst_mpeg_demux_parse_pes (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
||||||
|
|
||||||
outstream = CLASS (mpeg_demux)->get_video_stream (mpeg_demux,
|
outstream = CLASS (mpeg_demux)->get_video_stream (mpeg_demux,
|
||||||
id - 0xE0, GST_MPEG_DEMUX_VIDEO_MPEG, &mpeg_version);
|
id - 0xE0, GST_MPEG_DEMUX_VIDEO_MPEG, &mpeg_version);
|
||||||
CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
ret = CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
||||||
timestamp, headerlen + 4, datalen);
|
timestamp, headerlen + 4, datalen);
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING_OBJECT (mpeg_demux, "unknown stream id 0x%02x", id);
|
GST_WARNING_OBJECT (mpeg_demux, "unknown stream id 0x%02x", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstFlowReturn
|
||||||
gst_mpeg_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
|
gst_mpeg_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
|
||||||
GstMPEGStream * outstream, GstBuffer * buffer,
|
GstMPEGStream * outstream, GstBuffer * buffer,
|
||||||
GstClockTime timestamp, guint offset, guint size)
|
GstClockTime timestamp, guint offset, guint size)
|
||||||
{
|
{
|
||||||
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (mpeg_demux);
|
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (mpeg_demux);
|
||||||
|
GstFlowReturn ret;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
|
|
||||||
mpeg_demux->just_flushed = FALSE;
|
mpeg_demux->just_flushed = FALSE;
|
||||||
|
@ -1038,9 +1045,8 @@ gst_mpeg_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
|
||||||
mpeg_parse->current_ts + mpeg_demux->adjust + outstream->scr_offs;
|
mpeg_parse->current_ts + mpeg_demux->adjust + outstream->scr_offs;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GST_PAD_IS_USABLE (outstream->pad) || (size == 0)) {
|
if (size == 0)
|
||||||
return;
|
return GST_FLOW_OK;
|
||||||
}
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (mpeg_demux, "Creating subbuffer size %d, time=%"
|
GST_DEBUG_OBJECT (mpeg_demux, "Creating subbuffer size %d, time=%"
|
||||||
GST_TIME_FORMAT, size, GST_TIME_ARGS (timestamp));
|
GST_TIME_FORMAT, size, GST_TIME_ARGS (timestamp));
|
||||||
|
@ -1048,8 +1054,8 @@ 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));
|
||||||
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) &&
|
||||||
GST_CLOCK_TIME_IS_VALID (mpeg_parse->current_ts) &&
|
GST_CLOCK_TIME_IS_VALID (mpeg_parse->current_ts) &&
|
||||||
|
@ -1062,19 +1068,23 @@ gst_mpeg_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
|
||||||
mpeg_parse->current_ts + mpeg_demux->adjust -
|
mpeg_parse->current_ts + mpeg_demux->adjust -
|
||||||
mpeg_demux->max_gap_tolerance);
|
mpeg_demux->max_gap_tolerance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstFlowReturn
|
||||||
gst_mpeg_demux_process_private (GstMPEGDemux * mpeg_demux,
|
gst_mpeg_demux_process_private (GstMPEGDemux * mpeg_demux,
|
||||||
GstBuffer * buffer,
|
GstBuffer * buffer,
|
||||||
guint stream_nr, GstClockTime timestamp, guint headerlen, guint datalen)
|
guint stream_nr, GstClockTime timestamp, guint headerlen, guint datalen)
|
||||||
{
|
{
|
||||||
GstMPEGStream *outstream;
|
GstMPEGStream *outstream;
|
||||||
|
GstFlowReturn ret;
|
||||||
|
|
||||||
outstream = CLASS (mpeg_demux)->get_private_stream (mpeg_demux,
|
outstream = CLASS (mpeg_demux)->get_private_stream (mpeg_demux,
|
||||||
stream_nr, GST_MPEG_DEMUX_PRIVATE_UNKNOWN, NULL);
|
stream_nr, GST_MPEG_DEMUX_PRIVATE_UNKNOWN, NULL);
|
||||||
CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
ret = CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
||||||
timestamp, headerlen + 4, datalen);
|
timestamp, headerlen + 4, datalen);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1111,7 +1121,6 @@ gst_mpeg_demux_synchronise_pads (GstMPEGDemux * mpeg_demux,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Send a filler event on the indicated pad to catch it up to
|
/* Send a filler event on the indicated pad to catch it up to
|
||||||
* last_ts. Query the pad for current time, and use that time
|
* last_ts. Query the pad for current time, and use that time
|
||||||
* to set the duration of the filler event, otherwise we use
|
* to set the duration of the filler event, otherwise we use
|
||||||
|
@ -1122,6 +1131,13 @@ static void
|
||||||
gst_mpeg_demux_sync_stream_to_time (GstMPEGDemux * mpeg_demux,
|
gst_mpeg_demux_sync_stream_to_time (GstMPEGDemux * mpeg_demux,
|
||||||
GstMPEGStream * stream, GstClockTime last_ts)
|
GstMPEGStream * stream, GstClockTime last_ts)
|
||||||
{
|
{
|
||||||
|
static gboolean beenhere; /* FALSE */
|
||||||
|
|
||||||
|
if (!beenhere) {
|
||||||
|
g_message ("FIXME: %s\n", __FUNCTION__);
|
||||||
|
beenhere = TRUE;
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
GstClockTime start_ts;
|
GstClockTime start_ts;
|
||||||
GstEvent *filler = NULL;
|
GstEvent *filler = NULL;
|
||||||
GstFormat fmt = GST_FORMAT_TIME;
|
GstFormat fmt = GST_FORMAT_TIME;
|
||||||
|
@ -1138,18 +1154,17 @@ gst_mpeg_demux_sync_stream_to_time (GstMPEGDemux * mpeg_demux,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filler) {
|
if (filler) {
|
||||||
if (GST_PAD_IS_USABLE (stream->pad)) {
|
GST_LOG ("Advancing %s from %llu by %lld to %llu (diff %lld)",
|
||||||
GST_LOG ("Advancing %s from %llu by %lld to %llu (diff %lld)",
|
gst_pad_get_name (stream->pad), stream->cur_ts,
|
||||||
gst_pad_get_name (stream->pad), stream->cur_ts,
|
gst_event_filler_get_duration (filler), last_ts,
|
||||||
gst_event_filler_get_duration (filler), last_ts,
|
GST_CLOCK_DIFF (last_ts, stream->cur_ts));
|
||||||
GST_CLOCK_DIFF (last_ts, stream->cur_ts));
|
|
||||||
|
|
||||||
gst_pad_push (stream->pad, filler);
|
gst_pad_push_event (stream->pad, filler);
|
||||||
} else
|
|
||||||
gst_event_unref (filler);
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
const GstFormat *
|
const GstFormat *
|
||||||
gst_mpeg_demux_get_src_formats (GstPad * pad)
|
gst_mpeg_demux_get_src_formats (GstPad * pad)
|
||||||
{
|
{
|
||||||
|
@ -1248,12 +1263,9 @@ gst_mpeg_demux_handle_src_event (GstPad * pad, GstEvent * event)
|
||||||
}
|
}
|
||||||
case GST_EVENT_NAVIGATION:
|
case GST_EVENT_NAVIGATION:
|
||||||
{
|
{
|
||||||
GstPad *out = GST_PAD_PEER (GST_MPEG_PARSE (mpeg_demux)->sinkpad);
|
res = gst_pad_push_event (GST_MPEG_PARSE (mpeg_demux)->sinkpad, event);
|
||||||
|
break;
|
||||||
if (out && GST_PAD_IS_USABLE (out))
|
|
||||||
return gst_pad_send_event (out, event);
|
|
||||||
}
|
}
|
||||||
/* fall-through */
|
|
||||||
default:
|
default:
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
break;
|
break;
|
||||||
|
@ -1294,10 +1306,8 @@ gst_mpeg_demux_reset (GstMPEGDemux * mpeg_demux)
|
||||||
/* check get_audio/video_stream because it can be derivated */
|
/* check get_audio/video_stream because it can be derivated */
|
||||||
for (i = 0; i < GST_MPEG_DEMUX_NUM_VIDEO_STREAMS; i++)
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_VIDEO_STREAMS; i++)
|
||||||
if (mpeg_demux->video_stream[i]) {
|
if (mpeg_demux->video_stream[i]) {
|
||||||
if (GST_PAD_IS_USABLE (mpeg_demux->video_stream[i]->pad)) {
|
gst_pad_push_event (mpeg_demux->video_stream[i]->pad,
|
||||||
gst_pad_push_event (mpeg_demux->video_stream[i]->pad,
|
gst_event_new_eos ());
|
||||||
gst_event_new_eos ());
|
|
||||||
}
|
|
||||||
gst_element_remove_pad (GST_ELEMENT (mpeg_demux),
|
gst_element_remove_pad (GST_ELEMENT (mpeg_demux),
|
||||||
mpeg_demux->video_stream[i]->pad);
|
mpeg_demux->video_stream[i]->pad);
|
||||||
g_free (mpeg_demux->video_stream[i]);
|
g_free (mpeg_demux->video_stream[i]);
|
||||||
|
@ -1305,10 +1315,8 @@ gst_mpeg_demux_reset (GstMPEGDemux * mpeg_demux)
|
||||||
}
|
}
|
||||||
for (i = 0; i < GST_MPEG_DEMUX_NUM_AUDIO_STREAMS; i++)
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_AUDIO_STREAMS; i++)
|
||||||
if (mpeg_demux->audio_stream[i]) {
|
if (mpeg_demux->audio_stream[i]) {
|
||||||
if (GST_PAD_IS_USABLE (mpeg_demux->audio_stream[i]->pad)) {
|
gst_pad_push_event (mpeg_demux->audio_stream[i]->pad,
|
||||||
gst_pad_push_event (mpeg_demux->audio_stream[i]->pad,
|
gst_event_new_eos ());
|
||||||
gst_event_new_eos ());
|
|
||||||
}
|
|
||||||
gst_element_remove_pad (GST_ELEMENT (mpeg_demux),
|
gst_element_remove_pad (GST_ELEMENT (mpeg_demux),
|
||||||
mpeg_demux->audio_stream[i]->pad);
|
mpeg_demux->audio_stream[i]->pad);
|
||||||
g_free (mpeg_demux->audio_stream[i]);
|
g_free (mpeg_demux->audio_stream[i]);
|
||||||
|
@ -1316,10 +1324,8 @@ gst_mpeg_demux_reset (GstMPEGDemux * mpeg_demux)
|
||||||
}
|
}
|
||||||
for (i = 0; i < GST_MPEG_DEMUX_NUM_PRIVATE_STREAMS; i++)
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_PRIVATE_STREAMS; i++)
|
||||||
if (mpeg_demux->private_stream[i]) {
|
if (mpeg_demux->private_stream[i]) {
|
||||||
if (GST_PAD_IS_USABLE (mpeg_demux->private_stream[i]->pad)) {
|
gst_pad_push_event (mpeg_demux->private_stream[i]->pad,
|
||||||
gst_pad_push_event (mpeg_demux->private_stream[i]->pad,
|
gst_event_new_eos ());
|
||||||
gst_event_new_eos ());
|
|
||||||
}
|
|
||||||
gst_element_remove_pad (GST_ELEMENT (mpeg_demux),
|
gst_element_remove_pad (GST_ELEMENT (mpeg_demux),
|
||||||
mpeg_demux->private_stream[i]->pad);
|
mpeg_demux->private_stream[i]->pad);
|
||||||
g_free (mpeg_demux->private_stream[i]);
|
g_free (mpeg_demux->private_stream[i]);
|
||||||
|
|
|
@ -179,7 +179,7 @@ struct _GstMPEGDemuxClass {
|
||||||
gint type,
|
gint type,
|
||||||
const gpointer info);
|
const gpointer info);
|
||||||
|
|
||||||
void (*send_subbuffer) (GstMPEGDemux *mpeg_demux,
|
GstFlowReturn (*send_subbuffer) (GstMPEGDemux *mpeg_demux,
|
||||||
GstMPEGStream *outstream,
|
GstMPEGStream *outstream,
|
||||||
GstBuffer *buffer,
|
GstBuffer *buffer,
|
||||||
GstClockTime timestamp,
|
GstClockTime timestamp,
|
||||||
|
@ -187,7 +187,7 @@ struct _GstMPEGDemuxClass {
|
||||||
guint size);
|
guint size);
|
||||||
|
|
||||||
|
|
||||||
void (*process_private) (GstMPEGDemux *mpeg_demux,
|
GstFlowReturn (*process_private) (GstMPEGDemux *mpeg_demux,
|
||||||
GstBuffer *buffer,
|
GstBuffer *buffer,
|
||||||
guint stream_nr,
|
guint stream_nr,
|
||||||
GstClockTime timestamp,
|
GstClockTime timestamp,
|
||||||
|
|
|
@ -107,7 +107,7 @@ 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_discont (GstMPEGParse * mpeg_parse,
|
||||||
GstClockTime time);
|
GstClockTime time);
|
||||||
static GstFlowReturn 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);
|
||||||
|
|
||||||
static void gst_mpeg_parse_pad_added (GstElement * element, GstPad * pad);
|
static void gst_mpeg_parse_pad_added (GstElement * element, GstPad * pad);
|
||||||
|
@ -244,9 +244,9 @@ gst_mpeg_parse_init (GstMPEGParse * mpeg_parse)
|
||||||
GST_DEBUG_FUNCPTR (gst_mpeg_parse_handle_src_event));
|
GST_DEBUG_FUNCPTR (gst_mpeg_parse_handle_src_event));
|
||||||
#if 0
|
#if 0
|
||||||
gst_pad_set_query_type_function (mpeg_parse->srcpad,
|
gst_pad_set_query_type_function (mpeg_parse->srcpad,
|
||||||
gst_mpeg_parse_get_src_query_types);
|
GST_DEBUG_FUNCPTR (gst_mpeg_parse_get_src_query_types));
|
||||||
gst_pad_set_query_function (mpeg_parse->srcpad,
|
gst_pad_set_query_function (mpeg_parse->srcpad,
|
||||||
gst_mpeg_parse_handle_src_query);
|
GST_DEBUG_FUNCPTR (gst_mpeg_parse_handle_src_query));
|
||||||
#endif
|
#endif
|
||||||
gst_pad_use_fixed_caps (mpeg_parse->srcpad);
|
gst_pad_use_fixed_caps (mpeg_parse->srcpad);
|
||||||
}
|
}
|
||||||
|
@ -326,11 +326,11 @@ gst_mpeg_parse_reset (GstMPEGParse * mpeg_parse)
|
||||||
mpeg_parse->scr_pending = FALSE;
|
mpeg_parse->scr_pending = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static gboolean
|
||||||
gst_mpeg_parse_handle_discont (GstMPEGParse * mpeg_parse, GstEvent * event)
|
gst_mpeg_parse_handle_discont (GstMPEGParse * mpeg_parse, GstEvent * event)
|
||||||
{
|
{
|
||||||
GstFlowReturn result = GST_FLOW_OK;;
|
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
|
gboolean ret = TRUE;
|
||||||
gint64 time;
|
gint64 time;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -346,7 +346,7 @@ gst_mpeg_parse_handle_discont (GstMPEGParse * mpeg_parse, GstEvent * event)
|
||||||
(double) time / GST_SECOND);
|
(double) time / GST_SECOND);
|
||||||
|
|
||||||
if (CLASS (mpeg_parse)->send_discont)
|
if (CLASS (mpeg_parse)->send_discont)
|
||||||
result = CLASS (mpeg_parse)->send_discont (mpeg_parse, time);
|
ret = CLASS (mpeg_parse)->send_discont (mpeg_parse, time);
|
||||||
} 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");
|
||||||
|
@ -356,7 +356,7 @@ gst_mpeg_parse_handle_discont (GstMPEGParse * mpeg_parse, GstEvent * event)
|
||||||
mpeg_parse->packetize->resync = TRUE;
|
mpeg_parse->packetize->resync = TRUE;
|
||||||
|
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
return result;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
|
@ -365,7 +365,7 @@ gst_mpeg_parse_send_buffer (GstMPEGParse * mpeg_parse, GstBuffer * buffer,
|
||||||
{
|
{
|
||||||
GstFlowReturn result = GST_FLOW_OK;
|
GstFlowReturn result = GST_FLOW_OK;
|
||||||
|
|
||||||
if (!gst_caps_is_fixed (gst_pad_get_caps (mpeg_parse->srcpad))) {
|
if (!gst_caps_is_fixed (GST_PAD_CAPS (mpeg_parse->srcpad))) {
|
||||||
gboolean mpeg2 = GST_MPEG_PACKETIZE_IS_MPEG2 (mpeg_parse->packetize);
|
gboolean mpeg2 = GST_MPEG_PACKETIZE_IS_MPEG2 (mpeg_parse->packetize);
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
|
@ -377,68 +377,46 @@ gst_mpeg_parse_send_buffer (GstMPEGParse * mpeg_parse, GstBuffer * buffer,
|
||||||
if (!gst_pad_set_caps (mpeg_parse->srcpad, caps)) {
|
if (!gst_pad_set_caps (mpeg_parse->srcpad, caps)) {
|
||||||
GST_ELEMENT_ERROR (GST_ELEMENT (mpeg_parse),
|
GST_ELEMENT_ERROR (GST_ELEMENT (mpeg_parse),
|
||||||
CORE, NEGOTIATION, (NULL), ("failed to set caps"));
|
CORE, NEGOTIATION, (NULL), ("failed to set caps"));
|
||||||
|
gst_caps_unref (caps);
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_BUFFER_TIMESTAMP (buffer) = time;
|
GST_BUFFER_TIMESTAMP (buffer) = time;
|
||||||
GST_DEBUG ("current_scr %" G_GINT64_FORMAT, time);
|
GST_DEBUG ("current_scr %" G_GINT64_FORMAT, time);
|
||||||
|
|
||||||
if (GST_PAD_IS_USABLE (mpeg_parse->srcpad))
|
result = gst_pad_push (mpeg_parse->srcpad, buffer);
|
||||||
result = gst_pad_push (mpeg_parse->srcpad, buffer);
|
|
||||||
else
|
|
||||||
gst_buffer_unref (buffer);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static gboolean
|
||||||
gst_mpeg_parse_process_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
gst_mpeg_parse_process_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
||||||
GstClockTime time)
|
GstClockTime time)
|
||||||
{
|
{
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
return gst_pad_event_default (mpeg_parse->sinkpad, event);
|
||||||
default:
|
|
||||||
if (!gst_pad_event_default (mpeg_parse->sinkpad, event))
|
|
||||||
return GST_FLOW_ERROR;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static gboolean
|
||||||
gst_mpeg_parse_send_discont (GstMPEGParse * mpeg_parse, GstClockTime time)
|
gst_mpeg_parse_send_discont (GstMPEGParse * mpeg_parse, GstClockTime time)
|
||||||
{
|
{
|
||||||
GstFlowReturn result = GST_FLOW_OK;
|
|
||||||
GstEvent *event;
|
GstEvent *event;
|
||||||
|
|
||||||
event = gst_event_new_newsegment (FALSE, 1.0, GST_FORMAT_TIME, time,
|
event = gst_event_new_newsegment (FALSE, 1.0, GST_FORMAT_TIME, time,
|
||||||
GST_CLOCK_TIME_NONE, (gint64) 0);
|
GST_CLOCK_TIME_NONE, (gint64) 0);
|
||||||
|
|
||||||
if (!event) {
|
|
||||||
GST_ELEMENT_ERROR (GST_ELEMENT (mpeg_parse),
|
|
||||||
RESOURCE, FAILED, (NULL), ("Allocation failed"));
|
|
||||||
return GST_FLOW_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CLASS (mpeg_parse)->send_event)
|
if (CLASS (mpeg_parse)->send_event)
|
||||||
result = CLASS (mpeg_parse)->send_event (mpeg_parse, event, time);
|
return CLASS (mpeg_parse)->send_event (mpeg_parse, event, time);
|
||||||
|
|
||||||
return result;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static gboolean
|
||||||
gst_mpeg_parse_send_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
gst_mpeg_parse_send_event (GstMPEGParse * mpeg_parse, GstEvent * event,
|
||||||
GstClockTime time)
|
GstClockTime time)
|
||||||
{
|
{
|
||||||
GstFlowReturn result = GST_FLOW_OK;
|
return gst_pad_push_event (mpeg_parse->srcpad, event);
|
||||||
|
|
||||||
if (GST_PAD_IS_USABLE (mpeg_parse->srcpad))
|
|
||||||
result = gst_pad_push_event (mpeg_parse->srcpad, event);
|
|
||||||
else
|
|
||||||
gst_event_unref (event);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -633,9 +611,9 @@ gst_mpeg_parse_parse_packhead (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_mpeg_parse_event (GstPad * pad, GstEvent * event)
|
gst_mpeg_parse_event (GstPad * pad, GstEvent * event)
|
||||||
{
|
{
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
|
||||||
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (gst_pad_get_parent (pad));
|
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (gst_pad_get_parent (pad));
|
||||||
GstClockTime time;
|
GstClockTime time;
|
||||||
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
time = MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr);
|
time = MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr);
|
||||||
|
|
||||||
|
@ -643,6 +621,8 @@ gst_mpeg_parse_event (GstPad * pad, GstEvent * event)
|
||||||
case GST_EVENT_NEWSEGMENT:
|
case GST_EVENT_NEWSEGMENT:
|
||||||
if (CLASS (mpeg_parse)->handle_discont)
|
if (CLASS (mpeg_parse)->handle_discont)
|
||||||
ret = CLASS (mpeg_parse)->handle_discont (mpeg_parse, event);
|
ret = CLASS (mpeg_parse)->handle_discont (mpeg_parse, event);
|
||||||
|
else
|
||||||
|
gst_event_unref (event);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (CLASS (mpeg_parse)->process_event)
|
if (CLASS (mpeg_parse)->process_event)
|
||||||
|
@ -653,7 +633,7 @@ gst_mpeg_parse_event (GstPad * pad, GstEvent * event)
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_object_unref (mpeg_parse);
|
gst_object_unref (mpeg_parse);
|
||||||
return ret == GST_FLOW_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
|
@ -674,7 +654,7 @@ gst_mpeg_parse_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
while (1) {
|
while (1) {
|
||||||
result = gst_mpeg_packetize_read (mpeg_parse->packetize, &buffer);
|
result = gst_mpeg_packetize_read (mpeg_parse->packetize, &buffer);
|
||||||
if (result == GST_FLOW_RESEND) {
|
if (result == GST_FLOW_RESEND) {
|
||||||
// there was not enough data in packetizer cache
|
/* there was not enough data in packetizer cache */
|
||||||
result = GST_FLOW_OK;
|
result = GST_FLOW_OK;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -705,11 +685,11 @@ gst_mpeg_parse_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
} else {
|
} else {
|
||||||
if (mpeg2) {
|
if (mpeg2) {
|
||||||
if (CLASS (mpeg_parse)->parse_pes) {
|
if (CLASS (mpeg_parse)->parse_pes) {
|
||||||
CLASS (mpeg_parse)->parse_pes (mpeg_parse, buffer);
|
result = CLASS (mpeg_parse)->parse_pes (mpeg_parse, buffer);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (CLASS (mpeg_parse)->parse_packet) {
|
if (CLASS (mpeg_parse)->parse_packet) {
|
||||||
CLASS (mpeg_parse)->parse_packet (mpeg_parse, buffer);
|
result = CLASS (mpeg_parse)->parse_packet (mpeg_parse, buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -727,13 +707,9 @@ gst_mpeg_parse_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (CLASS (mpeg_parse)->send_discont) {
|
if (CLASS (mpeg_parse)->send_discont) {
|
||||||
result = CLASS (mpeg_parse)->send_discont (mpeg_parse,
|
CLASS (mpeg_parse)->send_discont (mpeg_parse,
|
||||||
MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr +
|
MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr +
|
||||||
mpeg_parse->adjust));
|
mpeg_parse->adjust));
|
||||||
if (result != GST_FLOW_OK) {
|
|
||||||
gst_buffer_unref (buffer);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mpeg_parse->discont_pending = FALSE;
|
mpeg_parse->discont_pending = FALSE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -805,7 +781,7 @@ gst_mpeg_parse_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
", next SCR: %" G_GINT64_FORMAT, size, bss, br, mpeg_parse->next_scr);
|
", next SCR: %" G_GINT64_FORMAT, size, bss, br, mpeg_parse->next_scr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != GST_FLOW_OK) {
|
if (result != GST_FLOW_OK && result != GST_FLOW_NOT_LINKED) {
|
||||||
gst_buffer_unref (buffer);
|
gst_buffer_unref (buffer);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -813,6 +789,10 @@ gst_mpeg_parse_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
|
|
||||||
done:
|
done:
|
||||||
gst_object_unref (mpeg_parse);
|
gst_object_unref (mpeg_parse);
|
||||||
|
|
||||||
|
if (result == GST_FLOW_NOT_LINKED)
|
||||||
|
result = GST_FLOW_OK;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,22 +108,22 @@ G_BEGIN_DECLS
|
||||||
GstElementClass parent_class;
|
GstElementClass parent_class;
|
||||||
|
|
||||||
/* process packet types */
|
/* process packet types */
|
||||||
gboolean (*parse_packhead) (GstMPEGParse * parse, GstBuffer * buffer);
|
gboolean (*parse_packhead) (GstMPEGParse * parse, GstBuffer * buffer);
|
||||||
gboolean (*parse_syshead) (GstMPEGParse * parse, GstBuffer * buffer);
|
gboolean (*parse_syshead) (GstMPEGParse * parse, GstBuffer * buffer);
|
||||||
gboolean (*parse_packet) (GstMPEGParse * parse, GstBuffer * buffer);
|
GstFlowReturn (*parse_packet) (GstMPEGParse * parse, GstBuffer * buffer);
|
||||||
gboolean (*parse_pes) (GstMPEGParse * parse, GstBuffer * buffer);
|
GstFlowReturn (*parse_pes) (GstMPEGParse * parse, GstBuffer * buffer);
|
||||||
|
|
||||||
/* process events */
|
/* process events */
|
||||||
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, GstBuffer * buffer, GstClockTime time);
|
||||||
GstFlowReturn (*process_event) (GstMPEGParse * parse, GstEvent * event, GstClockTime time);
|
gboolean (*process_event) (GstMPEGParse * parse, GstEvent * event, GstClockTime time);
|
||||||
GstFlowReturn (*send_discont) (GstMPEGParse * parse, GstClockTime time);
|
gboolean (*send_discont) (GstMPEGParse * parse, GstClockTime time);
|
||||||
GstFlowReturn (*send_event) (GstMPEGParse * parse, GstEvent *event, GstClockTime time);
|
gboolean (*send_event) (GstMPEGParse * parse, GstEvent *event, GstClockTime time);
|
||||||
|
|
||||||
/* signals */
|
/* signals */
|
||||||
void (*reached_offset) (GstMPEGParse *mpeg_parse, GstClockTime timeval);
|
void (*reached_offset) (GstMPEGParse *parse, GstClockTime timeval);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_mpeg_parse_get_type (void);
|
GType gst_mpeg_parse_get_type (void);
|
||||||
|
|
Loading…
Reference in a new issue