2002-03-20 21:45:03 +00:00
|
|
|
/* GStreamer
|
2001-12-22 23:26:48 +00:00
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2003-06-29 19:46:09 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2004-07-27 21:51:28 +00:00
|
|
|
#include "gstmpegdemux.h"
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (gstmpegdemux_debug);
|
|
|
|
#define GST_CAT_DEFAULT (gstmpegdemux_debug)
|
|
|
|
|
2005-11-14 21:20:21 +00:00
|
|
|
#define PARSE_CLASS(o) GST_MPEG_PARSE_CLASS (G_OBJECT_GET_CLASS (o))
|
2004-03-27 22:45:41 +00:00
|
|
|
#define CLASS(o) GST_MPEG_DEMUX_CLASS (G_OBJECT_GET_CLASS (o))
|
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
/* MPEG2Demux signals and args */
|
2004-03-14 22:34:30 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-22 23:26:48 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-22 23:26:48 +00:00
|
|
|
ARG_0,
|
|
|
|
ARG_BIT_RATE,
|
2004-05-21 22:39:29 +00:00
|
|
|
ARG_MPEG2
|
|
|
|
/* FILL ME */
|
2001-12-22 23:26:48 +00:00
|
|
|
};
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("video/mpeg, "
|
2004-03-15 19:32:25 +00:00
|
|
|
"mpegversion = (int) { 1, 2 }, " "systemstream = (boolean) TRUE")
|
2004-03-14 22:34:30 +00:00
|
|
|
);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
static GstStaticPadTemplate video_template =
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("video_%02d",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_SOMETIMES,
|
|
|
|
GST_STATIC_CAPS ("video/mpeg, "
|
2004-03-15 19:32:25 +00:00
|
|
|
"mpegversion = (int) { 1, 2 }, " "systemstream = (boolean) FALSE")
|
2004-03-14 22:34:30 +00:00
|
|
|
);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
static GstStaticPadTemplate audio_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("audio_%02d",
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_SOMETIMES,
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_STATIC_CAPS ("audio/mpeg, " "mpegversion = (int) 1"
|
|
|
|
/* FIXME "layer = (int) { 1, 2 }" */
|
|
|
|
)
|
2004-03-14 22:34:30 +00:00
|
|
|
);
|
2003-03-02 09:48:48 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
static GstStaticPadTemplate private_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("private_%d",
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_SOMETIMES,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
2005-11-24 13:52:49 +00:00
|
|
|
#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);
|
|
|
|
|
2007-05-16 12:48:43 +00:00
|
|
|
static gboolean gst_mpeg_demux_process_event (GstMPEGParse * mpeg_parse,
|
|
|
|
GstEvent * event);
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
static GstPad *gst_mpeg_demux_new_output_pad (GstMPEGDemux * mpeg_demux,
|
|
|
|
const gchar * name, GstPadTemplate * temp);
|
|
|
|
static void gst_mpeg_demux_init_stream (GstMPEGDemux * mpeg_demux,
|
|
|
|
gint type,
|
|
|
|
GstMPEGStream * str,
|
|
|
|
gint number, const gchar * name, GstPadTemplate * temp);
|
|
|
|
static GstMPEGStream *gst_mpeg_demux_get_video_stream (GstMPEGDemux *
|
|
|
|
mpeg_demux, guint8 stream_nr, gint type, const gpointer info);
|
|
|
|
static GstMPEGStream *gst_mpeg_demux_get_audio_stream (GstMPEGDemux *
|
|
|
|
mpeg_demux, guint8 stream_nr, gint type, const gpointer info);
|
|
|
|
static GstMPEGStream *gst_mpeg_demux_get_private_stream (GstMPEGDemux *
|
|
|
|
mpeg_demux, guint8 stream_nr, gint type, const gpointer info);
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static gboolean gst_mpeg_demux_parse_packhead (GstMPEGParse * mpeg_parse,
|
|
|
|
GstBuffer * buffer);
|
|
|
|
static gboolean gst_mpeg_demux_parse_syshead (GstMPEGParse * mpeg_parse,
|
|
|
|
GstBuffer * buffer);
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
static GstFlowReturn gst_mpeg_demux_parse_packet (GstMPEGParse * mpeg_parse,
|
2004-03-14 22:34:30 +00:00
|
|
|
GstBuffer * buffer);
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
static GstFlowReturn gst_mpeg_demux_parse_pes (GstMPEGParse * mpeg_parse,
|
2004-03-14 22:34:30 +00:00
|
|
|
GstBuffer * buffer);
|
|
|
|
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
static GstFlowReturn gst_mpeg_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
|
2004-03-27 22:45:41 +00:00
|
|
|
GstMPEGStream * outstream, GstBuffer * buffer,
|
|
|
|
GstClockTime timestamp, guint offset, guint size);
|
gst/mpegstream/: Fix flow value combination; this fixes playbin/totem locking up if a VobSub file is specified as sub...
Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_class_init), (gst_dvd_demux_combine_flows),
(gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_init_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_combine_flows),
(gst_mpeg_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_chain):
Fix flow value combination; this fixes playbin/totem locking up if
a VobSub file is specified as subtitle file (#334322). Flow value
combination should only happen once we are fairly sure we've got all
pads that are available for now. Since there isn't a well-specified
time when this is the case in MPEG, we'll just assume this is the
case once there has been a certain number of packets for each
stream we've found so far.
2006-11-19 13:08:30 +00:00
|
|
|
static GstFlowReturn gst_mpeg_demux_combine_flows (GstMPEGDemux * mpeg_demux,
|
|
|
|
GstMPEGStream * stream, GstFlowReturn flow);
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
static GstFlowReturn gst_mpeg_demux_process_private (GstMPEGDemux * mpeg_demux,
|
2004-03-27 22:45:41 +00:00
|
|
|
GstBuffer * buffer,
|
|
|
|
guint stream_nr, GstClockTime timestamp, guint headerlen, guint datalen);
|
2005-11-14 21:20:21 +00:00
|
|
|
static void gst_mpeg_demux_synchronise_pads (GstMPEGDemux * mpeg_demux,
|
|
|
|
GstClockTime threshold, GstClockTime new_ts);
|
|
|
|
static void gst_mpeg_demux_sync_stream_to_time (GstMPEGDemux * mpeg_demux,
|
|
|
|
GstMPEGStream * stream, GstClockTime last_ts);
|
2004-03-27 22:45:41 +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.
2005-11-15 14:19:38 +00:00
|
|
|
#if 0
|
2004-03-27 22:45:41 +00:00
|
|
|
const GstFormat *gst_mpeg_demux_get_src_formats (GstPad * pad);
|
|
|
|
|
|
|
|
static gboolean index_seek (GstPad * pad, GstEvent * event, gint64 * offset);
|
|
|
|
static gboolean normal_seek (GstPad * pad, GstEvent * event, gint64 * offset);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
|
|
|
static gboolean gst_mpeg_demux_handle_src_event (GstPad * pad,
|
|
|
|
GstEvent * event);
|
2005-11-14 21:20:21 +00:00
|
|
|
#endif
|
2005-01-05 17:03:27 +00:00
|
|
|
static void gst_mpeg_demux_reset (GstMPEGDemux * mpeg_demux);
|
|
|
|
|
2005-11-14 21:20:21 +00:00
|
|
|
#if 0
|
|
|
|
static gboolean gst_mpeg_demux_handle_src_query (GstPad * pad,
|
|
|
|
GstQueryType type, GstFormat * format, gint64 * value);
|
|
|
|
#endif
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2005-09-02 15:43:54 +00:00
|
|
|
static GstStateChangeReturn gst_mpeg_demux_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2004-03-27 22:45:41 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void gst_mpeg_demux_set_index (GstElement * element, GstIndex * index);
|
|
|
|
static GstIndex *gst_mpeg_demux_get_index (GstElement * element);
|
|
|
|
|
2002-02-03 20:10:04 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
/*static guint gst_mpeg_demux_signals[LAST_SIGNAL] = { 0 };*/
|
|
|
|
|
2003-11-02 21:22:09 +00:00
|
|
|
static void
|
2005-11-24 13:52:49 +00:00
|
|
|
gst_mpeg_demux_base_init (gpointer klass_ptr)
|
2003-11-02 21:22:09 +00:00
|
|
|
{
|
2005-11-24 13:52:49 +00:00
|
|
|
GstMPEGDemuxClass *klass = GST_MPEG_DEMUX_CLASS (klass_ptr);
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass_ptr);
|
2003-11-02 21:22:09 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
klass->video_template = gst_static_pad_template_get (&video_template);
|
|
|
|
klass->audio_template = gst_static_pad_template_get (&audio_template);
|
|
|
|
klass->private_template = gst_static_pad_template_get (&private_template);
|
2003-11-02 21:22:09 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
gst_element_class_add_pad_template (element_class, klass->video_template);
|
|
|
|
gst_element_class_add_pad_template (element_class, klass->audio_template);
|
|
|
|
gst_element_class_add_pad_template (element_class, klass->private_template);
|
|
|
|
|
2010-03-18 14:53:14 +00:00
|
|
|
gst_element_class_set_details_simple (element_class, "MPEG Demuxer",
|
|
|
|
"Codec/Demuxer",
|
|
|
|
"Demultiplexes MPEG1 and MPEG2 System Streams",
|
|
|
|
"Erik Walthinsen <omega@cse.ogi.edu>, Wim Taymans <wim.taymans@chello.be>");
|
2003-11-02 21:22:09 +00:00
|
|
|
}
|
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_demux_class_init (GstMPEGDemuxClass * klass)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
2002-02-03 20:10:04 +00:00
|
|
|
GstElementClass *gstelement_class;
|
2004-03-27 22:45:41 +00:00
|
|
|
GstMPEGParseClass *mpeg_parse_class;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2005-11-14 21:20:21 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2002-02-03 20:10:04 +00:00
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2004-03-27 22:45:41 +00:00
|
|
|
mpeg_parse_class = (GstMPEGParseClass *) klass;
|
2002-02-03 20:10:04 +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.
2005-11-15 14:19:38 +00:00
|
|
|
gstelement_class->change_state =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_mpeg_demux_change_state);
|
|
|
|
gstelement_class->set_index = GST_DEBUG_FUNCPTR (gst_mpeg_demux_set_index);
|
|
|
|
gstelement_class->get_index = GST_DEBUG_FUNCPTR (gst_mpeg_demux_get_index);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
mpeg_parse_class->parse_packhead = gst_mpeg_demux_parse_packhead;
|
|
|
|
mpeg_parse_class->parse_syshead = gst_mpeg_demux_parse_syshead;
|
|
|
|
mpeg_parse_class->parse_packet = gst_mpeg_demux_parse_packet;
|
|
|
|
mpeg_parse_class->parse_pes = gst_mpeg_demux_parse_pes;
|
gst/mpegstream/: Fix flow value combination; this fixes playbin/totem locking up if a VobSub file is specified as sub...
Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_class_init), (gst_dvd_demux_combine_flows),
(gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_init_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_combine_flows),
(gst_mpeg_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_chain):
Fix flow value combination; this fixes playbin/totem locking up if
a VobSub file is specified as subtitle file (#334322). Flow value
combination should only happen once we are fairly sure we've got all
pads that are available for now. Since there isn't a well-specified
time when this is the case in MPEG, we'll just assume this is the
case once there has been a certain number of packets for each
stream we've found so far.
2006-11-19 13:08:30 +00:00
|
|
|
mpeg_parse_class->send_buffer = NULL;
|
2007-05-16 12:48:43 +00:00
|
|
|
mpeg_parse_class->process_event = gst_mpeg_demux_process_event;
|
2004-03-27 22:45:41 +00:00
|
|
|
|
|
|
|
klass->new_output_pad = gst_mpeg_demux_new_output_pad;
|
|
|
|
klass->init_stream = gst_mpeg_demux_init_stream;
|
|
|
|
klass->get_video_stream = gst_mpeg_demux_get_video_stream;
|
|
|
|
klass->get_audio_stream = gst_mpeg_demux_get_audio_stream;
|
|
|
|
klass->get_private_stream = gst_mpeg_demux_get_private_stream;
|
|
|
|
klass->send_subbuffer = gst_mpeg_demux_send_subbuffer;
|
gst/mpegstream/: Fix flow value combination; this fixes playbin/totem locking up if a VobSub file is specified as sub...
Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_class_init), (gst_dvd_demux_combine_flows),
(gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_init_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_combine_flows),
(gst_mpeg_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_chain):
Fix flow value combination; this fixes playbin/totem locking up if
a VobSub file is specified as subtitle file (#334322). Flow value
combination should only happen once we are fairly sure we've got all
pads that are available for now. Since there isn't a well-specified
time when this is the case in MPEG, we'll just assume this is the
case once there has been a certain number of packets for each
stream we've found so far.
2006-11-19 13:08:30 +00:00
|
|
|
klass->combine_flows = gst_mpeg_demux_combine_flows;
|
2004-03-27 22:45:41 +00:00
|
|
|
klass->process_private = gst_mpeg_demux_process_private;
|
2005-11-14 21:20:21 +00:00
|
|
|
klass->synchronise_pads = gst_mpeg_demux_synchronise_pads;
|
|
|
|
klass->sync_stream_to_time = gst_mpeg_demux_sync_stream_to_time;
|
ext/dvdread/dvdreadsrc.c: Fix. Don't do one big huge loop around the whole DVD, that will cache all data and thus eat...
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_dispose), (dvdreadsrc_set_property),
(dvdreadsrc_get_property), (_open), (_seek), (_read),
(dvdreadsrc_get), (dvdreadsrc_open_file),
(dvdreadsrc_change_state):
Fix. Don't do one big huge loop around the whole DVD, that will
cache all data and thus eat sizeof(dvd) (several GB) before we
see something.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_seek):
Actually NULL'ify event after using it.
* gst/matroska/ebml-read.c: (gst_ebml_read_use_event),
(gst_ebml_read_handle_event), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_read_element_data),
(gst_ebml_read_seek), (gst_ebml_read_skip):
Handle events.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_init), (gst_dvd_demux_get_audio_stream),
(gst_dvd_demux_get_subpicture_stream), (gst_dvd_demux_plugin_init):
Fix timing (this will probably break if I seek using menus, but
I didn't get there yet). VOBs and normal DVDs should now work.
Add a mpeg2-only pad with high rank so this get autoplugged for
MPEG-2 movies.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_base_init),
(gst_mpeg_demux_class_init), (gst_mpeg_demux_init),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_get_video_stream),
(gst_mpeg_demux_get_audio_stream),
(gst_mpeg_demux_get_private_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_plugin_init):
Use this as second rank for MPEG-1 and MPEG-2. Still use this for
MPEG-1 but use dvddemux for MPEG-2.
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_class_init),
(gst_mpeg_parse_init), (gst_mpeg_parse_new_pad),
(gst_mpeg_parse_parse_packhead):
Timing. Only add pad template if it exists. Add sink template from
class and not from ourselves. This means we will always use the
correct sink template even if it is not the one defined in this
file.
2004-10-01 08:42:56 +00:00
|
|
|
|
|
|
|
/* we have our own sink pad template, but don't use it in subclasses */
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&sink_template));
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-11-24 13:52:49 +00:00
|
|
|
gst_mpeg_demux_init (GstMPEGDemux * mpeg_demux, GstMPEGDemuxClass * klass)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
/* i think everything is already zero'd, but oh well */
|
2004-03-27 22:45:41 +00:00
|
|
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_VIDEO_STREAMS; i++) {
|
2002-11-27 21:00:12 +00:00
|
|
|
mpeg_demux->video_stream[i] = NULL;
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
2004-03-27 22:45:41 +00:00
|
|
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_AUDIO_STREAMS; i++) {
|
2002-11-27 21:00:12 +00:00
|
|
|
mpeg_demux->audio_stream[i] = NULL;
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
2004-03-27 22:45:41 +00:00
|
|
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_PRIVATE_STREAMS; i++) {
|
|
|
|
mpeg_demux->private_stream[i] = NULL;
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2005-11-14 21:20:21 +00:00
|
|
|
mpeg_demux->max_gap = GST_CLOCK_TIME_NONE;
|
|
|
|
mpeg_demux->max_gap_tolerance = GST_CLOCK_TIME_NONE;
|
2006-03-23 18:17:34 +00:00
|
|
|
|
|
|
|
mpeg_demux->last_pts = -1;
|
2008-07-05 15:56:56 +00:00
|
|
|
mpeg_demux->pending_tags = FALSE;
|
2005-11-14 21:20:21 +00:00
|
|
|
}
|
2002-11-27 21:00:12 +00:00
|
|
|
|
2007-05-16 12:48:43 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_mpeg_demux_process_event (GstMPEGParse * mpeg_parse, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstMPEGDemux *demux = GST_MPEG_DEMUX (mpeg_parse);
|
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
ret = GST_MPEG_PARSE_CLASS (parent_class)->process_event (mpeg_parse,
|
|
|
|
event);
|
|
|
|
|
2008-07-05 15:56:56 +00:00
|
|
|
demux->pending_tags = TRUE;
|
|
|
|
|
2007-05-16 12:48:43 +00:00
|
|
|
gst_mpeg_streams_reset_last_flow (demux->video_stream,
|
|
|
|
GST_MPEG_DEMUX_NUM_VIDEO_STREAMS);
|
|
|
|
gst_mpeg_streams_reset_last_flow (demux->audio_stream,
|
|
|
|
GST_MPEG_DEMUX_NUM_AUDIO_STREAMS);
|
|
|
|
gst_mpeg_streams_reset_last_flow (demux->private_stream,
|
|
|
|
GST_MPEG_DEMUX_NUM_PRIVATE_STREAMS);
|
|
|
|
break;
|
ext/dvdread/dvdreadsrc.c: Allow and implement non-flushing and/or segment seek (mainly in TIME and chapter format).
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_read),
(gst_dvd_read_src_create), (gst_dvd_read_src_handle_seek_event):
Allow and implement non-flushing and/or segment seek
(mainly in TIME and chapter format).
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_process_event),
(gst_dvd_demux_get_subpicture_stream),
(gst_dvd_demux_synchronise_pads),
(gst_dvd_demux_sync_stream_to_time):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_process_event),
(gst_mpeg_demux_send_subbuffer),
(gst_mpeg_demux_sync_stream_to_time),
(gst_mpeg_streams_reset_cur_ts):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_pad_added), (gst_mpeg_parse_handle_src_query):
Delegate a query to upstream if it can't be handled.
Make segment stop aware.
Fix (subtitle) stream synchronization.
Add some debug statements.
2008-06-27 12:58:35 +00:00
|
|
|
case GST_EVENT_NEWSEGMENT:
|
|
|
|
/* reset stream synchronization */
|
|
|
|
gst_mpeg_streams_reset_cur_ts (demux->video_stream,
|
|
|
|
GST_MPEG_DEMUX_NUM_VIDEO_STREAMS, 0);
|
|
|
|
gst_mpeg_streams_reset_cur_ts (demux->audio_stream,
|
|
|
|
GST_MPEG_DEMUX_NUM_AUDIO_STREAMS, 0);
|
|
|
|
gst_mpeg_streams_reset_cur_ts (demux->private_stream,
|
|
|
|
GST_MPEG_DEMUX_NUM_PRIVATE_STREAMS, 0);
|
|
|
|
/* fallthrough */
|
2007-05-16 12:48:43 +00:00
|
|
|
default:
|
|
|
|
ret = GST_MPEG_PARSE_CLASS (parent_class)->process_event (mpeg_parse,
|
|
|
|
event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2003-07-25 02:04:01 +00:00
|
|
|
static gint
|
2004-03-14 22:34:30 +00:00
|
|
|
_demux_get_writer_id (GstIndex * index, GstPad * pad)
|
2003-07-25 02:04:01 +00:00
|
|
|
{
|
|
|
|
gint id;
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2003-07-25 02:04:01 +00:00
|
|
|
if (!gst_index_get_writer_id (index, GST_OBJECT (pad), &id)) {
|
2005-11-14 21:20:21 +00:00
|
|
|
GST_WARNING_OBJECT (index,
|
2004-03-15 19:32:25 +00:00
|
|
|
"can't get index id for %s:%s", GST_DEBUG_PAD_NAME (pad));
|
2003-07-25 02:04:01 +00:00
|
|
|
return -1;
|
|
|
|
} else {
|
2005-11-14 21:20:21 +00:00
|
|
|
GST_LOG_OBJECT (index,
|
2004-03-15 19:32:25 +00:00
|
|
|
"got index id %d for %s:%s", id, GST_DEBUG_PAD_NAME (pad));
|
2003-07-25 02:04:01 +00:00
|
|
|
return id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
static GstPad *
|
|
|
|
gst_mpeg_demux_new_output_pad (GstMPEGDemux * mpeg_demux,
|
|
|
|
const gchar * name, GstPadTemplate * temp)
|
|
|
|
{
|
|
|
|
GstPad *pad;
|
|
|
|
|
|
|
|
pad = gst_pad_new_from_template (temp, name);
|
|
|
|
|
2005-11-14 21:20:21 +00:00
|
|
|
#if 0
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
gst_pad_set_event_function (pad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_mpeg_demux_handle_src_event));
|
gst/mpegstream/gstdvddemux.c (gst_dvd_demux_handle_newsegment): Properly handle non contiguous VOBUs by adding the se...
Original commit message from CVS:
2005-12-08 Martin Soto <martinsoto@users.sourceforge.net>
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_handle_newsegment):
Properly handle non contiguous VOBUs by adding the segment accum
field to the adjust value.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_class_init)
(gst_dvd_demux_init, gst_dvd_demux_handle_newsegment): Extend
handle_newsegment to prevent sending actual newsegment events and
use tiemstamp rewriting instead.
(gst_dvd_demux_handle_dvd_event): Don't send a newsegment after
dvd-lang-codes.
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_handle_newsegment)
(gst_mpeg_parse_event):
* gst/mpegstream/gstmpegparse.h (struct _GstMPEGParseClass):
Add a new parameter to handle_newsegment to allow controlling
whether newsegment events are forwarded or not.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_init)
(gst_dvd_demux_handle_dvd_event, gst_dvd_demux_send_subbuffer)
(gst_dvd_demux_reset):
last_end_ptm and discont_time aren't necessary anymore, since
timestamp adjustment is now replaced by newsegment events.
(gst_dvd_demux_init): Prevent MPEGParse from adjusting
timestamps.
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_handle_dvd_event):
Don't handle dvd-nav-packet events anymore, since the are now
replaced by standard newsegment events.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_init)
(gst_dvd_demux_handle_dvd_event, gst_dvd_demux_send_subbuffer)
(gst_dvd_demux_change_state):
* gst/mpegstream/gstdvddemux.h:
Get rid of the ignore_next_newmedia_discont hack.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_class_init)
(gst_dvd_demux_handle_newsegment):
* gst/mpegstream/gstmpegdemux.c (gst_mpeg_demux_class_init)
(gst_mpeg_demux_handle_newsegment): Don't override
handle_newsegment anymore. It was only necessary to handle
NEWMEDIA events.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_process_event)
(gst_dvd_demux_handle_dvd_event, gst_dvd_demux_set_cur_audio)
(gst_dvd_demux_set_cur_subpicture):
Reactivate handling of DVD events.
* gst/mpegstream/gstmpegparse.c (normal_seek)
(gst_mpeg_parse_handle_src_event)
(gst_mpeg_parse_handle_src_query):
First attempt at reenabling seek.
* gst/mpegstream/gstmpegparse.h:
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_init)
(gst_mpeg_parse_update_streaminfo)
(gst_mpeg_parse_get_rate)
(gst_mpeg_parse_convert, gst_mpeg_parse_get_src_query_types)
(gst_mpeg_parse_handle_src_query):
* gst/mpegstream/gstmpegdemux.c (gst_mpeg_demux_new_output_pad):
Make queries work again.
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_reset)
(gst_mpeg_parse_handle_newsegment)
(gst_mpeg_parse_send_newsegment, gst_mpeg_parse_pad_added)
(gst_mpeg_parse_chain, gst_mpeg_parse_handle_src_event):
* gst/mpegstream/gstmpegparse.h (struct _GstMPEGParse):
Get rid of the newsegment_pending attribute, and rely instead on
proper timestamp adjustment.
* gst/mpegstream/gstmpegparse.c
(gst_mpeg_parse_get_src_event_masks): Erase.
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_init):
Initialize fields before creating pads to prevent the pad creation
callback from failing.
(gst_mpeg_parse_reset): Initialize new fields, and change
initialization order to match the order in the structure.
(gst_mpeg_parse_handle_newsegment): Forward new segment events
whenever possible, and update the current segment.
(gst_mpeg_parse_send_newsegment): Update the current segment and
pending_newsegment.
(gst_mpeg_parse_pad_added): Use the current segment to send
newsegment events to new pads.
(gst_mpeg_parse_chain): Properly add adjust time to sent buffers
and events. Properly update newsegment_pending.
* gst/mpegstream/gstmpegparse.h (struct _GstMPEGParse):
New fields do_adjust and current_segment.
* gst/mpegstream/gstmpegdemux.c:
* gst/mpegstream/gstdvddemux.c:
* gst/mpegstream/gstmpegparse.h:
Rename handle_discont virtual method to handle_newsegment. Erase
some (already commented out support) for old NEW_MEDIA events.
* gst/mpegstream/gstmpegparse.h (struct _GstMPEGParse):
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_init)
(gst_mpeg_parse_reset, gst_mpeg_parse_handle_discont)
(gst_mpeg_parse_pad_added, gst_mpeg_parse_parse_packhead)
(gst_mpeg_parse_event, gst_mpeg_parse_chain):
Erase the "pending_scr" field, and replace it by a slightly
different handling of the current SCR. Document code blocks in
parse_packhead and chain.
2005-12-08 12:45:09 +00:00
|
|
|
#endif
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
gst_pad_set_query_type_function (pad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_mpeg_parse_get_src_query_types));
|
|
|
|
gst_pad_set_query_function (pad,
|
gst/mpegstream/gstdvddemux.c (gst_dvd_demux_handle_newsegment): Properly handle non contiguous VOBUs by adding the se...
Original commit message from CVS:
2005-12-08 Martin Soto <martinsoto@users.sourceforge.net>
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_handle_newsegment):
Properly handle non contiguous VOBUs by adding the segment accum
field to the adjust value.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_class_init)
(gst_dvd_demux_init, gst_dvd_demux_handle_newsegment): Extend
handle_newsegment to prevent sending actual newsegment events and
use tiemstamp rewriting instead.
(gst_dvd_demux_handle_dvd_event): Don't send a newsegment after
dvd-lang-codes.
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_handle_newsegment)
(gst_mpeg_parse_event):
* gst/mpegstream/gstmpegparse.h (struct _GstMPEGParseClass):
Add a new parameter to handle_newsegment to allow controlling
whether newsegment events are forwarded or not.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_init)
(gst_dvd_demux_handle_dvd_event, gst_dvd_demux_send_subbuffer)
(gst_dvd_demux_reset):
last_end_ptm and discont_time aren't necessary anymore, since
timestamp adjustment is now replaced by newsegment events.
(gst_dvd_demux_init): Prevent MPEGParse from adjusting
timestamps.
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_handle_dvd_event):
Don't handle dvd-nav-packet events anymore, since the are now
replaced by standard newsegment events.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_init)
(gst_dvd_demux_handle_dvd_event, gst_dvd_demux_send_subbuffer)
(gst_dvd_demux_change_state):
* gst/mpegstream/gstdvddemux.h:
Get rid of the ignore_next_newmedia_discont hack.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_class_init)
(gst_dvd_demux_handle_newsegment):
* gst/mpegstream/gstmpegdemux.c (gst_mpeg_demux_class_init)
(gst_mpeg_demux_handle_newsegment): Don't override
handle_newsegment anymore. It was only necessary to handle
NEWMEDIA events.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_process_event)
(gst_dvd_demux_handle_dvd_event, gst_dvd_demux_set_cur_audio)
(gst_dvd_demux_set_cur_subpicture):
Reactivate handling of DVD events.
* gst/mpegstream/gstmpegparse.c (normal_seek)
(gst_mpeg_parse_handle_src_event)
(gst_mpeg_parse_handle_src_query):
First attempt at reenabling seek.
* gst/mpegstream/gstmpegparse.h:
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_init)
(gst_mpeg_parse_update_streaminfo)
(gst_mpeg_parse_get_rate)
(gst_mpeg_parse_convert, gst_mpeg_parse_get_src_query_types)
(gst_mpeg_parse_handle_src_query):
* gst/mpegstream/gstmpegdemux.c (gst_mpeg_demux_new_output_pad):
Make queries work again.
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_reset)
(gst_mpeg_parse_handle_newsegment)
(gst_mpeg_parse_send_newsegment, gst_mpeg_parse_pad_added)
(gst_mpeg_parse_chain, gst_mpeg_parse_handle_src_event):
* gst/mpegstream/gstmpegparse.h (struct _GstMPEGParse):
Get rid of the newsegment_pending attribute, and rely instead on
proper timestamp adjustment.
* gst/mpegstream/gstmpegparse.c
(gst_mpeg_parse_get_src_event_masks): Erase.
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_init):
Initialize fields before creating pads to prevent the pad creation
callback from failing.
(gst_mpeg_parse_reset): Initialize new fields, and change
initialization order to match the order in the structure.
(gst_mpeg_parse_handle_newsegment): Forward new segment events
whenever possible, and update the current segment.
(gst_mpeg_parse_send_newsegment): Update the current segment and
pending_newsegment.
(gst_mpeg_parse_pad_added): Use the current segment to send
newsegment events to new pads.
(gst_mpeg_parse_chain): Properly add adjust time to sent buffers
and events. Properly update newsegment_pending.
* gst/mpegstream/gstmpegparse.h (struct _GstMPEGParse):
New fields do_adjust and current_segment.
* gst/mpegstream/gstmpegdemux.c:
* gst/mpegstream/gstdvddemux.c:
* gst/mpegstream/gstmpegparse.h:
Rename handle_discont virtual method to handle_newsegment. Erase
some (already commented out support) for old NEW_MEDIA events.
* gst/mpegstream/gstmpegparse.h (struct _GstMPEGParse):
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_init)
(gst_mpeg_parse_reset, gst_mpeg_parse_handle_discont)
(gst_mpeg_parse_pad_added, gst_mpeg_parse_parse_packhead)
(gst_mpeg_parse_event, gst_mpeg_parse_chain):
Erase the "pending_scr" field, and replace it by a slightly
different handling of the current SCR. Document code blocks in
parse_packhead and chain.
2005-12-08 12:45:09 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_mpeg_parse_handle_src_query));
|
2005-11-14 21:20:21 +00:00
|
|
|
gst_pad_use_fixed_caps (pad);
|
2004-03-27 22:45:41 +00:00
|
|
|
|
|
|
|
return pad;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_mpeg_demux_init_stream (GstMPEGDemux * mpeg_demux,
|
|
|
|
gint type,
|
|
|
|
GstMPEGStream * str, gint number, const gchar * name, GstPadTemplate * temp)
|
|
|
|
{
|
|
|
|
str->type = type;
|
|
|
|
str->number = number;
|
|
|
|
|
|
|
|
str->pad = CLASS (mpeg_demux)->new_output_pad (mpeg_demux, name, temp);
|
|
|
|
gst_pad_set_element_private (str->pad, str);
|
|
|
|
|
|
|
|
if (mpeg_demux->index) {
|
|
|
|
str->index_id = _demux_get_writer_id (mpeg_demux->index, str->pad);
|
|
|
|
}
|
2005-11-14 21:20:21 +00:00
|
|
|
|
|
|
|
str->cur_ts = 0;
|
|
|
|
str->scr_offs = 0;
|
gst/mpegstream/: Fix flow value combination; this fixes playbin/totem locking up if a VobSub file is specified as sub...
Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_class_init), (gst_dvd_demux_combine_flows),
(gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_init_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_combine_flows),
(gst_mpeg_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_chain):
Fix flow value combination; this fixes playbin/totem locking up if
a VobSub file is specified as subtitle file (#334322). Flow value
combination should only happen once we are fairly sure we've got all
pads that are available for now. Since there isn't a well-specified
time when this is the case in MPEG, we'll just assume this is the
case once there has been a certain number of packets for each
stream we've found so far.
2006-11-19 13:08:30 +00:00
|
|
|
|
|
|
|
str->last_flow = GST_FLOW_OK;
|
|
|
|
str->buffers_sent = 0;
|
2008-07-05 15:56:56 +00:00
|
|
|
str->tags = NULL;
|
2009-01-08 08:19:25 +00:00
|
|
|
str->caps = NULL;
|
2004-03-27 22:45:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstMPEGStream *
|
|
|
|
gst_mpeg_demux_get_video_stream (GstMPEGDemux * mpeg_demux,
|
|
|
|
guint8 stream_nr, gint type, const gpointer info)
|
|
|
|
{
|
|
|
|
gint mpeg_version = *((gint *) info);
|
|
|
|
GstMPEGStream *str;
|
|
|
|
GstMPEGVideoStream *video_str;
|
|
|
|
gchar *name;
|
2004-07-26 15:17:25 +00:00
|
|
|
gboolean set_caps = FALSE;
|
2004-03-27 22:45:41 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (stream_nr < GST_MPEG_DEMUX_NUM_VIDEO_STREAMS, NULL);
|
|
|
|
g_return_val_if_fail (type > GST_MPEG_DEMUX_VIDEO_UNKNOWN &&
|
|
|
|
type < GST_MPEG_DEMUX_VIDEO_LAST, NULL);
|
|
|
|
|
|
|
|
str = mpeg_demux->video_stream[stream_nr];
|
|
|
|
|
|
|
|
if (str == NULL) {
|
|
|
|
video_str = g_new0 (GstMPEGVideoStream, 1);
|
|
|
|
str = (GstMPEGStream *) video_str;
|
|
|
|
|
|
|
|
name = g_strdup_printf ("video_%02d", stream_nr);
|
|
|
|
CLASS (mpeg_demux)->init_stream (mpeg_demux, type, str, stream_nr, name,
|
|
|
|
CLASS (mpeg_demux)->video_template);
|
|
|
|
g_free (name);
|
|
|
|
|
2004-07-26 15:17:25 +00:00
|
|
|
set_caps = TRUE;
|
2004-03-27 22:45:41 +00:00
|
|
|
} else {
|
|
|
|
/* This stream may have been created by a derived class, reset the
|
|
|
|
size. */
|
|
|
|
video_str = g_renew (GstMPEGVideoStream, str, 1);
|
2008-11-03 11:31:49 +00:00
|
|
|
str = (GstMPEGStream *) video_str;
|
2004-03-27 22:45:41 +00:00
|
|
|
}
|
|
|
|
|
2008-11-03 11:31:49 +00:00
|
|
|
mpeg_demux->video_stream[stream_nr] = str;
|
|
|
|
|
2004-07-26 15:17:25 +00:00
|
|
|
if (set_caps || video_str->mpeg_version != mpeg_version) {
|
2005-11-14 21:20:21 +00:00
|
|
|
gchar *codec;
|
|
|
|
GstTagList *list;
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
/* We need to set new caps for this pad. */
|
2009-01-08 08:19:25 +00:00
|
|
|
if (str->caps)
|
|
|
|
gst_caps_unref (str->caps);
|
2005-12-27 19:06:08 +00:00
|
|
|
str->caps = gst_caps_new_simple ("video/mpeg",
|
2004-03-27 22:45:41 +00:00
|
|
|
"mpegversion", G_TYPE_INT, mpeg_version,
|
|
|
|
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
|
2005-12-27 19:06:08 +00:00
|
|
|
if (!gst_pad_set_caps (str->pad, str->caps)) {
|
2004-07-26 15:17:25 +00:00
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (mpeg_demux),
|
|
|
|
CORE, NEGOTIATION, (NULL), ("failed to set caps"));
|
2005-12-27 19:06:08 +00:00
|
|
|
gst_caps_unref (str->caps);
|
|
|
|
str->caps = NULL;
|
2006-10-09 12:09:14 +00:00
|
|
|
gst_pad_set_active (str->pad, TRUE);
|
ext/dvdread/dvdreadsrc.c: Fix. Don't do one big huge loop around the whole DVD, that will cache all data and thus eat...
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_dispose), (dvdreadsrc_set_property),
(dvdreadsrc_get_property), (_open), (_seek), (_read),
(dvdreadsrc_get), (dvdreadsrc_open_file),
(dvdreadsrc_change_state):
Fix. Don't do one big huge loop around the whole DVD, that will
cache all data and thus eat sizeof(dvd) (several GB) before we
see something.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_seek):
Actually NULL'ify event after using it.
* gst/matroska/ebml-read.c: (gst_ebml_read_use_event),
(gst_ebml_read_handle_event), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_read_element_data),
(gst_ebml_read_seek), (gst_ebml_read_skip):
Handle events.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_init), (gst_dvd_demux_get_audio_stream),
(gst_dvd_demux_get_subpicture_stream), (gst_dvd_demux_plugin_init):
Fix timing (this will probably break if I seek using menus, but
I didn't get there yet). VOBs and normal DVDs should now work.
Add a mpeg2-only pad with high rank so this get autoplugged for
MPEG-2 movies.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_base_init),
(gst_mpeg_demux_class_init), (gst_mpeg_demux_init),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_get_video_stream),
(gst_mpeg_demux_get_audio_stream),
(gst_mpeg_demux_get_private_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_plugin_init):
Use this as second rank for MPEG-1 and MPEG-2. Still use this for
MPEG-1 but use dvddemux for MPEG-2.
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_class_init),
(gst_mpeg_parse_init), (gst_mpeg_parse_new_pad),
(gst_mpeg_parse_parse_packhead):
Timing. Only add pad template if it exists. Add sink template from
class and not from ourselves. This means we will always use the
correct sink template even if it is not the one defined in this
file.
2004-10-01 08:42:56 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (mpeg_demux), str->pad);
|
2004-07-26 15:17:25 +00:00
|
|
|
return str;
|
|
|
|
}
|
2006-10-09 12:09:14 +00:00
|
|
|
gst_pad_set_active (str->pad, TRUE);
|
ext/dvdread/dvdreadsrc.c: Fix. Don't do one big huge loop around the whole DVD, that will cache all data and thus eat...
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_dispose), (dvdreadsrc_set_property),
(dvdreadsrc_get_property), (_open), (_seek), (_read),
(dvdreadsrc_get), (dvdreadsrc_open_file),
(dvdreadsrc_change_state):
Fix. Don't do one big huge loop around the whole DVD, that will
cache all data and thus eat sizeof(dvd) (several GB) before we
see something.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_seek):
Actually NULL'ify event after using it.
* gst/matroska/ebml-read.c: (gst_ebml_read_use_event),
(gst_ebml_read_handle_event), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_read_element_data),
(gst_ebml_read_seek), (gst_ebml_read_skip):
Handle events.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_init), (gst_dvd_demux_get_audio_stream),
(gst_dvd_demux_get_subpicture_stream), (gst_dvd_demux_plugin_init):
Fix timing (this will probably break if I seek using menus, but
I didn't get there yet). VOBs and normal DVDs should now work.
Add a mpeg2-only pad with high rank so this get autoplugged for
MPEG-2 movies.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_base_init),
(gst_mpeg_demux_class_init), (gst_mpeg_demux_init),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_get_video_stream),
(gst_mpeg_demux_get_audio_stream),
(gst_mpeg_demux_get_private_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_plugin_init):
Use this as second rank for MPEG-1 and MPEG-2. Still use this for
MPEG-1 but use dvddemux for MPEG-2.
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_class_init),
(gst_mpeg_parse_init), (gst_mpeg_parse_new_pad),
(gst_mpeg_parse_parse_packhead):
Timing. Only add pad template if it exists. Add sink template from
class and not from ourselves. This means we will always use the
correct sink template even if it is not the one defined in this
file.
2004-10-01 08:42:56 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (mpeg_demux), str->pad);
|
2004-03-27 22:45:41 +00:00
|
|
|
|
|
|
|
/* Store the current values. */
|
|
|
|
video_str->mpeg_version = mpeg_version;
|
2005-11-14 21:20:21 +00:00
|
|
|
|
|
|
|
/* set stream metadata */
|
|
|
|
codec = g_strdup_printf ("MPEG-%d video", mpeg_version);
|
|
|
|
list = gst_tag_list_new ();
|
|
|
|
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_VIDEO_CODEC, codec, NULL);
|
|
|
|
g_free (codec);
|
|
|
|
gst_element_found_tags_for_pad (GST_ELEMENT (mpeg_demux), str->pad, list);
|
2004-03-27 22:45:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstMPEGStream *
|
|
|
|
gst_mpeg_demux_get_audio_stream (GstMPEGDemux * mpeg_demux,
|
|
|
|
guint8 stream_nr, gint type, const gpointer info)
|
|
|
|
{
|
|
|
|
GstMPEGStream *str;
|
|
|
|
gchar *name;
|
2004-07-26 15:17:25 +00:00
|
|
|
gboolean set_caps = FALSE;
|
2004-03-27 22:45:41 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (stream_nr < GST_MPEG_DEMUX_NUM_AUDIO_STREAMS, NULL);
|
|
|
|
g_return_val_if_fail (type > GST_MPEG_DEMUX_AUDIO_UNKNOWN &&
|
|
|
|
type < GST_MPEG_DEMUX_AUDIO_LAST, NULL);
|
|
|
|
|
|
|
|
str = mpeg_demux->audio_stream[stream_nr];
|
2008-11-03 11:31:49 +00:00
|
|
|
|
2005-11-14 21:20:21 +00:00
|
|
|
if (str && str->type != type) {
|
|
|
|
gst_element_remove_pad (GST_ELEMENT (mpeg_demux), str->pad);
|
|
|
|
g_free (str);
|
|
|
|
str = mpeg_demux->audio_stream[stream_nr] = NULL;
|
|
|
|
}
|
2004-03-27 22:45:41 +00:00
|
|
|
|
|
|
|
if (str == NULL) {
|
|
|
|
str = g_new0 (GstMPEGStream, 1);
|
|
|
|
|
|
|
|
name = g_strdup_printf ("audio_%02d", stream_nr);
|
|
|
|
CLASS (mpeg_demux)->init_stream (mpeg_demux, type, str, stream_nr, name,
|
|
|
|
CLASS (mpeg_demux)->audio_template);
|
|
|
|
g_free (name);
|
|
|
|
|
2004-07-26 15:17:25 +00:00
|
|
|
/* new pad, set caps */
|
|
|
|
set_caps = TRUE;
|
2004-03-27 22:45:41 +00:00
|
|
|
} else {
|
|
|
|
/* This stream may have been created by a derived class, reset the
|
|
|
|
size. */
|
|
|
|
str = g_renew (GstMPEGStream, str, 1);
|
|
|
|
}
|
|
|
|
|
2008-11-03 11:31:49 +00:00
|
|
|
mpeg_demux->audio_stream[stream_nr] = str;
|
|
|
|
|
2004-07-26 15:17:25 +00:00
|
|
|
if (set_caps) {
|
2005-11-14 21:20:21 +00:00
|
|
|
GstTagList *list;
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
/* We need to set new caps for this pad. */
|
2009-01-08 08:19:25 +00:00
|
|
|
if (str->caps)
|
|
|
|
gst_caps_unref (str->caps);
|
2005-12-27 19:06:08 +00:00
|
|
|
str->caps = gst_caps_new_simple ("audio/mpeg",
|
2004-03-27 22:45:41 +00:00
|
|
|
"mpegversion", G_TYPE_INT, 1, NULL);
|
2005-12-27 19:06:08 +00:00
|
|
|
if (!gst_pad_set_caps (str->pad, str->caps)) {
|
2004-07-26 15:17:25 +00:00
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (mpeg_demux),
|
|
|
|
CORE, NEGOTIATION, (NULL), ("failed to set caps"));
|
2005-12-27 19:06:08 +00:00
|
|
|
gst_caps_unref (str->caps);
|
|
|
|
str->caps = NULL;
|
2006-10-09 12:09:14 +00:00
|
|
|
gst_pad_set_active (str->pad, TRUE);
|
ext/dvdread/dvdreadsrc.c: Fix. Don't do one big huge loop around the whole DVD, that will cache all data and thus eat...
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_dispose), (dvdreadsrc_set_property),
(dvdreadsrc_get_property), (_open), (_seek), (_read),
(dvdreadsrc_get), (dvdreadsrc_open_file),
(dvdreadsrc_change_state):
Fix. Don't do one big huge loop around the whole DVD, that will
cache all data and thus eat sizeof(dvd) (several GB) before we
see something.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_seek):
Actually NULL'ify event after using it.
* gst/matroska/ebml-read.c: (gst_ebml_read_use_event),
(gst_ebml_read_handle_event), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_read_element_data),
(gst_ebml_read_seek), (gst_ebml_read_skip):
Handle events.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_init), (gst_dvd_demux_get_audio_stream),
(gst_dvd_demux_get_subpicture_stream), (gst_dvd_demux_plugin_init):
Fix timing (this will probably break if I seek using menus, but
I didn't get there yet). VOBs and normal DVDs should now work.
Add a mpeg2-only pad with high rank so this get autoplugged for
MPEG-2 movies.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_base_init),
(gst_mpeg_demux_class_init), (gst_mpeg_demux_init),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_get_video_stream),
(gst_mpeg_demux_get_audio_stream),
(gst_mpeg_demux_get_private_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_plugin_init):
Use this as second rank for MPEG-1 and MPEG-2. Still use this for
MPEG-1 but use dvddemux for MPEG-2.
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_class_init),
(gst_mpeg_parse_init), (gst_mpeg_parse_new_pad),
(gst_mpeg_parse_parse_packhead):
Timing. Only add pad template if it exists. Add sink template from
class and not from ourselves. This means we will always use the
correct sink template even if it is not the one defined in this
file.
2004-10-01 08:42:56 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (mpeg_demux), str->pad);
|
2004-07-26 15:17:25 +00:00
|
|
|
return str;
|
|
|
|
}
|
2006-10-09 12:09:14 +00:00
|
|
|
gst_pad_set_active (str->pad, TRUE);
|
ext/dvdread/dvdreadsrc.c: Fix. Don't do one big huge loop around the whole DVD, that will cache all data and thus eat...
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_dispose), (dvdreadsrc_set_property),
(dvdreadsrc_get_property), (_open), (_seek), (_read),
(dvdreadsrc_get), (dvdreadsrc_open_file),
(dvdreadsrc_change_state):
Fix. Don't do one big huge loop around the whole DVD, that will
cache all data and thus eat sizeof(dvd) (several GB) before we
see something.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_seek):
Actually NULL'ify event after using it.
* gst/matroska/ebml-read.c: (gst_ebml_read_use_event),
(gst_ebml_read_handle_event), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_read_element_data),
(gst_ebml_read_seek), (gst_ebml_read_skip):
Handle events.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_init), (gst_dvd_demux_get_audio_stream),
(gst_dvd_demux_get_subpicture_stream), (gst_dvd_demux_plugin_init):
Fix timing (this will probably break if I seek using menus, but
I didn't get there yet). VOBs and normal DVDs should now work.
Add a mpeg2-only pad with high rank so this get autoplugged for
MPEG-2 movies.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_base_init),
(gst_mpeg_demux_class_init), (gst_mpeg_demux_init),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_get_video_stream),
(gst_mpeg_demux_get_audio_stream),
(gst_mpeg_demux_get_private_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_plugin_init):
Use this as second rank for MPEG-1 and MPEG-2. Still use this for
MPEG-1 but use dvddemux for MPEG-2.
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_class_init),
(gst_mpeg_parse_init), (gst_mpeg_parse_new_pad),
(gst_mpeg_parse_parse_packhead):
Timing. Only add pad template if it exists. Add sink template from
class and not from ourselves. This means we will always use the
correct sink template even if it is not the one defined in this
file.
2004-10-01 08:42:56 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (mpeg_demux), str->pad);
|
2005-11-14 21:20:21 +00:00
|
|
|
|
|
|
|
/* stream metadata */
|
|
|
|
list = gst_tag_list_new ();
|
|
|
|
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_AUDIO_CODEC, "MPEG-1 audio", NULL);
|
|
|
|
gst_element_found_tags_for_pad (GST_ELEMENT (mpeg_demux), str->pad, list);
|
2004-03-27 22:45:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstMPEGStream *
|
|
|
|
gst_mpeg_demux_get_private_stream (GstMPEGDemux * mpeg_demux,
|
|
|
|
guint8 stream_nr, gint type, const gpointer info)
|
|
|
|
{
|
|
|
|
GstMPEGStream *str;
|
|
|
|
gchar *name;
|
|
|
|
|
|
|
|
g_return_val_if_fail (stream_nr < GST_MPEG_DEMUX_NUM_PRIVATE_STREAMS, NULL);
|
|
|
|
|
|
|
|
str = mpeg_demux->private_stream[stream_nr];
|
|
|
|
|
|
|
|
if (str == NULL) {
|
|
|
|
name = g_strdup_printf ("private_%d", stream_nr + 1);
|
|
|
|
str = g_new0 (GstMPEGStream, 1);
|
|
|
|
CLASS (mpeg_demux)->init_stream (mpeg_demux, type, str, stream_nr, name,
|
|
|
|
CLASS (mpeg_demux)->private_template);
|
|
|
|
g_free (name);
|
2006-10-09 12:09:14 +00:00
|
|
|
gst_pad_set_active (str->pad, TRUE);
|
ext/dvdread/dvdreadsrc.c: Fix. Don't do one big huge loop around the whole DVD, that will cache all data and thus eat...
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_dispose), (dvdreadsrc_set_property),
(dvdreadsrc_get_property), (_open), (_seek), (_read),
(dvdreadsrc_get), (dvdreadsrc_open_file),
(dvdreadsrc_change_state):
Fix. Don't do one big huge loop around the whole DVD, that will
cache all data and thus eat sizeof(dvd) (several GB) before we
see something.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_seek):
Actually NULL'ify event after using it.
* gst/matroska/ebml-read.c: (gst_ebml_read_use_event),
(gst_ebml_read_handle_event), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_read_element_data),
(gst_ebml_read_seek), (gst_ebml_read_skip):
Handle events.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_init), (gst_dvd_demux_get_audio_stream),
(gst_dvd_demux_get_subpicture_stream), (gst_dvd_demux_plugin_init):
Fix timing (this will probably break if I seek using menus, but
I didn't get there yet). VOBs and normal DVDs should now work.
Add a mpeg2-only pad with high rank so this get autoplugged for
MPEG-2 movies.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_base_init),
(gst_mpeg_demux_class_init), (gst_mpeg_demux_init),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_get_video_stream),
(gst_mpeg_demux_get_audio_stream),
(gst_mpeg_demux_get_private_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_plugin_init):
Use this as second rank for MPEG-1 and MPEG-2. Still use this for
MPEG-1 but use dvddemux for MPEG-2.
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_class_init),
(gst_mpeg_parse_init), (gst_mpeg_parse_new_pad),
(gst_mpeg_parse_parse_packhead):
Timing. Only add pad template if it exists. Add sink template from
class and not from ourselves. This means we will always use the
correct sink template even if it is not the one defined in this
file.
2004-10-01 08:42:56 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (mpeg_demux), str->pad);
|
2004-03-27 22:45:41 +00:00
|
|
|
|
|
|
|
mpeg_demux->private_stream[stream_nr] = str;
|
|
|
|
}
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_mpeg_demux_parse_packhead (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
|
|
|
{
|
2008-07-05 15:56:56 +00:00
|
|
|
GstMPEGDemux *demux = GST_MPEG_DEMUX (mpeg_parse);
|
2004-03-27 22:45:41 +00:00
|
|
|
|
|
|
|
parent_class->parse_packhead (mpeg_parse, buffer);
|
|
|
|
|
|
|
|
/* do something useful here */
|
|
|
|
|
2008-07-05 15:56:56 +00:00
|
|
|
if (demux->pending_tags) {
|
|
|
|
GstMPEGStream **streams;
|
|
|
|
guint i, num;
|
|
|
|
|
|
|
|
streams = demux->audio_stream;
|
|
|
|
num = GST_MPEG_DEMUX_NUM_AUDIO_STREAMS;
|
|
|
|
for (i = 0; i < num; ++i) {
|
|
|
|
if (streams[i] != NULL && streams[i]->tags != NULL)
|
|
|
|
gst_pad_push_event (streams[i]->pad,
|
|
|
|
gst_event_new_tag (gst_tag_list_copy (streams[i]->tags)));
|
|
|
|
}
|
|
|
|
demux->pending_tags = FALSE;
|
|
|
|
}
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_demux_parse_syshead (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
|
|
|
|
guint16 header_length;
|
|
|
|
guchar *buf;
|
|
|
|
|
|
|
|
buf = GST_BUFFER_DATA (buffer);
|
|
|
|
buf += 4;
|
|
|
|
|
configure.ac: bump required gstreamer version to 0.8.1.1 because of following changes [--ds]
Original commit message from CVS:
reviewed by David Schleef
* configure.ac: bump required gstreamer version to 0.8.1.1
because of following changes [--ds]
* gst-libs/gst/riff/riff-read.c: Include gst/gstutils.h.
(gst_riff_peek_head, gst_riff_peek_list, gst_riff_read_list)
(gst_riff_read_header): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/typefind/gsttypefindfunctions.c: Include gst/gstutils.h.
(mp3_type_find): Use GST_READ_UINT*
macros to access possibly unaligned memory.
(mp3_type_find, mpeg1_parse_header, qt_type_find)
(speex_type_find): Likewise
* gst/tags/gstvorbistag.c: (ADVANCE): Likewise
* gst/qtdemux/qtdemux.c: Include stdlib.h (needed by realloc).
(QTDEMUX_GUINT32_GET, QTDEMUX_GUINT16_GET, QTDEMUX_FP32_GET)
(QTDEMUX_FP16_GET, QTDEMUX_FOURCC_GET)
(gst_qtdemux_loop_header, gst_qtdemux_loop_header)
(qtdemux_node_dump_foreach, qtdemux_tree_get_child_by_type)
(qtdemux_tree_get_sibling_by_type): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/mpegstream/gstmpegpacketize.c: (parse_generic, parse_chunk):
Likewise.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead)
(gst_mpeg_demux_parse_packet, gst_mpeg_demux_parse_pes): Likewise.
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain):
Likewise.
* gst/mpeg2sub/gstmpeg2subt.c: (GST_BUFFER_DATA)
(gst_mpeg2subt_chain_subtitle): Likewise.
* gst/mpeg1videoparse/gstmp1videoparse.c: (mp1videoparse_parse_seq)
(gst_mp1videoparse_time_code, gst_mp1videoparse_real_chain):
Likewise.
* gst/mpeg1sys/buffer.c: (mpeg1mux_buffer_update_audio_info):
Likewise.
* gst/cdxaparse/gstcdxaparse.c: (gst_bytestream_peek_bytes):
Likewise.
* gst/asfdemux/gstasfdemux.c: (_read_var_length, _read_uint):
Likewise.
2004-04-20 21:04:22 +00:00
|
|
|
header_length = GST_READ_UINT16_BE (buf);
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "header_length %d", header_length);
|
2001-12-22 23:26:48 +00:00
|
|
|
buf += 2;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
/* marker:1==1 ! rate_bound:22 | marker:1==1 */
|
2001-12-22 23:26:48 +00:00
|
|
|
buf += 3;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
/* audio_bound:6==1 ! fixed:1 | constrained:1 */
|
2001-12-22 23:26:48 +00:00
|
|
|
buf += 1;
|
|
|
|
|
|
|
|
/* audio_lock:1 | video_lock:1 | marker:1==1 | video_bound:5 */
|
|
|
|
buf += 1;
|
|
|
|
|
|
|
|
/* apacket_rate_restriction:1 | reserved:7==0x7F */
|
|
|
|
buf += 1;
|
|
|
|
|
|
|
|
if (!GST_MPEG_PARSE_IS_MPEG2 (mpeg_demux)) {
|
|
|
|
gint stream_count = (header_length - 6) / 3;
|
2004-03-14 22:34:30 +00:00
|
|
|
gint i, j = 0;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.c: Don't send things to NULL PAD_PEERs
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c:
Don't send things to NULL PAD_PEERs
* gst/deinterlace/gstdeinterlace.c: (gst_deinterlace_chain):
Copy-on-write the incoming buffer.
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegclock.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead),
(normal_seek), (gst_mpeg_demux_handle_src_event):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegpacketize.h:
* gst/mpegstream/gstmpegparse.c:
(gst_mpeg_parse_update_streaminfo), (gst_mpeg_parse_reset),
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_parse_packhead),
(gst_mpeg_parse_loop), (gst_mpeg_parse_get_rate),
(gst_mpeg_parse_convert_src), (gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event), (gst_mpeg_parse_change_state):
* gst/mpegstream/gstmpegparse.h:
* gst/mpegstream/gstrfc2250enc.h:
Various changes to the way time is computed that make seeking and
total time estimation much better here.
Use G_BEGIN/END_DECLS instead of __cplusplus
* gst/videocrop/gstvideocrop.c: (gst_video_crop_chain):
Use gst_buffer_stamp instead of only copying the TIMESTAMP
2005-02-01 16:40:10 +00:00
|
|
|
/* Reset the total_size_bound before counting it up */
|
|
|
|
mpeg_demux->total_size_bound = 0;
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "number of streams: %d ", stream_count);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
for (i = 0; i < stream_count; i++) {
|
|
|
|
guint8 stream_id;
|
|
|
|
gboolean STD_buffer_bound_scale;
|
|
|
|
guint16 STD_buffer_size_bound;
|
|
|
|
guint32 buf_byte_size_bound;
|
2004-03-27 22:45:41 +00:00
|
|
|
GstMPEGStream *outstream = NULL;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
stream_id = *buf++;
|
|
|
|
if (!(stream_id & 0x80)) {
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "error in system header length");
|
2004-03-15 19:32:25 +00:00
|
|
|
return FALSE;
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* check marker bits */
|
|
|
|
if ((*buf & 0xC0) != 0xC0) {
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "expecting placeholder bit values"
|
|
|
|
" '11' after stream id");
|
2004-03-15 19:32:25 +00:00
|
|
|
return FALSE;
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
STD_buffer_bound_scale = *buf & 0x20;
|
2004-03-14 22:34:30 +00:00
|
|
|
STD_buffer_size_bound = ((guint16) (*buf++ & 0x1F)) << 8;
|
2001-12-22 23:26:48 +00:00
|
|
|
STD_buffer_size_bound |= *buf++;
|
|
|
|
|
|
|
|
if (STD_buffer_bound_scale == 0) {
|
2004-03-15 19:32:25 +00:00
|
|
|
buf_byte_size_bound = STD_buffer_size_bound * 128;
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
2004-03-15 19:32:25 +00:00
|
|
|
buf_byte_size_bound = STD_buffer_size_bound * 1024;
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
2004-03-28 01:44:31 +00:00
|
|
|
if (stream_id == 0xBD) {
|
|
|
|
/* Private stream 1. */
|
|
|
|
outstream = CLASS (mpeg_demux)->get_private_stream (mpeg_demux,
|
|
|
|
0, GST_MPEG_DEMUX_PRIVATE_UNKNOWN, NULL);
|
|
|
|
} else if (stream_id == 0xBF) {
|
|
|
|
/* Private stream 2. */
|
|
|
|
outstream = CLASS (mpeg_demux)->get_private_stream (mpeg_demux,
|
|
|
|
1, GST_MPEG_DEMUX_PRIVATE_UNKNOWN, NULL);
|
|
|
|
} else if (stream_id >= 0xC0 && stream_id <= 0xDF) {
|
|
|
|
/* Audio. */
|
|
|
|
outstream = CLASS (mpeg_demux)->get_audio_stream (mpeg_demux,
|
|
|
|
stream_id - 0xC0, GST_MPEG_DEMUX_AUDIO_MPEG, NULL);
|
|
|
|
} else if (stream_id >= 0xE0 && stream_id <= 0xEF) {
|
|
|
|
/* Video. */
|
|
|
|
gint mpeg_version = !GST_MPEG_PARSE_IS_MPEG2 (mpeg_demux) ? 1 : 2;
|
2004-03-27 22:45:41 +00:00
|
|
|
|
2004-03-28 01:44:31 +00:00
|
|
|
outstream = CLASS (mpeg_demux)->get_video_stream (mpeg_demux,
|
|
|
|
stream_id - 0xE0, GST_MPEG_DEMUX_VIDEO_MPEG, &mpeg_version);
|
|
|
|
} else {
|
2004-05-14 11:39:41 +00:00
|
|
|
GST_WARNING_OBJECT (mpeg_demux, "unknown stream id 0x%02x", stream_id);
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "STD_buffer_bound_scale %d",
|
|
|
|
STD_buffer_bound_scale);
|
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "STD_buffer_size_bound %d or %d bytes",
|
2004-03-15 19:32:25 +00:00
|
|
|
STD_buffer_size_bound, buf_byte_size_bound);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
if (outstream != NULL) {
|
|
|
|
outstream->size_bound = buf_byte_size_bound;
|
2004-03-15 19:32:25 +00:00
|
|
|
mpeg_demux->total_size_bound += buf_byte_size_bound;
|
2002-05-26 21:59:22 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
if (mpeg_demux->index) {
|
|
|
|
outstream->index_id =
|
|
|
|
_demux_get_writer_id (mpeg_demux->index, outstream->pad);
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
static GstFlowReturn
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_demux_parse_packet (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
|
|
|
|
guint8 id;
|
|
|
|
guint16 headerlen;
|
|
|
|
|
|
|
|
guint16 packet_length;
|
|
|
|
gboolean STD_buffer_bound_scale;
|
|
|
|
guint16 STD_buffer_size_bound;
|
|
|
|
guint64 dts;
|
2001-12-23 23:18:39 +00:00
|
|
|
gint64 pts = -1;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
guint16 datalen;
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GstMPEGStream *outstream = NULL;
|
2009-04-21 18:20:02 +00:00
|
|
|
guint8 *buf;
|
2002-11-27 21:00:12 +00:00
|
|
|
gint64 timestamp;
|
2001-12-22 23:26:48 +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.
2005-11-15 14:19:38 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
|
2009-04-21 18:20:02 +00:00
|
|
|
buf = GST_BUFFER_DATA (buffer);
|
2004-03-14 22:34:30 +00:00
|
|
|
id = *(buf + 3);
|
2001-12-22 23:26:48 +00:00
|
|
|
buf += 4;
|
|
|
|
|
|
|
|
/* start parsing */
|
configure.ac: bump required gstreamer version to 0.8.1.1 because of following changes [--ds]
Original commit message from CVS:
reviewed by David Schleef
* configure.ac: bump required gstreamer version to 0.8.1.1
because of following changes [--ds]
* gst-libs/gst/riff/riff-read.c: Include gst/gstutils.h.
(gst_riff_peek_head, gst_riff_peek_list, gst_riff_read_list)
(gst_riff_read_header): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/typefind/gsttypefindfunctions.c: Include gst/gstutils.h.
(mp3_type_find): Use GST_READ_UINT*
macros to access possibly unaligned memory.
(mp3_type_find, mpeg1_parse_header, qt_type_find)
(speex_type_find): Likewise
* gst/tags/gstvorbistag.c: (ADVANCE): Likewise
* gst/qtdemux/qtdemux.c: Include stdlib.h (needed by realloc).
(QTDEMUX_GUINT32_GET, QTDEMUX_GUINT16_GET, QTDEMUX_FP32_GET)
(QTDEMUX_FP16_GET, QTDEMUX_FOURCC_GET)
(gst_qtdemux_loop_header, gst_qtdemux_loop_header)
(qtdemux_node_dump_foreach, qtdemux_tree_get_child_by_type)
(qtdemux_tree_get_sibling_by_type): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/mpegstream/gstmpegpacketize.c: (parse_generic, parse_chunk):
Likewise.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead)
(gst_mpeg_demux_parse_packet, gst_mpeg_demux_parse_pes): Likewise.
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain):
Likewise.
* gst/mpeg2sub/gstmpeg2subt.c: (GST_BUFFER_DATA)
(gst_mpeg2subt_chain_subtitle): Likewise.
* gst/mpeg1videoparse/gstmp1videoparse.c: (mp1videoparse_parse_seq)
(gst_mp1videoparse_time_code, gst_mp1videoparse_real_chain):
Likewise.
* gst/mpeg1sys/buffer.c: (mpeg1mux_buffer_update_audio_info):
Likewise.
* gst/cdxaparse/gstcdxaparse.c: (gst_bytestream_peek_bytes):
Likewise.
* gst/asfdemux/gstasfdemux.c: (_read_var_length, _read_uint):
Likewise.
2004-04-20 21:04:22 +00:00
|
|
|
packet_length = GST_READ_UINT16_BE (buf);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "got packet_length %d", packet_length);
|
2001-12-22 23:26:48 +00:00
|
|
|
headerlen = 2;
|
|
|
|
buf += 2;
|
|
|
|
|
|
|
|
/* loop through looping for stuffing bits, STD, PTS, DTS, etc */
|
|
|
|
do {
|
|
|
|
guint8 bits = *buf++;
|
|
|
|
|
|
|
|
/* stuffing bytes */
|
|
|
|
switch (bits & 0xC0) {
|
|
|
|
case 0xC0:
|
2004-03-15 19:32:25 +00:00
|
|
|
if (bits == 0xff) {
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "have stuffing byte");
|
2004-03-15 19:32:25 +00:00
|
|
|
} else {
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "expected stuffing byte");
|
2004-03-15 19:32:25 +00:00
|
|
|
}
|
|
|
|
headerlen++;
|
|
|
|
break;
|
2001-12-22 23:26:48 +00:00
|
|
|
case 0x40:
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "have STD");
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-15 19:32:25 +00:00
|
|
|
STD_buffer_bound_scale = bits & 0x20;
|
|
|
|
STD_buffer_size_bound = ((guint16) (bits & 0x1F)) << 8;
|
|
|
|
STD_buffer_size_bound |= *buf++;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-15 19:32:25 +00:00
|
|
|
headerlen += 2;
|
|
|
|
break;
|
2001-12-22 23:26:48 +00:00
|
|
|
case 0x00:
|
2004-03-15 19:32:25 +00:00
|
|
|
switch (bits & 0x30) {
|
|
|
|
case 0x20:
|
|
|
|
/* pts:3 ! 1 ! pts:15 ! 1 | pts:15 ! 1 */
|
|
|
|
pts = ((guint64) (bits & 0x0E)) << 29;
|
2004-09-29 19:09:26 +00:00
|
|
|
pts |= ((guint64) (*buf++)) << 22;
|
2004-03-15 19:32:25 +00:00
|
|
|
pts |= ((guint64) (*buf++ & 0xFE)) << 14;
|
2004-09-29 19:09:26 +00:00
|
|
|
pts |= ((guint64) (*buf++)) << 7;
|
2004-03-15 19:32:25 +00:00
|
|
|
pts |= ((guint64) (*buf++ & 0xFE)) >> 1;
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "PTS = %" G_GUINT64_FORMAT, pts);
|
2004-03-15 19:32:25 +00:00
|
|
|
headerlen += 5;
|
|
|
|
goto done;
|
|
|
|
case 0x30:
|
|
|
|
/* pts:3 ! 1 ! pts:15 ! 1 | pts:15 ! 1 */
|
|
|
|
pts = ((guint64) (bits & 0x0E)) << 29;
|
2004-09-29 19:09:26 +00:00
|
|
|
pts |= ((guint64) (*buf++)) << 22;
|
2004-03-15 19:32:25 +00:00
|
|
|
pts |= ((guint64) (*buf++ & 0xFE)) << 14;
|
2004-09-29 19:09:26 +00:00
|
|
|
pts |= ((guint64) (*buf++)) << 7;
|
2004-03-15 19:32:25 +00:00
|
|
|
pts |= ((guint64) (*buf++ & 0xFE)) >> 1;
|
|
|
|
|
|
|
|
/* sync:4 ! pts:3 ! 1 ! pts:15 ! 1 | pts:15 ! 1 */
|
|
|
|
dts = ((guint64) (*buf++ & 0x0E)) << 29;
|
|
|
|
dts |= ((guint64) * buf++) << 22;
|
|
|
|
dts |= ((guint64) (*buf++ & 0xFE)) << 14;
|
|
|
|
dts |= ((guint64) * buf++) << 7;
|
|
|
|
dts |= ((guint64) (*buf++ & 0xFE)) >> 1;
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "PTS = %" G_GUINT64_FORMAT
|
|
|
|
", DTS = %" G_GUINT64_FORMAT, pts, dts);
|
2004-03-15 19:32:25 +00:00
|
|
|
headerlen += 10;
|
|
|
|
goto done;
|
|
|
|
case 0x00:
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "have no pts/dts");
|
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "got trailer bits %x", (bits & 0x0f));
|
2004-03-15 19:32:25 +00:00
|
|
|
if ((bits & 0x0f) != 0xf) {
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "not a valid packet time sequence");
|
2004-03-15 19:32:25 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
headerlen++;
|
|
|
|
default:
|
|
|
|
goto done;
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
default:
|
2004-03-15 19:32:25 +00:00
|
|
|
goto done;
|
2004-03-14 22:34:30 +00:00
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
} while (1);
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "done with header loop");
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
done:
|
2002-11-04 23:16:45 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
/* calculate the amount of real data in this packet */
|
2004-03-14 22:34:30 +00:00
|
|
|
datalen = packet_length - headerlen + 2;
|
2004-07-09 14:11:02 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "headerlen is %d, datalen is %d",
|
|
|
|
headerlen, datalen);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2002-11-27 21:00:12 +00:00
|
|
|
if (pts != -1) {
|
2006-03-23 18:17:34 +00:00
|
|
|
/* Check for pts overflow */
|
|
|
|
if (mpeg_demux->last_pts != -1) {
|
|
|
|
gint32 diff = pts - mpeg_demux->last_pts;
|
|
|
|
|
|
|
|
if (diff > -4 * CLOCK_FREQ && diff < 4 * CLOCK_FREQ)
|
|
|
|
pts = mpeg_demux->last_pts + diff;
|
|
|
|
}
|
|
|
|
mpeg_demux->last_pts = pts;
|
|
|
|
|
2005-12-19 17:26:47 +00:00
|
|
|
timestamp = PARSE_CLASS (mpeg_parse)->adjust_ts (mpeg_parse,
|
|
|
|
MPEGTIME_TO_GSTTIME (pts));
|
2005-11-14 21:20:21 +00:00
|
|
|
|
|
|
|
/* this apparently happens for some input were headers are
|
|
|
|
* rewritten to make time start at zero... */
|
|
|
|
if ((gint64) timestamp < 0)
|
|
|
|
timestamp = 0;
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
2002-11-27 21:00:12 +00:00
|
|
|
timestamp = GST_CLOCK_TIME_NONE;
|
|
|
|
}
|
|
|
|
|
2004-03-28 01:44:31 +00:00
|
|
|
if (id == 0xBD) {
|
|
|
|
/* Private stream 1. */
|
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "we have a private 1 packet");
|
gst/mpegstream/: Fix flow value combination; this fixes playbin/totem locking up if a VobSub file is specified as sub...
Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_class_init), (gst_dvd_demux_combine_flows),
(gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_init_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_combine_flows),
(gst_mpeg_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_chain):
Fix flow value combination; this fixes playbin/totem locking up if
a VobSub file is specified as subtitle file (#334322). Flow value
combination should only happen once we are fairly sure we've got all
pads that are available for now. Since there isn't a well-specified
time when this is the case in MPEG, we'll just assume this is the
case once there has been a certain number of packets for each
stream we've found so far.
2006-11-19 13:08:30 +00:00
|
|
|
ret = CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 0, timestamp,
|
2004-03-28 01:44:31 +00:00
|
|
|
headerlen, datalen);
|
|
|
|
} else if (id == 0xBF) {
|
|
|
|
/* Private stream 2. */
|
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "we have a private 2 packet");
|
gst/mpegstream/: Fix flow value combination; this fixes playbin/totem locking up if a VobSub file is specified as sub...
Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_class_init), (gst_dvd_demux_combine_flows),
(gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_init_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_combine_flows),
(gst_mpeg_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_chain):
Fix flow value combination; this fixes playbin/totem locking up if
a VobSub file is specified as subtitle file (#334322). Flow value
combination should only happen once we are fairly sure we've got all
pads that are available for now. Since there isn't a well-specified
time when this is the case in MPEG, we'll just assume this is the
case once there has been a certain number of packets for each
stream we've found so far.
2006-11-19 13:08:30 +00:00
|
|
|
ret = CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 1, timestamp,
|
2004-03-28 01:44:31 +00:00
|
|
|
headerlen, datalen);
|
|
|
|
} else if (id >= 0xC0 && id <= 0xDF) {
|
|
|
|
/* Audio. */
|
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "we have an audio packet");
|
|
|
|
outstream = CLASS (mpeg_demux)->get_audio_stream (mpeg_demux,
|
|
|
|
id - 0xC0, GST_MPEG_DEMUX_AUDIO_MPEG, NULL);
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
ret = CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
2004-03-28 01:44:31 +00:00
|
|
|
timestamp, headerlen + 4, datalen);
|
|
|
|
} else if (id >= 0xE0 && id <= 0xEF) {
|
|
|
|
/* Video. */
|
|
|
|
gint mpeg_version = !GST_MPEG_PARSE_IS_MPEG2 (mpeg_demux) ? 1 : 2;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "we have a video packet");
|
|
|
|
|
|
|
|
outstream = CLASS (mpeg_demux)->get_video_stream (mpeg_demux,
|
|
|
|
id - 0xE0, GST_MPEG_DEMUX_VIDEO_MPEG, &mpeg_version);
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
ret = CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
2004-03-28 01:44:31 +00:00
|
|
|
timestamp, headerlen + 4, datalen);
|
2007-11-11 20:41:32 +00:00
|
|
|
} else if (id == 0xBE) {
|
|
|
|
/* padding stream */
|
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "we have a padding packet");
|
2004-03-28 01:44:31 +00:00
|
|
|
} else {
|
2004-05-14 11:39:41 +00:00
|
|
|
GST_WARNING_OBJECT (mpeg_demux, "unknown stream id 0x%02x", id);
|
2001-12-22 23:26:48 +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.
2005-11-15 14:19:38 +00:00
|
|
|
return ret;
|
2001-12-22 23:26:48 +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.
2005-11-15 14:19:38 +00:00
|
|
|
static GstFlowReturn
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_demux_parse_pes (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
|
|
|
|
guint8 id;
|
|
|
|
|
|
|
|
guint16 packet_length;
|
|
|
|
guint8 header_data_length = 0;
|
|
|
|
|
|
|
|
guint16 datalen;
|
|
|
|
guint16 headerlen;
|
ext/dvdread/dvdreadsrc.c: Fix. Don't do one big huge loop around the whole DVD, that will cache all data and thus eat...
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_dispose), (dvdreadsrc_set_property),
(dvdreadsrc_get_property), (_open), (_seek), (_read),
(dvdreadsrc_get), (dvdreadsrc_open_file),
(dvdreadsrc_change_state):
Fix. Don't do one big huge loop around the whole DVD, that will
cache all data and thus eat sizeof(dvd) (several GB) before we
see something.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_seek):
Actually NULL'ify event after using it.
* gst/matroska/ebml-read.c: (gst_ebml_read_use_event),
(gst_ebml_read_handle_event), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_read_element_data),
(gst_ebml_read_seek), (gst_ebml_read_skip):
Handle events.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_init), (gst_dvd_demux_get_audio_stream),
(gst_dvd_demux_get_subpicture_stream), (gst_dvd_demux_plugin_init):
Fix timing (this will probably break if I seek using menus, but
I didn't get there yet). VOBs and normal DVDs should now work.
Add a mpeg2-only pad with high rank so this get autoplugged for
MPEG-2 movies.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_base_init),
(gst_mpeg_demux_class_init), (gst_mpeg_demux_init),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_get_video_stream),
(gst_mpeg_demux_get_audio_stream),
(gst_mpeg_demux_get_private_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_plugin_init):
Use this as second rank for MPEG-1 and MPEG-2. Still use this for
MPEG-1 but use dvddemux for MPEG-2.
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_class_init),
(gst_mpeg_parse_init), (gst_mpeg_parse_new_pad),
(gst_mpeg_parse_parse_packhead):
Timing. Only add pad template if it exists. Add sink template from
class and not from ourselves. This means we will always use the
correct sink template even if it is not the one defined in this
file.
2004-10-01 08:42:56 +00:00
|
|
|
GstClockTime timestamp;
|
2001-12-22 23:26:48 +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.
2005-11-15 14:19:38 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GstMPEGStream *outstream = NULL;
|
|
|
|
guint8 *buf;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
buf = GST_BUFFER_DATA (buffer);
|
2004-03-14 22:34:30 +00:00
|
|
|
id = *(buf + 3);
|
2001-12-22 23:26:48 +00:00
|
|
|
buf += 4;
|
|
|
|
|
|
|
|
/* start parsing */
|
configure.ac: bump required gstreamer version to 0.8.1.1 because of following changes [--ds]
Original commit message from CVS:
reviewed by David Schleef
* configure.ac: bump required gstreamer version to 0.8.1.1
because of following changes [--ds]
* gst-libs/gst/riff/riff-read.c: Include gst/gstutils.h.
(gst_riff_peek_head, gst_riff_peek_list, gst_riff_read_list)
(gst_riff_read_header): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/typefind/gsttypefindfunctions.c: Include gst/gstutils.h.
(mp3_type_find): Use GST_READ_UINT*
macros to access possibly unaligned memory.
(mp3_type_find, mpeg1_parse_header, qt_type_find)
(speex_type_find): Likewise
* gst/tags/gstvorbistag.c: (ADVANCE): Likewise
* gst/qtdemux/qtdemux.c: Include stdlib.h (needed by realloc).
(QTDEMUX_GUINT32_GET, QTDEMUX_GUINT16_GET, QTDEMUX_FP32_GET)
(QTDEMUX_FP16_GET, QTDEMUX_FOURCC_GET)
(gst_qtdemux_loop_header, gst_qtdemux_loop_header)
(qtdemux_node_dump_foreach, qtdemux_tree_get_child_by_type)
(qtdemux_tree_get_sibling_by_type): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/mpegstream/gstmpegpacketize.c: (parse_generic, parse_chunk):
Likewise.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead)
(gst_mpeg_demux_parse_packet, gst_mpeg_demux_parse_pes): Likewise.
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain):
Likewise.
* gst/mpeg2sub/gstmpeg2subt.c: (GST_BUFFER_DATA)
(gst_mpeg2subt_chain_subtitle): Likewise.
* gst/mpeg1videoparse/gstmp1videoparse.c: (mp1videoparse_parse_seq)
(gst_mp1videoparse_time_code, gst_mp1videoparse_real_chain):
Likewise.
* gst/mpeg1sys/buffer.c: (mpeg1mux_buffer_update_audio_info):
Likewise.
* gst/cdxaparse/gstcdxaparse.c: (gst_bytestream_peek_bytes):
Likewise.
* gst/asfdemux/gstasfdemux.c: (_read_var_length, _read_uint):
Likewise.
2004-04-20 21:04:22 +00:00
|
|
|
packet_length = GST_READ_UINT16_BE (buf);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "packet_length %d", packet_length);
|
2001-12-22 23:26:48 +00:00
|
|
|
buf += 2;
|
|
|
|
|
|
|
|
/* we don't operate on: program_stream_map, padding_stream, */
|
|
|
|
/* private_stream_2, ECM, EMM, or program_stream_directory */
|
|
|
|
if ((id != 0xBC) && (id != 0xBE) && (id != 0xBF) && (id != 0xF0) &&
|
2004-03-14 22:34:30 +00:00
|
|
|
(id != 0xF1) && (id != 0xFF)) {
|
2001-12-22 23:26:48 +00:00
|
|
|
guchar flags1 = *buf++;
|
|
|
|
guchar flags2 = *buf++;
|
|
|
|
|
|
|
|
if ((flags1 & 0xC0) != 0x80) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
header_data_length = *buf++;
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "header_data_length: %d", header_data_length);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
/* check for PTS */
|
|
|
|
if ((flags2 & 0x80)) {
|
2004-03-27 22:45:41 +00:00
|
|
|
gint64 pts;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
pts = ((guint64) (*buf++ & 0x0E)) << 29;
|
|
|
|
pts |= ((guint64) * buf++) << 22;
|
2004-01-03 13:06:10 +00:00
|
|
|
pts |= ((guint64) (*buf++ & 0xFE)) << 14;
|
2004-03-14 22:34:30 +00:00
|
|
|
pts |= ((guint64) * buf++) << 7;
|
|
|
|
pts |= ((guint64) (*buf++ & 0xFE)) >> 1;
|
2002-11-04 23:16:45 +00:00
|
|
|
|
2006-03-23 18:17:34 +00:00
|
|
|
/* Check for pts overflow */
|
|
|
|
if (mpeg_demux->last_pts != -1) {
|
|
|
|
gint32 diff = pts - mpeg_demux->last_pts;
|
|
|
|
|
|
|
|
if (diff > -4 * CLOCK_FREQ && diff < 4 * CLOCK_FREQ)
|
|
|
|
pts = mpeg_demux->last_pts + diff;
|
|
|
|
}
|
|
|
|
mpeg_demux->last_pts = pts;
|
|
|
|
|
2005-12-19 17:26:47 +00:00
|
|
|
timestamp = PARSE_CLASS (mpeg_parse)->adjust_ts (mpeg_parse,
|
|
|
|
MPEGTIME_TO_GSTTIME (pts));
|
2002-11-04 23:16:45 +00:00
|
|
|
|
ext/a52dec/gsta52dec.c: Add some debug output. Check that a discont has a valid time associated.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_push),
(gst_a52dec_handle_event), (gst_a52dec_chain):
Add some debug output. Check that a discont has a valid
time associated.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event),
(gst_alsa_sink_loop):
Ignore TAG events. A little extra debug for broken timestamps.
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_init), (dvdnavsrc_loop),
(dvdnavsrc_change_state):
Ensure we send a discont to engage the link before we send any
other events.
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_init),
(dvdreadsrc_finalize), (_close), (_open), (_seek_title),
(_seek_chapter), (seek_sector), (dvdreadsrc_get),
(dvdreadsrc_uri_get_uri), (dvdreadsrc_uri_set_uri):
Handle URI of the form dvd://title[,chapter[,angle]]. Currently only
dvd://title works in totem because typefinding sends a seek that ends
up going back to chapter 1 regardless.
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/mpeg2dec/gstmpeg2dec.h:
Output correct timestamps and handle disconts.
* ext/ogg/gstoggdemux.c: (get_relative):
Small guard against a null dereference.
* ext/pango/gsttextoverlay.c: (gst_textoverlay_finalize),
(gst_textoverlay_set_property):
Free memory when done. Don't call gst_event_filler_get_duration on
EOS events. Use GST_LOG and GST_WARNING instead of g_message and
g_warning.
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init),
(draw_line), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain):
Draw solid lines, prettier colours.
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
Add a default palette that'll work for some movies.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_init),
(gst_dvd_demux_handle_dvd_event), (gst_dvd_demux_send_discont),
(gst_dvd_demux_send_subbuffer), (gst_dvd_demux_reset):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_parse_syshead), (gst_mpeg_demux_parse_pes):
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_init),
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_parse_packhead):
* gst/mpegstream/gstmpegparse.h:
Use PTM/NAV events when for timestamp adjustment when connected to
dvdnavsrc. Don't use many discont events where one suffices.
* gst/playback/gstplaybasebin.c: (group_destroy),
(gen_preroll_element), (gst_play_base_bin_add_element):
* gst/playback/gstplaybasebin.h:
Make sure we remove subtitles from the same bin we put them in.
* gst/subparse/gstsubparse.c: (convert_encoding), (parse_subrip),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_change_state):
Fix some memleaks and invalid accesses.
* gst/typefind/gsttypefindfunctions.c: (ogganx_type_find),
(oggskel_type_find), (cmml_type_find), (plugin_init):
Some typefind functions for Annodex v3.0 files
* gst/wavparse/gstwavparse.h:
GstRiffReadClass is the correct parent class.
2005-01-25 15:34:08 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux,
|
2005-11-14 21:20:21 +00:00
|
|
|
"0x%02x (% " G_GINT64_FORMAT ") PTS = %" G_GUINT64_FORMAT, id, pts,
|
|
|
|
MPEGTIME_TO_GSTTIME (pts));
|
2004-03-27 22:45:41 +00:00
|
|
|
} else {
|
|
|
|
timestamp = GST_CLOCK_TIME_NONE;
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
2004-03-27 22:45:41 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
if ((flags2 & 0x40)) {
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "%x DTS found", id);
|
2001-12-22 23:26:48 +00:00
|
|
|
buf += 5;
|
|
|
|
}
|
2004-03-27 22:45:41 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
if ((flags2 & 0x20)) {
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "%x ESCR found", id);
|
2001-12-22 23:26:48 +00:00
|
|
|
buf += 6;
|
|
|
|
}
|
2004-03-27 22:45:41 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
if ((flags2 & 0x10)) {
|
|
|
|
guint32 es_rate;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
es_rate = ((guint32) (*buf++ & 0x07)) << 14;
|
|
|
|
es_rate |= ((guint32) (*buf++)) << 7;
|
|
|
|
es_rate |= ((guint32) (*buf++ & 0xFE)) >> 1;
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "%x ES Rate found", id);
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
/* FIXME: lots of PES parsing missing here... */
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
/* calculate the amount of real data in this PES packet */
|
|
|
|
/* constant is 2 bytes packet_length, 2 bytes of bits, 1 byte header len */
|
|
|
|
headerlen = 5 + header_data_length;
|
|
|
|
/* constant is 2 bytes of bits, 1 byte header len */
|
|
|
|
datalen = packet_length - (3 + header_data_length);
|
2003-05-22 10:41:49 +00:00
|
|
|
} else {
|
2004-03-27 22:45:41 +00:00
|
|
|
/* Deliver the whole packet. */
|
|
|
|
/* constant corresponds to the 2 bytes of the packet length. */
|
|
|
|
headerlen = 2;
|
|
|
|
datalen = packet_length;
|
ext/dvdread/dvdreadsrc.c: Fix. Don't do one big huge loop around the whole DVD, that will cache all data and thus eat...
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_dispose), (dvdreadsrc_set_property),
(dvdreadsrc_get_property), (_open), (_seek), (_read),
(dvdreadsrc_get), (dvdreadsrc_open_file),
(dvdreadsrc_change_state):
Fix. Don't do one big huge loop around the whole DVD, that will
cache all data and thus eat sizeof(dvd) (several GB) before we
see something.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_seek):
Actually NULL'ify event after using it.
* gst/matroska/ebml-read.c: (gst_ebml_read_use_event),
(gst_ebml_read_handle_event), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_read_element_data),
(gst_ebml_read_seek), (gst_ebml_read_skip):
Handle events.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_init), (gst_dvd_demux_get_audio_stream),
(gst_dvd_demux_get_subpicture_stream), (gst_dvd_demux_plugin_init):
Fix timing (this will probably break if I seek using menus, but
I didn't get there yet). VOBs and normal DVDs should now work.
Add a mpeg2-only pad with high rank so this get autoplugged for
MPEG-2 movies.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_base_init),
(gst_mpeg_demux_class_init), (gst_mpeg_demux_init),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_get_video_stream),
(gst_mpeg_demux_get_audio_stream),
(gst_mpeg_demux_get_private_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_plugin_init):
Use this as second rank for MPEG-1 and MPEG-2. Still use this for
MPEG-1 but use dvddemux for MPEG-2.
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_class_init),
(gst_mpeg_parse_init), (gst_mpeg_parse_new_pad),
(gst_mpeg_parse_parse_packhead):
Timing. Only add pad template if it exists. Add sink template from
class and not from ourselves. This means we will always use the
correct sink template even if it is not the one defined in this
file.
2004-10-01 08:42:56 +00:00
|
|
|
|
|
|
|
timestamp = GST_CLOCK_TIME_NONE;
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "headerlen is %d, datalen is %d",
|
|
|
|
headerlen, datalen);
|
2002-11-27 21:00:12 +00:00
|
|
|
|
2004-03-28 01:44:31 +00:00
|
|
|
if (id == 0xBD) {
|
|
|
|
/* Private stream 1. */
|
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "we have a private 1 packet");
|
gst/mpegstream/: Fix flow value combination; this fixes playbin/totem locking up if a VobSub file is specified as sub...
Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_class_init), (gst_dvd_demux_combine_flows),
(gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_init_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_combine_flows),
(gst_mpeg_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_chain):
Fix flow value combination; this fixes playbin/totem locking up if
a VobSub file is specified as subtitle file (#334322). Flow value
combination should only happen once we are fairly sure we've got all
pads that are available for now. Since there isn't a well-specified
time when this is the case in MPEG, we'll just assume this is the
case once there has been a certain number of packets for each
stream we've found so far.
2006-11-19 13:08:30 +00:00
|
|
|
ret = CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 0,
|
|
|
|
timestamp, headerlen, datalen);
|
2004-03-28 01:44:31 +00:00
|
|
|
} else if (id == 0xBF) {
|
|
|
|
/* Private stream 2. */
|
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "we have a private 2 packet");
|
gst/mpegstream/: Fix flow value combination; this fixes playbin/totem locking up if a VobSub file is specified as sub...
Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_class_init), (gst_dvd_demux_combine_flows),
(gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_init_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_combine_flows),
(gst_mpeg_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_chain):
Fix flow value combination; this fixes playbin/totem locking up if
a VobSub file is specified as subtitle file (#334322). Flow value
combination should only happen once we are fairly sure we've got all
pads that are available for now. Since there isn't a well-specified
time when this is the case in MPEG, we'll just assume this is the
case once there has been a certain number of packets for each
stream we've found so far.
2006-11-19 13:08:30 +00:00
|
|
|
ret = CLASS (mpeg_demux)->process_private (mpeg_demux, buffer, 1,
|
|
|
|
timestamp, headerlen, datalen);
|
2004-03-28 01:44:31 +00:00
|
|
|
} else if (id >= 0xC0 && id <= 0xDF) {
|
|
|
|
/* Audio. */
|
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "we have an audio packet");
|
|
|
|
outstream = CLASS (mpeg_demux)->get_audio_stream (mpeg_demux,
|
|
|
|
id - 0xC0, GST_MPEG_DEMUX_AUDIO_MPEG, NULL);
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
ret = CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
2004-03-28 01:44:31 +00:00
|
|
|
timestamp, headerlen + 4, datalen);
|
|
|
|
} else if (id >= 0xE0 && id <= 0xEF) {
|
|
|
|
/* Video. */
|
|
|
|
gint mpeg_version = !GST_MPEG_PARSE_IS_MPEG2 (mpeg_demux) ? 1 : 2;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "we have a video packet");
|
|
|
|
|
|
|
|
outstream = CLASS (mpeg_demux)->get_video_stream (mpeg_demux,
|
|
|
|
id - 0xE0, GST_MPEG_DEMUX_VIDEO_MPEG, &mpeg_version);
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
ret = CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
2004-03-28 01:44:31 +00:00
|
|
|
timestamp, headerlen + 4, datalen);
|
2005-12-30 16:25:05 +00:00
|
|
|
} else if (id != 0xBE /* Ignore padding stream */ ) {
|
2004-05-14 11:39:41 +00:00
|
|
|
GST_WARNING_OBJECT (mpeg_demux, "unknown stream id 0x%02x", id);
|
2001-12-22 23:26:48 +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.
2005-11-15 14:19:38 +00:00
|
|
|
return ret;
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
gst/mpegstream/: Fix flow value combination; this fixes playbin/totem locking up if a VobSub file is specified as sub...
Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_class_init), (gst_dvd_demux_combine_flows),
(gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_init_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_combine_flows),
(gst_mpeg_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_chain):
Fix flow value combination; this fixes playbin/totem locking up if
a VobSub file is specified as subtitle file (#334322). Flow value
combination should only happen once we are fairly sure we've got all
pads that are available for now. Since there isn't a well-specified
time when this is the case in MPEG, we'll just assume this is the
case once there has been a certain number of packets for each
stream we've found so far.
2006-11-19 13:08:30 +00:00
|
|
|
/* random magic value */
|
|
|
|
#define MIN_BUFS_FOR_NO_MORE_PADS 100
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_mpeg_demux_combine_flows (GstMPEGDemux * demux, GstMPEGStream * stream,
|
|
|
|
GstFlowReturn flow)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
/* store the value */
|
|
|
|
stream->last_flow = flow;
|
|
|
|
|
|
|
|
/* if it's success we can return the value right away */
|
2010-08-27 16:24:11 +00:00
|
|
|
if (flow == GST_FLOW_OK)
|
gst/mpegstream/: Fix flow value combination; this fixes playbin/totem locking up if a VobSub file is specified as sub...
Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_class_init), (gst_dvd_demux_combine_flows),
(gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_init_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_combine_flows),
(gst_mpeg_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_chain):
Fix flow value combination; this fixes playbin/totem locking up if
a VobSub file is specified as subtitle file (#334322). Flow value
combination should only happen once we are fairly sure we've got all
pads that are available for now. Since there isn't a well-specified
time when this is the case in MPEG, we'll just assume this is the
case once there has been a certain number of packets for each
stream we've found so far.
2006-11-19 13:08:30 +00:00
|
|
|
goto done;
|
|
|
|
|
|
|
|
/* any other error that is not-linked can be returned right
|
|
|
|
* away */
|
|
|
|
if (flow != GST_FLOW_NOT_LINKED) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "flow %s on pad %" GST_PTR_FORMAT,
|
|
|
|
gst_flow_get_name (flow), stream->pad);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* only return NOT_LINKED if all other pads returned NOT_LINKED */
|
|
|
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_VIDEO_STREAMS; i++) {
|
|
|
|
if (demux->video_stream[i] != NULL) {
|
|
|
|
flow = demux->video_stream[i]->last_flow;
|
|
|
|
/* some other return value (must be SUCCESS but we can return
|
|
|
|
* other values as well) */
|
|
|
|
if (flow != GST_FLOW_NOT_LINKED)
|
|
|
|
goto done;
|
|
|
|
if (demux->video_stream[i]->buffers_sent < MIN_BUFS_FOR_NO_MORE_PADS) {
|
|
|
|
flow = GST_FLOW_OK;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_AUDIO_STREAMS; i++) {
|
|
|
|
if (demux->audio_stream[i] != NULL) {
|
|
|
|
flow = demux->audio_stream[i]->last_flow;
|
|
|
|
/* some other return value (must be SUCCESS but we can return
|
|
|
|
* other values as well) */
|
|
|
|
if (flow != GST_FLOW_NOT_LINKED)
|
|
|
|
goto done;
|
|
|
|
if (demux->audio_stream[i]->buffers_sent < MIN_BUFS_FOR_NO_MORE_PADS) {
|
|
|
|
flow = GST_FLOW_OK;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_PRIVATE_STREAMS; i++) {
|
|
|
|
if (demux->private_stream[i] != NULL) {
|
|
|
|
flow = demux->private_stream[i]->last_flow;
|
|
|
|
/* some other return value (must be SUCCESS but we can return
|
|
|
|
* other values as well) */
|
|
|
|
if (flow != GST_FLOW_NOT_LINKED)
|
|
|
|
goto done;
|
|
|
|
if (demux->private_stream[i]->buffers_sent < MIN_BUFS_FOR_NO_MORE_PADS) {
|
|
|
|
flow = GST_FLOW_OK;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* if we get here, all other pads were unlinked and we return
|
|
|
|
* NOT_LINKED then */
|
|
|
|
GST_DEBUG_OBJECT (demux, "all pads combined have not-linked flow");
|
|
|
|
|
|
|
|
done:
|
|
|
|
return flow;
|
|
|
|
}
|
|
|
|
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
static GstFlowReturn
|
2004-03-27 22:45:41 +00:00
|
|
|
gst_mpeg_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
|
|
|
|
GstMPEGStream * outstream, GstBuffer * buffer,
|
|
|
|
GstClockTime timestamp, guint offset, guint size)
|
2003-05-14 21:54:41 +00:00
|
|
|
{
|
2005-11-14 21:20:21 +00:00
|
|
|
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (mpeg_demux);
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
GstFlowReturn ret;
|
2004-03-27 22:45:41 +00:00
|
|
|
GstBuffer *outbuf;
|
2003-05-14 21:54:41 +00:00
|
|
|
|
2005-11-14 21:20:21 +00:00
|
|
|
if (timestamp != GST_CLOCK_TIME_NONE) {
|
|
|
|
outstream->cur_ts = timestamp;
|
2006-09-21 13:34:59 +00:00
|
|
|
if (timestamp > mpeg_parse->current_ts)
|
|
|
|
outstream->scr_offs = timestamp - mpeg_parse->current_ts;
|
|
|
|
else
|
2005-11-14 21:20:21 +00:00
|
|
|
outstream->scr_offs = 0;
|
|
|
|
|
|
|
|
if (mpeg_demux->index != NULL) {
|
|
|
|
/* Register a new index position. */
|
|
|
|
gst_index_add_association (mpeg_demux->index,
|
|
|
|
outstream->index_id, 0,
|
|
|
|
GST_FORMAT_BYTES,
|
|
|
|
GST_BUFFER_OFFSET (buffer), GST_FORMAT_TIME, timestamp, 0);
|
|
|
|
}
|
ext/dvdread/dvdreadsrc.c: Allow and implement non-flushing and/or segment seek (mainly in TIME and chapter format).
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_read),
(gst_dvd_read_src_create), (gst_dvd_read_src_handle_seek_event):
Allow and implement non-flushing and/or segment seek
(mainly in TIME and chapter format).
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_process_event),
(gst_dvd_demux_get_subpicture_stream),
(gst_dvd_demux_synchronise_pads),
(gst_dvd_demux_sync_stream_to_time):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_process_event),
(gst_mpeg_demux_send_subbuffer),
(gst_mpeg_demux_sync_stream_to_time),
(gst_mpeg_streams_reset_cur_ts):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_pad_added), (gst_mpeg_parse_handle_src_query):
Delegate a query to upstream if it can't be handled.
Make segment stop aware.
Fix (subtitle) stream synchronization.
Add some debug statements.
2008-06-27 12:58:35 +00:00
|
|
|
} else if (mpeg_parse->current_ts != GST_CLOCK_TIME_NONE)
|
2006-09-21 13:34:59 +00:00
|
|
|
outstream->cur_ts = mpeg_parse->current_ts + outstream->scr_offs;
|
2003-05-14 21:54:41 +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.
2005-11-15 14:19:38 +00:00
|
|
|
if (size == 0)
|
|
|
|
return GST_FLOW_OK;
|
2003-05-14 21:54:41 +00:00
|
|
|
|
gst/mpegstream/gstdvddemux.c (gst_dvd_demux_handle_newsegment): Properly handle non contiguous VOBUs by adding the se...
Original commit message from CVS:
2005-12-08 Martin Soto <martinsoto@users.sourceforge.net>
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_handle_newsegment):
Properly handle non contiguous VOBUs by adding the segment accum
field to the adjust value.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_class_init)
(gst_dvd_demux_init, gst_dvd_demux_handle_newsegment): Extend
handle_newsegment to prevent sending actual newsegment events and
use tiemstamp rewriting instead.
(gst_dvd_demux_handle_dvd_event): Don't send a newsegment after
dvd-lang-codes.
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_handle_newsegment)
(gst_mpeg_parse_event):
* gst/mpegstream/gstmpegparse.h (struct _GstMPEGParseClass):
Add a new parameter to handle_newsegment to allow controlling
whether newsegment events are forwarded or not.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_init)
(gst_dvd_demux_handle_dvd_event, gst_dvd_demux_send_subbuffer)
(gst_dvd_demux_reset):
last_end_ptm and discont_time aren't necessary anymore, since
timestamp adjustment is now replaced by newsegment events.
(gst_dvd_demux_init): Prevent MPEGParse from adjusting
timestamps.
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_handle_dvd_event):
Don't handle dvd-nav-packet events anymore, since the are now
replaced by standard newsegment events.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_init)
(gst_dvd_demux_handle_dvd_event, gst_dvd_demux_send_subbuffer)
(gst_dvd_demux_change_state):
* gst/mpegstream/gstdvddemux.h:
Get rid of the ignore_next_newmedia_discont hack.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_class_init)
(gst_dvd_demux_handle_newsegment):
* gst/mpegstream/gstmpegdemux.c (gst_mpeg_demux_class_init)
(gst_mpeg_demux_handle_newsegment): Don't override
handle_newsegment anymore. It was only necessary to handle
NEWMEDIA events.
* gst/mpegstream/gstdvddemux.c (gst_dvd_demux_process_event)
(gst_dvd_demux_handle_dvd_event, gst_dvd_demux_set_cur_audio)
(gst_dvd_demux_set_cur_subpicture):
Reactivate handling of DVD events.
* gst/mpegstream/gstmpegparse.c (normal_seek)
(gst_mpeg_parse_handle_src_event)
(gst_mpeg_parse_handle_src_query):
First attempt at reenabling seek.
* gst/mpegstream/gstmpegparse.h:
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_init)
(gst_mpeg_parse_update_streaminfo)
(gst_mpeg_parse_get_rate)
(gst_mpeg_parse_convert, gst_mpeg_parse_get_src_query_types)
(gst_mpeg_parse_handle_src_query):
* gst/mpegstream/gstmpegdemux.c (gst_mpeg_demux_new_output_pad):
Make queries work again.
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_reset)
(gst_mpeg_parse_handle_newsegment)
(gst_mpeg_parse_send_newsegment, gst_mpeg_parse_pad_added)
(gst_mpeg_parse_chain, gst_mpeg_parse_handle_src_event):
* gst/mpegstream/gstmpegparse.h (struct _GstMPEGParse):
Get rid of the newsegment_pending attribute, and rely instead on
proper timestamp adjustment.
* gst/mpegstream/gstmpegparse.c
(gst_mpeg_parse_get_src_event_masks): Erase.
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_init):
Initialize fields before creating pads to prevent the pad creation
callback from failing.
(gst_mpeg_parse_reset): Initialize new fields, and change
initialization order to match the order in the structure.
(gst_mpeg_parse_handle_newsegment): Forward new segment events
whenever possible, and update the current segment.
(gst_mpeg_parse_send_newsegment): Update the current segment and
pending_newsegment.
(gst_mpeg_parse_pad_added): Use the current segment to send
newsegment events to new pads.
(gst_mpeg_parse_chain): Properly add adjust time to sent buffers
and events. Properly update newsegment_pending.
* gst/mpegstream/gstmpegparse.h (struct _GstMPEGParse):
New fields do_adjust and current_segment.
* gst/mpegstream/gstmpegdemux.c:
* gst/mpegstream/gstdvddemux.c:
* gst/mpegstream/gstmpegparse.h:
Rename handle_discont virtual method to handle_newsegment. Erase
some (already commented out support) for old NEW_MEDIA events.
* gst/mpegstream/gstmpegparse.h (struct _GstMPEGParse):
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_init)
(gst_mpeg_parse_reset, gst_mpeg_parse_handle_discont)
(gst_mpeg_parse_pad_added, gst_mpeg_parse_parse_packhead)
(gst_mpeg_parse_event, gst_mpeg_parse_chain):
Erase the "pending_scr" field, and replace it by a slightly
different handling of the current SCR. Document code blocks in
parse_packhead and chain.
2005-12-08 12:45:09 +00:00
|
|
|
if (timestamp != GST_CLOCK_TIME_NONE) {
|
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "Creating subbuffer size %d, time=%"
|
|
|
|
GST_TIME_FORMAT, size, GST_TIME_ARGS (timestamp));
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "Creating subbuffer size %d", size);
|
|
|
|
}
|
2007-05-21 15:11:45 +00:00
|
|
|
|
|
|
|
if (G_UNLIKELY (offset + size > GST_BUFFER_SIZE (buffer)))
|
|
|
|
goto broken_file;
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
outbuf = gst_buffer_create_sub (buffer, offset, size);
|
2006-01-18 09:30:00 +00:00
|
|
|
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (outstream->pad));
|
2003-05-14 21:54:41 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
|
|
|
|
GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET (buffer) + offset;
|
2008-07-02 07:49:19 +00:00
|
|
|
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (timestamp) &&
|
|
|
|
GST_CLOCK_TIME_IS_VALID (mpeg_parse->current_segment.last_stop)) {
|
|
|
|
GstClockTimeDiff diff;
|
|
|
|
guint64 update_time;
|
|
|
|
|
|
|
|
update_time = MAX (timestamp, mpeg_parse->current_segment.start);
|
|
|
|
diff = GST_CLOCK_DIFF (mpeg_parse->current_segment.last_stop, update_time);
|
|
|
|
if (diff > GST_SECOND * 2) {
|
|
|
|
GST_DEBUG_OBJECT (mpeg_demux, "Gap of %" GST_TIME_FORMAT " detected in "
|
|
|
|
"stream %d. Sending updated NEWSEGMENT events", GST_TIME_ARGS (diff),
|
|
|
|
outstream->number);
|
|
|
|
PARSE_CLASS (mpeg_parse)->send_event (mpeg_parse,
|
|
|
|
gst_event_new_new_segment (TRUE, mpeg_parse->current_segment.rate,
|
|
|
|
GST_FORMAT_TIME, mpeg_parse->current_segment.last_stop,
|
|
|
|
mpeg_parse->current_segment.last_stop,
|
|
|
|
mpeg_parse->current_segment.last_stop));
|
|
|
|
gst_segment_set_newsegment (&mpeg_parse->current_segment,
|
|
|
|
FALSE, mpeg_parse->current_segment.rate, GST_FORMAT_TIME,
|
|
|
|
update_time, mpeg_parse->current_segment.stop, update_time);
|
|
|
|
PARSE_CLASS (mpeg_parse)->send_event (mpeg_parse,
|
|
|
|
gst_event_new_new_segment (FALSE, mpeg_parse->current_segment.rate,
|
|
|
|
GST_FORMAT_TIME, update_time,
|
|
|
|
mpeg_parse->current_segment.stop, update_time));
|
|
|
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
|
|
|
}
|
|
|
|
gst_segment_set_last_stop (&mpeg_parse->current_segment,
|
|
|
|
GST_FORMAT_TIME, update_time);
|
|
|
|
}
|
|
|
|
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
ret = gst_pad_push (outstream->pad, outbuf);
|
2007-05-21 15:11:45 +00:00
|
|
|
GST_LOG_OBJECT (outstream->pad, "flow: %s", gst_flow_get_name (ret));
|
gst/mpegstream/: Fix flow value combination; this fixes playbin/totem locking up if a VobSub file is specified as sub...
Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_class_init), (gst_dvd_demux_combine_flows),
(gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_init_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_combine_flows),
(gst_mpeg_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_chain):
Fix flow value combination; this fixes playbin/totem locking up if
a VobSub file is specified as subtitle file (#334322). Flow value
combination should only happen once we are fairly sure we've got all
pads that are available for now. Since there isn't a well-specified
time when this is the case in MPEG, we'll just assume this is the
case once there has been a certain number of packets for each
stream we've found so far.
2006-11-19 13:08:30 +00:00
|
|
|
++outstream->buffers_sent;
|
2005-11-14 21:20:21 +00:00
|
|
|
|
ext/dvdread/dvdreadsrc.c: Allow and implement non-flushing and/or segment seek (mainly in TIME and chapter format).
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_read),
(gst_dvd_read_src_create), (gst_dvd_read_src_handle_seek_event):
Allow and implement non-flushing and/or segment seek
(mainly in TIME and chapter format).
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_process_event),
(gst_dvd_demux_get_subpicture_stream),
(gst_dvd_demux_synchronise_pads),
(gst_dvd_demux_sync_stream_to_time):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_process_event),
(gst_mpeg_demux_send_subbuffer),
(gst_mpeg_demux_sync_stream_to_time),
(gst_mpeg_streams_reset_cur_ts):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_pad_added), (gst_mpeg_parse_handle_src_query):
Delegate a query to upstream if it can't be handled.
Make segment stop aware.
Fix (subtitle) stream synchronization.
Add some debug statements.
2008-06-27 12:58:35 +00:00
|
|
|
GST_LOG_OBJECT (mpeg_demux, "current: %" GST_TIME_FORMAT
|
|
|
|
", gap %" GST_TIME_FORMAT ", tol: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (mpeg_parse->current_ts),
|
|
|
|
GST_TIME_ARGS (mpeg_demux->max_gap),
|
|
|
|
GST_TIME_ARGS (mpeg_demux->max_gap_tolerance));
|
2005-11-14 21:20:21 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (mpeg_demux->max_gap) &&
|
|
|
|
GST_CLOCK_TIME_IS_VALID (mpeg_parse->current_ts) &&
|
2006-09-21 13:34:59 +00:00
|
|
|
(mpeg_parse->current_ts > mpeg_demux->max_gap)) {
|
|
|
|
CLASS (mpeg_demux)->synchronise_pads (mpeg_demux,
|
|
|
|
mpeg_parse->current_ts - mpeg_demux->max_gap,
|
|
|
|
mpeg_parse->current_ts - mpeg_demux->max_gap_tolerance);
|
2005-11-14 21:20:21 +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.
2005-11-15 14:19:38 +00:00
|
|
|
|
gst/mpegstream/: Fix flow value combination; this fixes playbin/totem locking up if a VobSub file is specified as sub...
Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_class_init), (gst_dvd_demux_combine_flows),
(gst_dvd_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_init_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_combine_flows),
(gst_mpeg_demux_send_subbuffer):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_chain):
Fix flow value combination; this fixes playbin/totem locking up if
a VobSub file is specified as subtitle file (#334322). Flow value
combination should only happen once we are fairly sure we've got all
pads that are available for now. Since there isn't a well-specified
time when this is the case in MPEG, we'll just assume this is the
case once there has been a certain number of packets for each
stream we've found so far.
2006-11-19 13:08:30 +00:00
|
|
|
ret = CLASS (mpeg_demux)->combine_flows (mpeg_demux, outstream, ret);
|
|
|
|
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
return ret;
|
2007-05-21 15:11:45 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
broken_file:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (mpeg_demux, STREAM, DEMUX, (NULL),
|
|
|
|
("Either broken file or not an MPEG stream"));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2003-05-14 21:54:41 +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.
2005-11-15 14:19:38 +00:00
|
|
|
static GstFlowReturn
|
2004-03-27 22:45:41 +00:00
|
|
|
gst_mpeg_demux_process_private (GstMPEGDemux * mpeg_demux,
|
|
|
|
GstBuffer * buffer,
|
|
|
|
guint stream_nr, GstClockTime timestamp, guint headerlen, guint datalen)
|
2003-05-14 21:54:41 +00:00
|
|
|
{
|
2004-03-27 22:45:41 +00:00
|
|
|
GstMPEGStream *outstream;
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
GstFlowReturn ret;
|
2003-05-14 21:54:41 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
outstream = CLASS (mpeg_demux)->get_private_stream (mpeg_demux,
|
|
|
|
stream_nr, GST_MPEG_DEMUX_PRIVATE_UNKNOWN, NULL);
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
ret = CLASS (mpeg_demux)->send_subbuffer (mpeg_demux, outstream, buffer,
|
2004-03-27 22:45:41 +00:00
|
|
|
timestamp, headerlen + 4, datalen);
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
return ret;
|
2003-05-14 21:54:41 +00:00
|
|
|
}
|
|
|
|
|
2005-11-14 21:20:21 +00:00
|
|
|
static void
|
|
|
|
gst_mpeg_demux_synchronise_pads (GstMPEGDemux * mpeg_demux,
|
|
|
|
GstClockTime threshold, GstClockTime new_ts)
|
|
|
|
{
|
|
|
|
/*
|
2006-09-21 13:34:59 +00:00
|
|
|
* Send a new-segment event to any pad with cur_ts < threshold to catch it up
|
2005-11-14 21:20:21 +00:00
|
|
|
*/
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_VIDEO_STREAMS; i++)
|
|
|
|
if (mpeg_demux->video_stream[i]
|
|
|
|
&& mpeg_demux->video_stream[i]->cur_ts < threshold) {
|
|
|
|
CLASS (mpeg_demux)->sync_stream_to_time (mpeg_demux,
|
|
|
|
mpeg_demux->video_stream[i], new_ts);
|
|
|
|
mpeg_demux->video_stream[i]->cur_ts = new_ts;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_AUDIO_STREAMS; i++)
|
|
|
|
if (mpeg_demux->audio_stream[i]
|
|
|
|
&& mpeg_demux->audio_stream[i]->cur_ts < threshold) {
|
|
|
|
CLASS (mpeg_demux)->sync_stream_to_time (mpeg_demux,
|
|
|
|
mpeg_demux->audio_stream[i], new_ts);
|
|
|
|
mpeg_demux->audio_stream[i]->cur_ts = new_ts;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_PRIVATE_STREAMS; i++)
|
|
|
|
if (mpeg_demux->private_stream[i]
|
|
|
|
&& mpeg_demux->private_stream[i]->cur_ts < threshold) {
|
|
|
|
CLASS (mpeg_demux)->sync_stream_to_time (mpeg_demux,
|
|
|
|
mpeg_demux->private_stream[i], new_ts);
|
|
|
|
mpeg_demux->private_stream[i]->cur_ts = new_ts;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-21 13:34:59 +00:00
|
|
|
/*
|
|
|
|
* Send a new-segment event on the indicated pad to catch it up to last_ts.
|
2005-11-14 21:20:21 +00:00
|
|
|
*/
|
|
|
|
static void
|
|
|
|
gst_mpeg_demux_sync_stream_to_time (GstMPEGDemux * mpeg_demux,
|
|
|
|
GstMPEGStream * stream, GstClockTime last_ts)
|
|
|
|
{
|
2006-09-21 13:34:59 +00:00
|
|
|
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (mpeg_demux);
|
ext/dvdread/dvdreadsrc.c: Allow and implement non-flushing and/or segment seek (mainly in TIME and chapter format).
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_read),
(gst_dvd_read_src_create), (gst_dvd_read_src_handle_seek_event):
Allow and implement non-flushing and/or segment seek
(mainly in TIME and chapter format).
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_process_event),
(gst_dvd_demux_get_subpicture_stream),
(gst_dvd_demux_synchronise_pads),
(gst_dvd_demux_sync_stream_to_time):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_process_event),
(gst_mpeg_demux_send_subbuffer),
(gst_mpeg_demux_sync_stream_to_time),
(gst_mpeg_streams_reset_cur_ts):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_pad_added), (gst_mpeg_parse_handle_src_query):
Delegate a query to upstream if it can't be handled.
Make segment stop aware.
Fix (subtitle) stream synchronization.
Add some debug statements.
2008-06-27 12:58:35 +00:00
|
|
|
guint64 update_time;
|
2005-11-14 21:20:21 +00:00
|
|
|
|
ext/dvdread/dvdreadsrc.c: Allow and implement non-flushing and/or segment seek (mainly in TIME and chapter format).
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_read),
(gst_dvd_read_src_create), (gst_dvd_read_src_handle_seek_event):
Allow and implement non-flushing and/or segment seek
(mainly in TIME and chapter format).
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_process_event),
(gst_dvd_demux_get_subpicture_stream),
(gst_dvd_demux_synchronise_pads),
(gst_dvd_demux_sync_stream_to_time):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_process_event),
(gst_mpeg_demux_send_subbuffer),
(gst_mpeg_demux_sync_stream_to_time),
(gst_mpeg_streams_reset_cur_ts):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_pad_added), (gst_mpeg_parse_handle_src_query):
Delegate a query to upstream if it can't be handled.
Make segment stop aware.
Fix (subtitle) stream synchronization.
Add some debug statements.
2008-06-27 12:58:35 +00:00
|
|
|
update_time =
|
|
|
|
MIN ((guint64) last_ts, (guint64) mpeg_parse->current_segment.stop);
|
2006-09-21 13:34:59 +00:00
|
|
|
gst_pad_push_event (stream->pad, gst_event_new_new_segment (TRUE,
|
|
|
|
mpeg_parse->current_segment.rate, GST_FORMAT_TIME,
|
ext/dvdread/dvdreadsrc.c: Allow and implement non-flushing and/or segment seek (mainly in TIME and chapter format).
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_read),
(gst_dvd_read_src_create), (gst_dvd_read_src_handle_seek_event):
Allow and implement non-flushing and/or segment seek
(mainly in TIME and chapter format).
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_process_event),
(gst_dvd_demux_get_subpicture_stream),
(gst_dvd_demux_synchronise_pads),
(gst_dvd_demux_sync_stream_to_time):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_process_event),
(gst_mpeg_demux_send_subbuffer),
(gst_mpeg_demux_sync_stream_to_time),
(gst_mpeg_streams_reset_cur_ts):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_pad_added), (gst_mpeg_parse_handle_src_query):
Delegate a query to upstream if it can't be handled.
Make segment stop aware.
Fix (subtitle) stream synchronization.
Add some debug statements.
2008-06-27 12:58:35 +00:00
|
|
|
update_time, mpeg_parse->current_segment.stop, update_time));
|
2005-11-14 21:20:21 +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.
2005-11-15 14:19:38 +00:00
|
|
|
#if 0
|
2004-03-14 22:34:30 +00:00
|
|
|
const GstFormat *
|
|
|
|
gst_mpeg_demux_get_src_formats (GstPad * pad)
|
|
|
|
{
|
2002-12-27 22:43:28 +00:00
|
|
|
static const GstFormat formats[] = {
|
2004-03-15 19:32:25 +00:00
|
|
|
GST_FORMAT_TIME, /* we prefer seeking on time */
|
2002-12-27 22:43:28 +00:00
|
|
|
GST_FORMAT_BYTES,
|
2004-03-14 22:34:30 +00:00
|
|
|
0
|
2002-12-27 22:43:28 +00:00
|
|
|
};
|
2004-03-15 19:32:25 +00:00
|
|
|
|
2002-12-27 22:43:28 +00:00
|
|
|
return formats;
|
2004-03-14 22:34:30 +00:00
|
|
|
}
|
2002-12-27 22:43:28 +00:00
|
|
|
|
2002-12-26 22:45:10 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
index_seek (GstPad * pad, GstEvent * event, gint64 * offset)
|
2002-12-26 22:45:10 +00:00
|
|
|
{
|
|
|
|
GstIndexEntry *entry;
|
|
|
|
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (gst_pad_get_parent (pad));
|
|
|
|
GstMPEGStream *stream = gst_pad_get_element_private (pad);
|
|
|
|
|
|
|
|
entry = gst_index_get_assoc_entry (mpeg_demux->index, stream->index_id,
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_INDEX_LOOKUP_BEFORE, 0,
|
|
|
|
GST_EVENT_SEEK_FORMAT (event), GST_EVENT_SEEK_OFFSET (event));
|
2003-07-25 02:04:01 +00:00
|
|
|
if (!entry) {
|
|
|
|
GST_CAT_WARNING (GST_CAT_SEEK, "%s:%s index %s %" G_GINT64_FORMAT
|
2004-03-15 19:32:25 +00:00
|
|
|
" -> failed",
|
|
|
|
GST_DEBUG_PAD_NAME (pad),
|
|
|
|
gst_format_get_details (GST_EVENT_SEEK_FORMAT (event))->nick,
|
|
|
|
GST_EVENT_SEEK_OFFSET (event));
|
2002-12-26 22:45:10 +00:00
|
|
|
return FALSE;
|
2003-07-25 02:04:01 +00:00
|
|
|
}
|
2002-12-26 22:45:10 +00:00
|
|
|
|
|
|
|
if (gst_index_entry_assoc_map (entry, GST_FORMAT_BYTES, offset)) {
|
2003-07-25 02:04:01 +00:00
|
|
|
GST_CAT_DEBUG (GST_CAT_SEEK, "%s:%s index %s %" G_GINT64_FORMAT
|
2004-03-15 19:32:25 +00:00
|
|
|
" -> %" G_GINT64_FORMAT " bytes",
|
|
|
|
GST_DEBUG_PAD_NAME (pad),
|
|
|
|
gst_format_get_details (GST_EVENT_SEEK_FORMAT (event))->nick,
|
|
|
|
GST_EVENT_SEEK_OFFSET (event), *offset);
|
2002-12-26 22:45:10 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
normal_seek (GstPad * pad, GstEvent * event, gint64 * offset)
|
2002-12-26 22:45:10 +00:00
|
|
|
{
|
|
|
|
gboolean res = FALSE;
|
|
|
|
gint64 adjust;
|
|
|
|
GstFormat format;
|
|
|
|
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
format = GST_EVENT_SEEK_FORMAT (event);
|
|
|
|
|
|
|
|
res = gst_pad_convert (pad, GST_FORMAT_BYTES, mpeg_demux->total_size_bound,
|
2004-03-14 22:34:30 +00:00
|
|
|
&format, &adjust);
|
2002-12-26 22:45:10 +00:00
|
|
|
|
2003-07-25 02:04:01 +00:00
|
|
|
if (res) {
|
2002-12-26 22:45:10 +00:00
|
|
|
*offset = MAX (GST_EVENT_SEEK_OFFSET (event) - adjust, 0);
|
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.c: Don't send things to NULL PAD_PEERs
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c:
Don't send things to NULL PAD_PEERs
* gst/deinterlace/gstdeinterlace.c: (gst_deinterlace_chain):
Copy-on-write the incoming buffer.
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegclock.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead),
(normal_seek), (gst_mpeg_demux_handle_src_event):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegpacketize.h:
* gst/mpegstream/gstmpegparse.c:
(gst_mpeg_parse_update_streaminfo), (gst_mpeg_parse_reset),
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_parse_packhead),
(gst_mpeg_parse_loop), (gst_mpeg_parse_get_rate),
(gst_mpeg_parse_convert_src), (gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event), (gst_mpeg_parse_change_state):
* gst/mpegstream/gstmpegparse.h:
* gst/mpegstream/gstrfc2250enc.h:
Various changes to the way time is computed that make seeking and
total time estimation much better here.
Use G_BEGIN/END_DECLS instead of __cplusplus
* gst/videocrop/gstvideocrop.c: (gst_video_crop_chain):
Use gst_buffer_stamp instead of only copying the TIMESTAMP
2005-02-01 16:40:10 +00:00
|
|
|
GST_CAT_DEBUG (GST_CAT_SEEK, "%s:%s guesstimate %" G_GINT64_FORMAT
|
2004-03-15 19:32:25 +00:00
|
|
|
" %s -> %" G_GINT64_FORMAT
|
|
|
|
" (total_size_bound = %" G_GINT64_FORMAT ")",
|
|
|
|
GST_DEBUG_PAD_NAME (pad),
|
|
|
|
GST_EVENT_SEEK_OFFSET (event),
|
|
|
|
gst_format_get_details (GST_EVENT_SEEK_FORMAT (event))->nick,
|
|
|
|
*offset, mpeg_demux->total_size_bound);
|
2003-07-25 02:04:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
return res;
|
2002-12-26 22:45:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_demux_handle_src_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
2002-12-26 22:45:10 +00:00
|
|
|
gboolean res = FALSE;
|
|
|
|
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_SEEK:
|
|
|
|
{
|
2005-11-14 21:20:21 +00:00
|
|
|
gint64 desired_offset;
|
2002-12-26 22:45:10 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
if (mpeg_demux->index)
|
2004-03-15 19:32:25 +00:00
|
|
|
res = index_seek (pad, event, &desired_offset);
|
2002-12-26 22:45:10 +00:00
|
|
|
if (!res)
|
2004-03-15 19:32:25 +00:00
|
|
|
res = normal_seek (pad, event, &desired_offset);
|
2002-12-26 22:45:10 +00:00
|
|
|
|
|
|
|
if (res) {
|
2004-03-15 19:32:25 +00:00
|
|
|
GstEvent *new_event;
|
2002-12-26 22:45:10 +00:00
|
|
|
|
2004-03-15 19:32:25 +00:00
|
|
|
new_event =
|
|
|
|
gst_event_new_seek (GST_EVENT_SEEK_TYPE (event), desired_offset);
|
|
|
|
res = gst_mpeg_parse_handle_src_event (pad, new_event);
|
2002-12-26 22:45:10 +00:00
|
|
|
}
|
2004-01-06 16:42:10 +00:00
|
|
|
gst_event_unref (event);
|
2002-12-26 22:45:10 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-01-06 16:42:10 +00:00
|
|
|
case GST_EVENT_NAVIGATION:
|
ext/mpeg2dec/gstmpeg2dec.c: Don't send things to NULL PAD_PEERs
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c:
Don't send things to NULL PAD_PEERs
* gst/deinterlace/gstdeinterlace.c: (gst_deinterlace_chain):
Copy-on-write the incoming buffer.
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegclock.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead),
(normal_seek), (gst_mpeg_demux_handle_src_event):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegpacketize.h:
* gst/mpegstream/gstmpegparse.c:
(gst_mpeg_parse_update_streaminfo), (gst_mpeg_parse_reset),
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_parse_packhead),
(gst_mpeg_parse_loop), (gst_mpeg_parse_get_rate),
(gst_mpeg_parse_convert_src), (gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event), (gst_mpeg_parse_change_state):
* gst/mpegstream/gstmpegparse.h:
* gst/mpegstream/gstrfc2250enc.h:
Various changes to the way time is computed that make seeking and
total time estimation much better here.
Use G_BEGIN/END_DECLS instead of __cplusplus
* gst/videocrop/gstvideocrop.c: (gst_video_crop_chain):
Use gst_buffer_stamp instead of only copying the TIMESTAMP
2005-02-01 16:40:10 +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.
2005-11-15 14:19:38 +00:00
|
|
|
res = gst_pad_push_event (GST_MPEG_PARSE (mpeg_demux)->sinkpad, event);
|
|
|
|
break;
|
ext/mpeg2dec/gstmpeg2dec.c: Don't send things to NULL PAD_PEERs
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c:
Don't send things to NULL PAD_PEERs
* gst/deinterlace/gstdeinterlace.c: (gst_deinterlace_chain):
Copy-on-write the incoming buffer.
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegclock.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead),
(normal_seek), (gst_mpeg_demux_handle_src_event):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegpacketize.h:
* gst/mpegstream/gstmpegparse.c:
(gst_mpeg_parse_update_streaminfo), (gst_mpeg_parse_reset),
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_parse_packhead),
(gst_mpeg_parse_loop), (gst_mpeg_parse_get_rate),
(gst_mpeg_parse_convert_src), (gst_mpeg_parse_handle_src_query),
(gst_mpeg_parse_handle_src_event), (gst_mpeg_parse_change_state):
* gst/mpegstream/gstmpegparse.h:
* gst/mpegstream/gstrfc2250enc.h:
Various changes to the way time is computed that make seeking and
total time estimation much better here.
Use G_BEGIN/END_DECLS instead of __cplusplus
* gst/videocrop/gstvideocrop.c: (gst_video_crop_chain):
Use gst_buffer_stamp instead of only copying the TIMESTAMP
2005-02-01 16:40:10 +00:00
|
|
|
}
|
2002-12-26 22:45:10 +00:00
|
|
|
default:
|
2004-01-06 16:42:10 +00:00
|
|
|
gst_event_unref (event);
|
2002-12-26 22:45:10 +00:00
|
|
|
break;
|
2004-03-14 22:34:30 +00:00
|
|
|
}
|
2002-12-26 22:45:10 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-11-14 21:20:21 +00:00
|
|
|
static gboolean
|
|
|
|
gst_mpeg_demux_handle_src_query (GstPad * pad, GstQueryType type,
|
|
|
|
GstFormat * format, gint64 * value)
|
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
res = gst_mpeg_parse_handle_src_query (pad, type, format, value);
|
|
|
|
|
|
|
|
if (res && (type == GST_QUERY_POSITION) && (format)
|
|
|
|
&& (*format == GST_FORMAT_TIME)) {
|
|
|
|
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
*value += mpeg_demux->adjust;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-12-16 12:54:04 +00:00
|
|
|
static void
|
|
|
|
gst_mpeg_demux_reset (GstMPEGDemux * mpeg_demux)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Reset the element */
|
|
|
|
|
|
|
|
GST_INFO ("Resetting the MPEG Demuxer");
|
|
|
|
|
|
|
|
/* free the streams , remove the pads */
|
|
|
|
/* filled in init_stream */
|
|
|
|
/* check get_audio/video_stream because it can be derivated */
|
|
|
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_VIDEO_STREAMS; i++)
|
|
|
|
if (mpeg_demux->video_stream[i]) {
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
gst_pad_push_event (mpeg_demux->video_stream[i]->pad,
|
|
|
|
gst_event_new_eos ());
|
2004-12-16 12:54:04 +00:00
|
|
|
gst_element_remove_pad (GST_ELEMENT (mpeg_demux),
|
|
|
|
mpeg_demux->video_stream[i]->pad);
|
2009-01-08 08:19:25 +00:00
|
|
|
if (mpeg_demux->video_stream[i]->caps)
|
|
|
|
gst_caps_unref (mpeg_demux->video_stream[i]->caps);
|
2004-12-16 12:54:04 +00:00
|
|
|
g_free (mpeg_demux->video_stream[i]);
|
|
|
|
mpeg_demux->video_stream[i] = NULL;
|
|
|
|
}
|
|
|
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_AUDIO_STREAMS; i++)
|
|
|
|
if (mpeg_demux->audio_stream[i]) {
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
gst_pad_push_event (mpeg_demux->audio_stream[i]->pad,
|
|
|
|
gst_event_new_eos ());
|
2004-12-16 12:54:04 +00:00
|
|
|
gst_element_remove_pad (GST_ELEMENT (mpeg_demux),
|
|
|
|
mpeg_demux->audio_stream[i]->pad);
|
2008-07-05 15:56:56 +00:00
|
|
|
if (mpeg_demux->audio_stream[i]->tags)
|
|
|
|
gst_tag_list_free (mpeg_demux->audio_stream[i]->tags);
|
2009-01-08 08:19:25 +00:00
|
|
|
if (mpeg_demux->audio_stream[i]->caps)
|
|
|
|
gst_caps_unref (mpeg_demux->audio_stream[i]->caps);
|
2004-12-16 12:54:04 +00:00
|
|
|
g_free (mpeg_demux->audio_stream[i]);
|
|
|
|
mpeg_demux->audio_stream[i] = NULL;
|
|
|
|
}
|
|
|
|
for (i = 0; i < GST_MPEG_DEMUX_NUM_PRIVATE_STREAMS; i++)
|
|
|
|
if (mpeg_demux->private_stream[i]) {
|
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.
2005-11-15 14:19:38 +00:00
|
|
|
gst_pad_push_event (mpeg_demux->private_stream[i]->pad,
|
|
|
|
gst_event_new_eos ());
|
2004-12-16 12:54:04 +00:00
|
|
|
gst_element_remove_pad (GST_ELEMENT (mpeg_demux),
|
|
|
|
mpeg_demux->private_stream[i]->pad);
|
2009-01-08 08:19:25 +00:00
|
|
|
if (mpeg_demux->private_stream[i]->caps)
|
|
|
|
gst_caps_unref (mpeg_demux->private_stream[i]->caps);
|
2004-12-16 12:54:04 +00:00
|
|
|
g_free (mpeg_demux->private_stream[i]);
|
|
|
|
mpeg_demux->private_stream[i] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
mpeg_demux->in_flush = FALSE;
|
|
|
|
mpeg_demux->header_length = 0;
|
|
|
|
mpeg_demux->rate_bound = 0;
|
|
|
|
mpeg_demux->audio_bound = 0;
|
|
|
|
mpeg_demux->video_bound = 0;
|
|
|
|
mpeg_demux->fixed = FALSE;
|
|
|
|
mpeg_demux->constrained = FALSE;
|
|
|
|
mpeg_demux->audio_lock = FALSE;
|
|
|
|
mpeg_demux->video_lock = FALSE;
|
|
|
|
|
|
|
|
mpeg_demux->packet_rate_restriction = FALSE;
|
ext/mad/gstmad.c: move GstIndexEntry *entry variable declaration before the first instruction
Original commit message from CVS:
* ext/mad/gstmad.c: (index_seek):
move GstIndexEntry *entry variable declaration before
the first instruction
* ext/mad/gstmad.c:
remove debug macros with variable number of parameter by using
GST_DEBUG for WIN32
* gst/dvdsub/gstdvdsubdec.c: (gst_dvd_sub_dec_parse_subpic):
use gst_guint64_to_gdouble for conversions
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_sync_stream_to_time):
replace __FUNCTION__ which is not supported by MSVC by the current function name
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_reset):
remove LL suffix by using G_GINT64_CONSTANT
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_parse_packhead),(gst_mpeg_parse_get_rate):
use gst_guint64_to_gdouble for conversions
* gst/mpegstream/gstmpegparse.h:
remove LL suffix by using G_GINT64_CONSTANT
* win32/vs6:
add project files for tagac3parse, asfdemux, dvdlpcmdec, dvdsub, iec958, lame,
mad, mpegaudioparse, mpegstream, realmedia, synaesthesia
2006-04-09 18:09:40 +00:00
|
|
|
mpeg_demux->total_size_bound = G_GINT64_CONSTANT (0);
|
2004-12-16 12:54:04 +00:00
|
|
|
|
|
|
|
mpeg_demux->index = NULL;
|
2006-03-23 18:17:34 +00:00
|
|
|
mpeg_demux->last_pts = -1;
|
2008-07-05 15:56:56 +00:00
|
|
|
mpeg_demux->pending_tags = FALSE;
|
2004-12-16 12:54:04 +00:00
|
|
|
|
2005-11-14 21:20:21 +00:00
|
|
|
/*
|
|
|
|
* Don't adjust things that are only for subclass use
|
|
|
|
* - if they changed it, they can reset it.
|
|
|
|
*
|
|
|
|
* mpeg_demux->adjust = 0;
|
|
|
|
* mpeg_demux->max_gap = GST_CLOCK_TIME_NONE;
|
|
|
|
* mpeg_demux->max_gap_tolerance = GST_CLOCK_TIME_NONE;
|
|
|
|
*/
|
2004-12-16 12:54:04 +00:00
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:54 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_mpeg_demux_change_state (GstElement * element, GstStateChange transition)
|
2004-03-14 22:34:30 +00:00
|
|
|
{
|
2004-12-16 12:54:04 +00:00
|
|
|
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (element);
|
2006-04-21 10:50:17 +00:00
|
|
|
GstStateChangeReturn ret;
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2005-09-02 15:43:54 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2004-12-16 12:54:04 +00:00
|
|
|
gst_mpeg_demux_reset (mpeg_demux);
|
2002-02-03 20:10:04 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2006-04-21 10:50:17 +00:00
|
|
|
return ret;
|
2002-02-03 20:10:04 +00:00
|
|
|
}
|
|
|
|
|
2002-11-27 21:00:12 +00:00
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_demux_set_index (GstElement * element, GstIndex * index)
|
2002-11-27 21:00:12 +00:00
|
|
|
{
|
|
|
|
GstMPEGDemux *mpeg_demux;
|
|
|
|
|
2002-12-12 22:17:10 +00:00
|
|
|
GST_ELEMENT_CLASS (parent_class)->set_index (element, index);
|
2002-11-27 21:00:12 +00:00
|
|
|
|
|
|
|
mpeg_demux = GST_MPEG_DEMUX (element);
|
|
|
|
|
2002-12-12 22:17:10 +00:00
|
|
|
mpeg_demux->index = index;
|
2002-11-27 21:00:12 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static GstIndex *
|
|
|
|
gst_mpeg_demux_get_index (GstElement * element)
|
2002-11-27 21:00:12 +00:00
|
|
|
{
|
|
|
|
GstMPEGDemux *mpeg_demux;
|
|
|
|
|
|
|
|
mpeg_demux = GST_MPEG_DEMUX (element);
|
|
|
|
|
2002-12-12 22:17:10 +00:00
|
|
|
return mpeg_demux->index;
|
2002-11-27 21:00:12 +00:00
|
|
|
}
|
|
|
|
|
2007-05-16 12:48:43 +00:00
|
|
|
void
|
|
|
|
gst_mpeg_streams_reset_last_flow (GstMPEGStream * streams[], guint num)
|
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
for (i = 0; i < num; ++i) {
|
|
|
|
if (streams[i] != NULL)
|
|
|
|
streams[i]->last_flow = GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
}
|
2002-02-03 20:10:04 +00:00
|
|
|
|
ext/dvdread/dvdreadsrc.c: Allow and implement non-flushing and/or segment seek (mainly in TIME and chapter format).
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_read),
(gst_dvd_read_src_create), (gst_dvd_read_src_handle_seek_event):
Allow and implement non-flushing and/or segment seek
(mainly in TIME and chapter format).
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_process_event),
(gst_dvd_demux_get_subpicture_stream),
(gst_dvd_demux_synchronise_pads),
(gst_dvd_demux_sync_stream_to_time):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_process_event),
(gst_mpeg_demux_send_subbuffer),
(gst_mpeg_demux_sync_stream_to_time),
(gst_mpeg_streams_reset_cur_ts):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_pad_added), (gst_mpeg_parse_handle_src_query):
Delegate a query to upstream if it can't be handled.
Make segment stop aware.
Fix (subtitle) stream synchronization.
Add some debug statements.
2008-06-27 12:58:35 +00:00
|
|
|
void
|
|
|
|
gst_mpeg_streams_reset_cur_ts (GstMPEGStream * streams[], guint num,
|
|
|
|
GstClockTime cur_ts)
|
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
for (i = 0; i < num; ++i) {
|
|
|
|
if (streams[i] != NULL)
|
|
|
|
streams[i]->cur_ts = cur_ts;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_demux_plugin_init (GstPlugin * plugin)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
2003-11-02 21:22:09 +00:00
|
|
|
return gst_element_register (plugin, "mpegdemux",
|
ext/dvdread/dvdreadsrc.c: Fix. Don't do one big huge loop around the whole DVD, that will cache all data and thus eat...
Original commit message from CVS:
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_init), (dvdreadsrc_dispose), (dvdreadsrc_set_property),
(dvdreadsrc_get_property), (_open), (_seek), (_read),
(dvdreadsrc_get), (dvdreadsrc_open_file),
(dvdreadsrc_change_state):
Fix. Don't do one big huge loop around the whole DVD, that will
cache all data and thus eat sizeof(dvd) (several GB) before we
see something.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_seek):
Actually NULL'ify event after using it.
* gst/matroska/ebml-read.c: (gst_ebml_read_use_event),
(gst_ebml_read_handle_event), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_read_element_data),
(gst_ebml_read_seek), (gst_ebml_read_skip):
Handle events.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_init), (gst_dvd_demux_get_audio_stream),
(gst_dvd_demux_get_subpicture_stream), (gst_dvd_demux_plugin_init):
Fix timing (this will probably break if I seek using menus, but
I didn't get there yet). VOBs and normal DVDs should now work.
Add a mpeg2-only pad with high rank so this get autoplugged for
MPEG-2 movies.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_base_init),
(gst_mpeg_demux_class_init), (gst_mpeg_demux_init),
(gst_mpeg_demux_new_output_pad), (gst_mpeg_demux_get_video_stream),
(gst_mpeg_demux_get_audio_stream),
(gst_mpeg_demux_get_private_stream), (gst_mpeg_demux_parse_packet),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_plugin_init):
Use this as second rank for MPEG-1 and MPEG-2. Still use this for
MPEG-1 but use dvddemux for MPEG-2.
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_class_init),
(gst_mpeg_parse_init), (gst_mpeg_parse_new_pad),
(gst_mpeg_parse_parse_packhead):
Timing. Only add pad template if it exists. Add sink template from
class and not from ourselves. This means we will always use the
correct sink template even if it is not the one defined in this
file.
2004-10-01 08:42:56 +00:00
|
|
|
GST_RANK_SECONDARY, GST_TYPE_MPEG_DEMUX);
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|