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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*#define GST_DEBUG_ENABLED*/
|
2003-06-29 19:46:09 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2001-12-22 23:26:48 +00:00
|
|
|
#include "gstmpegparse.h"
|
2002-05-26 21:59:22 +00:00
|
|
|
#include "gstmpegclock.h"
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2002-11-27 21:00:12 +00:00
|
|
|
static GstFormat scr_format;
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (gstmpegparse_debug);
|
|
|
|
#define GST_CAT_DEFAULT (gstmpegparse_debug)
|
|
|
|
|
2003-07-25 02:04:01 +00:00
|
|
|
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_SEEK);
|
|
|
|
|
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
|
|
|
#define MP_INVALID_SCR ((guint64)(-1))
|
|
|
|
#define MP_MUX_RATE_MULT 50
|
|
|
|
#define MP_MIN_VALID_BSS 8192
|
|
|
|
#define MP_MAX_VALID_BSS 16384
|
|
|
|
/*
|
|
|
|
* Hysteresis value to limit the
|
|
|
|
* total predicted time skipping about
|
|
|
|
*/
|
|
|
|
#define MP_SCR_RATE_HYST 0.08
|
2004-03-27 22:45:41 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
/* elementfactory information */
|
|
|
|
static GstElementDetails mpeg_parse_details = {
|
|
|
|
"MPEG System Parser",
|
2002-04-20 21:42:51 +00:00
|
|
|
"Codec/Parser",
|
|
|
|
"Parses MPEG1 and MPEG2 System Streams",
|
2004-03-14 22:34:30 +00:00
|
|
|
"Erik Walthinsen <omega@cse.ogi.edu>\n" "Wim Taymans <wim.taymans@chello.be>"
|
2001-12-22 23:26:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define CLASS(o) GST_MPEG_PARSE_CLASS (G_OBJECT_GET_CLASS (o))
|
|
|
|
|
2005-01-25 18:26:45 +00:00
|
|
|
#define DEFAULT_MAX_DISCONT 45000
|
2002-11-27 21:00:12 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
/* GstMPEGParse 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,
|
2002-05-26 21:59:22 +00:00
|
|
|
ARG_SYNC,
|
2002-11-27 21:00:12 +00:00
|
|
|
ARG_MAX_DISCONT,
|
2004-05-21 22:39:29 +00:00
|
|
|
ARG_DO_ADJUST
|
|
|
|
/* FILL ME */
|
2001-12-22 23:26:48 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
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
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
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
|
|
|
);
|
|
|
|
|
|
|
|
static void gst_mpeg_parse_class_init (GstMPEGParseClass * klass);
|
|
|
|
static void gst_mpeg_parse_base_init (GstMPEGParseClass * klass);
|
|
|
|
static void gst_mpeg_parse_init (GstMPEGParse * mpeg_parse);
|
|
|
|
static GstElementStateReturn gst_mpeg_parse_change_state (GstElement * element);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void gst_mpeg_parse_set_clock (GstElement * element, GstClock * clock);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static gboolean gst_mpeg_parse_parse_packhead (GstMPEGParse * mpeg_parse,
|
|
|
|
GstBuffer * buffer);
|
2004-03-27 22:45:41 +00:00
|
|
|
|
|
|
|
static void gst_mpeg_parse_handle_discont (GstMPEGParse * mpeg_parse,
|
|
|
|
GstEvent * event);
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void gst_mpeg_parse_send_data (GstMPEGParse * mpeg_parse, GstData * data,
|
|
|
|
GstClockTime time);
|
2004-03-27 22:45:41 +00:00
|
|
|
static void gst_mpeg_parse_send_discont (GstMPEGParse * mpeg_parse,
|
|
|
|
GstClockTime time);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
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
|
|
|
static void gst_mpeg_parse_new_pad (GstElement * element, GstPad * pad);
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void gst_mpeg_parse_loop (GstElement * element);
|
2002-05-26 21:59:22 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void gst_mpeg_parse_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_mpeg_parse_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_mpeg_parse_set_index (GstElement * element, GstIndex * index);
|
|
|
|
static GstIndex *gst_mpeg_parse_get_index (GstElement * element);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static gboolean gst_mpeg_parse_release_locks (GstElement * element);
|
2002-12-29 21:18:16 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
static GstElementClass *parent_class = NULL;
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
/*static guint gst_mpeg_parse_signals[LAST_SIGNAL] = { 0 };*/
|
|
|
|
|
|
|
|
GType
|
|
|
|
gst_mpeg_parse_get_type (void)
|
|
|
|
{
|
|
|
|
static GType mpeg_parse_type = 0;
|
|
|
|
|
|
|
|
if (!mpeg_parse_type) {
|
|
|
|
static const GTypeInfo mpeg_parse_info = {
|
2004-03-14 22:34:30 +00:00
|
|
|
sizeof (GstMPEGParseClass),
|
|
|
|
(GBaseInitFunc) gst_mpeg_parse_base_init,
|
2001-12-22 23:26:48 +00:00
|
|
|
NULL,
|
2004-03-14 22:34:30 +00:00
|
|
|
(GClassInitFunc) gst_mpeg_parse_class_init,
|
2001-12-22 23:26:48 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-14 22:34:30 +00:00
|
|
|
sizeof (GstMPEGParse),
|
2001-12-22 23:26:48 +00:00
|
|
|
0,
|
2004-03-14 22:34:30 +00:00
|
|
|
(GInstanceInitFunc) gst_mpeg_parse_init,
|
2001-12-22 23:26:48 +00:00
|
|
|
};
|
2004-03-15 19:32:25 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
mpeg_parse_type =
|
2004-03-15 19:32:25 +00:00
|
|
|
g_type_register_static (GST_TYPE_ELEMENT, "GstMPEGParse",
|
|
|
|
&mpeg_parse_info, 0);
|
2004-03-27 22:45:41 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (gstmpegparse_debug, "mpegparse", 0,
|
|
|
|
"MPEG parser element");
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
return mpeg_parse_type;
|
|
|
|
}
|
|
|
|
|
2003-11-02 21:22:09 +00:00
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_base_init (GstMPEGParseClass * klass)
|
2003-11-02 21:22:09 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
|
|
|
gst_element_class_set_details (element_class, &mpeg_parse_details);
|
|
|
|
}
|
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_class_init (GstMPEGParseClass * klass)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
2001-12-23 22:37:07 +00:00
|
|
|
|
2002-05-26 21:59:22 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC,
|
2004-03-14 22:34:30 +00:00
|
|
|
g_param_spec_boolean ("sync", "Sync", "Synchronize on the stream SCR",
|
2004-03-15 19:32:25 +00:00
|
|
|
FALSE, G_PARAM_READWRITE));
|
2002-11-27 21:00:12 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_DISCONT,
|
2004-03-14 22:34:30 +00:00
|
|
|
g_param_spec_int ("max_discont", "Max Discont",
|
2005-01-25 18:26:45 +00:00
|
|
|
"The maximum allowed SCR discontinuity", 0, G_MAXINT,
|
2004-03-15 19:32:25 +00:00
|
|
|
DEFAULT_MAX_DISCONT, G_PARAM_READWRITE));
|
2004-03-27 22:45:41 +00:00
|
|
|
/* FIXME: Default is TRUE to make the behavior backwards compatible.
|
|
|
|
It probably should be FALSE. */
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DO_ADJUST,
|
|
|
|
g_param_spec_boolean ("adjust", "adjust", "Adjust timestamps to "
|
|
|
|
"smooth discontinuities", TRUE, G_PARAM_READWRITE));
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
gobject_class->get_property = gst_mpeg_parse_get_property;
|
2002-05-26 21:59:22 +00:00
|
|
|
gobject_class->set_property = gst_mpeg_parse_set_property;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
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
|
|
|
gstelement_class->new_pad = gst_mpeg_parse_new_pad;
|
2004-03-14 22:34:30 +00:00
|
|
|
gstelement_class->change_state = gst_mpeg_parse_change_state;
|
|
|
|
gstelement_class->set_clock = gst_mpeg_parse_set_clock;
|
|
|
|
gstelement_class->get_index = gst_mpeg_parse_get_index;
|
|
|
|
gstelement_class->set_index = gst_mpeg_parse_set_index;
|
2002-12-29 21:18:16 +00:00
|
|
|
gstelement_class->release_locks = gst_mpeg_parse_release_locks;
|
2002-11-27 21:00:12 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
klass->parse_packhead = gst_mpeg_parse_parse_packhead;
|
2004-03-14 22:34:30 +00:00
|
|
|
klass->parse_syshead = NULL;
|
|
|
|
klass->parse_packet = NULL;
|
|
|
|
klass->parse_pes = NULL;
|
|
|
|
klass->handle_discont = gst_mpeg_parse_handle_discont;
|
2004-03-27 22:45:41 +00:00
|
|
|
klass->send_data = gst_mpeg_parse_send_data;
|
|
|
|
klass->send_discont = gst_mpeg_parse_send_discont;
|
2004-01-03 01:27:31 +00:00
|
|
|
|
|
|
|
/* FIXME: this is a hack. We add the pad templates here instead
|
|
|
|
* in the base_init function, since the derived class (mpegdemux)
|
|
|
|
* uses different pads. IMO, this is wrong. */
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_static_pad_template_get (&src_factory));
|
2004-01-03 01:27:31 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_static_pad_template_get (&sink_factory));
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_init (GstMPEGParse * mpeg_parse)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
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
|
|
|
GstElementClass *klass = GST_ELEMENT_GET_CLASS (mpeg_parse);
|
|
|
|
GstPadTemplate *templ;
|
|
|
|
|
|
|
|
templ = gst_element_class_get_pad_template (klass, "sink");
|
|
|
|
mpeg_parse->sinkpad = gst_pad_new_from_template (templ, "sink");
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (mpeg_parse), mpeg_parse->sinkpad);
|
|
|
|
gst_pad_set_formats_function (mpeg_parse->sinkpad,
|
|
|
|
gst_mpeg_parse_get_src_formats);
|
|
|
|
gst_pad_set_convert_function (mpeg_parse->sinkpad,
|
|
|
|
gst_mpeg_parse_convert_src);
|
|
|
|
|
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
|
|
|
if ((templ = gst_element_class_get_pad_template (klass, "src"))) {
|
|
|
|
mpeg_parse->srcpad = gst_pad_new_from_template (templ, "src");
|
|
|
|
gst_element_add_pad (GST_ELEMENT (mpeg_parse), mpeg_parse->srcpad);
|
|
|
|
gst_pad_set_formats_function (mpeg_parse->srcpad,
|
|
|
|
gst_mpeg_parse_get_src_formats);
|
|
|
|
gst_pad_set_convert_function (mpeg_parse->srcpad,
|
|
|
|
gst_mpeg_parse_convert_src);
|
|
|
|
gst_pad_set_event_mask_function (mpeg_parse->srcpad,
|
|
|
|
gst_mpeg_parse_get_src_event_masks);
|
|
|
|
gst_pad_set_event_function (mpeg_parse->srcpad,
|
|
|
|
gst_mpeg_parse_handle_src_event);
|
|
|
|
gst_pad_set_query_type_function (mpeg_parse->srcpad,
|
|
|
|
gst_mpeg_parse_get_src_query_types);
|
|
|
|
gst_pad_set_query_function (mpeg_parse->srcpad,
|
|
|
|
gst_mpeg_parse_handle_src_query);
|
|
|
|
gst_pad_use_explicit_caps (mpeg_parse->srcpad);
|
|
|
|
}
|
2002-05-26 21:59:22 +00:00
|
|
|
|
|
|
|
gst_element_set_loop_function (GST_ELEMENT (mpeg_parse), gst_mpeg_parse_loop);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
mpeg_parse->packetize = NULL;
|
2002-06-08 23:48:43 +00:00
|
|
|
mpeg_parse->sync = FALSE;
|
2002-12-29 21:18:16 +00:00
|
|
|
mpeg_parse->id = NULL;
|
2002-11-27 21:00:12 +00:00
|
|
|
mpeg_parse->max_discont = DEFAULT_MAX_DISCONT;
|
2002-05-26 21:59:22 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
mpeg_parse->do_adjust = TRUE;
|
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
|
|
|
mpeg_parse->use_adjust = TRUE;
|
2004-03-27 22:45:41 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
GST_FLAG_SET (mpeg_parse, GST_ELEMENT_EVENT_AWARE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_set_clock (GstElement * element, GstClock * clock)
|
|
|
|
{
|
2002-05-26 21:59:22 +00:00
|
|
|
GstMPEGParse *parse = GST_MPEG_PARSE (element);
|
|
|
|
|
|
|
|
parse->clock = clock;
|
2004-03-14 22:34:30 +00:00
|
|
|
}
|
2002-05-26 21:59:22 +00:00
|
|
|
|
2003-12-22 01:47:08 +00:00
|
|
|
#if 0
|
2002-12-30 19:18:04 +00:00
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_update_streaminfo (GstMPEGParse * mpeg_parse)
|
2002-12-30 19:18:04 +00:00
|
|
|
{
|
|
|
|
GstProps *props;
|
|
|
|
GstPropsEntry *entry;
|
|
|
|
gboolean mpeg2 = GST_MPEG_PACKETIZE_IS_MPEG2 (mpeg_parse->packetize);
|
2003-02-02 20:06:39 +00:00
|
|
|
GstCaps *caps;
|
2002-12-30 19:18:04 +00:00
|
|
|
|
|
|
|
props = gst_props_empty_new ();
|
|
|
|
|
2003-12-22 01:47:08 +00:00
|
|
|
entry = gst_props_entry_new ("mpegversion", G_TYPE_INT (mpeg2 ? 2 : 1));
|
2002-12-30 19:18:04 +00:00
|
|
|
gst_props_add_entry (props, (GstPropsEntry *) entry);
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
entry =
|
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_props_entry_new ("bitrate", G_TYPE_INT (mpeg_parse->mux_rate * 8));
|
2002-12-30 19:18:04 +00:00
|
|
|
gst_props_add_entry (props, (GstPropsEntry *) entry);
|
|
|
|
|
2003-02-02 20:06:39 +00:00
|
|
|
caps = gst_caps_new ("mpeg_streaminfo",
|
2004-03-14 22:34:30 +00:00
|
|
|
"application/x-gst-streaminfo", props);
|
2002-12-30 19:18:04 +00:00
|
|
|
|
2003-02-02 20:06:39 +00:00
|
|
|
gst_caps_replace_sink (&mpeg_parse->streaminfo, caps);
|
2002-12-30 19:18:04 +00:00
|
|
|
g_object_notify (G_OBJECT (mpeg_parse), "streaminfo");
|
|
|
|
}
|
2003-12-22 01:47:08 +00:00
|
|
|
#endif
|
2002-12-30 19:18:04 +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
|
|
|
static void
|
|
|
|
gst_mpeg_parse_reset (GstMPEGParse * mpeg_parse)
|
|
|
|
{
|
|
|
|
mpeg_parse->current_scr = 0;
|
|
|
|
mpeg_parse->bytes_since_scr = 0;
|
|
|
|
mpeg_parse->avg_bitrate_time = 0;
|
|
|
|
mpeg_parse->avg_bitrate_bytes = 0;
|
|
|
|
mpeg_parse->first_scr = MP_INVALID_SCR;
|
|
|
|
mpeg_parse->first_scr_pos = 0;
|
|
|
|
mpeg_parse->last_scr = MP_INVALID_SCR;
|
|
|
|
mpeg_parse->last_scr_pos = 0;
|
|
|
|
mpeg_parse->scr_rate = 0;
|
|
|
|
|
|
|
|
mpeg_parse->adjust = 0;
|
|
|
|
mpeg_parse->next_scr = 0;
|
|
|
|
mpeg_parse->mux_rate = 0;
|
|
|
|
|
|
|
|
mpeg_parse->discont_pending = FALSE;
|
|
|
|
mpeg_parse->scr_pending = FALSE;
|
|
|
|
}
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
static void
|
|
|
|
gst_mpeg_parse_handle_discont (GstMPEGParse * mpeg_parse, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstClockTime time;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_DISCONTINUOUS);
|
|
|
|
|
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
|
|
|
if (GST_EVENT_DISCONT_NEW_MEDIA (event)) {
|
|
|
|
gst_mpeg_parse_reset (mpeg_parse);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &time)
|
|
|
|
&& (GST_CLOCK_TIME_IS_VALID (time))) {
|
|
|
|
GST_DEBUG_OBJECT (mpeg_parse, "forwarding discontinuity, time: %0.3fs",
|
|
|
|
(double) time / GST_SECOND);
|
2004-03-27 22:45:41 +00:00
|
|
|
|
|
|
|
if (CLASS (mpeg_parse)->send_discont)
|
|
|
|
CLASS (mpeg_parse)->send_discont (mpeg_parse, time);
|
|
|
|
} else {
|
|
|
|
/* Use the next SCR to send a discontinuous event. */
|
|
|
|
mpeg_parse->discont_pending = TRUE;
|
|
|
|
mpeg_parse->scr_pending = TRUE;
|
|
|
|
}
|
|
|
|
mpeg_parse->packetize->resync = TRUE;
|
|
|
|
|
|
|
|
gst_event_unref (event);
|
|
|
|
}
|
|
|
|
|
2002-05-26 21:59:22 +00:00
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_send_data (GstMPEGParse * mpeg_parse, GstData * data,
|
|
|
|
GstClockTime time)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
if (GST_IS_EVENT (data)) {
|
2002-05-26 21:59:22 +00:00
|
|
|
GstEvent *event = GST_EVENT (data);
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
default:
|
2004-03-15 19:32:25 +00:00
|
|
|
gst_pad_event_default (mpeg_parse->sinkpad, event);
|
|
|
|
break;
|
2002-05-26 21:59:22 +00:00
|
|
|
}
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
2004-07-26 15:17:25 +00:00
|
|
|
if (!gst_pad_is_negotiated (mpeg_parse->srcpad)) {
|
2001-12-26 20:14:07 +00:00
|
|
|
gboolean mpeg2 = GST_MPEG_PACKETIZE_IS_MPEG2 (mpeg_parse->packetize);
|
2004-07-26 15:17:25 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
caps = gst_caps_new_simple ("video/mpeg",
|
|
|
|
"mpegversion", G_TYPE_INT, (mpeg2 ? 2 : 1),
|
|
|
|
"systemstream", G_TYPE_BOOLEAN, TRUE,
|
|
|
|
"parsed", G_TYPE_BOOLEAN, TRUE, NULL);
|
|
|
|
|
|
|
|
if (!gst_pad_set_explicit_caps (mpeg_parse->srcpad, caps)) {
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (mpeg_parse),
|
|
|
|
CORE, NEGOTIATION, (NULL), ("failed to set caps"));
|
|
|
|
return;
|
|
|
|
}
|
2001-12-26 20:14:07 +00:00
|
|
|
}
|
|
|
|
|
2002-05-26 21:59:22 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (data) = time;
|
2003-06-29 19:46:09 +00:00
|
|
|
GST_DEBUG ("current_scr %" G_GINT64_FORMAT, time);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2002-11-04 23:16:45 +00:00
|
|
|
if (GST_PAD_IS_USABLE (mpeg_parse->srcpad))
|
2003-10-08 16:08:10 +00:00
|
|
|
gst_pad_push (mpeg_parse->srcpad, GST_DATA (data));
|
2002-11-04 23:16:45 +00:00
|
|
|
else
|
|
|
|
gst_data_unref (data);
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-26 21:59:22 +00:00
|
|
|
static void
|
2004-03-27 22:45:41 +00:00
|
|
|
gst_mpeg_parse_send_discont (GstMPEGParse * mpeg_parse, GstClockTime time)
|
2002-05-26 21:59:22 +00:00
|
|
|
{
|
|
|
|
GstEvent *event;
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
if (GST_PAD_IS_USABLE (mpeg_parse->srcpad)) {
|
|
|
|
event = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time, NULL);
|
2003-10-08 16:08:10 +00:00
|
|
|
gst_pad_push (mpeg_parse->srcpad, GST_DATA (event));
|
2004-03-27 22:45:41 +00:00
|
|
|
}
|
2002-05-26 21:59:22 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
static void
|
|
|
|
gst_mpeg_parse_new_pad (GstElement * element, GstPad * pad)
|
|
|
|
{
|
|
|
|
GstMPEGParse *mpeg_parse;
|
|
|
|
|
|
|
|
if (GST_PAD_IS_SINK (pad))
|
|
|
|
return;
|
|
|
|
|
|
|
|
mpeg_parse = GST_MPEG_PARSE (element);
|
|
|
|
|
|
|
|
/* For each new added pad, send a discont so it knows about the current
|
|
|
|
* time. This is required because MPEG allows any sort of order of
|
|
|
|
* packets, including setting base time before defining streams or
|
|
|
|
* even adding streams halfway a stream. */
|
2005-01-05 17:03:27 +00:00
|
|
|
if (!mpeg_parse->scr_pending) {
|
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
|
|
|
GstEvent *event = gst_event_new_discontinuous (FALSE,
|
|
|
|
GST_FORMAT_TIME,
|
|
|
|
(guint64) MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr +
|
|
|
|
mpeg_parse->adjust),
|
|
|
|
GST_FORMAT_UNDEFINED);
|
|
|
|
|
|
|
|
gst_pad_push (pad, GST_DATA (event));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_parse_packhead (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
guint8 *buf;
|
2004-09-13 18:56:32 +00:00
|
|
|
guint64 prev_scr, scr;
|
2001-12-22 23:26:48 +00:00
|
|
|
guint32 scr1, scr2;
|
2001-12-23 22:37:07 +00:00
|
|
|
guint32 new_rate;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
buf = GST_BUFFER_DATA (buffer);
|
|
|
|
buf += 4;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
scr1 = GUINT32_FROM_BE (*(guint32 *) buf);
|
|
|
|
scr2 = GUINT32_FROM_BE (*(guint32 *) (buf + 4));
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
if (GST_MPEG_PACKETIZE_IS_MPEG2 (mpeg_parse->packetize)) {
|
2002-11-04 23:16:45 +00:00
|
|
|
guint32 scr_ext;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
/* :2=01 ! scr:3 ! marker:1==1 ! scr:15 ! marker:1==1 ! scr:15 */
|
2004-03-14 22:34:30 +00:00
|
|
|
scr = ((guint64) scr1 & 0x38000000) << 3;
|
2004-01-03 23:07:19 +00:00
|
|
|
scr |= ((guint64) scr1 & 0x03fff800) << 4;
|
|
|
|
scr |= ((guint64) scr1 & 0x000003ff) << 5;
|
|
|
|
scr |= ((guint64) scr2 & 0xf8000000) >> 27;
|
2002-11-04 23:16:45 +00:00
|
|
|
|
|
|
|
scr_ext = (scr2 & 0x03fe0000) >> 17;
|
|
|
|
|
|
|
|
scr = (scr * 300 + scr_ext % 300) / 300;
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_LOG_OBJECT (mpeg_parse, "%" G_GINT64_FORMAT " %d, %08x %08x %"
|
|
|
|
G_GINT64_FORMAT " diff: %" G_GINT64_FORMAT,
|
|
|
|
scr, scr_ext, scr1, scr2, mpeg_parse->bytes_since_scr,
|
2004-03-15 19:32:25 +00:00
|
|
|
scr - mpeg_parse->current_scr);
|
2002-11-04 23:16:45 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
buf += 6;
|
2001-12-23 22:37:07 +00:00
|
|
|
new_rate = (GUINT32_FROM_BE ((*(guint32 *) buf)) & 0xfffffc00) >> 10;
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
|
|
|
scr = ((guint64) scr1 & 0x0e000000) << 5;
|
2004-01-03 23:07:19 +00:00
|
|
|
scr |= ((guint64) scr1 & 0x00fffe00) << 6;
|
|
|
|
scr |= ((guint64) scr1 & 0x000000ff) << 7;
|
|
|
|
scr |= ((guint64) scr2 & 0xfe000000) >> 25;
|
2003-01-17 16:21:35 +00:00
|
|
|
|
2001-12-23 22:37:07 +00:00
|
|
|
buf += 5;
|
2003-01-17 16:21:35 +00:00
|
|
|
/* we do this byte by byte because buf[3] might be outside of buf's
|
|
|
|
* memory space */
|
2004-03-14 22:34:30 +00:00
|
|
|
new_rate = ((gint32) buf[0] & 0x7f) << 15;
|
2004-01-03 23:07:19 +00:00
|
|
|
new_rate |= ((gint32) buf[1]) << 7;
|
2004-03-14 22:34:30 +00:00
|
|
|
new_rate |= buf[2] >> 1;
|
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
|
|
|
new_rate *= MP_MUX_RATE_MULT;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-09-13 18:56:32 +00:00
|
|
|
prev_scr = mpeg_parse->current_scr;
|
2004-03-27 22:45:41 +00:00
|
|
|
mpeg_parse->current_scr = scr;
|
|
|
|
mpeg_parse->scr_pending = FALSE;
|
2002-11-04 23:16:45 +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
|
|
|
if (mpeg_parse->next_scr == MP_INVALID_SCR) {
|
2004-03-27 22:45:41 +00:00
|
|
|
mpeg_parse->next_scr = mpeg_parse->current_scr;
|
2002-12-26 22:45:10 +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
|
|
|
if ((mpeg_parse->first_scr == MP_INVALID_SCR) ||
|
|
|
|
(mpeg_parse->current_scr < mpeg_parse->first_scr)) {
|
|
|
|
mpeg_parse->first_scr = mpeg_parse->current_scr;
|
|
|
|
mpeg_parse->first_scr_pos = gst_bytestream_tell (mpeg_parse->packetize->bs);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((mpeg_parse->last_scr == MP_INVALID_SCR) ||
|
|
|
|
(mpeg_parse->current_scr > mpeg_parse->last_scr)) {
|
|
|
|
mpeg_parse->last_scr = mpeg_parse->current_scr;
|
|
|
|
mpeg_parse->last_scr_pos = gst_bytestream_tell (mpeg_parse->packetize->bs);
|
|
|
|
}
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_LOG_OBJECT (mpeg_parse,
|
|
|
|
"SCR is %" G_GUINT64_FORMAT
|
|
|
|
" (%" G_GUINT64_FORMAT ") next: %"
|
|
|
|
G_GINT64_FORMAT " (%" G_GINT64_FORMAT
|
|
|
|
") diff: %" G_GINT64_FORMAT " (%"
|
2004-03-14 22:34:30 +00:00
|
|
|
G_GINT64_FORMAT ")",
|
2004-03-27 22:45:41 +00:00
|
|
|
mpeg_parse->current_scr,
|
|
|
|
MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr),
|
2004-03-14 22:34:30 +00:00
|
|
|
mpeg_parse->next_scr,
|
|
|
|
MPEGTIME_TO_GSTTIME (mpeg_parse->next_scr),
|
2004-03-27 22:45:41 +00:00
|
|
|
mpeg_parse->current_scr - mpeg_parse->next_scr,
|
|
|
|
MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr) -
|
|
|
|
MPEGTIME_TO_GSTTIME (mpeg_parse->next_scr));
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
if (ABS ((gint64) mpeg_parse->next_scr - (gint64) (scr)) >
|
2004-03-14 22:34:30 +00:00
|
|
|
mpeg_parse->max_discont) {
|
|
|
|
GST_DEBUG ("discontinuity detected; expected: %" G_GUINT64_FORMAT " got: %"
|
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
|
|
|
G_GUINT64_FORMAT " adjusted:%" G_GINT64_FORMAT " adjust:%"
|
|
|
|
G_GINT64_FORMAT, mpeg_parse->next_scr, mpeg_parse->current_scr,
|
|
|
|
mpeg_parse->current_scr + mpeg_parse->adjust, mpeg_parse->adjust);
|
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
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
if (mpeg_parse->do_adjust) {
|
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
|
|
|
if (mpeg_parse->use_adjust) {
|
|
|
|
mpeg_parse->adjust +=
|
|
|
|
(gint64) mpeg_parse->next_scr - (gint64) mpeg_parse->current_scr;
|
|
|
|
GST_DEBUG ("new adjust: %" G_GINT64_FORMAT, mpeg_parse->adjust);
|
|
|
|
}
|
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
|
|
|
} else {
|
|
|
|
mpeg_parse->discont_pending = TRUE;
|
2004-03-27 22:45:41 +00:00
|
|
|
}
|
2002-05-26 21:59:22 +00:00
|
|
|
}
|
2002-11-04 23:16:45 +00:00
|
|
|
|
2002-12-23 00:35:24 +00:00
|
|
|
if (mpeg_parse->index && GST_INDEX_IS_WRITABLE (mpeg_parse->index)) {
|
2002-12-12 22:17:10 +00:00
|
|
|
/* update index if any */
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_index_add_association (mpeg_parse->index, mpeg_parse->index_id,
|
2004-03-15 19:32:25 +00:00
|
|
|
GST_ASSOCIATION_FLAG_KEY_UNIT,
|
|
|
|
GST_FORMAT_BYTES, GST_BUFFER_OFFSET (buffer),
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_FORMAT_TIME, MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr), 0);
|
2002-11-27 21:00:12 +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
|
|
|
if (mpeg_parse->current_scr > prev_scr) {
|
|
|
|
mpeg_parse->avg_bitrate_time +=
|
|
|
|
MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr - prev_scr);
|
|
|
|
mpeg_parse->avg_bitrate_bytes += mpeg_parse->bytes_since_scr;
|
|
|
|
}
|
|
|
|
|
2002-11-04 23:16:45 +00:00
|
|
|
if (mpeg_parse->mux_rate != new_rate) {
|
2005-01-19 15:06:01 +00:00
|
|
|
if (GST_MPEG_PACKETIZE_IS_MPEG2 (mpeg_parse->packetize)) {
|
|
|
|
mpeg_parse->mux_rate = new_rate;
|
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
|
|
|
} else if (mpeg_parse->avg_bitrate_bytes > MP_MIN_VALID_BSS) {
|
2005-01-19 15:06:01 +00:00
|
|
|
mpeg_parse->mux_rate =
|
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_SECOND * mpeg_parse->avg_bitrate_bytes /
|
|
|
|
mpeg_parse->avg_bitrate_time;
|
2005-01-19 15:06:01 +00:00
|
|
|
}
|
2003-12-22 01:47:08 +00:00
|
|
|
//gst_mpeg_parse_update_streaminfo (mpeg_parse);
|
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_DEBUG ("stream current is %1.3fMbs, calculated over %1.3fkB",
|
|
|
|
(mpeg_parse->mux_rate * 8) / 1048576.0,
|
|
|
|
mpeg_parse->bytes_since_scr / 1024.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mpeg_parse->avg_bitrate_bytes > MP_MAX_VALID_BSS) {
|
|
|
|
mpeg_parse->avg_bitrate_bytes = 0;
|
|
|
|
mpeg_parse->avg_bitrate_time = 0;
|
2001-12-23 22:37:07 +00:00
|
|
|
}
|
2004-09-29 19:09:26 +00:00
|
|
|
mpeg_parse->bytes_since_scr = 0;
|
2001-12-23 22:37:07 +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
|
|
|
if (mpeg_parse->avg_bitrate_bytes) {
|
|
|
|
GST_DEBUG ("stream avg is %1.3fMbs, calculated over %1.3fkB",
|
|
|
|
(float) (mpeg_parse->avg_bitrate_bytes) * 8 * GST_SECOND
|
|
|
|
/ mpeg_parse->avg_bitrate_time / 1048576.0,
|
|
|
|
mpeg_parse->avg_bitrate_bytes / 1024.0);
|
|
|
|
}
|
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_loop (GstElement * element)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (element);
|
2001-12-23 22:37:07 +00:00
|
|
|
GstData *data;
|
|
|
|
guint id;
|
|
|
|
gboolean mpeg2;
|
2002-05-26 21:59:22 +00:00
|
|
|
GstClockTime time;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2001-12-23 22:37:07 +00:00
|
|
|
data = gst_mpeg_packetize_read (mpeg_parse->packetize);
|
2003-02-02 20:06:39 +00:00
|
|
|
if (!data)
|
|
|
|
return;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2001-12-23 22:37:07 +00:00
|
|
|
id = GST_MPEG_PACKETIZE_ID (mpeg_parse->packetize);
|
|
|
|
mpeg2 = GST_MPEG_PACKETIZE_IS_MPEG2 (mpeg_parse->packetize);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2001-12-23 22:37:07 +00:00
|
|
|
if (GST_IS_BUFFER (data)) {
|
|
|
|
GstBuffer *buffer = GST_BUFFER (data);
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_LOG_OBJECT (mpeg_parse, "have chunk 0x%02X", id);
|
2001-12-23 22:37:07 +00:00
|
|
|
|
|
|
|
switch (id) {
|
2003-03-28 17:33:20 +00:00
|
|
|
case 0xb9:
|
2004-03-15 19:32:25 +00:00
|
|
|
break;
|
2001-12-23 22:37:07 +00:00
|
|
|
case 0xba:
|
2004-03-15 19:32:25 +00:00
|
|
|
if (CLASS (mpeg_parse)->parse_packhead) {
|
|
|
|
CLASS (mpeg_parse)->parse_packhead (mpeg_parse, buffer);
|
|
|
|
}
|
|
|
|
break;
|
2001-12-23 22:37:07 +00:00
|
|
|
case 0xbb:
|
2004-03-15 19:32:25 +00:00
|
|
|
if (CLASS (mpeg_parse)->parse_syshead) {
|
|
|
|
CLASS (mpeg_parse)->parse_syshead (mpeg_parse, buffer);
|
|
|
|
}
|
|
|
|
break;
|
2001-12-23 22:37:07 +00:00
|
|
|
default:
|
2004-03-15 19:32:25 +00:00
|
|
|
if (mpeg2 && ((id < 0xBD) || (id > 0xFE))) {
|
|
|
|
g_warning ("******** unknown id 0x%02X", id);
|
|
|
|
} else {
|
|
|
|
if (mpeg2) {
|
|
|
|
if (CLASS (mpeg_parse)->parse_pes) {
|
|
|
|
CLASS (mpeg_parse)->parse_pes (mpeg_parse, buffer);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (CLASS (mpeg_parse)->parse_packet) {
|
|
|
|
CLASS (mpeg_parse)->parse_packet (mpeg_parse, buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
2001-12-23 22:37:07 +00:00
|
|
|
}
|
|
|
|
|
2002-05-26 21:59:22 +00:00
|
|
|
time = MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr);
|
|
|
|
|
|
|
|
if (GST_IS_EVENT (data)) {
|
|
|
|
GstEvent *event = GST_EVENT (data);
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_DISCONTINUOUS:
|
2004-03-27 22:45:41 +00:00
|
|
|
if (CLASS (mpeg_parse)->handle_discont)
|
|
|
|
CLASS (mpeg_parse)->handle_discont (mpeg_parse, event);
|
2004-03-15 19:32:25 +00:00
|
|
|
return;
|
2002-05-26 21:59:22 +00:00
|
|
|
default:
|
2004-03-15 19:32:25 +00:00
|
|
|
break;
|
2002-05-26 21:59:22 +00:00
|
|
|
}
|
|
|
|
if (CLASS (mpeg_parse)->send_data)
|
|
|
|
CLASS (mpeg_parse)->send_data (mpeg_parse, data, time);
|
2002-07-08 19:43:33 +00:00
|
|
|
else
|
|
|
|
gst_event_unref (event);
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
2002-05-26 21:59:22 +00:00
|
|
|
guint64 size;
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2002-05-26 21:59:22 +00:00
|
|
|
/* we're not sending data as long as no new SCR was found */
|
|
|
|
if (mpeg_parse->discont_pending) {
|
|
|
|
if (!mpeg_parse->scr_pending) {
|
2004-03-15 19:32:25 +00:00
|
|
|
if (mpeg_parse->clock && mpeg_parse->sync) {
|
|
|
|
gst_element_set_time (GST_ELEMENT (mpeg_parse),
|
|
|
|
MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr));
|
|
|
|
}
|
2004-03-27 22:45:41 +00:00
|
|
|
if (CLASS (mpeg_parse)->send_discont) {
|
|
|
|
CLASS (mpeg_parse)->send_discont (mpeg_parse,
|
|
|
|
MPEGTIME_TO_GSTTIME (mpeg_parse->current_scr +
|
|
|
|
mpeg_parse->adjust));
|
2004-03-15 19:32:25 +00:00
|
|
|
}
|
|
|
|
mpeg_parse->discont_pending = FALSE;
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
2004-03-15 19:32:25 +00:00
|
|
|
GST_DEBUG ("waiting for SCR");
|
|
|
|
gst_buffer_unref (GST_BUFFER (data));
|
|
|
|
return;
|
2002-05-26 21:59:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-04 23:16:45 +00:00
|
|
|
size = GST_BUFFER_SIZE (data);
|
|
|
|
mpeg_parse->bytes_since_scr += size;
|
|
|
|
|
2002-12-30 19:18:04 +00:00
|
|
|
if (!GST_PAD_CAPS (mpeg_parse->sinkpad)) {
|
|
|
|
gboolean mpeg2 = GST_MPEG_PACKETIZE_IS_MPEG2 (mpeg_parse->packetize);
|
|
|
|
|
|
|
|
if (gst_pad_try_set_caps (mpeg_parse->sinkpad,
|
2004-03-15 19:32:25 +00:00
|
|
|
gst_caps_new_simple ("video/mpeg",
|
|
|
|
"mpegversion", G_TYPE_INT, (mpeg2 ? 2 : 1),
|
|
|
|
"systemstream", G_TYPE_BOOLEAN, TRUE,
|
|
|
|
"parsed", G_TYPE_BOOLEAN, TRUE, NULL)) < 0) {
|
|
|
|
GST_ELEMENT_ERROR (mpeg_parse, CORE, NEGOTIATION, (NULL), (NULL));
|
|
|
|
return;
|
2002-12-30 19:18:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-26 21:59:22 +00:00
|
|
|
if (CLASS (mpeg_parse)->send_data)
|
|
|
|
CLASS (mpeg_parse)->send_data (mpeg_parse, data, time);
|
|
|
|
|
2002-06-08 23:48:43 +00:00
|
|
|
if (mpeg_parse->clock && mpeg_parse->sync && !mpeg_parse->discont_pending) {
|
2003-06-29 19:46:09 +00:00
|
|
|
GST_DEBUG ("syncing mpegparse");
|
2004-01-14 00:53:52 +00:00
|
|
|
gst_element_wait (GST_ELEMENT (mpeg_parse), time);
|
2002-05-26 21:59:22 +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
|
|
|
if (mpeg_parse->current_scr != MP_INVALID_SCR) {
|
2002-11-04 23:16:45 +00:00
|
|
|
guint64 scr, bss, br;
|
|
|
|
|
|
|
|
scr = mpeg_parse->current_scr;
|
|
|
|
bss = mpeg_parse->bytes_since_scr;
|
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
|
|
|
br = mpeg_parse->mux_rate;
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2002-11-27 21:00:12 +00:00
|
|
|
if (br) {
|
2004-03-15 19:32:25 +00:00
|
|
|
if (GST_MPEG_PACKETIZE_IS_MPEG2 (mpeg_parse->packetize)) {
|
|
|
|
/*
|
|
|
|
* The mpeg spec says something like this, but that doesn't really work:
|
|
|
|
*
|
|
|
|
* mpeg_parse->next_scr = (scr * br + bss * CLOCK_FREQ) / (CLOCK_FREQ + br);
|
|
|
|
*/
|
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
|
|
|
|
2004-03-15 19:32:25 +00:00
|
|
|
mpeg_parse->next_scr = scr + (bss * CLOCK_FREQ) / br;
|
|
|
|
} else {
|
|
|
|
/* we are interpolating the scr here */
|
|
|
|
mpeg_parse->next_scr = scr + (bss * CLOCK_FREQ) / br;
|
|
|
|
}
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
2004-03-15 19:32:25 +00:00
|
|
|
/* no bitrate known */
|
|
|
|
mpeg_parse->next_scr = scr;
|
2002-11-04 23:16:45 +00:00
|
|
|
}
|
|
|
|
|
2004-03-27 22:45:41 +00:00
|
|
|
GST_LOG_OBJECT (mpeg_parse, "size: %" G_GINT64_FORMAT
|
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
|
|
|
", total since SCR: %" G_GINT64_FORMAT ", br: %" G_GINT64_FORMAT
|
|
|
|
", next SCR: %" G_GINT64_FORMAT, size, bss, br, mpeg_parse->next_scr);
|
2002-11-04 23:16:45 +00:00
|
|
|
}
|
2002-05-26 21:59:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
const GstFormat *
|
|
|
|
gst_mpeg_parse_get_src_formats (GstPad * pad)
|
2002-07-24 21:43:44 +00:00
|
|
|
{
|
|
|
|
static const GstFormat formats[] = {
|
2002-12-23 00:35:24 +00:00
|
|
|
GST_FORMAT_BYTES,
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_FORMAT_TIME,
|
|
|
|
0
|
2002-07-24 21:43:44 +00:00
|
|
|
};
|
2004-03-15 19:32:25 +00:00
|
|
|
|
2002-07-24 21:43:44 +00:00
|
|
|
return formats;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* Return the bitrate to the nearest byte/sec
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
gst_mpeg_parse_get_rate (GstMPEGParse * mpeg_parse, gint64 * rate)
|
|
|
|
{
|
|
|
|
GstFormat time_format = GST_FORMAT_TIME;
|
|
|
|
GstFormat bytes_format = GST_FORMAT_BYTES;
|
|
|
|
gint64 total_time = 0;
|
|
|
|
gint64 total_bytes = 0;
|
|
|
|
|
|
|
|
/* If upstream knows the total time and the total bytes,
|
|
|
|
* use those to compute an average byterate
|
|
|
|
*/
|
|
|
|
if (gst_pad_query (GST_PAD_PEER (mpeg_parse->sinkpad),
|
|
|
|
GST_QUERY_TOTAL, &time_format, &total_time)
|
|
|
|
&&
|
|
|
|
gst_pad_query (GST_PAD_PEER (mpeg_parse->sinkpad),
|
|
|
|
GST_QUERY_TOTAL, &bytes_format, &total_bytes)
|
|
|
|
&& total_time != 0) {
|
|
|
|
*rate = GST_SECOND * total_bytes / total_time;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((mpeg_parse->first_scr != MP_INVALID_SCR) &&
|
|
|
|
(mpeg_parse->last_scr != MP_INVALID_SCR) &&
|
|
|
|
(mpeg_parse->last_scr_pos - mpeg_parse->first_scr_pos > MP_MIN_VALID_BSS)
|
|
|
|
&& (mpeg_parse->last_scr != mpeg_parse->first_scr)) {
|
|
|
|
*rate =
|
|
|
|
GST_SECOND * (mpeg_parse->last_scr_pos -
|
|
|
|
mpeg_parse->first_scr_pos) / MPEGTIME_TO_GSTTIME (mpeg_parse->last_scr -
|
|
|
|
mpeg_parse->first_scr);
|
|
|
|
if (*rate != 0) {
|
|
|
|
/*
|
|
|
|
* check if we need to update scr_rate
|
|
|
|
*/
|
|
|
|
if ((mpeg_parse->scr_rate == 0) ||
|
|
|
|
(((double) (ABS (mpeg_parse->scr_rate -
|
|
|
|
*rate)) / mpeg_parse->scr_rate)
|
|
|
|
>= MP_SCR_RATE_HYST)) {
|
|
|
|
mpeg_parse->scr_rate = *rate;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (mpeg_parse->scr_rate != 0) {
|
|
|
|
*rate = mpeg_parse->scr_rate;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mpeg_parse->avg_bitrate_time != 0 && mpeg_parse->avg_bitrate_bytes != 0) {
|
|
|
|
*rate =
|
|
|
|
GST_SECOND * mpeg_parse->avg_bitrate_bytes /
|
|
|
|
mpeg_parse->avg_bitrate_time;
|
|
|
|
if (*rate != 0) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mpeg_parse->mux_rate != 0) {
|
|
|
|
*rate = mpeg_parse->mux_rate;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-12-26 22:45:10 +00:00
|
|
|
gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_convert_src (GstPad * pad, GstFormat src_format,
|
|
|
|
gint64 src_value, GstFormat * dest_format, gint64 * dest_value)
|
2002-12-26 22:45:10 +00:00
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (gst_pad_get_parent (pad));
|
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
|
|
|
gint64 rate;
|
|
|
|
|
2002-12-26 22:45:10 +00:00
|
|
|
|
|
|
|
switch (src_format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:25 +00:00
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
*dest_format = GST_FORMAT_TIME;
|
|
|
|
case GST_FORMAT_TIME:
|
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
|
|
|
if (!gst_mpeg_parse_get_rate (mpeg_parse, &rate))
|
2004-03-15 19:32:25 +00:00
|
|
|
res = FALSE;
|
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
|
|
|
else {
|
|
|
|
*dest_value = GST_SECOND * src_value / rate;
|
|
|
|
}
|
2004-03-15 19:32:25 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
2002-12-26 22:45:10 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:25 +00:00
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
*dest_format = GST_FORMAT_BYTES;
|
|
|
|
case GST_FORMAT_BYTES:
|
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
|
|
|
if (!gst_mpeg_parse_get_rate (mpeg_parse, &rate))
|
|
|
|
res = FALSE;
|
|
|
|
else {
|
|
|
|
*dest_value = src_value * rate / GST_SECOND;
|
|
|
|
}
|
2004-03-15 19:32:25 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
2002-12-26 22:45:10 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
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
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
const GstQueryType *
|
|
|
|
gst_mpeg_parse_get_src_query_types (GstPad * pad)
|
2002-07-24 21:43:44 +00:00
|
|
|
{
|
2002-12-30 17:53:18 +00:00
|
|
|
static const GstQueryType types[] = {
|
|
|
|
GST_QUERY_TOTAL,
|
|
|
|
GST_QUERY_POSITION,
|
2004-03-14 22:34:30 +00:00
|
|
|
0
|
2002-07-24 21:43:44 +00:00
|
|
|
};
|
2004-03-15 19:32:25 +00:00
|
|
|
|
2002-07-24 21:43:44 +00:00
|
|
|
return types;
|
|
|
|
}
|
|
|
|
|
2002-05-26 21:59:22 +00:00
|
|
|
gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_handle_src_query (GstPad * pad, GstQueryType type,
|
|
|
|
GstFormat * format, gint64 * value)
|
2002-05-26 21:59:22 +00:00
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (gst_pad_get_parent (pad));
|
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
|
|
|
GstFormat src_format = GST_FORMAT_UNDEFINED;
|
|
|
|
gint64 src_value = 0;
|
2002-05-26 21:59:22 +00:00
|
|
|
|
|
|
|
switch (type) {
|
2002-12-30 17:53:18 +00:00
|
|
|
case GST_QUERY_TOTAL:
|
2002-05-26 21:59:22 +00:00
|
|
|
{
|
|
|
|
switch (*format) {
|
2004-03-15 19:32:25 +00:00
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
*format = GST_FORMAT_TIME;
|
|
|
|
/* fallthrough */
|
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
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
/*
|
|
|
|
* Try asking upstream if it knows the time - a DVD might know
|
|
|
|
*/
|
|
|
|
src_format = GST_FORMAT_TIME;
|
|
|
|
if (gst_pad_query (GST_PAD_PEER (mpeg_parse->sinkpad),
|
|
|
|
GST_QUERY_TOTAL, &src_format, &src_value)) {
|
|
|
|
res = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Otherwise fallthrough */
|
2004-03-15 19:32:25 +00:00
|
|
|
default:
|
|
|
|
src_format = GST_FORMAT_BYTES;
|
|
|
|
if (!gst_pad_query (GST_PAD_PEER (mpeg_parse->sinkpad),
|
|
|
|
GST_QUERY_TOTAL, &src_format, &src_value)) {
|
|
|
|
res = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
2002-05-26 21:59:22 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2002-12-30 17:53:18 +00:00
|
|
|
case GST_QUERY_POSITION:
|
2002-05-26 21:59:22 +00:00
|
|
|
{
|
|
|
|
switch (*format) {
|
2004-03-15 19:32:25 +00:00
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
*format = GST_FORMAT_TIME;
|
|
|
|
/* fallthrough */
|
|
|
|
default:
|
|
|
|
src_format = GST_FORMAT_TIME;
|
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
|
|
|
if ((mpeg_parse->current_scr == MP_INVALID_SCR) ||
|
|
|
|
(mpeg_parse->first_scr == MP_INVALID_SCR))
|
|
|
|
res = FALSE;
|
|
|
|
else {
|
|
|
|
gint64 cur =
|
|
|
|
(gint64) (mpeg_parse->current_scr) - mpeg_parse->first_scr;
|
|
|
|
src_value = MPEGTIME_TO_GSTTIME (MAX (0, cur));
|
|
|
|
}
|
2004-03-15 19:32:25 +00:00
|
|
|
break;
|
2002-05-26 21:59:22 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-12-26 22:45:10 +00:00
|
|
|
/* bring to requested format */
|
|
|
|
if (res)
|
|
|
|
res = gst_pad_convert (pad, src_format, src_value, format, value);
|
|
|
|
|
2002-05-26 21:59:22 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
const GstEventMask *
|
|
|
|
gst_mpeg_parse_get_src_event_masks (GstPad * pad)
|
2002-07-24 21:43:44 +00:00
|
|
|
{
|
|
|
|
static const GstEventMask masks[] = {
|
2004-03-14 22:34:30 +00:00
|
|
|
{GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH},
|
|
|
|
{0,}
|
2002-07-24 21:43:44 +00:00
|
|
|
};
|
2004-03-15 19:32:25 +00:00
|
|
|
|
2002-07-24 21:43:44 +00:00
|
|
|
return masks;
|
|
|
|
}
|
|
|
|
|
2002-12-23 00:35:24 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
index_seek (GstPad * pad, GstEvent * event, guint64 * offset, gint64 * scr)
|
2002-12-23 00:35:24 +00:00
|
|
|
{
|
|
|
|
GstIndexEntry *entry;
|
2002-12-26 22:45:10 +00:00
|
|
|
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (gst_pad_get_parent (pad));
|
2002-12-23 00:35:24 +00:00
|
|
|
|
2002-12-26 22:45:10 +00:00
|
|
|
entry = gst_index_get_assoc_entry (mpeg_parse->index, mpeg_parse->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));
|
2002-12-23 00:35:24 +00:00
|
|
|
if (!entry)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (gst_index_entry_assoc_map (entry, GST_FORMAT_BYTES, offset)) {
|
2002-12-26 22:45:10 +00:00
|
|
|
gint64 time;
|
|
|
|
|
|
|
|
if (gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &time)) {
|
|
|
|
*scr = GSTTIME_TO_MPEGTIME (time);
|
|
|
|
}
|
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, scr=%" G_GINT64_FORMAT,
|
|
|
|
GST_DEBUG_PAD_NAME (pad),
|
|
|
|
gst_format_get_details (GST_EVENT_SEEK_FORMAT (event))->nick,
|
|
|
|
GST_EVENT_SEEK_OFFSET (event), *offset, *scr);
|
2002-12-23 00:35:24 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-12-26 22:45:10 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
normal_seek (GstPad * pad, GstEvent * event, guint64 * offset, gint64 * scr)
|
2002-12-26 22:45:10 +00:00
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
GstFormat format;
|
|
|
|
gint64 time;
|
|
|
|
|
|
|
|
/* bring offset to bytes */
|
|
|
|
format = GST_FORMAT_BYTES;
|
2004-03-14 22:34:30 +00:00
|
|
|
res = gst_pad_convert (pad,
|
|
|
|
GST_EVENT_SEEK_FORMAT (event),
|
|
|
|
GST_EVENT_SEEK_OFFSET (event), &format, offset);
|
2002-12-26 22:45:10 +00:00
|
|
|
/* bring offset to time */
|
|
|
|
format = GST_FORMAT_TIME;
|
2004-03-14 22:34:30 +00:00
|
|
|
res &= gst_pad_convert (pad,
|
|
|
|
GST_EVENT_SEEK_FORMAT (event),
|
|
|
|
GST_EVENT_SEEK_OFFSET (event), &format, &time);
|
2002-12-26 22:45:10 +00:00
|
|
|
|
|
|
|
/* convert to scr */
|
|
|
|
*scr = GSTTIME_TO_MPEGTIME (time);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2002-05-26 21:59:22 +00:00
|
|
|
gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_handle_src_event (GstPad * pad, GstEvent * event)
|
2002-05-26 21:59:22 +00:00
|
|
|
{
|
2002-12-23 00:35:24 +00:00
|
|
|
gboolean res = FALSE;
|
2002-05-26 21:59:22 +00:00
|
|
|
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_SEEK:
|
|
|
|
{
|
|
|
|
guint64 desired_offset;
|
2002-12-26 22:45:10 +00:00
|
|
|
guint64 expected_scr;
|
2002-05-26 21:59:22 +00:00
|
|
|
|
2002-12-26 22:45:10 +00:00
|
|
|
/* first to to use the index if we have one */
|
2004-03-14 22:34:30 +00:00
|
|
|
if (mpeg_parse->index)
|
2004-03-15 19:32:25 +00:00
|
|
|
res = index_seek (pad, event, &desired_offset, &expected_scr);
|
2002-12-26 22:45:10 +00:00
|
|
|
/* nothing found, try fuzzy seek */
|
2004-03-14 22:34:30 +00:00
|
|
|
if (!res)
|
2004-03-15 19:32:25 +00:00
|
|
|
res = normal_seek (pad, event, &desired_offset, &expected_scr);
|
2002-05-26 21:59:22 +00:00
|
|
|
|
2002-12-26 22:45:10 +00:00
|
|
|
if (!res)
|
2004-03-15 19:32:25 +00:00
|
|
|
break;
|
2004-03-14 22:34:30 +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
|
|
|
GST_DEBUG ("sending seek to %" G_GINT64_FORMAT " expected SCR: %"
|
|
|
|
G_GUINT64_FORMAT " (%" G_GUINT64_FORMAT ")", desired_offset,
|
|
|
|
expected_scr, MPEGTIME_TO_GSTTIME (expected_scr));
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
if (gst_bytestream_seek (mpeg_parse->packetize->bs, desired_offset,
|
2004-03-15 19:32:25 +00:00
|
|
|
GST_SEEK_METHOD_SET)) {
|
|
|
|
mpeg_parse->discont_pending = TRUE;
|
|
|
|
mpeg_parse->scr_pending = TRUE;
|
|
|
|
mpeg_parse->next_scr = expected_scr;
|
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
|
|
|
mpeg_parse->current_scr = MP_INVALID_SCR;
|
2004-03-15 19:32:25 +00:00
|
|
|
mpeg_parse->adjust = 0;
|
|
|
|
res = TRUE;
|
2002-05-26 21:59:22 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2002-07-08 19:43:33 +00:00
|
|
|
gst_event_unref (event);
|
2002-05-26 21:59:22 +00:00
|
|
|
return res;
|
2001-12-23 22:37:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstElementStateReturn
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_change_state (GstElement * element)
|
2001-12-23 22:37:07 +00:00
|
|
|
{
|
|
|
|
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (element);
|
|
|
|
|
|
|
|
switch (GST_STATE_TRANSITION (element)) {
|
2002-02-02 13:57:30 +00:00
|
|
|
case GST_STATE_READY_TO_PAUSED:
|
2001-12-23 22:37:07 +00:00
|
|
|
if (!mpeg_parse->packetize) {
|
2004-03-15 19:32:25 +00:00
|
|
|
mpeg_parse->packetize =
|
|
|
|
gst_mpeg_packetize_new (mpeg_parse->sinkpad,
|
|
|
|
GST_MPEG_PACKETIZE_SYSTEM);
|
2001-12-23 22:37:07 +00:00
|
|
|
}
|
2002-12-26 22:45:10 +00:00
|
|
|
/* initialize parser state */
|
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_mpeg_parse_reset (mpeg_parse);
|
2001-12-23 22:37:07 +00:00
|
|
|
break;
|
2002-02-02 13:57:30 +00:00
|
|
|
case GST_STATE_PAUSED_TO_READY:
|
2001-12-23 22:37:07 +00:00
|
|
|
if (mpeg_parse->packetize) {
|
2004-03-15 19:32:25 +00:00
|
|
|
gst_mpeg_packetize_destroy (mpeg_parse->packetize);
|
|
|
|
mpeg_parse->packetize = NULL;
|
2001-12-23 22:37:07 +00:00
|
|
|
}
|
2003-12-22 01:47:08 +00:00
|
|
|
//gst_caps_replace (&mpeg_parse->streaminfo, NULL);
|
2001-12-23 22:37:07 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2002-02-02 13:57:30 +00:00
|
|
|
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
GstMPEGParse *mpeg_parse;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
mpeg_parse = GST_MPEG_PARSE (object);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2004-03-14 22:34:30 +00:00
|
|
|
case ARG_SYNC:
|
2002-05-26 23:17:50 +00:00
|
|
|
g_value_set_boolean (value, mpeg_parse->sync);
|
|
|
|
break;
|
2004-03-14 22:34:30 +00:00
|
|
|
case ARG_MAX_DISCONT:
|
2002-11-27 21:00:12 +00:00
|
|
|
g_value_set_int (value, mpeg_parse->max_discont);
|
|
|
|
break;
|
2004-03-27 22:45:41 +00:00
|
|
|
case ARG_DO_ADJUST:
|
|
|
|
g_value_set_boolean (value, mpeg_parse->do_adjust);
|
|
|
|
break;
|
2004-03-14 22:34:30 +00:00
|
|
|
default:
|
2001-12-22 23:26:48 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-26 21:59:22 +00:00
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
2002-05-26 21:59:22 +00:00
|
|
|
{
|
|
|
|
GstMPEGParse *mpeg_parse;
|
|
|
|
|
2002-11-27 21:00:12 +00:00
|
|
|
mpeg_parse = GST_MPEG_PARSE (object);
|
2002-05-26 21:59:22 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2004-03-14 22:34:30 +00:00
|
|
|
case ARG_SYNC:
|
|
|
|
mpeg_parse->sync = g_value_get_boolean (value);
|
2002-05-26 21:59:22 +00:00
|
|
|
break;
|
2004-03-14 22:34:30 +00:00
|
|
|
case ARG_MAX_DISCONT:
|
|
|
|
mpeg_parse->max_discont = g_value_get_int (value);
|
2002-11-27 21:00:12 +00:00
|
|
|
break;
|
2004-03-27 22:45:41 +00:00
|
|
|
case ARG_DO_ADJUST:
|
|
|
|
mpeg_parse->do_adjust = g_value_get_boolean (value);
|
|
|
|
mpeg_parse->adjust = 0;
|
|
|
|
break;
|
2004-03-14 22:34:30 +00:00
|
|
|
default:
|
2002-05-26 21:59:22 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-27 21:00:12 +00:00
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_set_index (GstElement * element, GstIndex * index)
|
2002-11-27 21:00:12 +00:00
|
|
|
{
|
|
|
|
GstMPEGParse *mpeg_parse;
|
|
|
|
|
|
|
|
mpeg_parse = GST_MPEG_PARSE (element);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2002-12-12 22:17:10 +00:00
|
|
|
mpeg_parse->index = index;
|
2002-11-27 21:00:12 +00:00
|
|
|
|
2002-12-12 22:17:10 +00:00
|
|
|
gst_index_get_writer_id (index, GST_OBJECT (mpeg_parse->sinkpad),
|
2004-03-14 22:34:30 +00:00
|
|
|
&mpeg_parse->index_id);
|
2002-12-12 22:17:10 +00:00
|
|
|
gst_index_add_format (index, mpeg_parse->index_id, scr_format);
|
2002-11-27 21:00:12 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static GstIndex *
|
|
|
|
gst_mpeg_parse_get_index (GstElement * element)
|
2002-11-27 21:00:12 +00:00
|
|
|
{
|
|
|
|
GstMPEGParse *mpeg_parse;
|
|
|
|
|
|
|
|
mpeg_parse = GST_MPEG_PARSE (element);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2002-12-12 22:17:10 +00:00
|
|
|
return mpeg_parse->index;
|
2002-11-27 21:00:12 +00:00
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2002-12-29 21:18:16 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_release_locks (GstElement * element)
|
2002-12-29 21:18:16 +00:00
|
|
|
{
|
|
|
|
GstMPEGParse *mpeg_parse;
|
|
|
|
|
|
|
|
mpeg_parse = GST_MPEG_PARSE (element);
|
|
|
|
|
|
|
|
if (mpeg_parse->id) {
|
2004-01-14 00:53:52 +00:00
|
|
|
/* FIXME */
|
|
|
|
//gst_clock_id_unlock (mpeg_parse->id);
|
2002-12-29 21:18:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_parse_plugin_init (GstPlugin * plugin)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
2004-03-14 22:34:30 +00:00
|
|
|
scr_format =
|
|
|
|
gst_format_register ("scr", "The MPEG system clock reference time");
|
2002-11-27 21:00:12 +00:00
|
|
|
|
2003-11-02 21:22:09 +00:00
|
|
|
return gst_element_register (plugin, "mpegparse",
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_RANK_NONE, GST_TYPE_MPEG_PARSE);
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|