2003-11-24 04:08:48 +00:00
|
|
|
/* GStreamer
|
2005-03-31 09:43:49 +00:00
|
|
|
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
2003-11-24 04:08:48 +00:00
|
|
|
*
|
2004-01-23 13:22:17 +00:00
|
|
|
* gstoggdemux.c: ogg stream demuxer
|
2003-11-24 04:08:48 +00:00
|
|
|
*
|
|
|
|
* 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
|
2012-11-03 23:05:09 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2003-11-24 04:08:48 +00:00
|
|
|
*/
|
|
|
|
|
2007-01-09 12:30:46 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-oggdemux
|
2008-04-23 13:45:29 +00:00
|
|
|
* @see_also: <link linkend="gst-plugins-base-plugins-oggmux">oggmux</link>
|
2007-01-09 12:30:46 +00:00
|
|
|
*
|
|
|
|
* This element demuxes ogg files into their encoded audio and video components.
|
2008-07-10 21:06:06 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
2007-01-09 12:30:46 +00:00
|
|
|
* <title>Example pipelines</title>
|
2008-07-10 21:06:06 +00:00
|
|
|
* |[
|
2007-01-09 12:30:46 +00:00
|
|
|
* gst-launch -v filesrc location=test.ogg ! oggdemux ! vorbisdec ! audioconvert ! alsasink
|
2008-07-10 21:06:06 +00:00
|
|
|
* ]| Decodes the vorbis audio stored inside an ogg container.
|
2007-01-09 12:30:46 +00:00
|
|
|
* </refsect2>
|
|
|
|
*
|
|
|
|
* Last reviewed on 2006-12-30 (0.10.5)
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2003-11-24 04:08:48 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2011-12-04 20:50:25 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
#include <string.h>
|
2005-10-23 09:57:59 +00:00
|
|
|
#include <gst/gst-i18n-plugin.h>
|
2010-01-23 21:03:18 +00:00
|
|
|
#include <gst/tag/tag.h>
|
2006-05-25 09:32:31 +00:00
|
|
|
|
2007-01-09 12:30:46 +00:00
|
|
|
#include "gstoggdemux.h"
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
#define CHUNKSIZE (8500) /* this is out of vorbisfile */
|
2004-07-02 03:41:22 +00:00
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
/* we hope we get a granpos within this many bytes off the end */
|
|
|
|
#define DURATION_CHUNK_OFFSET (64*1024)
|
|
|
|
|
|
|
|
/* stop duration checks within this much of EOS */
|
|
|
|
#define EOS_AVOIDANCE_THRESHOLD 8192
|
|
|
|
|
2012-06-14 17:31:51 +00:00
|
|
|
/* An Ogg page can not be larger than 255 segments of 255 bytes, plus
|
|
|
|
26 bytes of header */
|
|
|
|
#define MAX_OGG_PAGE_SIZE (255 * 255 + 26)
|
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
#define GST_FLOW_LIMIT GST_FLOW_CUSTOM_ERROR
|
2011-08-13 13:18:56 +00:00
|
|
|
#define GST_FLOW_SKIP_PUSH GST_FLOW_CUSTOM_SUCCESS_1
|
2004-07-02 03:41:22 +00:00
|
|
|
|
2012-09-10 00:08:51 +00:00
|
|
|
#define GST_CHAIN_LOCK(ogg) g_mutex_lock(&(ogg)->chain_lock)
|
|
|
|
#define GST_CHAIN_UNLOCK(ogg) g_mutex_unlock(&(ogg)->chain_lock)
|
2008-05-22 22:09:16 +00:00
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
#define GST_PUSH_LOCK(ogg) \
|
|
|
|
do { \
|
|
|
|
GST_TRACE_OBJECT(ogg, "Push lock"); \
|
2012-09-10 00:08:51 +00:00
|
|
|
g_mutex_lock(&(ogg)->push_lock); \
|
2011-08-13 13:18:56 +00:00
|
|
|
} while(0)
|
|
|
|
|
|
|
|
#define GST_PUSH_UNLOCK(ogg) \
|
|
|
|
do { \
|
|
|
|
GST_TRACE_OBJECT(ogg, "Push unlock"); \
|
2012-09-10 00:08:51 +00:00
|
|
|
g_mutex_unlock(&(ogg)->push_lock); \
|
2011-08-13 13:18:56 +00:00
|
|
|
} while(0)
|
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_ogg_demux_debug);
|
|
|
|
GST_DEBUG_CATEGORY (gst_ogg_demux_setup_debug);
|
2003-11-24 04:08:48 +00:00
|
|
|
#define GST_CAT_DEFAULT gst_ogg_demux_debug
|
|
|
|
|
2010-01-23 13:46:19 +00:00
|
|
|
|
|
|
|
static ogg_packet *
|
|
|
|
_ogg_packet_copy (const ogg_packet * packet)
|
|
|
|
{
|
2011-08-18 09:05:17 +00:00
|
|
|
ogg_packet *ret = g_slice_new (ogg_packet);
|
2010-01-23 13:46:19 +00:00
|
|
|
|
|
|
|
*ret = *packet;
|
|
|
|
ret->packet = g_memdup (packet->packet, packet->bytes);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ogg_packet_free (ogg_packet * packet)
|
|
|
|
{
|
|
|
|
g_free (packet->packet);
|
2011-08-18 09:05:17 +00:00
|
|
|
g_slice_free (ogg_packet, packet);
|
2010-01-23 13:46:19 +00:00
|
|
|
}
|
|
|
|
|
2006-11-24 15:40:58 +00:00
|
|
|
static ogg_page *
|
|
|
|
gst_ogg_page_copy (ogg_page * page)
|
|
|
|
{
|
2011-08-18 09:05:17 +00:00
|
|
|
ogg_page *p = g_slice_new (ogg_page);
|
2006-11-24 15:40:58 +00:00
|
|
|
|
|
|
|
/* make a copy of the page */
|
|
|
|
p->header = g_memdup (page->header, page->header_len);
|
|
|
|
p->header_len = page->header_len;
|
|
|
|
p->body = g_memdup (page->body, page->body_len);
|
|
|
|
p->body_len = page->body_len;
|
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ogg_page_free (ogg_page * page)
|
|
|
|
{
|
|
|
|
g_free (page->header);
|
|
|
|
g_free (page->body);
|
2011-08-18 09:05:17 +00:00
|
|
|
g_slice_free (ogg_page, page);
|
2006-11-24 15:40:58 +00:00
|
|
|
}
|
|
|
|
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
static gboolean gst_ogg_demux_collect_chain_info (GstOggDemux * ogg,
|
|
|
|
GstOggChain * chain);
|
|
|
|
static gboolean gst_ogg_demux_activate_chain (GstOggDemux * ogg,
|
|
|
|
GstOggChain * chain, GstEvent * event);
|
2011-08-13 13:14:19 +00:00
|
|
|
static void gst_ogg_pad_mark_discont (GstOggPad * pad);
|
2006-11-09 00:50:00 +00:00
|
|
|
static void gst_ogg_chain_mark_discont (GstOggChain * chain);
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
static gboolean gst_ogg_demux_perform_seek (GstOggDemux * ogg,
|
|
|
|
GstEvent * event);
|
2005-11-15 18:11:17 +00:00
|
|
|
static gboolean gst_ogg_demux_receive_event (GstElement * element,
|
|
|
|
GstEvent * event);
|
2003-11-24 04:08:48 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static void gst_ogg_pad_dispose (GObject * object);
|
|
|
|
static void gst_ogg_pad_finalize (GObject * object);
|
2005-05-09 10:56:13 +00:00
|
|
|
|
2011-11-16 16:25:17 +00:00
|
|
|
static gboolean gst_ogg_pad_src_query (GstPad * pad, GstObject * parent,
|
|
|
|
GstQuery * query);
|
2011-11-17 11:48:25 +00:00
|
|
|
static gboolean gst_ogg_pad_event (GstPad * pad, GstObject * parent,
|
|
|
|
GstEvent * event);
|
ext/ogg/gstoggdemux.c: Annodex support in ogg demuxer. Doesn't do very much without the other annodex patches (to come).
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_parse_skeleton_fishead),
(gst_ogg_pad_parse_skeleton_fisbone), (gst_ogg_pad_query_convert),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_read_chain),
(gst_ogg_demux_read_end_chain), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_change_state), (gst_annodex_granule_to_time):
Annodex support in ogg demuxer. Doesn't do very much without the
other annodex patches (to come).
2006-02-24 17:31:53 +00:00
|
|
|
static GstOggPad *gst_ogg_chain_get_stream (GstOggChain * chain,
|
2011-08-17 17:03:16 +00:00
|
|
|
guint32 serialno);
|
ext/ogg/gstoggdemux.c: Annodex support in ogg demuxer. Doesn't do very much without the other annodex patches (to come).
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_parse_skeleton_fishead),
(gst_ogg_pad_parse_skeleton_fisbone), (gst_ogg_pad_query_convert),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_read_chain),
(gst_ogg_demux_read_end_chain), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_change_state), (gst_annodex_granule_to_time):
Annodex support in ogg demuxer. Doesn't do very much without the
other annodex patches (to come).
2006-02-24 17:31:53 +00:00
|
|
|
|
2006-06-15 15:27:49 +00:00
|
|
|
static GstFlowReturn gst_ogg_demux_combine_flows (GstOggDemux * ogg,
|
|
|
|
GstOggPad * pad, GstFlowReturn ret);
|
2009-09-10 08:00:16 +00:00
|
|
|
static void gst_ogg_demux_sync_streams (GstOggDemux * ogg);
|
2013-09-06 18:36:12 +00:00
|
|
|
static gboolean gst_ogg_demux_check_eos (GstOggDemux * ogg);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2013-03-03 17:39:13 +00:00
|
|
|
static GstCaps *gst_ogg_demux_set_header_on_caps (GstOggDemux * ogg,
|
2010-12-23 17:18:17 +00:00
|
|
|
GstCaps * caps, GList * headers);
|
2011-08-13 13:18:56 +00:00
|
|
|
static gboolean gst_ogg_demux_send_event (GstOggDemux * ogg, GstEvent * event);
|
|
|
|
static gboolean gst_ogg_demux_perform_seek_push (GstOggDemux * ogg,
|
|
|
|
GstEvent * event);
|
|
|
|
static gboolean gst_ogg_demux_check_duration_push (GstOggDemux * ogg,
|
|
|
|
GstSeekFlags flags, GstEvent * event);
|
2010-12-23 17:18:17 +00:00
|
|
|
|
2010-03-11 12:32:14 +00:00
|
|
|
GType gst_ogg_pad_get_type (void);
|
2008-12-10 14:55:10 +00:00
|
|
|
G_DEFINE_TYPE (GstOggPad, gst_ogg_pad, GST_TYPE_PAD);
|
2003-11-24 04:08:48 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_pad_class_init (GstOggPadClass * klass)
|
2003-11-24 04:08:48 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
GObjectClass *gobject_class;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
2003-11-24 04:08:48 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
gobject_class->dispose = gst_ogg_pad_dispose;
|
|
|
|
gobject_class->finalize = gst_ogg_pad_finalize;
|
|
|
|
}
|
2003-11-24 04:08:48 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_pad_init (GstOggPad * pad)
|
|
|
|
{
|
|
|
|
gst_pad_set_event_function (GST_PAD (pad),
|
|
|
|
GST_DEBUG_FUNCPTR (gst_ogg_pad_event));
|
|
|
|
gst_pad_set_query_function (GST_PAD (pad),
|
|
|
|
GST_DEBUG_FUNCPTR (gst_ogg_pad_src_query));
|
2011-05-16 10:20:34 +00:00
|
|
|
gst_pad_use_fixed_caps (GST_PAD (pad));
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
pad->current_granule = -1;
|
2009-12-07 14:42:05 +00:00
|
|
|
pad->keyframe_granule = -1;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
pad->start_time = GST_CLOCK_TIME_NONE;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2011-05-16 11:48:11 +00:00
|
|
|
pad->position = GST_CLOCK_TIME_NONE;
|
2009-09-10 08:00:16 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
pad->have_type = FALSE;
|
2006-11-24 15:40:58 +00:00
|
|
|
pad->continued = NULL;
|
2009-08-29 17:51:48 +00:00
|
|
|
pad->map.headers = NULL;
|
2010-01-08 15:57:40 +00:00
|
|
|
pad->map.queued = NULL;
|
2011-01-13 15:35:30 +00:00
|
|
|
|
|
|
|
pad->map.granulerate_n = 0;
|
|
|
|
pad->map.granulerate_d = 0;
|
|
|
|
pad->map.granuleshift = -1;
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
2004-07-02 03:41:22 +00:00
|
|
|
|
2003-11-24 04:08:48 +00:00
|
|
|
static void
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_ogg_pad_dispose (GObject * object)
|
2003-11-24 04:08:48 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
GstOggPad *pad = GST_OGG_PAD (object);
|
|
|
|
|
|
|
|
pad->chain = NULL;
|
|
|
|
pad->ogg = NULL;
|
|
|
|
|
2010-01-23 13:46:19 +00:00
|
|
|
g_list_foreach (pad->map.headers, (GFunc) _ogg_packet_free, NULL);
|
2009-08-29 17:51:48 +00:00
|
|
|
g_list_free (pad->map.headers);
|
|
|
|
pad->map.headers = NULL;
|
2010-01-23 13:46:19 +00:00
|
|
|
g_list_foreach (pad->map.queued, (GFunc) _ogg_packet_free, NULL);
|
2010-01-08 15:57:40 +00:00
|
|
|
g_list_free (pad->map.queued);
|
|
|
|
pad->map.queued = NULL;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2010-03-02 10:16:39 +00:00
|
|
|
g_free (pad->map.index);
|
|
|
|
pad->map.index = NULL;
|
|
|
|
|
2006-11-24 15:40:58 +00:00
|
|
|
/* clear continued pages */
|
|
|
|
g_list_foreach (pad->continued, (GFunc) gst_ogg_page_free, NULL);
|
|
|
|
g_list_free (pad->continued);
|
|
|
|
pad->continued = NULL;
|
|
|
|
|
2010-10-27 09:16:15 +00:00
|
|
|
if (pad->map.caps) {
|
|
|
|
gst_caps_unref (pad->map.caps);
|
|
|
|
pad->map.caps = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pad->map.taglist) {
|
2012-09-14 15:53:21 +00:00
|
|
|
gst_tag_list_unref (pad->map.taglist);
|
2010-10-27 09:16:15 +00:00
|
|
|
pad->map.taglist = NULL;
|
|
|
|
}
|
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
ogg_stream_reset (&pad->map.stream);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2008-12-10 14:55:10 +00:00
|
|
|
G_OBJECT_CLASS (gst_ogg_pad_parent_class)->dispose (object);
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
2004-07-02 03:41:22 +00:00
|
|
|
|
2003-11-24 04:08:48 +00:00
|
|
|
static void
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_ogg_pad_finalize (GObject * object)
|
2003-11-24 04:08:48 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
GstOggPad *pad = GST_OGG_PAD (object);
|
2003-11-24 04:08:48 +00:00
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
ogg_stream_clear (&pad->map.stream);
|
2004-11-01 10:38:30 +00:00
|
|
|
|
2008-12-10 14:55:10 +00:00
|
|
|
G_OBJECT_CLASS (gst_ogg_pad_parent_class)->finalize (object);
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean
|
2011-11-16 16:25:17 +00:00
|
|
|
gst_ogg_pad_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
2003-11-24 04:08:48 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
gboolean res = TRUE;
|
ext/: More seeking fixes, oggdemux now supports seeking to time and uses the downstream element to convert granulepos...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_init),
(gst_ogg_demux_get_formats), (gst_ogg_demux_src_query),
(gst_ogg_demux_src_event), (gst_ogg_demux_src_convert),
(gst_ogg_demux_handle_event), (gst_ogg_demux_seek_before),
(_find_chain_get_unknown_part), (_find_streams_check),
(gst_ogg_demux_push), (gst_ogg_pad_push):
* ext/theora/theoradec.c: (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_get_formats),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_event):
More seeking fixes, oggdemux now supports seeking to time and
uses the downstream element to convert granulepos to time.
Seeking in theora-only ogg files now works.
2004-07-21 16:48:20 +00:00
|
|
|
GstOggDemux *ogg;
|
|
|
|
|
2011-11-16 16:25:17 +00:00
|
|
|
ogg = GST_OGG_DEMUX (parent);
|
2004-03-06 11:18:28 +00:00
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
Query API update.
Original commit message from CVS:
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(query_positions_elems), (query_positions_pads), (update_scale),
(do_seek), (set_update_scale), (message_received), (main):
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_find_chains),
(gst_ogg_demux_loop):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_sink_query):
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_dec_sink_event):
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_data_packet):
* gst/adder/gstadder.c: (gst_adder_query):
* gst/audiotestsrc/gstaudiotestsrc.c: (gst_audiotestsrc_src_query):
* gst/playback/test3.c: (update_scale):
* gst/playback/test5.c: (new_pad), (no_more_pads), (start_finding),
(dump_element_stats), (main):
* gst/playback/test6.c: (main):
* gst/sine/gstsinesrc.c: (gst_sinesrc_src_query):
Query API update.
2005-10-19 15:55:33 +00:00
|
|
|
case GST_QUERY_DURATION:
|
ext/ogg/gstoggdemux.c: Parse seeking events better.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_pad_event), (gst_ogg_demux_factory_filter),
(gst_ogg_pad_submit_packet), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
Parse seeking events better.
Unref static caps.
Generate correct newsegment events, fixes seeking in live oggs.
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_dec_src_event), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_dec_push), (theora_dec_chain):
Use newsegment values to report correct play time.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event):
* ext/vorbis/vorbisdec.h:
Parse and use newsegment values to report correct play time.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Clear ringbuffer on flush.
Use newsegment values to calculate playback time.
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Basesink does newsegment calculations for us now.
2005-08-24 18:04:45 +00:00
|
|
|
{
|
|
|
|
GstFormat format;
|
2010-04-30 15:41:05 +00:00
|
|
|
gint64 total_time = -1;
|
ext/ogg/gstoggdemux.c: Parse seeking events better.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_pad_event), (gst_ogg_demux_factory_filter),
(gst_ogg_pad_submit_packet), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
Parse seeking events better.
Unref static caps.
Generate correct newsegment events, fixes seeking in live oggs.
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_dec_src_event), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_dec_push), (theora_dec_chain):
Use newsegment values to report correct play time.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event):
* ext/vorbis/vorbisdec.h:
Parse and use newsegment values to report correct play time.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Clear ringbuffer on flush.
Use newsegment values to calculate playback time.
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Basesink does newsegment calculations for us now.
2005-08-24 18:04:45 +00:00
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_parse_duration (query, &format, NULL);
|
2013-10-08 19:57:11 +00:00
|
|
|
/* can only get duration in time */
|
2006-04-10 19:13:30 +00:00
|
|
|
if (format != GST_FORMAT_TIME)
|
|
|
|
goto wrong_format;
|
|
|
|
|
2010-05-04 11:05:51 +00:00
|
|
|
if (ogg->total_time != -1) {
|
|
|
|
/* we can return the total length */
|
2009-03-17 18:53:44 +00:00
|
|
|
total_time = ogg->total_time;
|
|
|
|
} else {
|
2010-04-30 15:41:05 +00:00
|
|
|
gint bitrate = ogg->bitrate;
|
|
|
|
|
|
|
|
/* try with length and bitrate */
|
|
|
|
if (bitrate > 0) {
|
|
|
|
GstQuery *uquery;
|
|
|
|
|
|
|
|
/* ask upstream for total length in bytes */
|
|
|
|
uquery = gst_query_new_duration (GST_FORMAT_BYTES);
|
2011-05-17 09:25:31 +00:00
|
|
|
if (gst_pad_peer_query (ogg->sinkpad, uquery)) {
|
2010-04-30 15:41:05 +00:00
|
|
|
gint64 length;
|
|
|
|
|
|
|
|
gst_query_parse_duration (uquery, NULL, &length);
|
|
|
|
|
|
|
|
/* estimate using the bitrate */
|
|
|
|
total_time =
|
|
|
|
gst_util_uint64_scale (length, 8 * GST_SECOND, bitrate);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ogg,
|
|
|
|
"length: %" G_GINT64_FORMAT ", bitrate %d, total_time %"
|
|
|
|
GST_TIME_FORMAT, length, bitrate, GST_TIME_ARGS (total_time));
|
|
|
|
}
|
|
|
|
gst_query_unref (uquery);
|
|
|
|
}
|
2009-03-17 18:53:44 +00:00
|
|
|
}
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_duration (query, GST_FORMAT_TIME, total_time);
|
2005-03-31 09:43:49 +00:00
|
|
|
break;
|
ext/ogg/gstoggdemux.c: Parse seeking events better.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_pad_event), (gst_ogg_demux_factory_filter),
(gst_ogg_pad_submit_packet), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
Parse seeking events better.
Unref static caps.
Generate correct newsegment events, fixes seeking in live oggs.
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_dec_src_event), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_dec_push), (theora_dec_chain):
Use newsegment values to report correct play time.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event):
* ext/vorbis/vorbisdec.h:
Parse and use newsegment values to report correct play time.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Clear ringbuffer on flush.
Use newsegment values to calculate playback time.
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Basesink does newsegment calculations for us now.
2005-08-24 18:04:45 +00:00
|
|
|
}
|
2006-08-10 08:56:22 +00:00
|
|
|
case GST_QUERY_SEEKING:
|
|
|
|
{
|
|
|
|
GstFormat format;
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_parse_seeking (query, &format, NULL, NULL, NULL);
|
2006-08-10 08:56:22 +00:00
|
|
|
if (format == GST_FORMAT_TIME) {
|
2010-06-09 15:02:59 +00:00
|
|
|
gboolean seekable = FALSE;
|
|
|
|
gint64 stop = -1;
|
|
|
|
|
2012-05-13 22:11:20 +00:00
|
|
|
GST_CHAIN_LOCK (ogg);
|
2010-06-09 15:02:59 +00:00
|
|
|
if (ogg->pullmode) {
|
|
|
|
seekable = TRUE;
|
|
|
|
stop = ogg->total_time;
|
2011-12-16 15:27:24 +00:00
|
|
|
} else if (ogg->push_disable_seeking) {
|
|
|
|
seekable = FALSE;
|
2012-05-13 22:11:20 +00:00
|
|
|
} else if (ogg->current_chain == NULL) {
|
|
|
|
GstQuery *squery;
|
|
|
|
|
|
|
|
/* assume we can seek if upstream is seekable in BYTES format */
|
|
|
|
GST_LOG_OBJECT (ogg, "no current chain, check upstream seekability");
|
|
|
|
squery = gst_query_new_seeking (GST_FORMAT_BYTES);
|
|
|
|
if (gst_pad_peer_query (ogg->sinkpad, squery))
|
|
|
|
gst_query_parse_seeking (squery, NULL, &seekable, NULL, NULL);
|
|
|
|
else
|
|
|
|
seekable = FALSE;
|
|
|
|
gst_query_unref (squery);
|
2010-06-09 15:02:59 +00:00
|
|
|
} else if (ogg->current_chain->streams->len) {
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
seekable = FALSE;
|
|
|
|
for (i = 0; i < ogg->current_chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad =
|
|
|
|
g_array_index (ogg->current_chain->streams, GstOggPad *, i);
|
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
seekable = TRUE;
|
2010-06-09 15:02:59 +00:00
|
|
|
if (pad->map.index != NULL && pad->map.n_index != 0) {
|
|
|
|
GstOggIndex *idx;
|
|
|
|
GstClockTime idx_time;
|
|
|
|
|
|
|
|
idx = &pad->map.index[pad->map.n_index - 1];
|
|
|
|
idx_time =
|
|
|
|
gst_util_uint64_scale (idx->timestamp, GST_SECOND,
|
|
|
|
pad->map.kp_denom);
|
|
|
|
if (stop == -1)
|
|
|
|
stop = idx_time;
|
|
|
|
else
|
|
|
|
stop = MAX (idx_time, stop);
|
2011-08-13 13:18:56 +00:00
|
|
|
} else {
|
|
|
|
stop = -1; /* we've no clue, sadly, without seeking */
|
2010-06-09 15:02:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_seeking (query, GST_FORMAT_TIME, seekable, 0, stop);
|
2012-05-13 22:11:20 +00:00
|
|
|
GST_CHAIN_UNLOCK (ogg);
|
2006-08-10 08:56:22 +00:00
|
|
|
} else {
|
|
|
|
res = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2013-07-29 08:46:01 +00:00
|
|
|
case GST_QUERY_SEGMENT:{
|
|
|
|
GstFormat format;
|
|
|
|
gint64 start, stop;
|
|
|
|
|
|
|
|
format = ogg->segment.format;
|
|
|
|
|
|
|
|
start =
|
|
|
|
gst_segment_to_stream_time (&ogg->segment, format,
|
|
|
|
ogg->segment.start);
|
|
|
|
if ((stop = ogg->segment.stop) == -1)
|
|
|
|
stop = ogg->segment.duration;
|
|
|
|
else
|
|
|
|
stop = gst_segment_to_stream_time (&ogg->segment, format, stop);
|
|
|
|
|
|
|
|
gst_query_set_segment (query, ogg->segment.rate, format, start, stop);
|
|
|
|
res = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2003-11-24 04:08:48 +00:00
|
|
|
default:
|
2011-11-16 16:25:17 +00:00
|
|
|
res = gst_pad_query_default (pad, parent, query);
|
2003-11-24 04:08:48 +00:00
|
|
|
break;
|
|
|
|
}
|
ext/ogg/gstoggdemux.c: Parse seeking events better.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_pad_event), (gst_ogg_demux_factory_filter),
(gst_ogg_pad_submit_packet), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
Parse seeking events better.
Unref static caps.
Generate correct newsegment events, fixes seeking in live oggs.
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_dec_src_event), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_dec_push), (theora_dec_chain):
Use newsegment values to report correct play time.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event):
* ext/vorbis/vorbisdec.h:
Parse and use newsegment values to report correct play time.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Clear ringbuffer on flush.
Use newsegment values to calculate playback time.
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Basesink does newsegment calculations for us now.
2005-08-24 18:04:45 +00:00
|
|
|
done:
|
2006-04-10 19:13:30 +00:00
|
|
|
|
2003-11-24 04:08:48 +00:00
|
|
|
return res;
|
2006-04-10 19:13:30 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
wrong_format:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ogg, "only query duration on TIME is supported");
|
|
|
|
res = FALSE;
|
|
|
|
goto done;
|
|
|
|
}
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
|
|
|
|
2005-11-15 18:11:17 +00:00
|
|
|
static gboolean
|
|
|
|
gst_ogg_demux_receive_event (GstElement * element, GstEvent * event)
|
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
GstOggDemux *ogg;
|
|
|
|
|
|
|
|
ogg = GST_OGG_DEMUX (element);
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_SEEK:
|
|
|
|
/* now do the seek */
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
res = gst_ogg_demux_perform_seek (ogg, event);
|
2006-04-10 19:13:30 +00:00
|
|
|
gst_event_unref (event);
|
2005-11-15 18:11:17 +00:00
|
|
|
break;
|
|
|
|
default:
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "We only handle seek events here");
|
2005-11-15 18:11:17 +00:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
/* ERRORS */
|
2005-11-15 18:11:17 +00:00
|
|
|
error:
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ogg, "error handling event");
|
|
|
|
gst_event_unref (event);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-11-15 18:11:17 +00:00
|
|
|
}
|
|
|
|
|
2003-11-24 04:08:48 +00:00
|
|
|
static gboolean
|
2011-11-17 11:48:25 +00:00
|
|
|
gst_ogg_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
2003-11-24 04:08:48 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
gboolean res;
|
2003-11-24 04:08:48 +00:00
|
|
|
GstOggDemux *ogg;
|
|
|
|
|
2011-11-17 11:48:25 +00:00
|
|
|
ogg = GST_OGG_DEMUX (parent);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2003-11-24 04:08:48 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_SEEK:
|
2005-03-31 09:43:49 +00:00
|
|
|
/* now do the seek */
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
res = gst_ogg_demux_perform_seek (ogg, event);
|
2006-04-10 19:13:30 +00:00
|
|
|
gst_event_unref (event);
|
2005-03-31 09:43:49 +00:00
|
|
|
break;
|
2013-04-04 16:18:54 +00:00
|
|
|
case GST_EVENT_RECONFIGURE:
|
|
|
|
GST_OGG_PAD (pad)->last_ret = GST_FLOW_OK;
|
|
|
|
res = gst_pad_event_default (pad, parent, event);
|
|
|
|
break;
|
2003-11-24 04:08:48 +00:00
|
|
|
default:
|
2011-11-17 11:48:25 +00:00
|
|
|
res = gst_pad_event_default (pad, parent, event);
|
2005-03-31 09:43:49 +00:00
|
|
|
break;
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
2006-04-10 19:13:30 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
return res;
|
ext/: More seeking fixes, oggdemux now supports seeking to time and uses the downstream element to convert granulepos...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_init),
(gst_ogg_demux_get_formats), (gst_ogg_demux_src_query),
(gst_ogg_demux_src_event), (gst_ogg_demux_src_convert),
(gst_ogg_demux_handle_event), (gst_ogg_demux_seek_before),
(_find_chain_get_unknown_part), (_find_streams_check),
(gst_ogg_demux_push), (gst_ogg_pad_push):
* ext/theora/theoradec.c: (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_get_formats),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_event):
More seeking fixes, oggdemux now supports seeking to time and
uses the downstream element to convert granulepos to time.
Seeking in theora-only ogg files now works.
2004-07-21 16:48:20 +00:00
|
|
|
}
|
|
|
|
|
2004-01-29 02:50:20 +00:00
|
|
|
static void
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_ogg_pad_reset (GstOggPad * pad)
|
2004-01-29 02:50:20 +00:00
|
|
|
{
|
2009-08-29 17:51:48 +00:00
|
|
|
ogg_stream_reset (&pad->map.stream);
|
2006-11-24 15:40:58 +00:00
|
|
|
|
2008-04-03 10:19:43 +00:00
|
|
|
GST_DEBUG_OBJECT (pad, "doing reset");
|
|
|
|
|
2006-11-24 15:40:58 +00:00
|
|
|
/* clear continued pages */
|
|
|
|
g_list_foreach (pad->continued, (GFunc) gst_ogg_page_free, NULL);
|
|
|
|
g_list_free (pad->continued);
|
|
|
|
pad->continued = NULL;
|
|
|
|
|
|
|
|
pad->last_ret = GST_FLOW_OK;
|
2011-05-16 11:48:11 +00:00
|
|
|
pad->position = GST_CLOCK_TIME_NONE;
|
2009-11-25 08:46:55 +00:00
|
|
|
pad->current_granule = -1;
|
2009-12-07 14:42:05 +00:00
|
|
|
pad->keyframe_granule = -1;
|
2010-04-02 14:37:21 +00:00
|
|
|
pad->is_eos = FALSE;
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|
|
|
|
|
2007-01-09 12:30:46 +00:00
|
|
|
/* queue data, basically takes the packet, puts it in a buffer and store the
|
2010-01-08 15:57:40 +00:00
|
|
|
* buffer in the queued list. */
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_ogg_demux_queue_data (GstOggPad * pad, ogg_packet * packet)
|
|
|
|
{
|
2006-02-03 17:45:44 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
GstOggDemux *ogg = pad->ogg;
|
2006-02-03 17:45:44 +00:00
|
|
|
#endif
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
2011-08-18 15:20:57 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "%p queueing data serial %08x",
|
2011-08-17 17:03:16 +00:00
|
|
|
pad, pad->map.serialno);
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
2010-01-23 13:46:19 +00:00
|
|
|
pad->map.queued = g_list_append (pad->map.queued, _ogg_packet_copy (packet));
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
|
|
|
/* we are ok now */
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2010-01-25 13:00:52 +00:00
|
|
|
gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet,
|
|
|
|
gboolean push_headers)
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
{
|
2010-02-02 09:18:05 +00:00
|
|
|
GstBuffer *buf = NULL;
|
2006-06-15 15:27:49 +00:00
|
|
|
GstFlowReturn ret, cret;
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
GstOggDemux *ogg = pad->ogg;
|
2006-04-11 14:42:33 +00:00
|
|
|
gint64 current_time;
|
|
|
|
GstOggChain *chain;
|
2009-11-21 21:05:34 +00:00
|
|
|
gint64 duration;
|
2009-12-04 15:35:09 +00:00
|
|
|
gint offset;
|
2010-01-24 07:57:13 +00:00
|
|
|
gint trim;
|
2009-12-04 15:35:09 +00:00
|
|
|
GstClockTime out_timestamp, out_duration;
|
|
|
|
guint64 out_offset, out_offset_end;
|
2010-01-23 21:09:45 +00:00
|
|
|
gboolean delta_unit = FALSE;
|
2012-08-11 09:18:37 +00:00
|
|
|
gboolean is_header;
|
2006-04-11 14:42:33 +00:00
|
|
|
|
2010-12-28 18:39:18 +00:00
|
|
|
cret = GST_FLOW_OK;
|
|
|
|
|
2011-10-24 10:46:05 +00:00
|
|
|
GST_DEBUG_OBJECT (pad, "Chaining %d %d %" GST_TIME_FORMAT " %d %p",
|
|
|
|
ogg->pullmode, ogg->push_state, GST_TIME_ARGS (ogg->push_time_length),
|
|
|
|
ogg->push_disable_seeking, ogg->building_chain);
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_PUSH_LOCK (ogg);
|
|
|
|
if (!ogg->pullmode && ogg->push_state == PUSH_PLAYING
|
|
|
|
&& ogg->push_time_length == GST_CLOCK_TIME_NONE
|
|
|
|
&& !ogg->push_disable_seeking) {
|
|
|
|
if (!ogg->building_chain) {
|
|
|
|
/* we got all headers, now try to get duration */
|
|
|
|
if (!gst_ogg_demux_check_duration_push (ogg, GST_SEEK_FLAG_FLUSH, NULL)) {
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
|
2006-04-11 14:42:33 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg,
|
2011-08-18 15:20:57 +00:00
|
|
|
"%p streaming to peer serial %08x", pad, pad->map.serialno);
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
2009-12-04 04:05:29 +00:00
|
|
|
if (pad->map.is_ogm) {
|
|
|
|
const guint8 *data;
|
2009-12-04 15:35:09 +00:00
|
|
|
long bytes;
|
2009-12-04 04:05:29 +00:00
|
|
|
|
|
|
|
data = packet->packet;
|
2009-12-04 15:35:09 +00:00
|
|
|
bytes = packet->bytes;
|
|
|
|
|
|
|
|
if (bytes < 1)
|
|
|
|
goto empty_packet;
|
2009-12-04 04:05:29 +00:00
|
|
|
|
2010-09-14 20:08:51 +00:00
|
|
|
if ((data[0] & 1) || (data[0] & 3 && pad->map.is_ogm_text)) {
|
2009-12-04 04:05:29 +00:00
|
|
|
/* We don't push header packets for OGM */
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
offset = 1 + (((data[0] & 0xc0) >> 6) | ((data[0] & 0x02) << 1));
|
2010-01-23 21:09:45 +00:00
|
|
|
delta_unit = (((data[0] & 0x08) >> 3) == 0);
|
2010-01-24 07:57:13 +00:00
|
|
|
|
|
|
|
trim = 0;
|
|
|
|
|
|
|
|
/* Strip trailing \0 for subtitles */
|
|
|
|
if (pad->map.is_ogm_text) {
|
|
|
|
while (bytes && data[bytes - 1] == 0) {
|
|
|
|
trim++;
|
|
|
|
bytes--;
|
|
|
|
}
|
|
|
|
}
|
2010-05-05 11:59:57 +00:00
|
|
|
} else if (pad->map.is_vp8) {
|
2010-09-14 20:08:51 +00:00
|
|
|
if ((packet->bytes >= 7 && memcmp (packet->packet, "OVP80\2 ", 7) == 0) ||
|
|
|
|
packet->b_o_s ||
|
|
|
|
(packet->bytes >= 5 && memcmp (packet->packet, "OVP80", 5) == 0)) {
|
2010-05-05 11:59:57 +00:00
|
|
|
/* We don't push header packets for VP8 */
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
offset = 0;
|
|
|
|
trim = 0;
|
2013-03-31 16:54:46 +00:00
|
|
|
delta_unit = !gst_ogg_stream_packet_is_key_frame (&pad->map, packet);
|
2009-12-04 04:05:29 +00:00
|
|
|
} else {
|
|
|
|
offset = 0;
|
2010-01-24 07:57:13 +00:00
|
|
|
trim = 0;
|
2013-03-31 16:54:46 +00:00
|
|
|
delta_unit = !gst_ogg_stream_packet_is_key_frame (&pad->map, packet);
|
2009-12-04 04:05:29 +00:00
|
|
|
}
|
|
|
|
|
2009-12-04 15:35:09 +00:00
|
|
|
/* get timing info for the packet */
|
2012-08-11 09:18:37 +00:00
|
|
|
is_header = gst_ogg_stream_packet_is_header (&pad->map, packet);
|
|
|
|
if (is_header) {
|
2011-08-23 09:32:36 +00:00
|
|
|
duration = 0;
|
|
|
|
GST_DEBUG_OBJECT (ogg, "packet is header");
|
|
|
|
} else {
|
|
|
|
duration = gst_ogg_stream_get_packet_duration (&pad->map, packet);
|
|
|
|
GST_DEBUG_OBJECT (ogg, "packet duration %" G_GUINT64_FORMAT, duration);
|
|
|
|
}
|
2009-12-04 12:14:57 +00:00
|
|
|
|
2009-11-25 05:22:03 +00:00
|
|
|
if (packet->b_o_s) {
|
2009-12-04 15:35:09 +00:00
|
|
|
out_timestamp = GST_CLOCK_TIME_NONE;
|
|
|
|
out_duration = GST_CLOCK_TIME_NONE;
|
|
|
|
out_offset = 0;
|
|
|
|
out_offset_end = -1;
|
2009-11-25 05:22:03 +00:00
|
|
|
} else {
|
|
|
|
if (packet->granulepos != -1) {
|
2012-06-06 10:01:13 +00:00
|
|
|
gint64 granule = gst_ogg_stream_granulepos_to_granule (&pad->map,
|
2009-11-25 06:08:09 +00:00
|
|
|
packet->granulepos);
|
2012-06-06 10:01:13 +00:00
|
|
|
if (granule < 0) {
|
|
|
|
GST_ERROR_OBJECT (ogg,
|
|
|
|
"granulepos %" G_GINT64_FORMAT " yielded granule %" G_GINT64_FORMAT,
|
2012-08-08 13:07:49 +00:00
|
|
|
(gint64) packet->granulepos, (gint64) granule);
|
2012-06-06 10:01:13 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
pad->current_granule = granule;
|
2009-11-25 06:08:09 +00:00
|
|
|
pad->keyframe_granule =
|
|
|
|
gst_ogg_stream_granulepos_to_key_granule (&pad->map,
|
2009-11-25 05:22:03 +00:00
|
|
|
packet->granulepos);
|
2009-12-04 15:35:09 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "new granule %" G_GUINT64_FORMAT,
|
|
|
|
pad->current_granule);
|
2009-12-07 17:49:43 +00:00
|
|
|
} else if (ogg->segment.rate > 0.0 && pad->current_granule != -1) {
|
2009-12-04 15:35:09 +00:00
|
|
|
pad->current_granule += duration;
|
2013-03-31 16:54:46 +00:00
|
|
|
if (!delta_unit) {
|
2012-02-01 15:28:45 +00:00
|
|
|
pad->keyframe_granule = pad->current_granule;
|
|
|
|
}
|
2011-09-13 19:10:43 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "interpolating granule %" G_GUINT64_FORMAT,
|
2009-12-04 15:35:09 +00:00
|
|
|
pad->current_granule);
|
2009-11-25 05:22:03 +00:00
|
|
|
}
|
2009-12-07 17:49:43 +00:00
|
|
|
if (ogg->segment.rate < 0.0 && packet->granulepos == -1) {
|
|
|
|
/* negative rates, only set timestamp on the packets with a granulepos */
|
|
|
|
out_timestamp = -1;
|
|
|
|
out_duration = -1;
|
|
|
|
out_offset = -1;
|
|
|
|
out_offset_end = -1;
|
2009-12-04 04:05:29 +00:00
|
|
|
} else {
|
2009-12-07 17:49:43 +00:00
|
|
|
/* we only push buffers after we have a valid granule. This is done so that
|
|
|
|
* we nicely skip packets without a timestamp after a seek. This is ok
|
|
|
|
* because we base or seek on the packet after the page with the smaller
|
|
|
|
* timestamp. */
|
|
|
|
if (pad->current_granule == -1)
|
|
|
|
goto no_timestamp;
|
|
|
|
|
|
|
|
if (pad->map.is_ogm) {
|
|
|
|
out_timestamp = gst_ogg_stream_granule_to_time (&pad->map,
|
|
|
|
pad->current_granule);
|
|
|
|
out_duration = gst_util_uint64_scale (duration,
|
|
|
|
GST_SECOND * pad->map.granulerate_d, pad->map.granulerate_n);
|
2010-10-10 22:17:31 +00:00
|
|
|
} else if (pad->map.is_sparse) {
|
2010-01-24 14:41:44 +00:00
|
|
|
out_timestamp = gst_ogg_stream_granule_to_time (&pad->map,
|
|
|
|
pad->current_granule);
|
2010-12-17 14:16:18 +00:00
|
|
|
if (duration == GST_CLOCK_TIME_NONE) {
|
|
|
|
out_duration = GST_CLOCK_TIME_NONE;
|
|
|
|
} else {
|
|
|
|
out_duration = gst_util_uint64_scale (duration,
|
|
|
|
GST_SECOND * pad->map.granulerate_d, pad->map.granulerate_n);
|
|
|
|
}
|
2009-12-07 17:49:43 +00:00
|
|
|
} else {
|
|
|
|
out_timestamp = gst_ogg_stream_granule_to_time (&pad->map,
|
|
|
|
pad->current_granule - duration);
|
|
|
|
out_duration =
|
|
|
|
gst_ogg_stream_granule_to_time (&pad->map,
|
|
|
|
pad->current_granule) - out_timestamp;
|
|
|
|
}
|
|
|
|
out_offset_end =
|
2010-05-05 11:59:57 +00:00
|
|
|
gst_ogg_stream_granule_to_granulepos (&pad->map,
|
|
|
|
pad->current_granule, pad->keyframe_granule);
|
2009-12-07 17:49:43 +00:00
|
|
|
out_offset =
|
|
|
|
gst_ogg_stream_granule_to_time (&pad->map, pad->current_granule);
|
2009-12-04 04:05:29 +00:00
|
|
|
}
|
2009-11-25 05:22:03 +00:00
|
|
|
}
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
2010-03-14 20:11:53 +00:00
|
|
|
if (pad->map.is_ogm_text) {
|
|
|
|
/* check for invalid buffer sizes */
|
|
|
|
if (G_UNLIKELY (offset + trim >= packet->bytes))
|
|
|
|
goto empty_packet;
|
|
|
|
}
|
2009-12-04 15:35:09 +00:00
|
|
|
|
2010-12-28 18:39:18 +00:00
|
|
|
if (!pad->added)
|
|
|
|
goto not_added;
|
2009-12-04 15:35:09 +00:00
|
|
|
|
2010-12-22 19:06:56 +00:00
|
|
|
buf = gst_buffer_new_and_alloc (packet->bytes - offset - trim);
|
2009-12-04 15:35:09 +00:00
|
|
|
|
2010-01-23 21:09:45 +00:00
|
|
|
/* set delta flag for OGM content */
|
|
|
|
if (delta_unit)
|
|
|
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
|
|
|
|
|
2012-08-11 09:18:37 +00:00
|
|
|
/* set header flag for buffers that are also in the streamheaders */
|
|
|
|
if (is_header)
|
|
|
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_HEADER);
|
|
|
|
|
2012-07-24 12:36:58 +00:00
|
|
|
if (packet->packet != NULL) {
|
|
|
|
/* copy packet in buffer */
|
|
|
|
gst_buffer_fill (buf, 0, packet->packet + offset,
|
|
|
|
packet->bytes - offset - trim);
|
|
|
|
}
|
2009-12-04 15:35:09 +00:00
|
|
|
|
|
|
|
GST_BUFFER_TIMESTAMP (buf) = out_timestamp;
|
|
|
|
GST_BUFFER_DURATION (buf) = out_duration;
|
|
|
|
GST_BUFFER_OFFSET (buf) = out_offset;
|
|
|
|
GST_BUFFER_OFFSET_END (buf) = out_offset_end;
|
|
|
|
|
ext/ogg/gstoggdemux.c: Mark buffers with DISCONT after seek and after activating new chains.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_chain_peer),
(gst_ogg_chain_mark_discont), (gst_ogg_chain_new_stream),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek):
Mark buffers with DISCONT after seek and after activating new
chains.
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_get_query_types), (theora_dec_sink_event),
(theora_dec_push), (theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Fix frame counter.
Detect and mark DISCONT buffers.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_dec_push), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Use GstSegment.
Detect and mark DISCONT buffers.
Don't crash on 0 sized buffers.
2006-05-03 15:34:48 +00:00
|
|
|
/* Mark discont on the buffer */
|
|
|
|
if (pad->discont) {
|
|
|
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
|
|
|
|
pad->discont = FALSE;
|
|
|
|
}
|
|
|
|
|
2011-05-16 11:48:11 +00:00
|
|
|
pad->position = ogg->segment.position;
|
2009-09-10 08:00:16 +00:00
|
|
|
|
2010-01-25 13:00:52 +00:00
|
|
|
/* don't push the header packets when we are asked to skip them */
|
|
|
|
if (!packet->b_o_s || push_headers) {
|
2013-04-04 16:18:54 +00:00
|
|
|
if (pad->last_ret == GST_FLOW_OK) {
|
|
|
|
ret = gst_pad_push (GST_PAD_CAST (pad), buf);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "not pushing buffer on error pad");
|
|
|
|
ret = pad->last_ret;
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
2010-02-02 09:18:05 +00:00
|
|
|
buf = NULL;
|
2006-06-15 15:27:49 +00:00
|
|
|
|
2010-01-25 13:00:52 +00:00
|
|
|
/* combine flows */
|
|
|
|
cret = gst_ogg_demux_combine_flows (ogg, pad, ret);
|
|
|
|
}
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
2006-04-11 14:42:33 +00:00
|
|
|
/* we're done with skeleton stuff */
|
2009-08-29 17:51:48 +00:00
|
|
|
if (pad->map.is_skeleton)
|
2006-04-11 14:42:33 +00:00
|
|
|
goto done;
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
|
2006-04-11 14:42:33 +00:00
|
|
|
/* check if valid granulepos, then we can calculate the current
|
2009-12-04 14:39:59 +00:00
|
|
|
* position. We know the granule for each packet but we only want to update
|
2011-05-16 11:48:11 +00:00
|
|
|
* the position when we have a valid granulepos on the packet because else
|
2009-12-04 14:39:59 +00:00
|
|
|
* our time jumps around for the different streams. */
|
2006-04-11 14:42:33 +00:00
|
|
|
if (packet->granulepos < 0)
|
|
|
|
goto done;
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
|
2006-04-11 14:42:33 +00:00
|
|
|
/* convert to time */
|
2009-08-29 17:51:48 +00:00
|
|
|
current_time = gst_ogg_stream_get_end_time_for_granulepos (&pad->map,
|
|
|
|
packet->granulepos);
|
2006-04-11 14:42:33 +00:00
|
|
|
|
|
|
|
/* convert to stream time */
|
2008-07-28 15:34:13 +00:00
|
|
|
if ((chain = pad->chain)) {
|
|
|
|
gint64 chain_start = 0;
|
|
|
|
|
|
|
|
if (chain->segment_start != GST_CLOCK_TIME_NONE)
|
|
|
|
chain_start = chain->segment_start;
|
|
|
|
|
|
|
|
current_time = current_time - chain_start + chain->begin_time;
|
|
|
|
}
|
2006-04-11 14:42:33 +00:00
|
|
|
|
|
|
|
/* and store as the current position */
|
2011-05-16 11:48:11 +00:00
|
|
|
ogg->segment.position = current_time;
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
2006-04-11 14:42:33 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "ogg current time %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (current_time));
|
|
|
|
|
2010-04-02 14:37:21 +00:00
|
|
|
/* check stream eos */
|
2013-09-06 18:36:12 +00:00
|
|
|
if (!delta_unit &&
|
|
|
|
((ogg->segment.rate > 0.0 &&
|
|
|
|
ogg->segment.stop != GST_CLOCK_TIME_NONE &&
|
|
|
|
current_time >= ogg->segment.stop) ||
|
|
|
|
(ogg->segment.rate < 0.0 && current_time <= ogg->segment.start))) {
|
2010-05-04 13:47:29 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "marking pad %p EOS", pad);
|
2010-04-02 14:37:21 +00:00
|
|
|
pad->is_eos = TRUE;
|
2013-09-06 18:36:12 +00:00
|
|
|
|
|
|
|
if (cret == GST_FLOW_OK && gst_ogg_demux_check_eos (ogg)) {
|
|
|
|
cret = GST_FLOW_EOS;
|
|
|
|
}
|
2010-04-02 14:37:21 +00:00
|
|
|
}
|
|
|
|
|
2006-04-11 14:42:33 +00:00
|
|
|
done:
|
2010-02-02 09:18:05 +00:00
|
|
|
if (buf)
|
|
|
|
gst_buffer_unref (buf);
|
2006-06-15 15:27:49 +00:00
|
|
|
/* return combined flow result */
|
|
|
|
return cret;
|
2006-04-11 14:42:33 +00:00
|
|
|
|
|
|
|
/* special cases */
|
2009-12-04 15:35:09 +00:00
|
|
|
empty_packet:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Skipping empty packet");
|
|
|
|
goto done;
|
|
|
|
}
|
2010-05-05 11:59:57 +00:00
|
|
|
|
2009-12-04 15:35:09 +00:00
|
|
|
no_timestamp:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ogg, "skipping packet: no valid granule found yet");
|
|
|
|
goto done;
|
|
|
|
}
|
2010-12-28 18:39:18 +00:00
|
|
|
not_added:
|
2006-04-11 14:42:33 +00:00
|
|
|
{
|
2010-12-28 18:39:18 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "pad not added yet");
|
2006-06-15 15:27:49 +00:00
|
|
|
goto done;
|
2006-04-11 14:42:33 +00:00
|
|
|
}
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
}
|
|
|
|
|
2010-05-04 09:19:39 +00:00
|
|
|
static guint64
|
|
|
|
gst_ogg_demux_collect_start_time (GstOggDemux * ogg, GstOggChain * chain)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
guint64 start_time = G_MAXUINT64;
|
|
|
|
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
|
2011-08-22 13:55:59 +00:00
|
|
|
if (pad->map.is_skeleton)
|
2010-05-04 09:19:39 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
/* can do this if the pad start time is not defined */
|
2011-08-22 13:55:59 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "Pad %08x (%s) start time is %" GST_TIME_FORMAT,
|
|
|
|
pad->map.serialno, gst_ogg_stream_get_media_type (&pad->map),
|
|
|
|
GST_TIME_ARGS (pad->start_time));
|
2010-05-04 09:19:39 +00:00
|
|
|
if (pad->start_time == GST_CLOCK_TIME_NONE) {
|
2011-08-22 13:55:59 +00:00
|
|
|
if (!pad->map.is_sparse) {
|
|
|
|
start_time = G_MAXUINT64;
|
|
|
|
break;
|
|
|
|
}
|
2010-05-04 09:19:39 +00:00
|
|
|
} else {
|
|
|
|
start_time = MIN (start_time, pad->start_time);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return start_time;
|
|
|
|
}
|
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
static GstClockTime
|
|
|
|
gst_ogg_demux_collect_sync_time (GstOggDemux * ogg, GstOggChain * chain)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
GstClockTime sync_time = GST_CLOCK_TIME_NONE;
|
|
|
|
|
|
|
|
if (!chain) {
|
|
|
|
GST_WARNING_OBJECT (ogg, "No chain!");
|
|
|
|
return GST_CLOCK_TIME_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
|
|
|
|
if (pad->map.is_sparse)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (pad->push_sync_time == GST_CLOCK_TIME_NONE) {
|
|
|
|
sync_time = GST_CLOCK_TIME_NONE;
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
if (sync_time == GST_CLOCK_TIME_NONE)
|
|
|
|
sync_time = pad->push_sync_time;
|
|
|
|
else
|
|
|
|
sync_time = MAX (sync_time, pad->push_sync_time);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sync_time;
|
|
|
|
}
|
|
|
|
|
2012-05-12 13:24:24 +00:00
|
|
|
/* submit a packet to the oggpad, this function will run the type detection
|
|
|
|
* code for the pad if this is the first packet for this stream
|
2005-03-31 09:43:49 +00:00
|
|
|
*/
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_ogg_pad_submit_packet (GstOggPad * pad, ogg_packet * packet)
|
2004-07-02 03:41:22 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
gint64 granule;
|
2010-01-12 15:35:50 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
GstOggDemux *ogg = pad->ogg;
|
|
|
|
|
2011-08-18 15:20:57 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "%p submit packet serial %08x",
|
2011-08-17 17:03:16 +00:00
|
|
|
pad, pad->map.serialno);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
if (!pad->have_type) {
|
2009-08-29 17:51:48 +00:00
|
|
|
pad->have_type = gst_ogg_stream_setup_map (&pad->map, packet);
|
2012-03-13 11:40:11 +00:00
|
|
|
if (!pad->have_type && !pad->map.caps) {
|
2011-10-27 15:26:58 +00:00
|
|
|
pad->map.caps = gst_caps_new_empty_simple ("application/x-unknown");
|
2009-11-26 00:53:26 +00:00
|
|
|
}
|
2010-03-01 12:50:32 +00:00
|
|
|
if (pad->map.is_skeleton) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "we have a fishead");
|
|
|
|
/* copy values over to global ogg level */
|
|
|
|
ogg->basetime = pad->map.basetime;
|
|
|
|
ogg->prestime = pad->map.prestime;
|
2010-05-04 11:05:51 +00:00
|
|
|
|
|
|
|
/* use total time to update the total ogg time */
|
|
|
|
if (ogg->total_time == -1) {
|
|
|
|
ogg->total_time = pad->map.total_time;
|
|
|
|
} else if (pad->map.total_time > 0) {
|
|
|
|
ogg->total_time = MAX (ogg->total_time, pad->map.total_time);
|
|
|
|
}
|
2010-03-01 12:50:32 +00:00
|
|
|
}
|
2012-08-04 10:16:44 +00:00
|
|
|
if (!pad->map.caps) {
|
2009-11-26 00:53:26 +00:00
|
|
|
GST_WARNING_OBJECT (ogg, "stream parser didn't create src pad caps");
|
2009-08-29 17:51:48 +00:00
|
|
|
}
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
}
|
|
|
|
|
2010-03-01 12:50:32 +00:00
|
|
|
if (pad->map.is_skeleton) {
|
|
|
|
guint32 serialno;
|
2010-03-02 10:16:39 +00:00
|
|
|
GstOggPad *skel_pad;
|
|
|
|
GstOggSkeleton type;
|
2010-03-01 12:50:32 +00:00
|
|
|
|
|
|
|
/* try to parse the serialno first */
|
|
|
|
if (gst_ogg_map_parse_fisbone (&pad->map, packet->packet, packet->bytes,
|
2010-03-02 10:16:39 +00:00
|
|
|
&serialno, &type)) {
|
|
|
|
|
2011-08-23 09:58:20 +00:00
|
|
|
GST_DEBUG_OBJECT (pad->ogg,
|
2010-05-05 12:25:02 +00:00
|
|
|
"got skeleton packet for stream 0x%08x", serialno);
|
2010-03-02 10:16:39 +00:00
|
|
|
|
|
|
|
skel_pad = gst_ogg_chain_get_stream (pad->chain, serialno);
|
|
|
|
if (skel_pad) {
|
|
|
|
switch (type) {
|
|
|
|
case GST_OGG_SKELETON_FISBONE:
|
2010-05-06 10:21:38 +00:00
|
|
|
/* parse the remainder of the fisbone in the pad with the serialno,
|
|
|
|
* note that we ignore the start_time as this is usually wrong for
|
|
|
|
* live streams */
|
2010-06-08 10:01:15 +00:00
|
|
|
gst_ogg_map_add_fisbone (&skel_pad->map, &pad->map, packet->packet,
|
2010-05-06 10:21:38 +00:00
|
|
|
packet->bytes, NULL);
|
2010-03-02 10:16:39 +00:00
|
|
|
break;
|
|
|
|
case GST_OGG_SKELETON_INDEX:
|
2010-06-08 10:01:15 +00:00
|
|
|
gst_ogg_map_add_index (&skel_pad->map, &pad->map, packet->packet,
|
2010-03-02 10:16:39 +00:00
|
|
|
packet->bytes);
|
2010-06-09 14:38:34 +00:00
|
|
|
|
|
|
|
/* use total time to update the total ogg time */
|
|
|
|
if (ogg->total_time == -1) {
|
|
|
|
ogg->total_time = skel_pad->map.total_time;
|
|
|
|
} else if (skel_pad->map.total_time > 0) {
|
|
|
|
ogg->total_time = MAX (ogg->total_time, skel_pad->map.total_time);
|
|
|
|
}
|
2010-03-02 10:16:39 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-03-01 12:50:32 +00:00
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (pad->ogg,
|
2010-05-05 12:25:02 +00:00
|
|
|
"found skeleton fisbone for an unknown stream 0x%08x", serialno);
|
2010-03-01 12:50:32 +00:00
|
|
|
}
|
|
|
|
}
|
ext/ogg/gstoggdemux.c: Annodex support in ogg demuxer. Doesn't do very much without the other annodex patches (to come).
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_parse_skeleton_fishead),
(gst_ogg_pad_parse_skeleton_fisbone), (gst_ogg_pad_query_convert),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_read_chain),
(gst_ogg_demux_read_end_chain), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_change_state), (gst_annodex_granule_to_time):
Annodex support in ogg demuxer. Doesn't do very much without the
other annodex patches (to come).
2006-02-24 17:31:53 +00:00
|
|
|
}
|
|
|
|
|
2009-11-25 08:46:55 +00:00
|
|
|
granule = gst_ogg_stream_granulepos_to_granule (&pad->map,
|
|
|
|
packet->granulepos);
|
2013-01-07 18:01:31 +00:00
|
|
|
if (granule >= 0) {
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "%p has granulepos %" G_GINT64_FORMAT, pad, granule);
|
2005-03-31 09:43:49 +00:00
|
|
|
pad->current_granule = granule;
|
2012-06-06 10:01:13 +00:00
|
|
|
} else if (granule != -1) {
|
|
|
|
GST_ERROR_OBJECT (ogg,
|
|
|
|
"granulepos %" G_GINT64_FORMAT " yielded granule %" G_GINT64_FORMAT,
|
2012-08-08 13:07:49 +00:00
|
|
|
(gint64) packet->granulepos, (gint64) granule);
|
2012-06-06 10:01:13 +00:00
|
|
|
return GST_FLOW_ERROR;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
2010-01-06 12:56:26 +00:00
|
|
|
/* restart header packet count when seeing a b_o_s page;
|
|
|
|
* particularly useful following a seek or even following chain finding */
|
|
|
|
if (packet->b_o_s) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "b_o_s packet, resetting header packet count");
|
|
|
|
pad->map.n_header_packets_seen = 0;
|
2010-01-08 15:57:40 +00:00
|
|
|
if (!pad->map.have_headers) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "clearing header packets");
|
2010-01-24 13:29:07 +00:00
|
|
|
g_list_foreach (pad->map.headers, (GFunc) _ogg_packet_free, NULL);
|
2010-01-08 15:57:40 +00:00
|
|
|
g_list_free (pad->map.headers);
|
|
|
|
pad->map.headers = NULL;
|
|
|
|
}
|
2010-01-06 12:56:26 +00:00
|
|
|
}
|
|
|
|
|
2009-11-25 05:22:03 +00:00
|
|
|
/* Overload the value of b_o_s in ogg_packet with a flag whether or
|
|
|
|
* not this is a header packet. Maybe some day this could be cleaned
|
|
|
|
* up. */
|
|
|
|
packet->b_o_s = gst_ogg_stream_packet_is_header (&pad->map, packet);
|
|
|
|
if (!packet->b_o_s) {
|
2010-10-29 10:47:53 +00:00
|
|
|
GST_DEBUG ("found non-header packet");
|
2010-01-08 15:57:40 +00:00
|
|
|
pad->map.have_headers = TRUE;
|
2009-08-29 17:51:48 +00:00
|
|
|
if (pad->start_time == GST_CLOCK_TIME_NONE) {
|
|
|
|
gint64 duration = gst_ogg_stream_get_packet_duration (&pad->map, packet);
|
2009-12-04 12:14:57 +00:00
|
|
|
GST_DEBUG ("duration %" G_GINT64_FORMAT, duration);
|
2009-08-29 17:51:48 +00:00
|
|
|
if (duration != -1) {
|
|
|
|
pad->map.accumulated_granule += duration;
|
2009-12-04 12:14:57 +00:00
|
|
|
GST_DEBUG ("accumulated granule %" G_GINT64_FORMAT,
|
|
|
|
pad->map.accumulated_granule);
|
2009-08-29 17:51:48 +00:00
|
|
|
}
|
2006-11-04 07:25:58 +00:00
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
if (packet->granulepos != -1) {
|
|
|
|
ogg_int64_t start_granule;
|
2009-12-04 12:14:57 +00:00
|
|
|
gint64 granule;
|
|
|
|
|
|
|
|
granule = gst_ogg_stream_granulepos_to_granule (&pad->map,
|
|
|
|
packet->granulepos);
|
2012-06-06 10:01:13 +00:00
|
|
|
if (granule < 0) {
|
|
|
|
GST_ERROR_OBJECT (ogg,
|
|
|
|
"granulepos %" G_GINT64_FORMAT " yielded granule %"
|
2012-08-08 13:07:49 +00:00
|
|
|
G_GINT64_FORMAT, (gint64) packet->granulepos, (gint64) granule);
|
2012-06-06 10:01:13 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2009-08-29 17:51:48 +00:00
|
|
|
|
2012-06-06 16:42:36 +00:00
|
|
|
if (granule >= pad->map.accumulated_granule)
|
2009-12-04 12:14:57 +00:00
|
|
|
start_granule = granule - pad->map.accumulated_granule;
|
2012-06-06 16:42:36 +00:00
|
|
|
else {
|
|
|
|
if (pad->map.forbid_start_clamping) {
|
|
|
|
GST_ERROR_OBJECT (ogg, "Start of stream maps to negative time");
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
} else {
|
|
|
|
start_granule = 0;
|
|
|
|
}
|
|
|
|
}
|
2009-08-29 17:51:48 +00:00
|
|
|
|
|
|
|
pad->start_time = gst_ogg_stream_granule_to_time (&pad->map,
|
|
|
|
start_granule);
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg,
|
2011-11-22 13:01:35 +00:00
|
|
|
"start time %" GST_TIME_FORMAT " (%" GST_TIME_FORMAT ") for %s "
|
|
|
|
"from granpos %" G_GINT64_FORMAT " (granule %" G_GINT64_FORMAT ", "
|
|
|
|
"accumulated granule %" G_GINT64_FORMAT,
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_TIME_ARGS (pad->start_time), GST_TIME_ARGS (pad->start_time),
|
2011-11-29 08:11:21 +00:00
|
|
|
gst_ogg_stream_get_media_type (&pad->map),
|
|
|
|
(gint64) packet->granulepos, granule, pad->map.accumulated_granule);
|
2009-11-25 05:22:03 +00:00
|
|
|
} else {
|
|
|
|
packet->granulepos = gst_ogg_stream_granule_to_granulepos (&pad->map,
|
2009-11-25 06:08:09 +00:00
|
|
|
pad->map.accumulated_granule, pad->keyframe_granule);
|
2009-08-29 17:51:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2010-10-27 10:08:25 +00:00
|
|
|
/* look for tags in header packet (before inc header count) */
|
|
|
|
gst_ogg_stream_extract_tags (&pad->map, packet);
|
2009-08-29 17:51:48 +00:00
|
|
|
pad->map.n_header_packets_seen++;
|
2010-01-08 15:57:40 +00:00
|
|
|
if (!pad->map.have_headers) {
|
2010-01-23 13:46:19 +00:00
|
|
|
pad->map.headers =
|
|
|
|
g_list_append (pad->map.headers, _ogg_packet_copy (packet));
|
2010-01-08 15:57:40 +00:00
|
|
|
GST_DEBUG ("keeping header packet %d", pad->map.n_header_packets_seen);
|
|
|
|
}
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
}
|
2009-08-29 17:51:48 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
/* we know the start_time of the pad data, see if we
|
|
|
|
* can activate the complete chain if this is a dynamic
|
2010-05-06 10:06:09 +00:00
|
|
|
* chain. We need all the headers too for this. */
|
|
|
|
if (pad->start_time != GST_CLOCK_TIME_NONE && pad->map.have_headers) {
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
GstOggChain *chain = pad->chain;
|
|
|
|
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
/* check if complete chain has start time */
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
if (chain == ogg->building_chain) {
|
2010-05-04 09:19:39 +00:00
|
|
|
GstEvent *event = NULL;
|
|
|
|
|
|
|
|
if (ogg->resync) {
|
|
|
|
guint64 start_time;
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
|
2010-05-04 09:19:39 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "need to resync");
|
|
|
|
|
|
|
|
/* when we need to resync after a seek, we wait until we have received
|
|
|
|
* timestamps on all streams */
|
|
|
|
start_time = gst_ogg_demux_collect_start_time (ogg, chain);
|
|
|
|
|
|
|
|
if (start_time != G_MAXUINT64) {
|
|
|
|
gint64 segment_time;
|
2011-05-16 11:48:11 +00:00
|
|
|
GstSegment segment;
|
2010-05-04 09:19:39 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg, "start_time: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (start_time));
|
|
|
|
|
|
|
|
if (chain->segment_start < start_time)
|
|
|
|
segment_time =
|
|
|
|
(start_time - chain->segment_start) + chain->begin_time;
|
|
|
|
else
|
|
|
|
segment_time = chain->begin_time;
|
|
|
|
|
|
|
|
/* create the newsegment event we are going to send out */
|
2011-05-16 11:48:11 +00:00
|
|
|
gst_segment_init (&segment, GST_FORMAT_TIME);
|
2011-09-23 16:27:11 +00:00
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_PUSH_LOCK (ogg);
|
|
|
|
if (!ogg->pullmode && ogg->push_state == PUSH_LINEAR2) {
|
|
|
|
/* if we are fast forwarding to the actual seek target,
|
|
|
|
ensure previous frames are clipped */
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Resynced, starting segment at %" GST_TIME_FORMAT
|
|
|
|
", start_time %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (ogg->push_seek_time_original_target),
|
|
|
|
GST_TIME_ARGS (start_time));
|
2011-09-23 16:27:11 +00:00
|
|
|
segment.rate = ogg->push_seek_rate;
|
|
|
|
segment.start = ogg->push_seek_time_original_target;
|
2013-09-06 18:56:39 +00:00
|
|
|
segment.stop = ogg->push_seek_time_original_stop;
|
2011-09-23 16:27:11 +00:00
|
|
|
segment.time = ogg->push_seek_time_original_target;
|
2013-08-22 15:33:45 +00:00
|
|
|
segment.base = ogg->push_seek_time_original_target;
|
2011-09-23 16:27:11 +00:00
|
|
|
event = gst_event_new_segment (&segment);
|
2013-09-06 18:56:39 +00:00
|
|
|
gst_event_set_seqnum (event, ogg->push_seek_seqnum);
|
2011-08-13 13:18:56 +00:00
|
|
|
ogg->push_state = PUSH_PLAYING;
|
|
|
|
} else {
|
2011-09-23 16:27:11 +00:00
|
|
|
segment.rate = ogg->segment.rate;
|
|
|
|
segment.applied_rate = ogg->segment.applied_rate;
|
|
|
|
segment.start = start_time;
|
|
|
|
segment.stop = chain->segment_stop;
|
|
|
|
segment.time = segment_time;
|
2013-08-22 15:33:45 +00:00
|
|
|
segment.base = segment_time;
|
2011-09-23 16:27:11 +00:00
|
|
|
event = gst_event_new_segment (&segment);
|
2011-08-13 13:18:56 +00:00
|
|
|
}
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
2010-05-04 09:19:39 +00:00
|
|
|
|
|
|
|
ogg->resync = FALSE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* see if we have enough info to activate the chain, we have enough info
|
|
|
|
* when all streams have a valid start time. */
|
|
|
|
if (gst_ogg_demux_collect_chain_info (ogg, chain)) {
|
2011-05-16 11:48:11 +00:00
|
|
|
GstSegment segment;
|
2010-05-04 09:19:39 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg, "segment_start: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (chain->segment_start));
|
|
|
|
GST_DEBUG_OBJECT (ogg, "segment_stop: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (chain->segment_stop));
|
|
|
|
GST_DEBUG_OBJECT (ogg, "segment_time: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (chain->begin_time));
|
|
|
|
|
|
|
|
/* create the newsegment event we are going to send out */
|
2011-05-16 11:48:11 +00:00
|
|
|
gst_segment_init (&segment, GST_FORMAT_TIME);
|
|
|
|
segment.rate = ogg->segment.rate;
|
|
|
|
segment.applied_rate = ogg->segment.applied_rate;
|
|
|
|
segment.start = chain->segment_start;
|
|
|
|
segment.stop = chain->segment_stop;
|
|
|
|
segment.time = chain->begin_time;
|
2013-08-22 15:33:45 +00:00
|
|
|
segment.base = chain->begin_time;
|
2011-05-16 11:48:11 +00:00
|
|
|
event = gst_event_new_segment (&segment);
|
2010-05-04 09:19:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (event) {
|
2008-11-04 17:24:35 +00:00
|
|
|
gst_event_set_seqnum (event, ogg->seqnum);
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
gst_ogg_demux_activate_chain (ogg, chain, event);
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
|
|
|
ogg->building_chain = NULL;
|
2005-05-26 12:08:55 +00:00
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
}
|
Cleanups and buffer alloc.
Original commit message from CVS:
* ext/ogg/README:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_clear_chains):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page):
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet):
* gst/audioconvert/bufferframesconvert.c:
(buffer_frames_convert_chain):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_bufferalloc),
(gst_ffmpegcsp_chain):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_getcaps), (gst_videorate_setcaps),
(gst_videorate_event), (gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_activate),
(gst_videotestsrc_src_query), (gst_videotestsrc_loop):
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_alloc):
Cleanups and buffer alloc.
2005-06-02 09:46:40 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
/* if we are building a chain, store buffer for when we activate
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
* it. This path is taken if we operate in streaming mode. */
|
|
|
|
if (ogg->building_chain) {
|
2010-01-25 13:00:52 +00:00
|
|
|
/* bos packets where stored in the header list so we can discard
|
|
|
|
* them here*/
|
2010-01-08 15:57:40 +00:00
|
|
|
if (!packet->b_o_s)
|
|
|
|
ret = gst_ogg_demux_queue_data (pad, packet);
|
2005-07-14 18:13:08 +00:00
|
|
|
}
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
/* else we are completely streaming to the peer */
|
|
|
|
else {
|
2010-01-25 13:00:52 +00:00
|
|
|
ret = gst_ogg_demux_chain_peer (pad, packet, !ogg->pullmode);
|
Cleanups and buffer alloc.
Original commit message from CVS:
* ext/ogg/README:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_clear_chains):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page):
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet):
* gst/audioconvert/bufferframesconvert.c:
(buffer_frames_convert_chain):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_bufferalloc),
(gst_ffmpegcsp_chain):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_getcaps), (gst_videorate_setcaps),
(gst_videorate_event), (gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_activate),
(gst_videotestsrc_src_query), (gst_videotestsrc_loop):
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_alloc):
Cleanups and buffer alloc.
2005-06-02 09:46:40 +00:00
|
|
|
}
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
return ret;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
2006-11-24 15:40:58 +00:00
|
|
|
/* flush at most @npackets from the stream layer. All packets if
|
|
|
|
* @npackets is 0;
|
2005-03-31 09:43:49 +00:00
|
|
|
*/
|
|
|
|
static GstFlowReturn
|
2006-11-24 15:40:58 +00:00
|
|
|
gst_ogg_pad_stream_out (GstOggPad * pad, gint npackets)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
|
|
|
GstFlowReturn result = GST_FLOW_OK;
|
2006-11-24 15:40:58 +00:00
|
|
|
gboolean done = FALSE;
|
2005-03-31 09:43:49 +00:00
|
|
|
GstOggDemux *ogg;
|
|
|
|
|
2006-11-24 15:40:58 +00:00
|
|
|
ogg = pad->ogg;
|
2006-11-23 11:07:23 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
while (!done) {
|
2006-11-24 15:40:58 +00:00
|
|
|
int ret;
|
|
|
|
ogg_packet packet;
|
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
ret = ogg_stream_packetout (&pad->map.stream, &packet);
|
2005-03-31 09:43:49 +00:00
|
|
|
switch (ret) {
|
|
|
|
case 0:
|
2006-11-23 11:07:23 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "packetout done");
|
2005-03-31 09:43:49 +00:00
|
|
|
done = TRUE;
|
|
|
|
break;
|
|
|
|
case -1:
|
2006-11-23 11:07:23 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "packetout discont");
|
2011-08-13 13:14:19 +00:00
|
|
|
if (!pad->map.is_sparse) {
|
|
|
|
gst_ogg_chain_mark_discont (pad->chain);
|
|
|
|
} else {
|
|
|
|
gst_ogg_pad_mark_discont (pad);
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2007-01-05 19:43:55 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "packetout gave packet of size %ld", packet.bytes);
|
2011-10-22 19:20:38 +00:00
|
|
|
if (packet.bytes > ogg->max_packet_size)
|
|
|
|
ogg->max_packet_size = packet.bytes;
|
2005-03-31 09:43:49 +00:00
|
|
|
result = gst_ogg_pad_submit_packet (pad, &packet);
|
2010-10-29 10:48:18 +00:00
|
|
|
/* not linked is not a problem, it's possible that we are still
|
|
|
|
* collecting headers and that we don't have exposed the pads yet */
|
2010-08-30 13:50:26 +00:00
|
|
|
if (result == GST_FLOW_NOT_LINKED)
|
2010-10-29 10:48:18 +00:00
|
|
|
break;
|
2011-10-10 09:39:52 +00:00
|
|
|
else if (result <= GST_FLOW_EOS)
|
2005-07-14 18:13:08 +00:00
|
|
|
goto could_not_submit;
|
2005-03-31 09:43:49 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_WARNING_OBJECT (ogg,
|
|
|
|
"invalid return value %d for ogg_stream_packetout, resetting stream",
|
|
|
|
ret);
|
|
|
|
gst_ogg_pad_reset (pad);
|
|
|
|
break;
|
|
|
|
}
|
2006-11-24 15:40:58 +00:00
|
|
|
if (npackets > 0) {
|
|
|
|
npackets--;
|
|
|
|
done = (npackets == 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
could_not_submit:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (ogg,
|
2011-08-18 15:20:57 +00:00
|
|
|
"could not submit packet for stream %08x, "
|
|
|
|
"error: %d", pad->map.serialno, result);
|
2006-11-24 15:40:58 +00:00
|
|
|
gst_ogg_pad_reset (pad);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_demux_setup_bisection_bounds (GstOggDemux * ogg)
|
|
|
|
{
|
|
|
|
if (ogg->push_last_seek_time >= ogg->push_seek_time_target) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "We overshot by %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (ogg->push_last_seek_time - ogg->push_seek_time_target));
|
|
|
|
ogg->push_offset1 = ogg->push_last_seek_offset;
|
|
|
|
ogg->push_time1 = ogg->push_last_seek_time;
|
2011-10-22 19:20:38 +00:00
|
|
|
ogg->seek_undershot = FALSE;
|
2011-08-13 13:18:56 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "We undershot by %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (ogg->push_seek_time_target - ogg->push_last_seek_time));
|
|
|
|
ogg->push_offset0 = ogg->push_last_seek_offset;
|
|
|
|
ogg->push_time0 = ogg->push_last_seek_time;
|
2011-10-22 19:20:38 +00:00
|
|
|
ogg->seek_undershot = TRUE;
|
2011-08-13 13:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint64
|
2011-10-22 19:20:38 +00:00
|
|
|
gst_ogg_demux_estimate_bisection_target (GstOggDemux * ogg, float seek_quality)
|
2011-08-13 13:18:56 +00:00
|
|
|
{
|
|
|
|
gint64 best;
|
|
|
|
gint64 segment_bitrate;
|
2011-10-22 19:20:38 +00:00
|
|
|
gint64 skew;
|
2011-08-13 13:18:56 +00:00
|
|
|
|
|
|
|
/* we might not know the length of the stream in time,
|
|
|
|
so push_time1 might not be set */
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"push time 1: %" GST_TIME_FORMAT ", dbytes %" G_GINT64_FORMAT,
|
|
|
|
GST_TIME_ARGS (ogg->push_time1), ogg->push_offset1 - ogg->push_offset0);
|
|
|
|
if (ogg->push_time1 == GST_CLOCK_TIME_NONE) {
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"New segment to consider: bytes %" G_GINT64_FORMAT " %" G_GINT64_FORMAT
|
|
|
|
", time %" GST_TIME_FORMAT " (open ended)", ogg->push_offset0,
|
|
|
|
ogg->push_offset1, GST_TIME_ARGS (ogg->push_time0));
|
|
|
|
if (ogg->push_last_seek_time == ogg->push_start_time) {
|
|
|
|
/* if we're at start and don't know the end time, we can't estimate
|
|
|
|
bitrate, so get the nominal declared bitrate as a failsafe, or some
|
|
|
|
random constant which will be discarded after we made a (probably
|
|
|
|
dire) first guess */
|
|
|
|
segment_bitrate = (ogg->bitrate > 0 ? ogg->bitrate : 1000);
|
|
|
|
} else {
|
|
|
|
segment_bitrate =
|
|
|
|
gst_util_uint64_scale (ogg->push_last_seek_offset - 0,
|
|
|
|
8 * GST_SECOND, ogg->push_last_seek_time - ogg->push_start_time);
|
|
|
|
}
|
|
|
|
best =
|
|
|
|
ogg->push_offset0 +
|
|
|
|
gst_util_uint64_scale (ogg->push_seek_time_target - ogg->push_time0,
|
|
|
|
segment_bitrate, 8 * GST_SECOND);
|
2011-10-22 19:20:38 +00:00
|
|
|
ogg->seek_secant = TRUE;
|
2011-08-13 13:18:56 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"New segment to consider: bytes %" G_GINT64_FORMAT " %" G_GINT64_FORMAT
|
|
|
|
", time %" GST_TIME_FORMAT " %" GST_TIME_FORMAT, ogg->push_offset0,
|
|
|
|
ogg->push_offset1, GST_TIME_ARGS (ogg->push_time0),
|
|
|
|
GST_TIME_ARGS (ogg->push_time1));
|
|
|
|
if (ogg->push_time0 == ogg->push_time1) {
|
|
|
|
best = ogg->push_offset0;
|
|
|
|
} else {
|
|
|
|
segment_bitrate =
|
|
|
|
gst_util_uint64_scale (ogg->push_offset1 - ogg->push_offset0,
|
|
|
|
8 * GST_SECOND, ogg->push_time1 - ogg->push_time0);
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Local bitrate on the %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT
|
|
|
|
" segment: %" G_GINT64_FORMAT, GST_TIME_ARGS (ogg->push_time0),
|
2011-09-16 19:11:56 +00:00
|
|
|
GST_TIME_ARGS (ogg->push_time1), segment_bitrate);
|
2011-10-22 19:20:38 +00:00
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
best =
|
|
|
|
ogg->push_offset0 +
|
|
|
|
gst_util_uint64_scale (ogg->push_seek_time_target - ogg->push_time0,
|
|
|
|
segment_bitrate, 8 * GST_SECOND);
|
2011-10-22 19:20:38 +00:00
|
|
|
if (seek_quality < 0.5f && ogg->seek_secant) {
|
|
|
|
gint64 new_best, best2 = (ogg->push_offset0 + ogg->push_offset1) / 2;
|
|
|
|
/* if dire result, give as much as 25% weight to a dumb bisection guess */
|
|
|
|
float secant_weight = 1.0f - ((0.5 - seek_quality) / 0.5f) * 0.25;
|
|
|
|
new_best = (best * secant_weight + best2 * (1.0f - secant_weight));
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Secant says %" G_GINT64_FORMAT ", straight is %" G_GINT64_FORMAT
|
|
|
|
", new best %" G_GINT64_FORMAT " with secant_weight %f", best,
|
|
|
|
best2, new_best, secant_weight);
|
|
|
|
best = new_best;
|
|
|
|
ogg->seek_secant = FALSE;
|
|
|
|
} else {
|
|
|
|
ogg->seek_secant = TRUE;
|
|
|
|
}
|
2011-08-13 13:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-22 19:20:38 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "Raw best guess: %" G_GINT64_FORMAT, best);
|
|
|
|
|
|
|
|
/* offset the guess down as we need to capture the start of the
|
|
|
|
page we are targetting - but only do so if we did not undershoot
|
|
|
|
last time, as we're likely to still do this time */
|
|
|
|
if (!ogg->seek_undershot) {
|
|
|
|
/* very small packets are packed on pages, so offset by at least
|
|
|
|
a value which is likely to get us at least one page where the
|
|
|
|
packet starts */
|
|
|
|
skew =
|
|
|
|
ogg->max_packet_size >
|
|
|
|
ogg->max_page_size ? ogg->max_packet_size : ogg->max_page_size;
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Offsetting by %" G_GINT64_FORMAT, skew);
|
|
|
|
best -= skew;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* do not seek too close to the bounds, as we stop seeking
|
|
|
|
when we get to within max_packet_size before the target */
|
|
|
|
if (best > ogg->push_offset1 - ogg->max_packet_size) {
|
|
|
|
best = ogg->push_offset1 - ogg->max_packet_size;
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Too close to high bound, pushing back to %" G_GINT64_FORMAT, best);
|
|
|
|
} else if (best < ogg->push_offset0 + ogg->max_packet_size) {
|
|
|
|
best = ogg->push_offset0 + ogg->max_packet_size;
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Too close to low bound, pushing forth to %" G_GINT64_FORMAT, best);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* keep within bounds */
|
|
|
|
if (best > ogg->push_offset1)
|
|
|
|
best = ogg->push_offset1;
|
2011-08-13 13:18:56 +00:00
|
|
|
if (best < ogg->push_offset0)
|
|
|
|
best = ogg->push_offset0;
|
|
|
|
|
2011-10-22 19:20:38 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "Choosing target %" G_GINT64_FORMAT, best);
|
2011-08-13 13:18:56 +00:00
|
|
|
return best;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ogg_demux_record_keyframe_time (GstOggDemux * ogg, GstOggPad * pad,
|
|
|
|
ogg_int64_t granpos)
|
|
|
|
{
|
|
|
|
gint64 kf_granule;
|
|
|
|
GstClockTime kf_time;
|
|
|
|
|
|
|
|
kf_granule = gst_ogg_stream_granulepos_to_key_granule (&pad->map, granpos);
|
|
|
|
kf_time = gst_ogg_stream_granule_to_time (&pad->map, kf_granule);
|
|
|
|
|
|
|
|
pad->push_kf_time = kf_time;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* returns the earliest keyframe time for all non sparse pads in the chain,
|
|
|
|
* if known, and GST_CLOCK_TIME_NONE if not */
|
|
|
|
static GstClockTime
|
|
|
|
gst_ogg_demux_get_earliest_keyframe_time (GstOggDemux * ogg)
|
|
|
|
{
|
|
|
|
GstClockTime t = GST_CLOCK_TIME_NONE;
|
|
|
|
GstOggChain *chain = ogg->building_chain;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!chain) {
|
|
|
|
GST_WARNING_OBJECT (ogg, "No chain!");
|
|
|
|
return GST_CLOCK_TIME_NONE;
|
|
|
|
}
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
|
|
|
|
if (pad->map.is_sparse)
|
|
|
|
continue;
|
|
|
|
if (pad->push_kf_time == GST_CLOCK_TIME_NONE)
|
|
|
|
return GST_CLOCK_TIME_NONE;
|
|
|
|
if (t == GST_CLOCK_TIME_NONE || pad->push_kf_time < t)
|
|
|
|
t = pad->push_kf_time;
|
|
|
|
}
|
|
|
|
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* MUST be called with the push lock locked, and will unlock it
|
|
|
|
regardless of return value. */
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_ogg_demux_seek_back_after_push_duration_check_unlock (GstOggDemux * ogg)
|
|
|
|
{
|
|
|
|
GstEvent *event;
|
|
|
|
|
|
|
|
/* Get the delayed event, if any */
|
|
|
|
event = ogg->push_mode_seek_delayed_event;
|
|
|
|
ogg->push_mode_seek_delayed_event = NULL;
|
|
|
|
|
|
|
|
ogg->push_state = PUSH_PLAYING;
|
|
|
|
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
|
|
|
|
if (event) {
|
|
|
|
/* If there is one, perform it */
|
|
|
|
gst_ogg_demux_perform_seek_push (ogg, event);
|
|
|
|
} else {
|
|
|
|
/* If there wasn't, seek back at start to start normal playback */
|
|
|
|
GST_INFO_OBJECT (ogg, "Seeking back to 0 after duration check");
|
|
|
|
event = gst_event_new_seek (1.0, GST_FORMAT_BYTES,
|
|
|
|
GST_SEEK_FLAG_ACCURATE | GST_SEEK_FLAG_FLUSH,
|
|
|
|
GST_SEEK_TYPE_SET, 1, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
|
|
|
|
if (!gst_pad_push_event (ogg->sinkpad, event)) {
|
|
|
|
GST_WARNING_OBJECT (ogg, "Failed seeking back to start");
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
2011-10-22 19:20:38 +00:00
|
|
|
static float
|
|
|
|
gst_ogg_demux_estimate_seek_quality (GstOggDemux * ogg)
|
|
|
|
{
|
|
|
|
gint64 diff; /* how far from the goal we ended up */
|
|
|
|
gint64 dist; /* how far we moved this iteration */
|
|
|
|
float seek_quality;
|
|
|
|
|
|
|
|
if (ogg->push_prev_seek_time == GST_CLOCK_TIME_NONE) {
|
|
|
|
/* for the first seek, we pretend we got a good seek,
|
|
|
|
as we don't have a previous seek yet */
|
|
|
|
return 1.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We take a guess at how good the last seek was at guessing
|
|
|
|
the byte target by comparing the amplitude of the last
|
|
|
|
seek to the error */
|
|
|
|
diff = ogg->push_seek_time_target - ogg->push_last_seek_time;
|
|
|
|
if (diff < 0)
|
|
|
|
diff = -diff;
|
|
|
|
dist = ogg->push_last_seek_time - ogg->push_prev_seek_time;
|
|
|
|
if (dist < 0)
|
|
|
|
dist = -dist;
|
|
|
|
|
|
|
|
seek_quality = (dist == 0) ? 0.0f : 1.0f / (1.0f + diff / (float) dist);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"We moved %" GST_TIME_FORMAT ", we're off by %" GST_TIME_FORMAT
|
|
|
|
", seek quality %f", GST_TIME_ARGS (dist), GST_TIME_ARGS (diff),
|
|
|
|
seek_quality);
|
|
|
|
return seek_quality;
|
|
|
|
}
|
|
|
|
|
2011-10-22 19:29:26 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_demux_update_bisection_stats (GstOggDemux * ogg)
|
|
|
|
{
|
2011-10-24 10:46:05 +00:00
|
|
|
int n;
|
|
|
|
|
2011-10-22 19:29:26 +00:00
|
|
|
GST_INFO_OBJECT (ogg, "Bisection needed %d + %d steps",
|
|
|
|
ogg->push_bisection_steps[0], ogg->push_bisection_steps[1]);
|
2011-10-24 10:46:05 +00:00
|
|
|
|
|
|
|
for (n = 0; n < 2; ++n) {
|
|
|
|
ogg->stats_bisection_steps[n] += ogg->push_bisection_steps[n];
|
|
|
|
if (ogg->stats_bisection_max_steps[n] < ogg->push_bisection_steps[n])
|
|
|
|
ogg->stats_bisection_max_steps[n] = ogg->push_bisection_steps[n];
|
|
|
|
}
|
2011-10-22 19:29:26 +00:00
|
|
|
ogg->stats_nbisections++;
|
2011-10-24 10:46:05 +00:00
|
|
|
|
2011-10-22 19:29:26 +00:00
|
|
|
GST_INFO_OBJECT (ogg,
|
|
|
|
"So far, %.2f + %.2f bisections needed per seek (max %d + %d)",
|
|
|
|
ogg->stats_bisection_steps[0] / (float) ogg->stats_nbisections,
|
|
|
|
ogg->stats_bisection_steps[1] / (float) ogg->stats_nbisections,
|
|
|
|
ogg->stats_bisection_max_steps[0], ogg->stats_bisection_max_steps[1]);
|
|
|
|
}
|
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
static gboolean
|
|
|
|
gst_ogg_pad_handle_push_mode_state (GstOggPad * pad, ogg_page * page)
|
|
|
|
{
|
|
|
|
GstOggDemux *ogg = pad->ogg;
|
|
|
|
ogg_int64_t granpos = ogg_page_granulepos (page);
|
|
|
|
|
|
|
|
GST_PUSH_LOCK (ogg);
|
|
|
|
if (granpos >= 0) {
|
|
|
|
if (ogg->push_start_time == GST_CLOCK_TIME_NONE) {
|
|
|
|
ogg->push_start_time =
|
|
|
|
gst_ogg_stream_get_start_time_for_granulepos (&pad->map, granpos);
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Stream start time: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (ogg->push_start_time));
|
|
|
|
}
|
|
|
|
ogg->push_time_offset =
|
|
|
|
gst_ogg_stream_get_end_time_for_granulepos (&pad->map, granpos);
|
|
|
|
if (ogg->push_time_offset > 0) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Bitrate since start: %" G_GUINT64_FORMAT,
|
|
|
|
gst_util_uint64_scale (ogg->push_byte_offset, 8 * GST_SECOND,
|
|
|
|
ogg->push_time_offset));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ogg->push_state == PUSH_DURATION) {
|
|
|
|
GstClockTime t =
|
|
|
|
gst_ogg_stream_get_end_time_for_granulepos (&pad->map, granpos);
|
|
|
|
|
|
|
|
if (ogg->total_time == GST_CLOCK_TIME_NONE || t > ogg->total_time) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "New total time: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (t));
|
|
|
|
ogg->total_time = t;
|
|
|
|
ogg->push_time_length = t;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we were determining the duration of the stream, we're now done,
|
|
|
|
and can get back to sending the original event we delayed.
|
|
|
|
We stop a bit before the end of the stream, as if we get a EOS
|
2012-10-09 10:18:01 +00:00
|
|
|
event and there is a queue2 upstream (such as when using playbin),
|
2011-08-13 13:18:56 +00:00
|
|
|
it will pause the task *after* we come back from the EOS handler,
|
|
|
|
so we cannot prevent the pausing by issuing a seek. */
|
|
|
|
if (ogg->push_byte_offset + EOS_AVOIDANCE_THRESHOLD >=
|
|
|
|
ogg->push_byte_length) {
|
|
|
|
GstMessage *message;
|
|
|
|
GstFlowReturn res;
|
|
|
|
|
|
|
|
/* tell the pipeline we've just found out the duration */
|
2011-10-18 16:58:49 +00:00
|
|
|
ogg->push_time_length = ogg->total_time;
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_INFO_OBJECT (ogg, "New duration found: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (ogg->total_time));
|
2012-09-02 00:27:17 +00:00
|
|
|
message = gst_message_new_duration_changed (GST_OBJECT (ogg));
|
2011-08-13 13:18:56 +00:00
|
|
|
gst_element_post_message (GST_ELEMENT (ogg), message);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"We're close enough to the end, and we're scared "
|
|
|
|
"to get too close, seeking back to start");
|
|
|
|
|
|
|
|
res = gst_ogg_demux_seek_back_after_push_duration_check_unlock (ogg);
|
|
|
|
if (res != GST_FLOW_OK)
|
|
|
|
return res;
|
|
|
|
return GST_FLOW_SKIP_PUSH;
|
|
|
|
} else {
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
}
|
|
|
|
return GST_FLOW_SKIP_PUSH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we're seeking, look at time, and decide what to do */
|
|
|
|
if (ogg->push_state != PUSH_PLAYING && ogg->push_state != PUSH_LINEAR2) {
|
|
|
|
GstClockTime t;
|
|
|
|
gint64 best = -1;
|
|
|
|
GstEvent *sevent;
|
|
|
|
int res;
|
|
|
|
gboolean close_enough;
|
2011-10-22 19:20:38 +00:00
|
|
|
float seek_quality;
|
2011-08-13 13:18:56 +00:00
|
|
|
|
|
|
|
/* ignore -1 granpos when seeking, we want to sync on a real granpos */
|
|
|
|
if (granpos < 0) {
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
if (ogg_stream_pagein (&pad->map.stream, page) != 0)
|
|
|
|
goto choked;
|
|
|
|
return GST_FLOW_SKIP_PUSH;
|
|
|
|
}
|
|
|
|
|
|
|
|
t = gst_ogg_stream_get_end_time_for_granulepos (&pad->map, granpos);
|
|
|
|
|
|
|
|
if (ogg->push_state == PUSH_BISECT1 || ogg->push_state == PUSH_BISECT2) {
|
|
|
|
GstClockTime sync_time;
|
|
|
|
|
|
|
|
if (pad->push_sync_time == GST_CLOCK_TIME_NONE)
|
|
|
|
pad->push_sync_time = t;
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Got timestamp %" GST_TIME_FORMAT " for %s",
|
|
|
|
GST_TIME_ARGS (t), gst_ogg_stream_get_media_type (&pad->map));
|
|
|
|
sync_time = gst_ogg_demux_collect_sync_time (ogg, ogg->building_chain);
|
|
|
|
if (sync_time == GST_CLOCK_TIME_NONE) {
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Not enough timing info collected for sync, waiting for more");
|
|
|
|
if (ogg_stream_pagein (&pad->map.stream, page) != 0)
|
|
|
|
goto choked;
|
|
|
|
return GST_FLOW_SKIP_PUSH;
|
|
|
|
}
|
|
|
|
ogg->push_last_seek_time = sync_time;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Bisection just seeked at %" G_GINT64_FORMAT ", time %"
|
|
|
|
GST_TIME_FORMAT ", target was %" GST_TIME_FORMAT,
|
|
|
|
ogg->push_last_seek_offset,
|
|
|
|
GST_TIME_ARGS (ogg->push_last_seek_time),
|
|
|
|
GST_TIME_ARGS (ogg->push_seek_time_target));
|
|
|
|
|
|
|
|
if (ogg->push_time1 != GST_CLOCK_TIME_NONE) {
|
2011-10-22 19:20:38 +00:00
|
|
|
seek_quality = gst_ogg_demux_estimate_seek_quality (ogg);
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Interval was %" G_GINT64_FORMAT " - %" G_GINT64_FORMAT " (%"
|
|
|
|
G_GINT64_FORMAT "), time %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT
|
2011-10-22 19:20:38 +00:00
|
|
|
" (%" GST_TIME_FORMAT "), seek quality %f", ogg->push_offset0,
|
|
|
|
ogg->push_offset1, ogg->push_offset1 - ogg->push_offset0,
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_TIME_ARGS (ogg->push_time0), GST_TIME_ARGS (ogg->push_time1),
|
2011-10-22 19:20:38 +00:00
|
|
|
GST_TIME_ARGS (ogg->push_time1 - ogg->push_time0), seek_quality);
|
2011-08-13 13:18:56 +00:00
|
|
|
} else {
|
2011-10-22 19:20:38 +00:00
|
|
|
/* in a open ended seek, we can't do bisection, so we pretend
|
|
|
|
we like our result so far */
|
|
|
|
seek_quality = 1.0f;
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Interval was %" G_GINT64_FORMAT " - %" G_GINT64_FORMAT " (%"
|
|
|
|
G_GINT64_FORMAT "), time %" GST_TIME_FORMAT " - unknown",
|
|
|
|
ogg->push_offset0, ogg->push_offset1,
|
|
|
|
ogg->push_offset1 - ogg->push_offset0,
|
|
|
|
GST_TIME_ARGS (ogg->push_time0));
|
|
|
|
}
|
2011-10-22 19:20:38 +00:00
|
|
|
ogg->push_prev_seek_time = ogg->push_last_seek_time;
|
2011-08-13 13:18:56 +00:00
|
|
|
|
|
|
|
gst_ogg_demux_setup_bisection_bounds (ogg);
|
|
|
|
|
2011-10-22 19:20:38 +00:00
|
|
|
best = gst_ogg_demux_estimate_bisection_target (ogg, seek_quality);
|
2011-08-13 13:18:56 +00:00
|
|
|
|
|
|
|
if (ogg->push_seek_time_target == 0) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Seeking to 0, deemed close enough");
|
|
|
|
close_enough = (ogg->push_last_seek_time == 0);
|
|
|
|
} else {
|
|
|
|
/* TODO: make this dependent on framerate ? */
|
2011-10-22 19:20:38 +00:00
|
|
|
GstClockTime time_threshold = GST_SECOND / 2;
|
|
|
|
guint64 byte_threshold =
|
|
|
|
(ogg->max_packet_size >
|
|
|
|
64 * 1024 ? ogg->max_packet_size : 64 * 1024);
|
|
|
|
|
|
|
|
/* We want to be within half a second before the target,
|
|
|
|
or before the target and half less or equal to the max
|
|
|
|
packet size left to search in */
|
|
|
|
if (time_threshold > ogg->push_seek_time_target)
|
|
|
|
time_threshold = ogg->push_seek_time_target;
|
2011-08-13 13:18:56 +00:00
|
|
|
close_enough = ogg->push_last_seek_time < ogg->push_seek_time_target
|
2011-10-22 19:20:38 +00:00
|
|
|
&& (ogg->push_last_seek_time >=
|
|
|
|
ogg->push_seek_time_target - time_threshold
|
|
|
|
|| ogg->push_offset1 <= ogg->push_offset0 + byte_threshold);
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"testing if we're close enough: %" GST_TIME_FORMAT " <= %"
|
2011-10-22 19:20:38 +00:00
|
|
|
GST_TIME_FORMAT " < %" GST_TIME_FORMAT ", or %" G_GUINT64_FORMAT
|
|
|
|
" <= %" G_GUINT64_FORMAT " ? %s",
|
|
|
|
GST_TIME_ARGS (ogg->push_seek_time_target - time_threshold),
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_TIME_ARGS (ogg->push_last_seek_time),
|
|
|
|
GST_TIME_ARGS (ogg->push_seek_time_target),
|
2011-10-22 19:20:38 +00:00
|
|
|
ogg->push_offset1 - ogg->push_offset0, byte_threshold,
|
2011-08-13 13:18:56 +00:00
|
|
|
close_enough ? "Yes" : "No");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (close_enough || best == ogg->push_last_seek_offset) {
|
|
|
|
if (ogg->push_state == PUSH_BISECT1) {
|
|
|
|
/* we now know the time segment we'll have to search for
|
|
|
|
the second bisection */
|
|
|
|
ogg->push_time0 = ogg->push_start_time;
|
|
|
|
ogg->push_offset0 = 0;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Seek to %" GST_TIME_FORMAT
|
|
|
|
" (%lx) done, now gathering pages for all non-sparse streams",
|
|
|
|
GST_TIME_ARGS (ogg->push_seek_time_target), (long) granpos);
|
|
|
|
ogg->push_state = PUSH_LINEAR1;
|
|
|
|
} else {
|
|
|
|
/* If we're asked for an accurate seek, we'll go forward till
|
|
|
|
we get to the original seek target time, else we'll just drop
|
|
|
|
here at the keyframe */
|
|
|
|
if (ogg->push_seek_flags & GST_SEEK_FLAG_ACCURATE) {
|
|
|
|
GST_INFO_OBJECT (ogg,
|
|
|
|
"Seek to keyframe at %" GST_TIME_FORMAT " done (we're at %"
|
|
|
|
GST_TIME_FORMAT "), skipping to original target (%"
|
|
|
|
GST_TIME_FORMAT ")",
|
|
|
|
GST_TIME_ARGS (ogg->push_seek_time_target),
|
|
|
|
GST_TIME_ARGS (sync_time),
|
|
|
|
GST_TIME_ARGS (ogg->push_seek_time_original_target));
|
|
|
|
ogg->push_state = PUSH_LINEAR2;
|
|
|
|
} else {
|
2011-10-22 19:20:38 +00:00
|
|
|
GST_INFO_OBJECT (ogg, "Seek to keyframe done, playing");
|
2011-08-13 13:18:56 +00:00
|
|
|
|
|
|
|
/* we're synced to the seek target, so flush stream and stuff
|
|
|
|
any queued pages into the stream so we start decoding there */
|
|
|
|
ogg->push_state = PUSH_PLAYING;
|
|
|
|
}
|
2011-10-22 19:29:26 +00:00
|
|
|
gst_ogg_demux_update_bisection_stats (ogg);
|
2011-08-13 13:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (ogg->push_state == PUSH_LINEAR1) {
|
|
|
|
if (pad->push_kf_time == GST_CLOCK_TIME_NONE) {
|
|
|
|
GstClockTime earliest_keyframe_time;
|
|
|
|
|
|
|
|
gst_ogg_demux_record_keyframe_time (ogg, pad, granpos);
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Previous keyframe for %s stream at %" GST_TIME_FORMAT,
|
|
|
|
gst_ogg_stream_get_media_type (&pad->map),
|
|
|
|
GST_TIME_ARGS (pad->push_kf_time));
|
|
|
|
earliest_keyframe_time = gst_ogg_demux_get_earliest_keyframe_time (ogg);
|
|
|
|
if (earliest_keyframe_time != GST_CLOCK_TIME_NONE) {
|
2011-10-22 19:29:26 +00:00
|
|
|
if (earliest_keyframe_time > ogg->push_last_seek_time) {
|
|
|
|
GST_INFO_OBJECT (ogg,
|
|
|
|
"All non sparse streams now have a previous keyframe time, "
|
|
|
|
"and we already decoded it, switching to playing");
|
|
|
|
ogg->push_state = PUSH_PLAYING;
|
|
|
|
gst_ogg_demux_update_bisection_stats (ogg);
|
|
|
|
} else {
|
|
|
|
GST_INFO_OBJECT (ogg,
|
|
|
|
"All non sparse streams now have a previous keyframe time, "
|
|
|
|
"bisecting again to %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (earliest_keyframe_time));
|
|
|
|
|
|
|
|
ogg->push_seek_time_target = earliest_keyframe_time;
|
|
|
|
ogg->push_offset0 = 0;
|
|
|
|
ogg->push_time0 = ogg->push_start_time;
|
|
|
|
ogg->push_offset1 = ogg->push_last_seek_offset;
|
|
|
|
ogg->push_time1 = ogg->push_last_seek_time;
|
|
|
|
ogg->push_prev_seek_time = GST_CLOCK_TIME_NONE;
|
|
|
|
ogg->seek_secant = FALSE;
|
|
|
|
ogg->seek_undershot = FALSE;
|
|
|
|
|
|
|
|
ogg->push_state = PUSH_BISECT2;
|
|
|
|
best = gst_ogg_demux_estimate_bisection_target (ogg, 1.0f);
|
|
|
|
}
|
2011-08-13 13:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ogg->push_state == PUSH_BISECT1 || ogg->push_state == PUSH_BISECT2) {
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
ogg_sync_reset (&ogg->sync);
|
|
|
|
for (i = 0; i < ogg->building_chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad =
|
|
|
|
g_array_index (ogg->building_chain->streams, GstOggPad *, i);
|
|
|
|
|
|
|
|
pad->push_sync_time = GST_CLOCK_TIME_NONE;
|
|
|
|
ogg_stream_reset (&pad->map.stream);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"seeking to %" G_GINT64_FORMAT " - %" G_GINT64_FORMAT, best,
|
|
|
|
(gint64) - 1);
|
|
|
|
/* do seek */
|
|
|
|
g_assert (best != -1);
|
|
|
|
ogg->push_bisection_steps[ogg->push_state == PUSH_BISECT2 ? 1 : 0]++;
|
|
|
|
sevent =
|
|
|
|
gst_event_new_seek (ogg->push_seek_rate, GST_FORMAT_BYTES,
|
|
|
|
ogg->push_seek_flags, GST_SEEK_TYPE_SET, best,
|
|
|
|
GST_SEEK_TYPE_NONE, -1);
|
2013-09-06 18:56:39 +00:00
|
|
|
gst_event_set_seqnum (sevent, ogg->push_seek_seqnum);
|
2011-08-13 13:18:56 +00:00
|
|
|
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
res = gst_pad_push_event (ogg->sinkpad, sevent);
|
|
|
|
if (!res) {
|
|
|
|
/* We failed to send the seek event, notify the pipeline */
|
|
|
|
GST_ELEMENT_ERROR (ogg, RESOURCE, SEEK, (NULL), ("Failed to seek"));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
return GST_FLOW_SKIP_PUSH;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ogg->push_state != PUSH_PLAYING) {
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
return GST_FLOW_SKIP_PUSH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
choked:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (ogg,
|
|
|
|
"ogg stream choked on page (serial %08x), "
|
|
|
|
"resetting stream", pad->map.serialno);
|
|
|
|
gst_ogg_pad_reset (pad);
|
|
|
|
/* we continue to recover */
|
|
|
|
return GST_FLOW_SKIP_PUSH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-24 15:40:58 +00:00
|
|
|
/* submit a page to an oggpad, this function will then submit all
|
|
|
|
* the packets in the page.
|
|
|
|
*/
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_ogg_pad_submit_page (GstOggPad * pad, ogg_page * page)
|
|
|
|
{
|
|
|
|
GstFlowReturn result = GST_FLOW_OK;
|
|
|
|
GstOggDemux *ogg;
|
|
|
|
gboolean continued = FALSE;
|
|
|
|
|
|
|
|
ogg = pad->ogg;
|
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
/* for negative rates we read pages backwards and must therefore be careful
|
2007-01-09 12:30:46 +00:00
|
|
|
* with continued pages */
|
2006-11-24 15:40:58 +00:00
|
|
|
if (ogg->segment.rate < 0.0) {
|
|
|
|
gint npackets;
|
|
|
|
|
|
|
|
continued = ogg_page_continued (page);
|
|
|
|
|
|
|
|
/* number of completed packets in the page */
|
|
|
|
npackets = ogg_page_packets (page);
|
|
|
|
if (!continued) {
|
2007-01-09 12:30:46 +00:00
|
|
|
/* page is not continued so it contains at least one packet start. It's
|
|
|
|
* possible that no packet ends on this page (npackets == 0). In that
|
|
|
|
* case, the next (continued) page(s) we kept contain the remainder of the
|
|
|
|
* packets. We mark npackets=1 to make us start decoding the pages in the
|
|
|
|
* remainder of the algorithm. */
|
2006-11-24 15:40:58 +00:00
|
|
|
if (npackets == 0)
|
|
|
|
npackets = 1;
|
|
|
|
}
|
|
|
|
GST_LOG_OBJECT (ogg, "continued: %d, %d packets", continued, npackets);
|
|
|
|
|
|
|
|
if (npackets == 0) {
|
|
|
|
GST_LOG_OBJECT (ogg, "no decodable packets, we need a previous page");
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
/* keep track of time in push mode */
|
|
|
|
if (!ogg->pullmode) {
|
|
|
|
result = gst_ogg_pad_handle_push_mode_state (pad, page);
|
|
|
|
if (result == GST_FLOW_SKIP_PUSH)
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
if (result != GST_FLOW_OK)
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2011-10-22 19:20:38 +00:00
|
|
|
if (page->header_len + page->body_len > ogg->max_page_size)
|
|
|
|
ogg->max_page_size = page->header_len + page->body_len;
|
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
if (ogg_stream_pagein (&pad->map.stream, page) != 0)
|
2006-11-24 15:40:58 +00:00
|
|
|
goto choked;
|
|
|
|
|
2007-01-09 12:30:46 +00:00
|
|
|
/* flush all packets in the stream layer, this might not give a packet if
|
|
|
|
* the page had no packets finishing on the page (npackets == 0). */
|
2006-11-24 15:40:58 +00:00
|
|
|
result = gst_ogg_pad_stream_out (pad, 0);
|
|
|
|
|
|
|
|
if (pad->continued) {
|
|
|
|
ogg_packet packet;
|
|
|
|
|
|
|
|
/* now send the continued pages to the stream layer */
|
|
|
|
while (pad->continued) {
|
|
|
|
ogg_page *p = (ogg_page *) pad->continued->data;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ogg, "submitting continued page %p", p);
|
2009-08-29 17:51:48 +00:00
|
|
|
if (ogg_stream_pagein (&pad->map.stream, p) != 0)
|
2006-11-24 15:40:58 +00:00
|
|
|
goto choked;
|
|
|
|
|
|
|
|
pad->continued = g_list_delete_link (pad->continued, pad->continued);
|
|
|
|
|
|
|
|
/* free the page */
|
|
|
|
gst_ogg_page_free (p);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ogg, "flushing last continued packet");
|
|
|
|
/* flush 1 continued packet in the stream layer */
|
|
|
|
result = gst_ogg_pad_stream_out (pad, 1);
|
|
|
|
|
|
|
|
/* flush all remaining packets, we pushed them in the previous round.
|
|
|
|
* We don't use _reset() because we still want to get the discont when
|
|
|
|
* we submit a next page. */
|
2009-08-29 17:51:48 +00:00
|
|
|
while (ogg_stream_packetout (&pad->map.stream, &packet) != 0);
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
2006-11-24 15:40:58 +00:00
|
|
|
|
|
|
|
done:
|
|
|
|
/* keep continued pages (only in reverse mode) */
|
|
|
|
if (continued) {
|
|
|
|
ogg_page *p = gst_ogg_page_copy (page);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ogg, "keeping continued page %p", p);
|
|
|
|
pad->continued = g_list_prepend (pad->continued, p);
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
return result;
|
2005-07-14 18:13:08 +00:00
|
|
|
|
|
|
|
choked:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (ogg,
|
2011-08-18 15:20:57 +00:00
|
|
|
"ogg stream choked on page (serial %08x), "
|
|
|
|
"resetting stream", pad->map.serialno);
|
2005-07-14 18:13:08 +00:00
|
|
|
gst_ogg_pad_reset (pad);
|
|
|
|
/* we continue to recover */
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static GstOggChain *
|
|
|
|
gst_ogg_chain_new (GstOggDemux * ogg)
|
|
|
|
{
|
2011-08-18 09:05:17 +00:00
|
|
|
GstOggChain *chain = g_slice_new0 (GstOggChain);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg, "creating new chain %p", chain);
|
|
|
|
chain->ogg = ogg;
|
|
|
|
chain->offset = -1;
|
|
|
|
chain->bytes = -1;
|
|
|
|
chain->have_bos = FALSE;
|
|
|
|
chain->streams = g_array_new (FALSE, TRUE, sizeof (GstOggPad *));
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
chain->begin_time = GST_CLOCK_TIME_NONE;
|
ext/ogg/gstoggdemux.c: Parse seeking events better.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_pad_event), (gst_ogg_demux_factory_filter),
(gst_ogg_pad_submit_packet), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
Parse seeking events better.
Unref static caps.
Generate correct newsegment events, fixes seeking in live oggs.
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_dec_src_event), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_dec_push), (theora_dec_chain):
Use newsegment values to report correct play time.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event):
* ext/vorbis/vorbisdec.h:
Parse and use newsegment values to report correct play time.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Clear ringbuffer on flush.
Use newsegment values to calculate playback time.
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Basesink does newsegment calculations for us now.
2005-08-24 18:04:45 +00:00
|
|
|
chain->segment_start = GST_CLOCK_TIME_NONE;
|
2005-11-08 12:12:55 +00:00
|
|
|
chain->segment_stop = GST_CLOCK_TIME_NONE;
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
chain->total_time = GST_CLOCK_TIME_NONE;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
return chain;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ogg_chain_free (GstOggChain * chain)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
|
2005-06-28 10:16:13 +00:00
|
|
|
gst_object_unref (pad);
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
g_array_free (chain->streams, TRUE);
|
2011-08-18 09:05:17 +00:00
|
|
|
g_slice_free (GstOggChain, chain);
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
2010-04-30 16:37:17 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_pad_mark_discont (GstOggPad * pad)
|
|
|
|
{
|
|
|
|
pad->discont = TRUE;
|
|
|
|
pad->map.last_size = 0;
|
|
|
|
}
|
|
|
|
|
ext/ogg/gstoggdemux.c: Mark buffers with DISCONT after seek and after activating new chains.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_chain_peer),
(gst_ogg_chain_mark_discont), (gst_ogg_chain_new_stream),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek):
Mark buffers with DISCONT after seek and after activating new
chains.
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_get_query_types), (theora_dec_sink_event),
(theora_dec_push), (theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Fix frame counter.
Detect and mark DISCONT buffers.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_dec_push), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Use GstSegment.
Detect and mark DISCONT buffers.
Don't crash on 0 sized buffers.
2006-05-03 15:34:48 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_chain_mark_discont (GstOggChain * chain)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
|
2010-04-30 16:37:17 +00:00
|
|
|
gst_ogg_pad_mark_discont (pad);
|
ext/ogg/gstoggdemux.c: Mark buffers with DISCONT after seek and after activating new chains.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_chain_peer),
(gst_ogg_chain_mark_discont), (gst_ogg_chain_new_stream),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek):
Mark buffers with DISCONT after seek and after activating new
chains.
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_get_query_types), (theora_dec_sink_event),
(theora_dec_push), (theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Fix frame counter.
Detect and mark DISCONT buffers.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_dec_push), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Use GstSegment.
Detect and mark DISCONT buffers.
Don't crash on 0 sized buffers.
2006-05-03 15:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-24 15:40:58 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_chain_reset (GstOggChain * chain)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
|
|
|
|
gst_ogg_pad_reset (pad);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static GstOggPad *
|
2011-08-17 17:03:16 +00:00
|
|
|
gst_ogg_chain_new_stream (GstOggChain * chain, guint32 serialno)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
|
|
|
GstOggPad *ret;
|
|
|
|
GstTagList *list;
|
|
|
|
gchar *name;
|
|
|
|
|
2011-08-17 17:03:16 +00:00
|
|
|
GST_DEBUG_OBJECT (chain->ogg,
|
2011-08-18 15:20:57 +00:00
|
|
|
"creating new stream %08x in chain %p", serialno, chain);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2011-11-04 11:53:33 +00:00
|
|
|
name = g_strdup_printf ("src_%08x", serialno);
|
2011-10-21 19:41:03 +00:00
|
|
|
ret = g_object_new (GST_TYPE_OGG_PAD, "name", name, NULL);
|
|
|
|
g_free (name);
|
2005-03-31 09:43:49 +00:00
|
|
|
/* we own this one */
|
2010-12-07 10:31:30 +00:00
|
|
|
gst_object_ref_sink (ret);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
GST_PAD_DIRECTION (ret) = GST_PAD_SRC;
|
2010-04-30 16:37:17 +00:00
|
|
|
gst_ogg_pad_mark_discont (ret);
|
2007-01-09 12:30:46 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
ret->chain = chain;
|
|
|
|
ret->ogg = chain->ogg;
|
2007-01-09 12:30:46 +00:00
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
ret->map.serialno = serialno;
|
|
|
|
if (ogg_stream_init (&ret->map.stream, serialno) != 0)
|
2007-01-09 12:30:46 +00:00
|
|
|
goto init_failed;
|
|
|
|
|
|
|
|
/* FIXME: either do something with it or remove it */
|
2011-10-30 11:09:10 +00:00
|
|
|
list = gst_tag_list_new_empty ();
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_SERIAL, serialno,
|
|
|
|
NULL);
|
2012-09-14 15:53:21 +00:00
|
|
|
gst_tag_list_unref (list);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2005-08-20 20:40:25 +00:00
|
|
|
GST_DEBUG_OBJECT (chain->ogg,
|
2011-08-18 15:20:57 +00:00
|
|
|
"created new ogg src %p for stream with serial %08x", ret, serialno);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
g_array_append_val (chain->streams, ret);
|
2011-05-30 15:14:48 +00:00
|
|
|
gst_pad_set_active (GST_PAD_CAST (ret), TRUE);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
return ret;
|
2007-01-09 12:30:46 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
init_failed:
|
|
|
|
{
|
2011-08-18 15:20:57 +00:00
|
|
|
GST_ERROR ("Could not initialize ogg_stream struct for serial %08x",
|
|
|
|
serialno);
|
2007-01-09 12:30:46 +00:00
|
|
|
gst_object_unref (ret);
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstOggPad *
|
2011-08-17 17:03:16 +00:00
|
|
|
gst_ogg_chain_get_stream (GstOggChain * chain, guint32 serialno)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
if (pad->map.serialno == serialno)
|
2005-03-31 09:43:49 +00:00
|
|
|
return pad;
|
2004-07-02 03:41:22 +00:00
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
return NULL;
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean
|
2011-08-17 17:03:16 +00:00
|
|
|
gst_ogg_chain_has_stream (GstOggChain * chain, guint32 serialno)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
|
|
|
return gst_ogg_chain_get_stream (chain, serialno) != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* signals and args */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
ARG_0
|
|
|
|
/* FILL ME */
|
|
|
|
};
|
|
|
|
|
|
|
|
static GstStaticPadTemplate ogg_demux_src_template_factory =
|
2011-11-04 11:53:33 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("src_%08x",
|
2005-03-31 09:43:49 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_SOMETIMES,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate ogg_demux_sink_template_factory =
|
ext/ogg/gstoggdemux.c: Annodex support in ogg demuxer. Doesn't do very much without the other annodex patches (to come).
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_parse_skeleton_fishead),
(gst_ogg_pad_parse_skeleton_fisbone), (gst_ogg_pad_query_convert),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_read_chain),
(gst_ogg_demux_read_end_chain), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_change_state), (gst_annodex_granule_to_time):
Annodex support in ogg demuxer. Doesn't do very much without the
other annodex patches (to come).
2006-02-24 17:31:53 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
2005-03-31 09:43:49 +00:00
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2012-05-13 17:49:31 +00:00
|
|
|
GST_STATIC_CAPS ("application/ogg; audio/ogg; video/ogg; application/kate")
|
2005-03-31 09:43:49 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static void gst_ogg_demux_finalize (GObject * object);
|
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
static GstFlowReturn gst_ogg_demux_read_chain (GstOggDemux * ogg,
|
|
|
|
GstOggChain ** chain);
|
|
|
|
static GstFlowReturn gst_ogg_demux_read_end_chain (GstOggDemux * ogg,
|
2005-03-31 09:43:49 +00:00
|
|
|
GstOggChain * chain);
|
|
|
|
|
2011-11-17 11:48:25 +00:00
|
|
|
static gboolean gst_ogg_demux_sink_event (GstPad * pad, GstObject * parent,
|
|
|
|
GstEvent * event);
|
2005-03-31 09:43:49 +00:00
|
|
|
static void gst_ogg_demux_loop (GstOggPad * pad);
|
2011-11-17 11:48:25 +00:00
|
|
|
static GstFlowReturn gst_ogg_demux_chain (GstPad * pad, GstObject * parent,
|
|
|
|
GstBuffer * buffer);
|
2011-11-18 12:56:04 +00:00
|
|
|
static gboolean gst_ogg_demux_sink_activate (GstPad * sinkpad,
|
|
|
|
GstObject * parent);
|
2011-11-21 12:35:34 +00:00
|
|
|
static gboolean gst_ogg_demux_sink_activate_mode (GstPad * sinkpad,
|
|
|
|
GstObject * parent, GstPadMode mode, gboolean active);
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn gst_ogg_demux_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
static void gst_ogg_print (GstOggDemux * demux);
|
|
|
|
|
2011-04-19 12:11:32 +00:00
|
|
|
#define gst_ogg_demux_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE (GstOggDemux, gst_ogg_demux, GST_TYPE_ELEMENT);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2004-01-29 02:50:20 +00:00
|
|
|
static void
|
2011-04-19 12:11:32 +00:00
|
|
|
gst_ogg_demux_class_init (GstOggDemuxClass * klass)
|
2004-01-29 02:50:20 +00:00
|
|
|
{
|
2011-04-19 12:11:32 +00:00
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-04-09 23:45:16 +00:00
|
|
|
gst_element_class_set_static_metadata (gstelement_class,
|
2010-03-16 14:45:23 +00:00
|
|
|
"Ogg demuxer", "Codec/Demuxer",
|
|
|
|
"demux ogg streams (info about ogg: http://xiph.org)",
|
|
|
|
"Wim Taymans <wim@fluendo.com>");
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2011-04-19 12:11:32 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_static_pad_template_get (&ogg_demux_sink_template_factory));
|
2011-04-19 12:11:32 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_static_pad_template_get (&ogg_demux_src_template_factory));
|
|
|
|
|
|
|
|
gstelement_class->change_state = gst_ogg_demux_change_state;
|
2005-11-15 18:11:17 +00:00
|
|
|
gstelement_class->send_event = gst_ogg_demux_receive_event;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
gobject_class->finalize = gst_ogg_demux_finalize;
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|
|
|
|
|
2004-07-02 03:41:22 +00:00
|
|
|
static void
|
2011-04-19 12:11:32 +00:00
|
|
|
gst_ogg_demux_init (GstOggDemux * ogg)
|
2004-07-02 03:41:22 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
/* create the sink pad */
|
2005-11-16 18:21:46 +00:00
|
|
|
ogg->sinkpad =
|
|
|
|
gst_pad_new_from_static_template (&ogg_demux_sink_template_factory,
|
|
|
|
"sink");
|
2005-11-15 19:34:39 +00:00
|
|
|
|
2006-04-10 19:13:30 +00:00
|
|
|
gst_pad_set_event_function (ogg->sinkpad, gst_ogg_demux_sink_event);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_pad_set_chain_function (ogg->sinkpad, gst_ogg_demux_chain);
|
|
|
|
gst_pad_set_activate_function (ogg->sinkpad, gst_ogg_demux_sink_activate);
|
2011-11-21 12:35:34 +00:00
|
|
|
gst_pad_set_activatemode_function (ogg->sinkpad,
|
|
|
|
gst_ogg_demux_sink_activate_mode);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (ogg), ogg->sinkpad);
|
|
|
|
|
2012-09-10 00:08:51 +00:00
|
|
|
g_mutex_init (&ogg->chain_lock);
|
|
|
|
g_mutex_init (&ogg->push_lock);
|
2005-03-31 09:43:49 +00:00
|
|
|
ogg->chains = g_array_new (FALSE, TRUE, sizeof (GstOggChain *));
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
|
2011-10-21 18:38:19 +00:00
|
|
|
ogg->stats_nbisections = 0;
|
|
|
|
ogg->stats_bisection_steps[0] = 0;
|
|
|
|
ogg->stats_bisection_steps[1] = 0;
|
|
|
|
ogg->stats_bisection_max_steps[0] = 0;
|
|
|
|
ogg->stats_bisection_max_steps[1] = 0;
|
|
|
|
|
2006-08-31 12:31:00 +00:00
|
|
|
ogg->newsegment = NULL;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ogg_demux_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstOggDemux *ogg;
|
|
|
|
|
|
|
|
ogg = GST_OGG_DEMUX (object);
|
|
|
|
|
2006-07-14 16:45:17 +00:00
|
|
|
g_array_free (ogg->chains, TRUE);
|
2012-09-10 00:08:51 +00:00
|
|
|
g_mutex_clear (&ogg->chain_lock);
|
|
|
|
g_mutex_clear (&ogg->push_lock);
|
2005-03-31 09:43:49 +00:00
|
|
|
ogg_sync_clear (&ogg->sync);
|
|
|
|
|
2006-08-31 12:31:00 +00:00
|
|
|
if (ogg->newsegment)
|
|
|
|
gst_event_unref (ogg->newsegment);
|
|
|
|
|
2006-04-10 19:13:30 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2004-07-02 03:41:22 +00:00
|
|
|
}
|
|
|
|
|
2010-05-04 09:19:39 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_demux_reset_streams (GstOggDemux * ogg)
|
|
|
|
{
|
|
|
|
GstOggChain *chain;
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
chain = ogg->current_chain;
|
|
|
|
if (chain == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *stream = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
|
|
|
|
stream->start_time = -1;
|
|
|
|
stream->map.accumulated_granule = 0;
|
|
|
|
}
|
|
|
|
ogg->building_chain = chain;
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "Resetting current chain");
|
2010-05-04 09:19:39 +00:00
|
|
|
ogg->current_chain = NULL;
|
|
|
|
ogg->resync = TRUE;
|
|
|
|
}
|
|
|
|
|
2004-07-02 03:41:22 +00:00
|
|
|
static gboolean
|
2011-11-17 11:48:25 +00:00
|
|
|
gst_ogg_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
2006-04-10 19:13:30 +00:00
|
|
|
gboolean res;
|
|
|
|
GstOggDemux *ogg;
|
|
|
|
|
2011-11-17 11:48:25 +00:00
|
|
|
ogg = GST_OGG_DEMUX (parent);
|
2004-07-02 03:41:22 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2010-05-03 14:52:59 +00:00
|
|
|
case GST_EVENT_FLUSH_START:
|
|
|
|
res = gst_ogg_demux_send_event (ogg, event);
|
|
|
|
break;
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
GST_DEBUG_OBJECT (ogg, "got a flush stop event");
|
|
|
|
ogg_sync_reset (&ogg->sync);
|
|
|
|
res = gst_ogg_demux_send_event (ogg, event);
|
2011-08-13 13:18:56 +00:00
|
|
|
if (ogg->pullmode || ogg->push_state != PUSH_DURATION) {
|
|
|
|
/* it's starting to feel reaaaally dirty :(
|
|
|
|
if we're on a spliced seek to get duration, don't reset streams,
|
|
|
|
we'll need them for the delayed seek */
|
|
|
|
gst_ogg_demux_reset_streams (ogg);
|
|
|
|
}
|
2010-05-03 14:52:59 +00:00
|
|
|
break;
|
2011-05-16 11:48:11 +00:00
|
|
|
case GST_EVENT_SEGMENT:
|
examples/seeking/seek.c: Update seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
2005-07-27 18:34:29 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "got a new segment event");
|
2011-08-13 13:18:56 +00:00
|
|
|
{
|
2011-09-23 16:27:11 +00:00
|
|
|
GstSegment segment;
|
2013-09-06 18:56:39 +00:00
|
|
|
gboolean update;
|
2011-09-23 16:27:11 +00:00
|
|
|
|
|
|
|
gst_event_copy_segment (event, &segment);
|
|
|
|
|
|
|
|
if (segment.format == GST_FORMAT_BYTES) {
|
2011-09-16 19:14:39 +00:00
|
|
|
GST_PUSH_LOCK (ogg);
|
2011-09-23 16:27:11 +00:00
|
|
|
ogg->push_byte_offset = segment.start;
|
|
|
|
ogg->push_last_seek_offset = segment.start;
|
2013-09-06 18:56:39 +00:00
|
|
|
|
|
|
|
if (gst_event_get_seqnum (event) == ogg->push_seek_seqnum)
|
|
|
|
gst_segment_do_seek (&ogg->segment, ogg->push_seek_rate,
|
|
|
|
GST_FORMAT_TIME, ogg->push_seek_flags, GST_SEEK_TYPE_SET,
|
|
|
|
ogg->push_seek_time_original_target, GST_SEEK_TYPE_SET,
|
|
|
|
ogg->push_seek_time_original_stop, &update);
|
|
|
|
|
2011-09-16 19:14:39 +00:00
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (ogg, "unexpected segment format: %s",
|
2011-09-23 16:27:11 +00:00
|
|
|
gst_format_get_name (segment.format));
|
2011-08-13 13:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_event_unref (event);
|
2006-04-10 19:13:30 +00:00
|
|
|
res = TRUE;
|
2005-03-31 09:43:49 +00:00
|
|
|
break;
|
2006-04-10 19:13:30 +00:00
|
|
|
case GST_EVENT_EOS:
|
2008-11-25 15:28:36 +00:00
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ogg, "got an EOS event");
|
2011-08-13 13:18:56 +00:00
|
|
|
#if 0
|
|
|
|
/* This would be what is needed (recover from EOS by going on to
|
|
|
|
the next step (issue the delayed seek)), but it does not work
|
|
|
|
if there is a queue2 upstream - see more details comment in
|
|
|
|
gst_ogg_pad_submit_page.
|
|
|
|
If I could find a way to bypass queue2 behavior, this should
|
|
|
|
be enabled. */
|
|
|
|
GST_PUSH_LOCK (ogg);
|
|
|
|
if (ogg->push_state == PUSH_DURATION) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Got EOS while determining length");
|
|
|
|
res = gst_ogg_demux_seek_back_after_push_duration_check_unlock (ogg);
|
|
|
|
if (res != GST_FLOW_OK) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Error seeking back after duration check: %d",
|
|
|
|
res);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
#endif
|
2010-05-03 14:52:59 +00:00
|
|
|
res = gst_ogg_demux_send_event (ogg, event);
|
2008-11-25 15:28:36 +00:00
|
|
|
if (ogg->current_chain == NULL) {
|
|
|
|
GST_ELEMENT_ERROR (ogg, STREAM, DEMUX, (NULL),
|
|
|
|
("can't get first chain"));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
default:
|
2012-01-30 19:58:34 +00:00
|
|
|
res = gst_pad_event_default (pad, parent, event);
|
2006-04-10 19:13:30 +00:00
|
|
|
break;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
2006-04-10 19:13:30 +00:00
|
|
|
|
|
|
|
return res;
|
2004-07-02 03:41:22 +00:00
|
|
|
}
|
|
|
|
|
2011-01-10 07:55:26 +00:00
|
|
|
/* submit the given buffer to the ogg sync */
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
static GstFlowReturn
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_ogg_demux_submit_buffer (GstOggDemux * ogg, GstBuffer * buffer)
|
|
|
|
{
|
2011-03-27 16:30:24 +00:00
|
|
|
gsize size;
|
2005-03-31 09:43:49 +00:00
|
|
|
gchar *oggbuffer;
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2011-06-10 15:58:48 +00:00
|
|
|
size = gst_buffer_get_size (buffer);
|
2011-03-27 16:30:24 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "submitting %" G_GSIZE_FORMAT " bytes", size);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (G_UNLIKELY (size == 0))
|
|
|
|
goto done;
|
2006-08-14 10:49:10 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
oggbuffer = ogg_sync_buffer (&ogg->sync, size);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (G_UNLIKELY (oggbuffer == NULL))
|
|
|
|
goto no_buffer;
|
|
|
|
|
2011-06-10 15:58:48 +00:00
|
|
|
gst_buffer_extract (buffer, 0, oggbuffer, size);
|
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (G_UNLIKELY (ogg_sync_wrote (&ogg->sync, size) < 0))
|
|
|
|
goto write_failed;
|
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
if (!ogg->pullmode) {
|
|
|
|
GST_PUSH_LOCK (ogg);
|
|
|
|
ogg->push_byte_offset += size;
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
}
|
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
done:
|
Leak fixes in oggdemux.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_internal_chain),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_chain_unlocked):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_change_state):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_init),
(gst_ffmpegcsp_bufferalloc), (gst_ffmpegcsp_chain),
(gst_ffmpegcsp_change_state), (gst_ffmpegcsp_set_property),
(gst_ffmpegcsp_get_property):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_check_xshm_calls), (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xvimage_put), (gst_xvimagesink_imagepool_clear),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_free),
(gst_xvimagesink_buffer_alloc), (gst_xvimagesink_set_xwindow_id):
Leak fixes in oggdemux.
Some cleanups in audioconvert.
Make passthrough work along with buffer_alloc etc.
Make buffer_alloc and buffer recycling actually work in
xvimagesink.
2005-05-17 17:41:32 +00:00
|
|
|
gst_buffer_unref (buffer);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_buffer:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (ogg, STREAM, DECODE,
|
|
|
|
(NULL), ("failed to get ogg sync buffer"));
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
write_failed:
|
|
|
|
{
|
2011-08-09 14:39:31 +00:00
|
|
|
GST_ELEMENT_ERROR (ogg, STREAM, DECODE, (NULL),
|
|
|
|
("failed to write %" G_GSIZE_FORMAT " bytes to the sync buffer", size));
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto done;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* in random access mode this code updates the current read position
|
|
|
|
* and resets the ogg sync buffer so that the next read will happen
|
|
|
|
* from this new location.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
gst_ogg_demux_seek (GstOggDemux * ogg, gint64 offset)
|
|
|
|
{
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "seeking to %" G_GINT64_FORMAT, offset);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
ogg->offset = offset;
|
2009-04-28 09:24:19 +00:00
|
|
|
ogg->read_offset = offset;
|
2005-03-31 09:43:49 +00:00
|
|
|
ogg_sync_reset (&ogg->sync);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read more data from the current offset and submit to
|
|
|
|
* the ogg sync layer.
|
|
|
|
*/
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
static GstFlowReturn
|
2009-05-19 10:45:59 +00:00
|
|
|
gst_ogg_demux_get_data (GstOggDemux * ogg, gint64 end_offset)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
|
|
|
GstFlowReturn ret;
|
2012-03-20 12:18:19 +00:00
|
|
|
GstBuffer *buffer;
|
|
|
|
gchar *oggbuffer;
|
|
|
|
gsize size;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2009-05-19 10:45:59 +00:00
|
|
|
GST_LOG_OBJECT (ogg,
|
|
|
|
"get data %" G_GINT64_FORMAT " %" G_GINT64_FORMAT " %" G_GINT64_FORMAT,
|
|
|
|
ogg->read_offset, ogg->length, end_offset);
|
|
|
|
|
|
|
|
if (end_offset > 0 && ogg->read_offset >= end_offset)
|
|
|
|
goto boundary_reached;
|
|
|
|
|
2009-04-28 09:24:19 +00:00
|
|
|
if (ogg->read_offset == ogg->length)
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
goto eos;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-03-20 12:18:19 +00:00
|
|
|
oggbuffer = ogg_sync_buffer (&ogg->sync, CHUNKSIZE);
|
|
|
|
if (G_UNLIKELY (oggbuffer == NULL))
|
|
|
|
goto no_buffer;
|
|
|
|
|
|
|
|
buffer =
|
|
|
|
gst_buffer_new_wrapped_full (0, oggbuffer, CHUNKSIZE, 0, CHUNKSIZE, NULL,
|
|
|
|
NULL);
|
|
|
|
|
2009-04-28 09:24:19 +00:00
|
|
|
ret = gst_pad_pull_range (ogg->sinkpad, ogg->read_offset, CHUNKSIZE, &buffer);
|
2005-03-31 09:43:49 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
goto error;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-03-20 12:18:19 +00:00
|
|
|
size = gst_buffer_get_size (buffer);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (ogg_sync_wrote (&ogg->sync, size) < 0))
|
|
|
|
goto write_failed;
|
2009-04-28 09:24:19 +00:00
|
|
|
|
2012-03-20 12:18:19 +00:00
|
|
|
ogg->read_offset += size;
|
|
|
|
gst_buffer_unref (buffer);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
return ret;
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
|
|
|
|
/* ERROR */
|
2009-05-19 10:45:59 +00:00
|
|
|
boundary_reached:
|
|
|
|
{
|
|
|
|
GST_LOG_OBJECT (ogg, "reached boundary");
|
|
|
|
return GST_FLOW_LIMIT;
|
|
|
|
}
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
eos:
|
|
|
|
{
|
|
|
|
GST_LOG_OBJECT (ogg, "reached EOS");
|
2011-10-10 09:39:52 +00:00
|
|
|
return GST_FLOW_EOS;
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
}
|
2012-03-20 12:18:19 +00:00
|
|
|
no_buffer:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (ogg, STREAM, DECODE,
|
|
|
|
(NULL), ("failed to get ogg sync buffer"));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
error:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (ogg, "got %d (%s) from pull range", ret,
|
|
|
|
gst_flow_get_name (ret));
|
2012-03-20 12:18:19 +00:00
|
|
|
gst_buffer_unref (buffer);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
return ret;
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
}
|
2012-03-20 12:18:19 +00:00
|
|
|
write_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (ogg, STREAM, DECODE, (NULL),
|
|
|
|
("failed to write %" G_GSIZE_FORMAT " bytes to the sync buffer", size));
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Read the next page from the current offset.
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
* boundary: number of bytes ahead we allow looking for;
|
|
|
|
* -1 if no boundary
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
*
|
|
|
|
* @offset will contain the offset the next page starts at when this function
|
|
|
|
* returns GST_FLOW_OK.
|
|
|
|
*
|
2011-10-10 09:39:52 +00:00
|
|
|
* GST_FLOW_EOS is returned on EOS.
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
*
|
|
|
|
* GST_FLOW_LIMIT is returned when we did not find a page before the
|
|
|
|
* boundary. If @boundary is -1, this is never returned.
|
|
|
|
*
|
|
|
|
* Any other error returned while retrieving data from the peer is returned as
|
|
|
|
* is.
|
2005-03-31 09:43:49 +00:00
|
|
|
*/
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
static GstFlowReturn
|
2010-05-05 11:59:57 +00:00
|
|
|
gst_ogg_demux_get_next_page (GstOggDemux * ogg, ogg_page * og,
|
|
|
|
gint64 boundary, gint64 * offset)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
2009-05-19 10:45:59 +00:00
|
|
|
gint64 end_offset = -1;
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GstFlowReturn ret;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
GST_LOG_OBJECT (ogg,
|
|
|
|
"get next page, current offset %" G_GINT64_FORMAT ", bytes boundary %"
|
|
|
|
G_GINT64_FORMAT, ogg->offset, boundary);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2009-05-26 11:14:07 +00:00
|
|
|
if (boundary >= 0)
|
2005-03-31 09:43:49 +00:00
|
|
|
end_offset = ogg->offset + boundary;
|
|
|
|
|
|
|
|
while (TRUE) {
|
|
|
|
glong more;
|
|
|
|
|
2009-05-19 10:45:59 +00:00
|
|
|
if (end_offset > 0 && ogg->offset >= end_offset)
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
goto boundary_reached;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
more = ogg_sync_pageseek (&ogg->sync, og);
|
|
|
|
|
2006-08-14 10:49:10 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "pageseek gave %ld", more);
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
if (more < 0) {
|
|
|
|
/* skipped n bytes */
|
|
|
|
ogg->offset -= more;
|
2010-05-05 11:59:57 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "skipped %ld bytes, offset %" G_GINT64_FORMAT,
|
|
|
|
more, ogg->offset);
|
2005-03-31 09:43:49 +00:00
|
|
|
} else if (more == 0) {
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
/* we need more data */
|
2005-03-31 09:43:49 +00:00
|
|
|
if (boundary == 0)
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
goto boundary_reached;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "need more data");
|
2009-05-19 10:45:59 +00:00
|
|
|
ret = gst_ogg_demux_get_data (ogg, end_offset);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
break;
|
2005-03-31 09:43:49 +00:00
|
|
|
} else {
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
gint64 res_offset = ogg->offset;
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
/* got a page. Return the offset at the page beginning,
|
|
|
|
advance the internal offset past the page end */
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (offset)
|
|
|
|
*offset = res_offset;
|
|
|
|
ret = GST_FLOW_OK;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
ogg->offset += more;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ogg,
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
"got page at %" G_GINT64_FORMAT ", serial %08x, end at %"
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
G_GINT64_FORMAT ", granule %" G_GINT64_FORMAT, res_offset,
|
2009-10-09 14:19:17 +00:00
|
|
|
ogg_page_serialno (og), ogg->offset,
|
|
|
|
(gint64) ogg_page_granulepos (og));
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
break;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
}
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "returning %d", ret);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
boundary_reached:
|
|
|
|
{
|
|
|
|
GST_LOG_OBJECT (ogg,
|
|
|
|
"offset %" G_GINT64_FORMAT " >= end_offset %" G_GINT64_FORMAT,
|
|
|
|
ogg->offset, end_offset);
|
|
|
|
return GST_FLOW_LIMIT;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* from the current offset, find the previous page, seeking backwards
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
* until we find the page.
|
|
|
|
*/
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_ogg_demux_get_prev_page (GstOggDemux * ogg, ogg_page * og, gint64 * offset)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GstFlowReturn ret;
|
2005-03-31 09:43:49 +00:00
|
|
|
gint64 begin = ogg->offset;
|
|
|
|
gint64 end = begin;
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
gint64 cur_offset = -1;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2009-04-28 09:24:19 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "getting page before %" G_GINT64_FORMAT, begin);
|
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
while (cur_offset == -1) {
|
2005-03-31 09:43:49 +00:00
|
|
|
begin -= CHUNKSIZE;
|
|
|
|
if (begin < 0)
|
|
|
|
begin = 0;
|
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
/* seek CHUNKSIZE back */
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_ogg_demux_seek (ogg, begin);
|
|
|
|
|
|
|
|
/* now continue reading until we run out of data, if we find a page
|
|
|
|
* start, we save it. It might not be the final page as there could be
|
|
|
|
* another page after this one. */
|
|
|
|
while (ogg->offset < end) {
|
2012-06-14 17:31:51 +00:00
|
|
|
gint64 new_offset, boundary;
|
|
|
|
|
|
|
|
/* An Ogg page cannot be more than a bit less than 64 KB, so we can
|
|
|
|
bound the boundary to that size when searching backwards if we
|
|
|
|
haven't found a page yet. So the most we have to look at is twice
|
|
|
|
the max page size, which is the worst case if we start scanning
|
|
|
|
just after a large page, after which also lies a large page. */
|
|
|
|
boundary = end - ogg->offset;
|
|
|
|
if (boundary > 2 * MAX_OGG_PAGE_SIZE)
|
|
|
|
boundary = 2 * MAX_OGG_PAGE_SIZE;
|
|
|
|
|
|
|
|
ret = gst_ogg_demux_get_next_page (ogg, og, boundary, &new_offset);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
/* we hit the upper limit, offset contains the last page start */
|
2009-04-28 09:24:19 +00:00
|
|
|
if (ret == GST_FLOW_LIMIT) {
|
|
|
|
GST_LOG_OBJECT (ogg, "hit limit");
|
2005-03-31 09:43:49 +00:00
|
|
|
break;
|
2009-04-28 09:24:19 +00:00
|
|
|
}
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
/* something went wrong */
|
2011-10-10 09:39:52 +00:00
|
|
|
if (ret == GST_FLOW_EOS) {
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
new_offset = 0;
|
2009-04-28 09:24:19 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "got unexpected");
|
2012-01-10 16:14:29 +00:00
|
|
|
/* We hit EOS. */
|
|
|
|
goto beach;
|
2009-04-28 09:24:19 +00:00
|
|
|
} else if (ret != GST_FLOW_OK) {
|
|
|
|
GST_LOG_OBJECT (ogg, "got error %d", ret);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
return ret;
|
2009-04-28 09:24:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ogg, "found page at %" G_GINT64_FORMAT, new_offset);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
|
|
|
|
/* offset is next page start */
|
|
|
|
cur_offset = new_offset;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-28 09:24:19 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "found previous page at %" G_GINT64_FORMAT, cur_offset);
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
/* we have the offset. Actually snork and hold the page now */
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
gst_ogg_demux_seek (ogg, cur_offset);
|
|
|
|
ret = gst_ogg_demux_get_next_page (ogg, og, -1, NULL);
|
2009-04-28 09:24:19 +00:00
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
GST_WARNING_OBJECT (ogg, "can't get last page at %" G_GINT64_FORMAT,
|
|
|
|
cur_offset);
|
2005-03-31 09:43:49 +00:00
|
|
|
/* this shouldn't be possible */
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
return ret;
|
2009-04-28 09:24:19 +00:00
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (offset)
|
|
|
|
*offset = cur_offset;
|
|
|
|
|
2012-01-10 16:14:29 +00:00
|
|
|
beach:
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
return ret;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
2004-07-02 03:41:22 +00:00
|
|
|
static gboolean
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_ogg_demux_deactivate_current_chain (GstOggDemux * ogg)
|
2004-07-02 03:41:22 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
gint i;
|
|
|
|
GstOggChain *chain = ogg->current_chain;
|
2004-07-02 03:41:22 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
if (chain == NULL)
|
|
|
|
return TRUE;
|
|
|
|
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "deactivating chain %p", chain);
|
2005-12-18 15:04:21 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
/* send EOS on all the pads */
|
2005-03-31 09:43:49 +00:00
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
2008-11-04 17:24:35 +00:00
|
|
|
GstEvent *event;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2010-01-21 16:32:33 +00:00
|
|
|
if (!pad->added)
|
2008-08-23 15:19:59 +00:00
|
|
|
continue;
|
|
|
|
|
2008-11-04 17:24:35 +00:00
|
|
|
event = gst_event_new_eos ();
|
|
|
|
gst_event_set_seqnum (event, ogg->seqnum);
|
|
|
|
gst_pad_push_event (GST_PAD_CAST (pad), event);
|
2005-12-18 15:04:21 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg, "removing pad %" GST_PTR_FORMAT, pad);
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
|
|
|
|
/* deactivate first */
|
|
|
|
gst_pad_set_active (GST_PAD_CAST (pad), FALSE);
|
|
|
|
|
|
|
|
gst_element_remove_pad (GST_ELEMENT (ogg), GST_PAD_CAST (pad));
|
2010-01-21 16:32:33 +00:00
|
|
|
|
|
|
|
pad->added = FALSE;
|
2004-07-13 10:38:25 +00:00
|
|
|
}
|
2012-01-11 16:17:42 +00:00
|
|
|
|
|
|
|
/* if we cannot seek back to the chain, we can destroy the chain
|
|
|
|
* completely */
|
|
|
|
if (!ogg->pullmode) {
|
|
|
|
gst_ogg_chain_free (chain);
|
|
|
|
}
|
2004-07-13 10:38:25 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2004-07-13 10:38:25 +00:00
|
|
|
|
2013-03-03 17:39:13 +00:00
|
|
|
static GstCaps *
|
2010-12-23 17:18:17 +00:00
|
|
|
gst_ogg_demux_set_header_on_caps (GstOggDemux * ogg, GstCaps * caps,
|
|
|
|
GList * headers)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
GValue array = { 0 };
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ogg, "caps: %" GST_PTR_FORMAT, caps);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (!caps))
|
|
|
|
return NULL;
|
|
|
|
if (G_UNLIKELY (!headers))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
caps = gst_caps_make_writable (caps);
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
|
|
|
|
g_value_init (&array, GST_TYPE_ARRAY);
|
|
|
|
|
|
|
|
while (headers) {
|
|
|
|
GValue value = { 0 };
|
|
|
|
GstBuffer *buffer;
|
|
|
|
ogg_packet *op = headers->data;
|
|
|
|
g_assert (op);
|
|
|
|
buffer = gst_buffer_new_and_alloc (op->bytes);
|
2011-11-10 14:18:54 +00:00
|
|
|
if (op->bytes)
|
|
|
|
gst_buffer_fill (buffer, 0, op->packet, op->bytes);
|
2012-01-30 16:16:17 +00:00
|
|
|
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_HEADER);
|
2010-12-23 17:18:17 +00:00
|
|
|
g_value_init (&value, GST_TYPE_BUFFER);
|
|
|
|
gst_value_take_buffer (&value, buffer);
|
|
|
|
gst_value_array_append_value (&array, &value);
|
|
|
|
g_value_unset (&value);
|
|
|
|
headers = headers->next;
|
|
|
|
}
|
|
|
|
|
2013-03-03 17:39:13 +00:00
|
|
|
gst_structure_take_value (structure, "streamheader", &array);
|
2010-12-23 17:18:17 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "here are the newly set caps: %" GST_PTR_FORMAT, caps);
|
|
|
|
|
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_demux_push_queued_buffers (GstOggDemux * ogg, GstOggPad * pad)
|
|
|
|
{
|
|
|
|
GList *walk;
|
|
|
|
|
|
|
|
/* push queued packets */
|
|
|
|
for (walk = pad->map.queued; walk; walk = g_list_next (walk)) {
|
|
|
|
ogg_packet *p = walk->data;
|
|
|
|
|
|
|
|
gst_ogg_demux_chain_peer (pad, p, TRUE);
|
|
|
|
_ogg_packet_free (p);
|
|
|
|
}
|
|
|
|
/* and free the queued buffers */
|
|
|
|
g_list_free (pad->map.queued);
|
|
|
|
pad->map.queued = NULL;
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
gst_ogg_demux_activate_chain (GstOggDemux * ogg, GstOggChain * chain,
|
|
|
|
GstEvent * event)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
|
|
|
gint i;
|
2010-06-14 09:11:56 +00:00
|
|
|
gint bitrate, idx_bitrate;
|
|
|
|
|
|
|
|
g_return_val_if_fail (chain != NULL, FALSE);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
if (chain == ogg->current_chain) {
|
|
|
|
if (event)
|
|
|
|
gst_event_unref (event);
|
2011-08-13 13:18:56 +00:00
|
|
|
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
gst_ogg_demux_push_queued_buffers (ogg, pad);
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
return TRUE;
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2010-04-30 15:41:05 +00:00
|
|
|
|
2010-06-14 09:11:56 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "activating chain %p", chain);
|
2006-03-09 17:45:39 +00:00
|
|
|
|
2010-06-14 09:11:56 +00:00
|
|
|
bitrate = idx_bitrate = 0;
|
2010-04-30 15:41:05 +00:00
|
|
|
|
2010-06-14 09:11:56 +00:00
|
|
|
/* first add the pads */
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad;
|
2013-07-22 13:24:29 +00:00
|
|
|
GstEvent *ss_event;
|
2012-08-04 10:16:44 +00:00
|
|
|
gchar *stream_id;
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
2010-06-14 09:11:56 +00:00
|
|
|
pad = g_array_index (chain->streams, GstOggPad *, i);
|
2008-08-23 15:19:59 +00:00
|
|
|
|
2010-06-14 09:11:56 +00:00
|
|
|
if (pad->map.idx_bitrate)
|
|
|
|
idx_bitrate = MAX (idx_bitrate, pad->map.idx_bitrate);
|
2010-05-06 08:56:21 +00:00
|
|
|
|
2010-06-14 09:11:56 +00:00
|
|
|
bitrate += pad->map.bitrate;
|
2010-04-30 15:41:05 +00:00
|
|
|
|
2010-06-14 09:11:56 +00:00
|
|
|
/* mark discont */
|
|
|
|
gst_ogg_pad_mark_discont (pad);
|
|
|
|
pad->last_ret = GST_FLOW_OK;
|
2010-05-04 09:19:39 +00:00
|
|
|
|
2012-05-12 13:36:09 +00:00
|
|
|
if (pad->map.is_skeleton || pad->map.is_cmml || pad->added
|
2012-08-04 10:16:44 +00:00
|
|
|
|| !pad->map.caps)
|
2010-06-14 09:11:56 +00:00
|
|
|
continue;
|
2008-08-23 15:19:59 +00:00
|
|
|
|
2010-06-14 09:11:56 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "adding pad %" GST_PTR_FORMAT, pad);
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
2010-06-14 09:11:56 +00:00
|
|
|
/* activate first */
|
|
|
|
gst_pad_set_active (GST_PAD_CAST (pad), TRUE);
|
ext/ogg/gstoggdemux.c: Mark buffers with DISCONT after seek and after activating new chains.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_chain_peer),
(gst_ogg_chain_mark_discont), (gst_ogg_chain_new_stream),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek):
Mark buffers with DISCONT after seek and after activating new
chains.
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_get_query_types), (theora_dec_sink_event),
(theora_dec_push), (theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Fix frame counter.
Detect and mark DISCONT buffers.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_dec_push), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Use GstSegment.
Detect and mark DISCONT buffers.
Don't crash on 0 sized buffers.
2006-05-03 15:34:48 +00:00
|
|
|
|
2012-08-04 10:16:44 +00:00
|
|
|
stream_id =
|
|
|
|
gst_pad_create_stream_id_printf (GST_PAD (pad), GST_ELEMENT_CAST (ogg),
|
|
|
|
"%08x", pad->map.serialno);
|
2013-07-22 13:24:29 +00:00
|
|
|
ss_event =
|
|
|
|
gst_pad_get_sticky_event (ogg->sinkpad, GST_EVENT_STREAM_START, 0);
|
|
|
|
if (ss_event) {
|
|
|
|
if (gst_event_parse_group_id (ss_event, &ogg->group_id))
|
|
|
|
ogg->have_group_id = TRUE;
|
|
|
|
else
|
|
|
|
ogg->have_group_id = FALSE;
|
|
|
|
gst_event_unref (ss_event);
|
|
|
|
} else if (!ogg->have_group_id) {
|
|
|
|
ogg->have_group_id = TRUE;
|
|
|
|
ogg->group_id = gst_util_group_id_next ();
|
|
|
|
}
|
|
|
|
ss_event = gst_event_new_stream_start (stream_id);
|
|
|
|
if (ogg->have_group_id)
|
|
|
|
gst_event_set_group_id (ss_event, ogg->group_id);
|
|
|
|
|
|
|
|
gst_pad_push_event (GST_PAD (pad), ss_event);
|
2012-08-04 10:16:44 +00:00
|
|
|
g_free (stream_id);
|
|
|
|
|
|
|
|
/* Set headers on caps */
|
|
|
|
pad->map.caps =
|
|
|
|
gst_ogg_demux_set_header_on_caps (ogg, pad->map.caps, pad->map.headers);
|
|
|
|
gst_pad_set_caps (GST_PAD_CAST (pad), pad->map.caps);
|
|
|
|
|
2010-06-14 09:11:56 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (ogg), GST_PAD_CAST (pad));
|
|
|
|
pad->added = TRUE;
|
2005-07-14 18:13:08 +00:00
|
|
|
}
|
2010-06-14 09:11:56 +00:00
|
|
|
/* prefer the index bitrate over the ones encoded in the streams */
|
|
|
|
ogg->bitrate = (idx_bitrate ? idx_bitrate : bitrate);
|
2005-07-14 18:13:08 +00:00
|
|
|
|
2008-04-02 14:58:05 +00:00
|
|
|
/* after adding the new pads, remove the old pads */
|
|
|
|
gst_ogg_demux_deactivate_current_chain (ogg);
|
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "Setting current chain to %p", chain);
|
2005-07-14 18:13:08 +00:00
|
|
|
ogg->current_chain = chain;
|
|
|
|
|
2008-04-02 14:58:05 +00:00
|
|
|
/* we are finished now */
|
|
|
|
gst_element_no_more_pads (GST_ELEMENT (ogg));
|
|
|
|
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "starting chain");
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
|
2010-01-25 13:00:52 +00:00
|
|
|
/* then send out any headers and queued packets */
|
2005-07-14 18:13:08 +00:00
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
2010-01-08 15:57:40 +00:00
|
|
|
GList *walk;
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
GstOggPad *pad;
|
2012-08-04 10:16:44 +00:00
|
|
|
GstTagList *tags;
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
2005-07-14 18:13:08 +00:00
|
|
|
pad = g_array_index (chain->streams, GstOggPad *, i);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-08-04 10:16:44 +00:00
|
|
|
/* Skip pads that were not added, e.g. Skeleton streams */
|
|
|
|
if (!pad->added)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* FIXME, must be sent from the streaming thread */
|
|
|
|
if (event)
|
|
|
|
gst_pad_push_event (GST_PAD_CAST (pad), gst_event_ref (event));
|
|
|
|
|
2010-10-27 08:58:16 +00:00
|
|
|
/* FIXME also streaming thread */
|
|
|
|
if (pad->map.taglist) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "pushing tags");
|
2011-11-02 11:08:22 +00:00
|
|
|
gst_pad_push_event (GST_PAD_CAST (pad),
|
2012-07-27 21:59:31 +00:00
|
|
|
gst_event_new_tag (pad->map.taglist));
|
2010-10-27 08:58:16 +00:00
|
|
|
pad->map.taglist = NULL;
|
|
|
|
}
|
|
|
|
|
2012-08-04 10:16:44 +00:00
|
|
|
tags = gst_tag_list_new (GST_TAG_CONTAINER_FORMAT, "Ogg", NULL);
|
|
|
|
gst_tag_list_set_scope (tags, GST_TAG_SCOPE_GLOBAL);
|
|
|
|
gst_pad_push_event (GST_PAD (pad), gst_event_new_tag (tags));
|
2010-12-23 17:18:17 +00:00
|
|
|
|
2010-01-08 15:57:40 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "pushing headers");
|
2010-01-25 13:00:52 +00:00
|
|
|
/* push headers */
|
2010-01-08 15:57:40 +00:00
|
|
|
for (walk = pad->map.headers; walk; walk = g_list_next (walk)) {
|
2010-01-23 13:46:19 +00:00
|
|
|
ogg_packet *p = walk->data;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2010-01-25 13:00:52 +00:00
|
|
|
gst_ogg_demux_chain_peer (pad, p, TRUE);
|
2010-01-08 15:57:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg, "pushing queued buffers");
|
2011-08-13 13:18:56 +00:00
|
|
|
gst_ogg_demux_push_queued_buffers (ogg, pad);
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
2012-08-04 10:16:44 +00:00
|
|
|
|
|
|
|
if (event)
|
|
|
|
gst_event_unref (event);
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2009-12-07 14:42:05 +00:00
|
|
|
do_binary_search (GstOggDemux * ogg, GstOggChain * chain, gint64 begin,
|
|
|
|
gint64 end, gint64 begintime, gint64 endtime, gint64 target,
|
2013-07-13 23:42:52 +00:00
|
|
|
gint64 * offset, gboolean only_serial_no, gint serialno)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
|
|
|
gint64 best;
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GstFlowReturn ret;
|
2009-12-07 14:42:05 +00:00
|
|
|
gint64 result = 0;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
best = begin;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
2010-05-05 11:59:57 +00:00
|
|
|
"chain offset %" G_GINT64_FORMAT ", end offset %" G_GINT64_FORMAT,
|
|
|
|
begin, end);
|
2005-03-31 09:43:49 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"chain begin time %" GST_TIME_FORMAT ", end time %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (begintime), GST_TIME_ARGS (endtime));
|
|
|
|
GST_DEBUG_OBJECT (ogg, "target %" GST_TIME_FORMAT, GST_TIME_ARGS (target));
|
|
|
|
|
|
|
|
/* perform the seek */
|
|
|
|
while (begin < end) {
|
|
|
|
gint64 bisect;
|
|
|
|
|
|
|
|
if ((end - begin < CHUNKSIZE) || (endtime == begintime)) {
|
|
|
|
bisect = begin;
|
|
|
|
} else {
|
|
|
|
/* take a (pretty decent) guess, avoiding overflow */
|
|
|
|
gint64 rate = (end - begin) * GST_MSECOND / (endtime - begintime);
|
|
|
|
|
|
|
|
bisect = (target - begintime) / GST_MSECOND * rate + begin - CHUNKSIZE;
|
|
|
|
|
|
|
|
if (bisect <= begin)
|
ext/: Don't crap out when seeking back to position 0.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_sink_activate):
* ext/vorbis/vorbisdec.c: (vorbis_dec_convert),
(vorbis_dec_src_query), (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain):
Don't crap out when seeking back to position 0.
2005-04-28 17:13:47 +00:00
|
|
|
bisect = begin;
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "Initial guess: %" G_GINT64_FORMAT, bisect);
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
gst_ogg_demux_seek (ogg, bisect);
|
|
|
|
|
|
|
|
while (begin < end) {
|
|
|
|
ogg_page og;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"after seek, bisect %" G_GINT64_FORMAT ", begin %" G_GINT64_FORMAT
|
|
|
|
", end %" G_GINT64_FORMAT, bisect, begin, end);
|
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
ret = gst_ogg_demux_get_next_page (ogg, &og, end - ogg->offset, &result);
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "looking for next page returned %" G_GINT64_FORMAT,
|
|
|
|
result);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (ret == GST_FLOW_LIMIT) {
|
|
|
|
/* we hit the upper limit, go back a bit */
|
2005-03-31 09:43:49 +00:00
|
|
|
if (bisect <= begin + 1) {
|
|
|
|
end = begin; /* found it */
|
|
|
|
} else {
|
|
|
|
if (bisect == 0)
|
|
|
|
goto seek_error;
|
|
|
|
|
|
|
|
bisect -= CHUNKSIZE;
|
|
|
|
if (bisect <= begin)
|
|
|
|
bisect = begin + 1;
|
|
|
|
|
|
|
|
gst_ogg_demux_seek (ogg, bisect);
|
|
|
|
}
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
} else if (ret == GST_FLOW_OK) {
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
/* found offset of next ogg page */
|
2005-03-31 09:43:49 +00:00
|
|
|
gint64 granulepos;
|
|
|
|
GstClockTime granuletime;
|
|
|
|
GstOggPad *pad;
|
|
|
|
|
2009-12-07 14:42:05 +00:00
|
|
|
/* get the granulepos */
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "found next ogg page at %" G_GINT64_FORMAT,
|
|
|
|
result);
|
2005-03-31 09:43:49 +00:00
|
|
|
granulepos = ogg_page_granulepos (&og);
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
if (granulepos == -1) {
|
|
|
|
GST_LOG_OBJECT (ogg, "granulepos of next page is -1");
|
2005-03-31 09:43:49 +00:00
|
|
|
continue;
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2013-07-13 23:42:52 +00:00
|
|
|
/* Avoid seeking to an incorrect granuletime by only considering
|
|
|
|
the stream for which we found the earliest time */
|
|
|
|
if (only_serial_no && ogg_page_serialno (&og) != serialno)
|
|
|
|
continue;
|
|
|
|
|
2009-12-07 14:42:05 +00:00
|
|
|
/* get the stream */
|
2005-03-31 09:43:49 +00:00
|
|
|
pad = gst_ogg_chain_get_stream (chain, ogg_page_serialno (&og));
|
2009-08-29 17:51:48 +00:00
|
|
|
if (pad == NULL || pad->map.is_skeleton)
|
2005-03-31 09:43:49 +00:00
|
|
|
continue;
|
|
|
|
|
2009-12-07 14:42:05 +00:00
|
|
|
/* convert granulepos to time */
|
2009-08-29 17:51:48 +00:00
|
|
|
granuletime = gst_ogg_stream_get_end_time_for_granulepos (&pad->map,
|
|
|
|
granulepos);
|
|
|
|
if (granuletime < pad->start_time)
|
|
|
|
continue;
|
2009-12-07 14:42:05 +00:00
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "granulepos %" G_GINT64_FORMAT " maps to time %"
|
|
|
|
GST_TIME_FORMAT, granulepos, GST_TIME_ARGS (granuletime));
|
ext/ogg/gstoggdemux.c: Annodex support in ogg demuxer. Doesn't do very much without the other annodex patches (to come).
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_parse_skeleton_fishead),
(gst_ogg_pad_parse_skeleton_fisbone), (gst_ogg_pad_query_convert),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_read_chain),
(gst_ogg_demux_read_end_chain), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_change_state), (gst_annodex_granule_to_time):
Annodex support in ogg demuxer. Doesn't do very much without the
other annodex patches (to come).
2006-02-24 17:31:53 +00:00
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
granuletime -= pad->start_time;
|
2010-02-23 10:41:20 +00:00
|
|
|
granuletime += chain->begin_time;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"found page with granule %" G_GINT64_FORMAT " and time %"
|
|
|
|
GST_TIME_FORMAT, granulepos, GST_TIME_ARGS (granuletime));
|
|
|
|
|
|
|
|
if (granuletime < target) {
|
|
|
|
best = result; /* raw offset of packet with granulepos */
|
|
|
|
begin = ogg->offset; /* raw offset of next page */
|
|
|
|
begintime = granuletime;
|
|
|
|
|
|
|
|
bisect = begin; /* *not* begin + 1 */
|
|
|
|
} else {
|
|
|
|
if (bisect <= begin + 1) {
|
|
|
|
end = begin; /* found it */
|
|
|
|
} else {
|
|
|
|
if (end == ogg->offset) { /* we're pretty close - we'd be stuck in */
|
|
|
|
end = result;
|
|
|
|
bisect -= CHUNKSIZE; /* an endless loop otherwise. */
|
|
|
|
if (bisect <= begin)
|
|
|
|
bisect = begin + 1;
|
|
|
|
gst_ogg_demux_seek (ogg, bisect);
|
|
|
|
} else {
|
|
|
|
end = result;
|
|
|
|
endtime = granuletime;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
} else
|
|
|
|
goto seek_error;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
}
|
2009-04-28 09:24:19 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "seeking to %" G_GINT64_FORMAT, best);
|
|
|
|
gst_ogg_demux_seek (ogg, best);
|
2009-12-07 14:42:05 +00:00
|
|
|
*offset = best;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
seek_error:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ogg, "got a seek error");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-02 10:16:39 +00:00
|
|
|
static gboolean
|
|
|
|
do_index_search (GstOggDemux * ogg, GstOggChain * chain, gint64 begin,
|
|
|
|
gint64 end, gint64 begintime, gint64 endtime, gint64 target,
|
|
|
|
gint64 * p_offset, gint64 * p_timestamp)
|
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
guint64 timestamp, offset;
|
|
|
|
guint64 r_timestamp, r_offset;
|
|
|
|
gboolean result = FALSE;
|
|
|
|
|
|
|
|
target -= begintime;
|
|
|
|
|
|
|
|
r_offset = -1;
|
|
|
|
r_timestamp = -1;
|
|
|
|
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
|
|
|
|
timestamp = target;
|
|
|
|
if (gst_ogg_map_search_index (&pad->map, TRUE, ×tamp, &offset)) {
|
|
|
|
GST_INFO ("found %" G_GUINT64_FORMAT " at offset %" G_GUINT64_FORMAT,
|
|
|
|
timestamp, offset);
|
|
|
|
|
|
|
|
if (r_offset == -1 || offset < r_offset) {
|
|
|
|
r_offset = offset;
|
|
|
|
r_timestamp = timestamp;
|
|
|
|
}
|
|
|
|
result |= TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p_timestamp)
|
|
|
|
*p_timestamp = r_timestamp;
|
|
|
|
if (p_offset)
|
|
|
|
*p_offset = r_offset;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2009-12-07 14:42:05 +00:00
|
|
|
/*
|
|
|
|
* do seek to time @position, return FALSE or chain and TRUE
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
gst_ogg_demux_do_seek (GstOggDemux * ogg, GstSegment * segment,
|
|
|
|
gboolean accurate, gboolean keyframe, GstOggChain ** rchain)
|
|
|
|
{
|
|
|
|
guint64 position;
|
|
|
|
GstOggChain *chain = NULL;
|
|
|
|
gint64 begin, end;
|
|
|
|
gint64 begintime, endtime;
|
2009-12-07 17:49:43 +00:00
|
|
|
gint64 target, keytarget;
|
2010-05-04 11:36:58 +00:00
|
|
|
gint64 best;
|
2009-12-07 14:42:05 +00:00
|
|
|
gint64 total;
|
|
|
|
gint64 result = 0;
|
|
|
|
GstFlowReturn ret;
|
2013-07-13 18:45:01 +00:00
|
|
|
gint i, pending;
|
2013-07-13 23:42:52 +00:00
|
|
|
gint serialno = 0;
|
2009-12-07 14:42:05 +00:00
|
|
|
|
2011-05-16 11:48:11 +00:00
|
|
|
position = segment->position;
|
2009-12-07 14:42:05 +00:00
|
|
|
|
|
|
|
/* first find the chain to search in */
|
|
|
|
total = ogg->total_time;
|
|
|
|
if (ogg->chains->len == 0)
|
|
|
|
goto no_chains;
|
|
|
|
|
|
|
|
for (i = ogg->chains->len - 1; i >= 0; i--) {
|
|
|
|
chain = g_array_index (ogg->chains, GstOggChain *, i);
|
|
|
|
total -= chain->total_time;
|
|
|
|
if (position >= total)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* first step, locate page containing the required data */
|
|
|
|
begin = chain->offset;
|
|
|
|
end = chain->end_offset;
|
|
|
|
begintime = chain->begin_time;
|
|
|
|
endtime = begintime + chain->total_time;
|
|
|
|
target = position - total + begintime;
|
|
|
|
|
|
|
|
if (!do_binary_search (ogg, chain, begin, end, begintime, endtime, target,
|
2013-07-13 18:45:01 +00:00
|
|
|
&best, FALSE, 0))
|
2009-12-07 14:42:05 +00:00
|
|
|
goto seek_error;
|
|
|
|
|
|
|
|
/* second step: find pages for all streams, we use the keyframe_granule to keep
|
|
|
|
* track of which ones we saw. If we have seen a page for each stream we can
|
|
|
|
* calculate the positions of each keyframe. */
|
|
|
|
GST_DEBUG_OBJECT (ogg, "find keyframes");
|
2013-07-13 18:45:01 +00:00
|
|
|
pending = chain->streams->len;
|
2009-12-07 14:42:05 +00:00
|
|
|
|
2009-12-07 17:49:43 +00:00
|
|
|
/* figure out where the keyframes are */
|
|
|
|
keytarget = target;
|
|
|
|
|
2009-12-07 14:42:05 +00:00
|
|
|
while (TRUE) {
|
|
|
|
ogg_page og;
|
|
|
|
gint64 granulepos;
|
|
|
|
GstOggPad *pad;
|
2009-12-07 17:49:43 +00:00
|
|
|
GstClockTime keyframe_time, granule_time;
|
2009-12-07 14:42:05 +00:00
|
|
|
|
|
|
|
ret = gst_ogg_demux_get_next_page (ogg, &og, end - ogg->offset, &result);
|
|
|
|
GST_LOG_OBJECT (ogg, "looking for next page returned %" G_GINT64_FORMAT,
|
|
|
|
result);
|
|
|
|
if (ret == GST_FLOW_LIMIT) {
|
|
|
|
GST_LOG_OBJECT (ogg, "reached limit");
|
|
|
|
break;
|
2010-06-24 14:55:57 +00:00
|
|
|
} else if (ret != GST_FLOW_OK)
|
|
|
|
goto seek_error;
|
2009-12-07 14:42:05 +00:00
|
|
|
|
|
|
|
/* get the stream */
|
|
|
|
pad = gst_ogg_chain_get_stream (chain, ogg_page_serialno (&og));
|
|
|
|
if (pad == NULL)
|
|
|
|
continue;
|
|
|
|
|
2012-05-12 13:36:09 +00:00
|
|
|
if (pad->map.is_skeleton || pad->map.is_cmml)
|
2009-12-07 14:42:05 +00:00
|
|
|
goto next;
|
|
|
|
|
|
|
|
granulepos = ogg_page_granulepos (&og);
|
2011-01-05 23:54:15 +00:00
|
|
|
if (granulepos == -1 || granulepos == 0) {
|
2009-12-07 14:42:05 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "granulepos of next page is -1");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-12-07 17:49:43 +00:00
|
|
|
/* in reverse we want to go past the page with the lower timestamp */
|
|
|
|
if (segment->rate < 0.0) {
|
|
|
|
/* get time for this pad */
|
|
|
|
granule_time = gst_ogg_stream_get_end_time_for_granulepos (&pad->map,
|
|
|
|
granulepos);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ogg,
|
|
|
|
"looking at page with ts %" GST_TIME_FORMAT ", target %"
|
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (granule_time),
|
|
|
|
GST_TIME_ARGS (target));
|
|
|
|
if (granule_time < target)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we've seen this pad before */
|
|
|
|
if (pad->keyframe_granule != -1)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* convert granule of this pad to the granule of the keyframe */
|
2010-05-05 11:59:57 +00:00
|
|
|
pad->keyframe_granule =
|
|
|
|
gst_ogg_stream_granulepos_to_key_granule (&pad->map, granulepos);
|
2009-12-07 14:42:05 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "marking stream granule %" G_GINT64_FORMAT,
|
|
|
|
pad->keyframe_granule);
|
|
|
|
|
2009-12-07 17:49:43 +00:00
|
|
|
/* get time of the keyframe */
|
|
|
|
keyframe_time =
|
|
|
|
gst_ogg_stream_granule_to_time (&pad->map, pad->keyframe_granule);
|
2011-08-17 17:03:16 +00:00
|
|
|
GST_LOG_OBJECT (ogg,
|
2011-08-18 15:20:57 +00:00
|
|
|
"stream %08x granule time %" GST_TIME_FORMAT,
|
2009-12-07 17:49:43 +00:00
|
|
|
pad->map.serialno, GST_TIME_ARGS (keyframe_time));
|
|
|
|
|
|
|
|
/* collect smallest value */
|
2010-01-18 18:22:52 +00:00
|
|
|
if (keyframe_time != -1) {
|
|
|
|
keyframe_time += begintime;
|
2013-07-13 23:42:52 +00:00
|
|
|
if (keyframe_time < keytarget) {
|
|
|
|
serialno = pad->map.serialno;
|
2010-01-18 18:22:52 +00:00
|
|
|
keytarget = keyframe_time;
|
2013-07-13 23:42:52 +00:00
|
|
|
}
|
2010-01-18 18:22:52 +00:00
|
|
|
}
|
2009-12-07 17:49:43 +00:00
|
|
|
|
2009-12-07 14:42:05 +00:00
|
|
|
next:
|
|
|
|
pending--;
|
|
|
|
if (pending == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-12-07 17:49:43 +00:00
|
|
|
/* for negative rates we will get to the keyframe backwards */
|
|
|
|
if (segment->rate < 0.0)
|
|
|
|
goto done;
|
2009-12-07 14:42:05 +00:00
|
|
|
|
2009-12-07 17:49:43 +00:00
|
|
|
if (keytarget != target) {
|
|
|
|
GST_LOG_OBJECT (ogg, "final seek to target %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (keytarget));
|
2009-12-07 14:42:05 +00:00
|
|
|
|
2009-12-07 17:49:43 +00:00
|
|
|
/* last step, seek to the location of the keyframe */
|
|
|
|
if (!do_binary_search (ogg, chain, begin, end, begintime, endtime,
|
2013-07-13 23:42:52 +00:00
|
|
|
keytarget, &best, TRUE, serialno))
|
2009-12-07 17:49:43 +00:00
|
|
|
goto seek_error;
|
|
|
|
} else {
|
|
|
|
/* seek back to previous position */
|
|
|
|
GST_LOG_OBJECT (ogg, "keyframe on target");
|
|
|
|
gst_ogg_demux_seek (ogg, best);
|
2009-12-07 14:42:05 +00:00
|
|
|
}
|
|
|
|
|
2009-12-07 17:49:43 +00:00
|
|
|
done:
|
2009-12-07 14:42:05 +00:00
|
|
|
if (keyframe) {
|
2009-12-07 17:49:43 +00:00
|
|
|
if (segment->rate > 0.0)
|
|
|
|
segment->time = keytarget;
|
2011-05-16 11:48:11 +00:00
|
|
|
segment->position = keytarget - begintime;
|
2009-12-07 14:42:05 +00:00
|
|
|
}
|
|
|
|
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
*rchain = chain;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
no_chains:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ogg, "no chains");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
seek_error:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ogg, "got a seek error");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-10 19:13:30 +00:00
|
|
|
/* does not take ownership of the event */
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
static gboolean
|
2010-04-30 16:03:37 +00:00
|
|
|
gst_ogg_demux_perform_seek_pull (GstOggDemux * ogg, GstEvent * event)
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
{
|
|
|
|
GstOggChain *chain = NULL;
|
|
|
|
gboolean res;
|
2009-12-07 14:42:05 +00:00
|
|
|
gboolean flush, accurate, keyframe;
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
GstFormat format;
|
|
|
|
gdouble rate;
|
|
|
|
GstSeekFlags flags;
|
2012-07-27 13:21:51 +00:00
|
|
|
GstSeekType start_type, stop_type;
|
|
|
|
gint64 start, stop;
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
gboolean update;
|
2008-11-04 17:24:35 +00:00
|
|
|
guint32 seqnum;
|
|
|
|
GstEvent *tevent;
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
|
|
|
|
if (event) {
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "seek with event");
|
|
|
|
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
gst_event_parse_seek (event, &rate, &format, &flags,
|
2012-07-27 13:21:51 +00:00
|
|
|
&start_type, &start, &stop_type, &stop);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
/* we can only seek on time */
|
|
|
|
if (format != GST_FORMAT_TIME) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "can only seek on TIME");
|
|
|
|
goto error;
|
|
|
|
}
|
2008-11-04 17:24:35 +00:00
|
|
|
seqnum = gst_event_get_seqnum (event);
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
} else {
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "seek without event");
|
|
|
|
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
flags = 0;
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
rate = 1.0;
|
2008-11-04 17:24:35 +00:00
|
|
|
seqnum = gst_util_seqnum_next ();
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg, "seek, rate %g", rate);
|
|
|
|
|
|
|
|
flush = flags & GST_SEEK_FLAG_FLUSH;
|
|
|
|
accurate = flags & GST_SEEK_FLAG_ACCURATE;
|
2009-12-07 14:42:05 +00:00
|
|
|
keyframe = flags & GST_SEEK_FLAG_KEY_UNIT;
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
|
|
|
|
/* first step is to unlock the streaming thread if it is
|
|
|
|
* blocked in a chain call, we do this by starting the flush. because
|
|
|
|
* we cannot yet hold any streaming lock, we have to protect the chains
|
|
|
|
* with their own lock. */
|
|
|
|
if (flush) {
|
|
|
|
gint i;
|
|
|
|
|
2008-11-04 17:24:35 +00:00
|
|
|
tevent = gst_event_new_flush_start ();
|
|
|
|
gst_event_set_seqnum (tevent, seqnum);
|
|
|
|
|
|
|
|
gst_event_ref (tevent);
|
|
|
|
gst_pad_push_event (ogg->sinkpad, tevent);
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
|
|
|
|
GST_CHAIN_LOCK (ogg);
|
|
|
|
for (i = 0; i < ogg->chains->len; i++) {
|
|
|
|
GstOggChain *chain = g_array_index (ogg->chains, GstOggChain *, i);
|
|
|
|
gint j;
|
|
|
|
|
|
|
|
for (j = 0; j < chain->streams->len; j++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, j);
|
|
|
|
|
2008-11-04 17:24:35 +00:00
|
|
|
gst_event_ref (tevent);
|
|
|
|
gst_pad_push_event (GST_PAD (pad), tevent);
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
GST_CHAIN_UNLOCK (ogg);
|
2008-11-04 17:24:35 +00:00
|
|
|
|
|
|
|
gst_event_unref (tevent);
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
} else {
|
|
|
|
gst_pad_pause_task (ogg->sinkpad);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now grab the stream lock so that streaming cannot continue, for
|
|
|
|
* non flushing seeks when the element is in PAUSED this could block
|
|
|
|
* forever. */
|
|
|
|
GST_PAD_STREAM_LOCK (ogg->sinkpad);
|
|
|
|
|
|
|
|
if (event) {
|
2011-05-16 11:48:11 +00:00
|
|
|
gst_segment_do_seek (&ogg->segment, rate, format, flags,
|
2012-07-27 13:21:51 +00:00
|
|
|
start_type, start, stop_type, stop, &update);
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
}
|
|
|
|
|
ext/ogg/gstoggdemux.c: Add some more debugging.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_demux_receive_event), (gst_ogg_pad_event),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_submit_buffer), (gst_ogg_demux_get_data),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain):
Add some more debugging.
2006-04-10 15:17:24 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "segment positions set to %" GST_TIME_FORMAT "-%"
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (ogg->segment.start),
|
|
|
|
GST_TIME_ARGS (ogg->segment.stop));
|
|
|
|
|
|
|
|
/* we need to stop flushing on the srcpad as we're going to use it
|
|
|
|
* next. We can do this as we have the STREAM lock now. */
|
2008-11-04 17:24:35 +00:00
|
|
|
if (flush) {
|
2011-06-10 09:59:53 +00:00
|
|
|
tevent = gst_event_new_flush_stop (TRUE);
|
2008-11-04 17:24:35 +00:00
|
|
|
gst_event_set_seqnum (tevent, seqnum);
|
|
|
|
gst_pad_push_event (ogg->sinkpad, tevent);
|
|
|
|
}
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
/* reset all ogg streams now, need to do this from within the lock to
|
|
|
|
* make sure the streaming thread is not messing with the stream */
|
|
|
|
for (i = 0; i < ogg->chains->len; i++) {
|
|
|
|
GstOggChain *chain = g_array_index (ogg->chains, GstOggChain *, i);
|
|
|
|
|
2006-11-24 15:40:58 +00:00
|
|
|
gst_ogg_chain_reset (chain);
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-04 17:24:35 +00:00
|
|
|
/* for reverse we will already seek accurately */
|
2009-12-07 14:42:05 +00:00
|
|
|
res = gst_ogg_demux_do_seek (ogg, &ogg->segment, accurate, keyframe, &chain);
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
|
2006-08-14 10:49:10 +00:00
|
|
|
/* seek failed, make sure we continue the current chain */
|
|
|
|
if (!res) {
|
2009-03-13 14:26:40 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "seek failed");
|
2006-08-14 10:49:10 +00:00
|
|
|
chain = ogg->current_chain;
|
2009-03-13 14:26:40 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "seek success");
|
2006-08-14 10:49:10 +00:00
|
|
|
}
|
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (!chain)
|
|
|
|
goto no_chain;
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
/* now we have a new position, prepare for streaming again */
|
|
|
|
{
|
|
|
|
GstEvent *event;
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
gint64 stop;
|
2006-06-02 14:07:42 +00:00
|
|
|
gint64 start;
|
2011-05-16 11:48:11 +00:00
|
|
|
gint64 position, begin_time;
|
|
|
|
GstSegment segment;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
/* we have to send the flush to the old chain, not the new one */
|
2008-11-04 17:24:35 +00:00
|
|
|
if (flush) {
|
2011-06-10 09:59:53 +00:00
|
|
|
tevent = gst_event_new_flush_stop (TRUE);
|
2008-11-04 17:24:35 +00:00
|
|
|
gst_event_set_seqnum (tevent, seqnum);
|
|
|
|
gst_ogg_demux_send_event (ogg, tevent);
|
|
|
|
}
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
|
2007-05-15 16:46:10 +00:00
|
|
|
/* we need this to see how far inside the chain we need to start */
|
|
|
|
if (chain->begin_time != GST_CLOCK_TIME_NONE)
|
|
|
|
begin_time = chain->begin_time;
|
|
|
|
else
|
|
|
|
begin_time = 0;
|
2006-04-26 17:17:39 +00:00
|
|
|
|
2007-05-15 16:46:10 +00:00
|
|
|
/* segment.start gives the start over all chains, we calculate the amount
|
|
|
|
* of time into this chain we need to start */
|
|
|
|
start = ogg->segment.start - begin_time;
|
2006-06-02 14:07:42 +00:00
|
|
|
if (chain->segment_start != GST_CLOCK_TIME_NONE)
|
|
|
|
start += chain->segment_start;
|
|
|
|
|
2007-05-15 16:46:10 +00:00
|
|
|
if ((stop = ogg->segment.stop) == -1)
|
|
|
|
stop = ogg->segment.duration;
|
|
|
|
|
|
|
|
/* segment.stop gives the stop time over all chains, calculate the amount of
|
|
|
|
* time we need to stop in this chain */
|
|
|
|
if (stop != -1) {
|
|
|
|
if (stop > begin_time)
|
|
|
|
stop -= begin_time;
|
|
|
|
else
|
|
|
|
stop = 0;
|
|
|
|
stop += chain->segment_start;
|
|
|
|
/* we must stop when this chain ends and switch to the next chain to play
|
|
|
|
* the remainder of the segment. */
|
|
|
|
stop = MIN (stop, chain->segment_stop);
|
|
|
|
}
|
|
|
|
|
2011-05-16 11:48:11 +00:00
|
|
|
position = ogg->segment.position;
|
2006-11-09 00:50:00 +00:00
|
|
|
if (chain->segment_start != GST_CLOCK_TIME_NONE)
|
2011-05-16 11:48:11 +00:00
|
|
|
position += chain->segment_start;
|
2006-11-09 00:50:00 +00:00
|
|
|
|
2011-05-16 11:48:11 +00:00
|
|
|
gst_segment_copy_into (&ogg->segment, &segment);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2011-05-16 11:48:11 +00:00
|
|
|
/* create the segment event we are going to send out */
|
|
|
|
if (ogg->segment.rate >= 0.0) {
|
|
|
|
segment.start = position;
|
|
|
|
segment.stop = stop;
|
|
|
|
} else {
|
|
|
|
segment.start = start;
|
|
|
|
segment.stop = position;
|
|
|
|
}
|
|
|
|
event = gst_event_new_segment (&segment);
|
2008-11-04 17:24:35 +00:00
|
|
|
gst_event_set_seqnum (event, seqnum);
|
|
|
|
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
if (chain != ogg->current_chain) {
|
2006-04-26 17:17:39 +00:00
|
|
|
/* switch to different chain, send segment on new chain */
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
gst_ogg_demux_activate_chain (ogg, chain, event);
|
|
|
|
} else {
|
ext/ogg/gstoggdemux.c: Mark buffers with DISCONT after seek and after activating new chains.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_chain_peer),
(gst_ogg_chain_mark_discont), (gst_ogg_chain_new_stream),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek):
Mark buffers with DISCONT after seek and after activating new
chains.
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_get_query_types), (theora_dec_sink_event),
(theora_dec_push), (theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Fix frame counter.
Detect and mark DISCONT buffers.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_dec_push), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Use GstSegment.
Detect and mark DISCONT buffers.
Don't crash on 0 sized buffers.
2006-05-03 15:34:48 +00:00
|
|
|
/* mark discont and send segment on current chain */
|
|
|
|
gst_ogg_chain_mark_discont (chain);
|
2006-08-31 12:31:00 +00:00
|
|
|
/* This event should be sent from the streaming thread (sink pad task) */
|
|
|
|
if (ogg->newsegment)
|
|
|
|
gst_event_unref (ogg->newsegment);
|
|
|
|
ogg->newsegment = event;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
|
|
|
/* notify start of new segment */
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
if (ogg->segment.flags & GST_SEEK_FLAG_SEGMENT) {
|
2008-11-04 17:24:35 +00:00
|
|
|
GstMessage *message;
|
|
|
|
|
|
|
|
message = gst_message_new_segment_start (GST_OBJECT (ogg),
|
2011-05-16 11:48:11 +00:00
|
|
|
GST_FORMAT_TIME, ogg->segment.position);
|
2008-11-04 17:24:35 +00:00
|
|
|
gst_message_set_seqnum (message, seqnum);
|
|
|
|
|
|
|
|
gst_element_post_message (GST_ELEMENT (ogg), message);
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
}
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
|
2008-11-04 17:24:35 +00:00
|
|
|
ogg->seqnum = seqnum;
|
2005-03-31 09:43:49 +00:00
|
|
|
/* restart our task since it might have been stopped when we did the
|
|
|
|
* flush. */
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
gst_pad_start_task (ogg->sinkpad, (GstTaskFunction) gst_ogg_demux_loop,
|
2012-06-20 08:33:24 +00:00
|
|
|
ogg->sinkpad, NULL);
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* streaming can continue now */
|
2005-11-21 17:29:00 +00:00
|
|
|
GST_PAD_STREAM_UNLOCK (ogg->sinkpad);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2006-08-14 10:49:10 +00:00
|
|
|
return res;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2010-05-04 11:05:51 +00:00
|
|
|
/* ERRORS */
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
error:
|
2005-10-18 13:20:29 +00:00
|
|
|
{
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "seek failed");
|
2005-10-18 13:20:29 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
no_chain:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ogg, "no chain to seek in");
|
|
|
|
GST_PAD_STREAM_UNLOCK (ogg->sinkpad);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
static gboolean
|
|
|
|
gst_ogg_demux_get_duration_push (GstOggDemux * ogg, int flags)
|
|
|
|
{
|
|
|
|
/* In push mode, we get to the end of the stream to get the duration */
|
|
|
|
gint64 position;
|
|
|
|
GstEvent *sevent;
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
/* A full Ogg page can be almost 64 KB. There's no guarantee that there'll be a
|
|
|
|
granpos there, but it's fairly likely */
|
|
|
|
position =
|
|
|
|
ogg->push_byte_length - DURATION_CHUNK_OFFSET - EOS_AVOIDANCE_THRESHOLD;
|
|
|
|
if (position < 0)
|
|
|
|
position = 0;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Getting duration, seeking near the end, to %" G_GINT64_FORMAT, position);
|
|
|
|
ogg->push_state = PUSH_DURATION;
|
|
|
|
/* do not read the last byte */
|
|
|
|
sevent = gst_event_new_seek (1.0, GST_FORMAT_BYTES, flags, GST_SEEK_TYPE_SET,
|
|
|
|
position, GST_SEEK_TYPE_SET, ogg->push_byte_length - 1);
|
|
|
|
res = gst_pad_push_event (ogg->sinkpad, sevent);
|
|
|
|
if (res) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Seek succesful");
|
|
|
|
return TRUE;
|
|
|
|
} else {
|
|
|
|
GST_INFO_OBJECT (ogg, "Seek failed, duration will stay unknown");
|
|
|
|
ogg->push_state = PUSH_PLAYING;
|
2011-10-16 10:32:41 +00:00
|
|
|
ogg->push_disable_seeking = TRUE;
|
2011-08-13 13:18:56 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_ogg_demux_check_duration_push (GstOggDemux * ogg, GstSeekFlags flags,
|
|
|
|
GstEvent * event)
|
|
|
|
{
|
|
|
|
if (ogg->push_byte_length < 0) {
|
|
|
|
GstPad *peer;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Trying to find byte/time length");
|
|
|
|
if ((peer = gst_pad_get_peer (ogg->sinkpad)) != NULL) {
|
|
|
|
gint64 length;
|
|
|
|
int res;
|
|
|
|
|
2011-09-23 16:27:11 +00:00
|
|
|
res = gst_pad_query_duration (peer, GST_FORMAT_BYTES, &length);
|
2011-08-13 13:18:56 +00:00
|
|
|
if (res && length > 0) {
|
|
|
|
ogg->push_byte_length = length;
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"File byte length %" G_GINT64_FORMAT, ogg->push_byte_length);
|
2011-12-16 15:27:24 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "File byte length unknown, assuming live");
|
|
|
|
ogg->push_disable_seeking = TRUE;
|
|
|
|
return TRUE;
|
2011-08-13 13:18:56 +00:00
|
|
|
}
|
2011-09-23 16:27:11 +00:00
|
|
|
res = gst_pad_query_duration (peer, GST_FORMAT_TIME, &length);
|
2011-08-13 13:18:56 +00:00
|
|
|
gst_object_unref (peer);
|
|
|
|
if (res && length >= 0) {
|
|
|
|
ogg->push_time_length = length;
|
|
|
|
GST_DEBUG_OBJECT (ogg, "File time length %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (ogg->push_time_length));
|
|
|
|
} else if (!ogg->push_disable_seeking) {
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
res = gst_ogg_demux_get_duration_push (ogg, flags);
|
|
|
|
if (res) {
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"File time length unknown, trying to determine");
|
|
|
|
ogg->push_mode_seek_delayed_event = NULL;
|
|
|
|
if (event) {
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Let me intercept this innocent looking seek request");
|
|
|
|
ogg->push_mode_seek_delayed_event = gst_event_copy (event);
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-04-30 16:03:37 +00:00
|
|
|
static gboolean
|
|
|
|
gst_ogg_demux_perform_seek_push (GstOggDemux * ogg, GstEvent * event)
|
|
|
|
{
|
2010-04-30 16:37:17 +00:00
|
|
|
gint bitrate;
|
2010-05-04 11:36:58 +00:00
|
|
|
gboolean res = TRUE;
|
|
|
|
GstFormat format;
|
|
|
|
gdouble rate;
|
|
|
|
GstSeekFlags flags;
|
|
|
|
GstSeekType start_type, stop_type;
|
|
|
|
gint64 start, stop;
|
|
|
|
GstEvent *sevent;
|
|
|
|
GstOggChain *chain;
|
|
|
|
gint64 best, best_time;
|
2011-08-13 13:18:56 +00:00
|
|
|
gint i;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Push mode seek request received");
|
2010-04-30 16:37:17 +00:00
|
|
|
|
2010-05-04 11:36:58 +00:00
|
|
|
gst_event_parse_seek (event, &rate, &format, &flags,
|
|
|
|
&start_type, &start, &stop_type, &stop);
|
2010-04-30 16:37:17 +00:00
|
|
|
|
2010-05-04 11:36:58 +00:00
|
|
|
if (format != GST_FORMAT_TIME) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "can only seek on TIME");
|
|
|
|
goto error;
|
|
|
|
}
|
2010-04-30 16:37:17 +00:00
|
|
|
|
2013-09-06 18:56:39 +00:00
|
|
|
if (start_type != GST_SEEK_TYPE_SET || stop_type != GST_SEEK_TYPE_SET) {
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "can only seek to a SET target");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(flags & GST_SEEK_FLAG_FLUSH)) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "can only do flushing seeks");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Push mode seek request: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (start));
|
|
|
|
|
2010-05-04 11:36:58 +00:00
|
|
|
chain = ogg->current_chain;
|
2011-08-13 13:18:56 +00:00
|
|
|
if (!chain) {
|
|
|
|
GST_WARNING_OBJECT (ogg, "No chain to seek on");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* start accessing push_* members */
|
|
|
|
GST_PUSH_LOCK (ogg);
|
|
|
|
|
|
|
|
/* not if we disabled seeking (chained streams) */
|
|
|
|
if (ogg->push_disable_seeking) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Seeking disabled");
|
|
|
|
goto error_locked;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* not when we're trying to work out duration */
|
|
|
|
if (ogg->push_state == PUSH_DURATION) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Busy working out duration, try again later");
|
|
|
|
goto error_locked;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* actually, not if we're doing any seeking already */
|
|
|
|
if (ogg->push_state != PUSH_PLAYING) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Already doing some seeking, try again later");
|
|
|
|
goto error_locked;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* on the first seek, get length if we can */
|
|
|
|
if (!gst_ogg_demux_check_duration_push (ogg, flags, event)) {
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
2010-05-06 11:10:54 +00:00
|
|
|
return FALSE;
|
2011-08-13 13:18:56 +00:00
|
|
|
}
|
2010-04-30 16:37:17 +00:00
|
|
|
|
2010-05-04 11:36:58 +00:00
|
|
|
if (do_index_search (ogg, chain, 0, -1, 0, -1, start, &best, &best_time)) {
|
|
|
|
/* the index gave some result */
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"found offset %" G_GINT64_FORMAT " with time %" G_GUINT64_FORMAT,
|
|
|
|
best, best_time);
|
|
|
|
} else {
|
2011-08-13 13:18:56 +00:00
|
|
|
if (ogg->push_time_length > 0) {
|
|
|
|
/* if we know the time length, we know the full segment bitrate */
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Using real file bitrate");
|
|
|
|
bitrate =
|
|
|
|
gst_util_uint64_scale (ogg->push_byte_length, 8 * GST_SECOND,
|
|
|
|
ogg->push_time_length);
|
|
|
|
} else if (ogg->push_time_offset > 0) {
|
|
|
|
/* get a first approximation using known bitrate to the current position */
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Using file bitrate so far");
|
|
|
|
bitrate =
|
|
|
|
gst_util_uint64_scale (ogg->push_byte_offset, 8 * GST_SECOND,
|
|
|
|
ogg->push_time_offset);
|
|
|
|
} else if (ogg->bitrate > 0) {
|
|
|
|
/* nominal bitrate is better than nothing, even if it lies often */
|
|
|
|
GST_DEBUG_OBJECT (ogg, "Using nominal bitrate");
|
|
|
|
bitrate = ogg->bitrate;
|
|
|
|
} else {
|
|
|
|
/* meh */
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"At stream start, and no nominal bitrate, using some random magic "
|
|
|
|
"number to seed");
|
|
|
|
/* the bisection, once started, should give us a better approximation */
|
|
|
|
bitrate = 1000;
|
|
|
|
}
|
|
|
|
best = gst_util_uint64_scale (start, bitrate, 8 * GST_SECOND);
|
2010-05-04 11:36:58 +00:00
|
|
|
}
|
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
/* offset by typical page length, and ensure our best guess is within
|
|
|
|
reasonable bounds */
|
|
|
|
best -= CHUNKSIZE;
|
|
|
|
if (best < 0)
|
|
|
|
best = 0;
|
|
|
|
if (ogg->push_byte_length > 0 && best >= ogg->push_byte_length)
|
|
|
|
best = ogg->push_byte_length - 1;
|
|
|
|
|
|
|
|
/* set up bisection search */
|
|
|
|
ogg->push_offset0 = 0;
|
|
|
|
ogg->push_offset1 = ogg->push_byte_length - 1;
|
|
|
|
ogg->push_time0 = ogg->push_start_time;
|
|
|
|
ogg->push_time1 = ogg->push_time_length;
|
2013-09-06 18:56:39 +00:00
|
|
|
ogg->push_seek_seqnum = gst_event_get_seqnum (event);
|
2011-08-13 13:18:56 +00:00
|
|
|
ogg->push_seek_time_target = start;
|
2011-10-22 19:20:38 +00:00
|
|
|
ogg->push_prev_seek_time = GST_CLOCK_TIME_NONE;
|
2011-08-13 13:18:56 +00:00
|
|
|
ogg->push_seek_time_original_target = start;
|
2013-09-06 18:56:39 +00:00
|
|
|
ogg->push_seek_time_original_stop = stop;
|
2011-08-13 13:18:56 +00:00
|
|
|
ogg->push_state = PUSH_BISECT1;
|
2011-10-22 19:20:38 +00:00
|
|
|
ogg->seek_secant = FALSE;
|
|
|
|
ogg->seek_undershot = FALSE;
|
2011-08-13 13:18:56 +00:00
|
|
|
|
|
|
|
/* reset pad push mode seeking state */
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
pad->push_kf_time = GST_CLOCK_TIME_NONE;
|
|
|
|
pad->push_sync_time = GST_CLOCK_TIME_NONE;
|
2010-04-30 16:37:17 +00:00
|
|
|
}
|
2010-05-04 11:36:58 +00:00
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Setting up bisection search for %" G_GINT64_FORMAT " - %" G_GINT64_FORMAT
|
|
|
|
" (time %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT ")", ogg->push_offset0,
|
|
|
|
ogg->push_offset1, GST_TIME_ARGS (ogg->push_time0),
|
|
|
|
GST_TIME_ARGS (ogg->push_time1));
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Target time is %" GST_TIME_FORMAT ", best first guess is %"
|
|
|
|
G_GINT64_FORMAT, GST_TIME_ARGS (ogg->push_seek_time_target), best);
|
|
|
|
|
|
|
|
ogg->push_seek_rate = rate;
|
|
|
|
ogg->push_seek_flags = flags;
|
|
|
|
ogg->push_mode_seek_delayed_event = NULL;
|
|
|
|
ogg->push_bisection_steps[0] = 1;
|
|
|
|
ogg->push_bisection_steps[1] = 0;
|
|
|
|
sevent = gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
|
|
|
|
start_type, best, GST_SEEK_TYPE_NONE, -1);
|
2013-09-06 18:56:39 +00:00
|
|
|
gst_event_set_seqnum (sevent, gst_event_get_seqnum (event));
|
2011-08-13 13:18:56 +00:00
|
|
|
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
res = gst_pad_push_event (ogg->sinkpad, sevent);
|
|
|
|
|
2010-04-30 16:37:17 +00:00
|
|
|
return res;
|
2010-05-04 11:36:58 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
error:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ogg, "seek failed");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-13 13:18:56 +00:00
|
|
|
|
|
|
|
error_locked:
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
goto error;
|
2010-04-30 16:03:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_ogg_demux_perform_seek (GstOggDemux * ogg, GstEvent * event)
|
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
if (ogg->pullmode) {
|
|
|
|
res = gst_ogg_demux_perform_seek_pull (ogg, event);
|
|
|
|
} else {
|
|
|
|
res = gst_ogg_demux_perform_seek_push (ogg, event);
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
/* finds each bitstream link one at a time using a bisection search
|
|
|
|
* (has to begin by knowing the offset of the lb's initial page).
|
|
|
|
* Recurses for each link so it can alloc the link storage after
|
2010-04-30 16:37:17 +00:00
|
|
|
* finding them all, then unroll and fill the cache at the same time
|
2005-03-31 09:43:49 +00:00
|
|
|
*/
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
static GstFlowReturn
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_ogg_demux_bisect_forward_serialno (GstOggDemux * ogg,
|
|
|
|
gint64 begin, gint64 searched, gint64 end, GstOggChain * chain, glong m)
|
|
|
|
{
|
|
|
|
gint64 endsearched = end;
|
|
|
|
gint64 next = end;
|
|
|
|
ogg_page og;
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GstFlowReturn ret;
|
|
|
|
gint64 offset;
|
2005-03-31 09:43:49 +00:00
|
|
|
GstOggChain *nextchain;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ogg,
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
"bisect begin: %" G_GINT64_FORMAT ", searched: %" G_GINT64_FORMAT
|
|
|
|
", end %" G_GINT64_FORMAT ", chain: %p", begin, searched, end, chain);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
/* the below guards against garbage seperating the last and
|
|
|
|
* first pages of two links. */
|
|
|
|
while (searched < endsearched) {
|
|
|
|
gint64 bisect;
|
|
|
|
|
|
|
|
if (endsearched - searched < CHUNKSIZE) {
|
|
|
|
bisect = searched;
|
|
|
|
} else {
|
|
|
|
bisect = (searched + endsearched) / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_ogg_demux_seek (ogg, bisect);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
ret = gst_ogg_demux_get_next_page (ogg, &og, -1, &offset);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2011-10-10 09:39:52 +00:00
|
|
|
if (ret == GST_FLOW_EOS) {
|
2005-03-31 09:43:49 +00:00
|
|
|
endsearched = bisect;
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
} else if (ret == GST_FLOW_OK) {
|
2011-08-17 17:03:16 +00:00
|
|
|
guint32 serial = ogg_page_serialno (&og);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
if (!gst_ogg_chain_has_stream (chain, serial)) {
|
|
|
|
endsearched = bisect;
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
next = offset;
|
2005-03-31 09:43:49 +00:00
|
|
|
} else {
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
searched = offset + og.header_len + og.body_len;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
} else
|
|
|
|
return ret;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "current chain ends at %" G_GINT64_FORMAT, searched);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
chain->end_offset = searched;
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
ret = gst_ogg_demux_read_end_chain (ogg, chain);
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
return ret;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "found begin at %" G_GINT64_FORMAT, next);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
gst_ogg_demux_seek (ogg, next);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
ret = gst_ogg_demux_read_chain (ogg, &nextchain);
|
2011-10-10 09:39:52 +00:00
|
|
|
if (ret == GST_FLOW_EOS) {
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
nextchain = NULL;
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
GST_LOG_OBJECT (ogg, "no next chain");
|
|
|
|
} else if (ret != GST_FLOW_OK)
|
|
|
|
goto done;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
if (searched < end && nextchain != NULL) {
|
|
|
|
ret = gst_ogg_demux_bisect_forward_serialno (ogg, next, ogg->offset,
|
|
|
|
end, nextchain, m + 1);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto done;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
2007-12-03 10:58:14 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "adding chain %p", chain);
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
g_array_insert_val (ogg->chains, 0, chain);
|
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
done:
|
|
|
|
return ret;
|
2004-07-02 03:41:22 +00:00
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
/* read a chain from the ogg file. This code will
|
|
|
|
* read all BOS pages and will create and return a GstOggChain
|
|
|
|
* structure with the results.
|
|
|
|
*
|
|
|
|
* This function will also read N pages from each stream in the
|
2012-05-12 13:24:24 +00:00
|
|
|
* chain and submit them to the internal ogg stream parser/mapper
|
|
|
|
* until we know the timestamp of the first page in the chain.
|
2005-03-31 09:43:49 +00:00
|
|
|
*/
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_ogg_demux_read_chain (GstOggDemux * ogg, GstOggChain ** res_chain)
|
2004-07-02 03:41:22 +00:00
|
|
|
{
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GstFlowReturn ret;
|
2005-03-31 09:43:49 +00:00
|
|
|
GstOggChain *chain = NULL;
|
|
|
|
gint64 offset = ogg->offset;
|
2011-08-23 09:40:12 +00:00
|
|
|
ogg_page og;
|
2005-03-31 09:43:49 +00:00
|
|
|
gboolean done;
|
|
|
|
gint i;
|
2004-07-02 03:41:22 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "reading chain at %" G_GINT64_FORMAT, offset);
|
2004-07-02 03:41:22 +00:00
|
|
|
|
2012-05-12 13:24:24 +00:00
|
|
|
/* first read the BOS pages, detect the stream types, create the internal
|
|
|
|
* stream mappers, send data to them. */
|
2005-03-31 09:43:49 +00:00
|
|
|
while (TRUE) {
|
2004-07-02 03:41:22 +00:00
|
|
|
GstOggPad *pad;
|
2011-08-17 17:03:16 +00:00
|
|
|
guint32 serial;
|
2004-07-02 03:41:22 +00:00
|
|
|
|
2011-08-23 09:40:12 +00:00
|
|
|
ret = gst_ogg_demux_get_next_page (ogg, &og, -1, NULL);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (ret != GST_FLOW_OK) {
|
2011-10-10 09:39:52 +00:00
|
|
|
if (ret == GST_FLOW_EOS) {
|
2011-08-23 10:12:10 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "Reached EOS, done reading end chain");
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (ogg, "problem reading BOS page: ret=%d", ret);
|
|
|
|
}
|
2007-01-23 18:39:45 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-08-23 09:40:12 +00:00
|
|
|
if (!ogg_page_bos (&og)) {
|
2011-08-23 09:47:53 +00:00
|
|
|
GST_INFO_OBJECT (ogg, "page is not BOS page, all streams identified");
|
2009-04-28 09:24:19 +00:00
|
|
|
/* if we did not find a chain yet, assume this is a bogus stream and
|
|
|
|
* ignore it */
|
2011-08-23 09:47:53 +00:00
|
|
|
if (!chain) {
|
|
|
|
GST_WARNING_OBJECT (ogg, "No chain found, no Ogg data in stream ?");
|
2011-10-10 09:39:52 +00:00
|
|
|
ret = GST_FLOW_EOS;
|
2011-08-23 09:47:53 +00:00
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
break;
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
}
|
2004-10-18 15:23:41 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
if (chain == NULL) {
|
|
|
|
chain = gst_ogg_chain_new (ogg);
|
|
|
|
chain->offset = offset;
|
2004-07-02 03:41:22 +00:00
|
|
|
}
|
2004-10-18 15:23:41 +00:00
|
|
|
|
2011-08-23 09:40:12 +00:00
|
|
|
serial = ogg_page_serialno (&og);
|
2006-08-14 10:49:10 +00:00
|
|
|
if (gst_ogg_chain_get_stream (chain, serial) != NULL) {
|
2011-08-17 17:03:16 +00:00
|
|
|
GST_WARNING_OBJECT (ogg,
|
2011-08-18 15:20:57 +00:00
|
|
|
"found serial %08x BOS page twice, ignoring", serial);
|
2006-08-14 10:49:10 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
pad = gst_ogg_chain_new_stream (chain, serial);
|
2011-08-23 09:40:12 +00:00
|
|
|
gst_ogg_pad_submit_page (pad, &og);
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
|
|
|
|
if (ret != GST_FLOW_OK || chain == NULL) {
|
2008-04-02 15:41:50 +00:00
|
|
|
if (ret == GST_FLOW_OK) {
|
2008-04-02 15:07:01 +00:00
|
|
|
GST_WARNING_OBJECT (ogg, "no chain was found");
|
|
|
|
ret = GST_FLOW_ERROR;
|
2011-10-10 09:39:52 +00:00
|
|
|
} else if (ret != GST_FLOW_EOS) {
|
2007-03-07 17:15:57 +00:00
|
|
|
GST_WARNING_OBJECT (ogg, "failed to read chain");
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "done reading chains");
|
|
|
|
}
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (chain) {
|
|
|
|
gst_ogg_chain_free (chain);
|
|
|
|
}
|
2007-12-03 10:58:14 +00:00
|
|
|
if (res_chain)
|
|
|
|
*res_chain = NULL;
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
return ret;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
chain->have_bos = TRUE;
|
2012-05-12 13:24:24 +00:00
|
|
|
GST_INFO_OBJECT (ogg, "read bos pages, ");
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-05-12 13:24:24 +00:00
|
|
|
/* now read pages until each ogg stream mapper has figured out the
|
|
|
|
* timestamp of the first packet in the chain */
|
ext/ogg/gstoggdemux.c: Make oggdemux only find the final time in a chain, not per-pad, since the per-pad information ...
Original commit message from CVS:
2005-10-31 Michael Smith <msmith@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_collect_chain_info), (gst_ogg_print):
Patch from Alessandro Decina <alessandro@nnva.org>.
Make oggdemux only find the final time in a chain, not per-pad,
since the per-pad information can be very expensive to locate, and
it isn't used anywhere. This makes reading a file containing
OggSkeleton reasonably fast.
Also, make chain finding work when there are logical bitstreams that
can't be decoded. Fixes #319110.
2005-10-31 18:35:45 +00:00
|
|
|
|
|
|
|
/* save the offset to the first non bos page in the chain: if searching for
|
|
|
|
* pad->first_time we read past the end of the chain, we'll seek back to this
|
|
|
|
* position
|
|
|
|
*/
|
|
|
|
offset = ogg->offset;
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
done = FALSE;
|
|
|
|
while (!done) {
|
2011-08-17 17:03:16 +00:00
|
|
|
guint32 serial;
|
ext/ogg/gstoggdemux.c: Make oggdemux only find the final time in a chain, not per-pad, since the per-pad information ...
Original commit message from CVS:
2005-10-31 Michael Smith <msmith@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_collect_chain_info), (gst_ogg_print):
Patch from Alessandro Decina <alessandro@nnva.org>.
Make oggdemux only find the final time in a chain, not per-pad,
since the per-pad information can be very expensive to locate, and
it isn't used anywhere. This makes reading a file containing
OggSkeleton reasonably fast.
Also, make chain finding work when there are logical bitstreams that
can't be decoded. Fixes #319110.
2005-10-31 18:35:45 +00:00
|
|
|
gboolean known_serial = FALSE;
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GstFlowReturn ret;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2011-08-23 09:40:12 +00:00
|
|
|
serial = ogg_page_serialno (&og);
|
2005-03-31 09:43:49 +00:00
|
|
|
done = TRUE;
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
|
2011-08-17 17:03:16 +00:00
|
|
|
GST_LOG_OBJECT (ogg,
|
2011-08-18 15:20:57 +00:00
|
|
|
"serial %08x time %" GST_TIME_FORMAT,
|
2009-08-29 17:51:48 +00:00
|
|
|
pad->map.serialno, GST_TIME_ARGS (pad->start_time));
|
2007-06-05 16:02:57 +00:00
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
if (pad->map.serialno == serial) {
|
ext/ogg/gstoggdemux.c: Make oggdemux only find the final time in a chain, not per-pad, since the per-pad information ...
Original commit message from CVS:
2005-10-31 Michael Smith <msmith@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_collect_chain_info), (gst_ogg_print):
Patch from Alessandro Decina <alessandro@nnva.org>.
Make oggdemux only find the final time in a chain, not per-pad,
since the per-pad information can be very expensive to locate, and
it isn't used anywhere. This makes reading a file containing
OggSkeleton reasonably fast.
Also, make chain finding work when there are logical bitstreams that
can't be decoded. Fixes #319110.
2005-10-31 18:35:45 +00:00
|
|
|
known_serial = TRUE;
|
|
|
|
|
2007-08-21 11:42:39 +00:00
|
|
|
/* submit the page now, this will fill in the start_time when the
|
2012-05-12 13:24:24 +00:00
|
|
|
* internal stream mapper finds it */
|
2011-08-23 09:40:12 +00:00
|
|
|
gst_ogg_pad_submit_page (pad, &og);
|
2007-08-21 11:42:39 +00:00
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
if (!pad->map.is_skeleton && pad->start_time == -1
|
2011-08-23 09:40:12 +00:00
|
|
|
&& ogg_page_eos (&og)) {
|
ext/ogg/gstoggdemux.c: Make oggdemux only find the final time in a chain, not per-pad, since the per-pad information ...
Original commit message from CVS:
2005-10-31 Michael Smith <msmith@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_collect_chain_info), (gst_ogg_print):
Patch from Alessandro Decina <alessandro@nnva.org>.
Make oggdemux only find the final time in a chain, not per-pad,
since the per-pad information can be very expensive to locate, and
it isn't used anywhere. This makes reading a file containing
OggSkeleton reasonably fast.
Also, make chain finding work when there are logical bitstreams that
can't be decoded. Fixes #319110.
2005-10-31 18:35:45 +00:00
|
|
|
/* got EOS on a pad before we could find its start_time.
|
|
|
|
* We have no chance of finding a start_time for every pad so
|
|
|
|
* stop searching for the other start_time(s).
|
|
|
|
*/
|
|
|
|
done = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2004-10-18 15:23:41 +00:00
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
/* the timestamp will be filled in when we submit the pages */
|
2010-10-10 22:22:04 +00:00
|
|
|
if (!pad->map.is_sparse)
|
2007-06-05 16:02:57 +00:00
|
|
|
done &= (pad->start_time != GST_CLOCK_TIME_NONE);
|
2007-08-21 11:42:39 +00:00
|
|
|
|
2011-08-18 15:20:57 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "done %08x now %d", pad->map.serialno, done);
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
2004-10-18 15:23:41 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Make oggdemux only find the final time in a chain, not per-pad, since the per-pad information ...
Original commit message from CVS:
2005-10-31 Michael Smith <msmith@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_collect_chain_info), (gst_ogg_print):
Patch from Alessandro Decina <alessandro@nnva.org>.
Make oggdemux only find the final time in a chain, not per-pad,
since the per-pad information can be very expensive to locate, and
it isn't used anywhere. This makes reading a file containing
OggSkeleton reasonably fast.
Also, make chain finding work when there are logical bitstreams that
can't be decoded. Fixes #319110.
2005-10-31 18:35:45 +00:00
|
|
|
/* we read a page not belonging to the current chain: seek back to the
|
|
|
|
* beginning of the chain
|
|
|
|
*/
|
|
|
|
if (!known_serial) {
|
2011-08-18 15:20:57 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "unknown serial %08x", serial);
|
ext/ogg/gstoggdemux.c: Make oggdemux only find the final time in a chain, not per-pad, since the per-pad information ...
Original commit message from CVS:
2005-10-31 Michael Smith <msmith@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_collect_chain_info), (gst_ogg_print):
Patch from Alessandro Decina <alessandro@nnva.org>.
Make oggdemux only find the final time in a chain, not per-pad,
since the per-pad information can be very expensive to locate, and
it isn't used anywhere. This makes reading a file containing
OggSkeleton reasonably fast.
Also, make chain finding work when there are logical bitstreams that
can't be decoded. Fixes #319110.
2005-10-31 18:35:45 +00:00
|
|
|
gst_ogg_demux_seek (ogg, offset);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
if (!done) {
|
2011-08-23 09:40:12 +00:00
|
|
|
ret = gst_ogg_demux_get_next_page (ogg, &og, -1, NULL);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
2005-03-31 09:43:49 +00:00
|
|
|
break;
|
2004-07-02 03:41:22 +00:00
|
|
|
}
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "done reading chain");
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
|
|
|
|
if (res_chain)
|
|
|
|
*res_chain = chain;
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
2004-07-02 03:41:22 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
/* read the last pages from the ogg stream to get the final
|
2005-03-31 09:43:49 +00:00
|
|
|
* page end_offsets.
|
|
|
|
*/
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
static GstFlowReturn
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_ogg_demux_read_end_chain (GstOggDemux * ogg, GstOggChain * chain)
|
|
|
|
{
|
|
|
|
gint64 begin = chain->end_offset;
|
|
|
|
gint64 end = begin;
|
ext/ogg/gstoggdemux.c: Make oggdemux only find the final time in a chain, not per-pad, since the per-pad information ...
Original commit message from CVS:
2005-10-31 Michael Smith <msmith@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_collect_chain_info), (gst_ogg_print):
Patch from Alessandro Decina <alessandro@nnva.org>.
Make oggdemux only find the final time in a chain, not per-pad,
since the per-pad information can be very expensive to locate, and
it isn't used anywhere. This makes reading a file containing
OggSkeleton reasonably fast.
Also, make chain finding work when there are logical bitstreams that
can't be decoded. Fixes #319110.
2005-10-31 18:35:45 +00:00
|
|
|
gint64 last_granule = -1;
|
|
|
|
GstOggPad *last_pad = NULL;
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GstFlowReturn ret;
|
2005-03-31 09:43:49 +00:00
|
|
|
gboolean done = FALSE;
|
|
|
|
ogg_page og;
|
|
|
|
gint i;
|
2004-07-02 03:41:22 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
while (!done) {
|
|
|
|
begin -= CHUNKSIZE;
|
|
|
|
if (begin < 0)
|
|
|
|
begin = 0;
|
|
|
|
|
|
|
|
gst_ogg_demux_seek (ogg, begin);
|
|
|
|
|
|
|
|
/* now continue reading until we run out of data, if we find a page
|
|
|
|
* start, we save it. It might not be the final page as there could be
|
|
|
|
* another page after this one. */
|
|
|
|
while (ogg->offset < end) {
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
ret = gst_ogg_demux_get_next_page (ogg, &og, end - ogg->offset, NULL);
|
|
|
|
|
|
|
|
if (ret == GST_FLOW_LIMIT)
|
2005-03-31 09:43:49 +00:00
|
|
|
break;
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
return ret;
|
2004-07-02 03:41:22 +00:00
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
ext/ogg/gstoggdemux.c: Annodex support in ogg demuxer. Doesn't do very much without the other annodex patches (to come).
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_parse_skeleton_fishead),
(gst_ogg_pad_parse_skeleton_fisbone), (gst_ogg_pad_query_convert),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_read_chain),
(gst_ogg_demux_read_end_chain), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_change_state), (gst_annodex_granule_to_time):
Annodex support in ogg demuxer. Doesn't do very much without the
other annodex patches (to come).
2006-02-24 17:31:53 +00:00
|
|
|
|
2011-08-22 13:56:38 +00:00
|
|
|
if (pad->map.is_skeleton)
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
continue;
|
2004-07-02 03:41:22 +00:00
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
if (pad->map.serialno == ogg_page_serialno (&og)) {
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
gint64 granulepos = ogg_page_granulepos (&og);
|
ext/ogg/gstoggdemux.c: Make oggdemux only find the final time in a chain, not per-pad, since the per-pad information ...
Original commit message from CVS:
2005-10-31 Michael Smith <msmith@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_collect_chain_info), (gst_ogg_print):
Patch from Alessandro Decina <alessandro@nnva.org>.
Make oggdemux only find the final time in a chain, not per-pad,
since the per-pad information can be very expensive to locate, and
it isn't used anywhere. This makes reading a file containing
OggSkeleton reasonably fast.
Also, make chain finding work when there are logical bitstreams that
can't be decoded. Fixes #319110.
2005-10-31 18:35:45 +00:00
|
|
|
|
2010-10-12 14:03:36 +00:00
|
|
|
if (granulepos != -1) {
|
|
|
|
last_granule = granulepos;
|
|
|
|
last_pad = pad;
|
2009-09-12 22:48:11 +00:00
|
|
|
done = TRUE;
|
|
|
|
}
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
break;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
}
|
2004-07-02 03:41:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-29 17:51:48 +00:00
|
|
|
if (last_pad) {
|
|
|
|
chain->segment_stop =
|
|
|
|
gst_ogg_stream_get_end_time_for_granulepos (&last_pad->map,
|
|
|
|
last_granule);
|
|
|
|
} else {
|
ext/ogg/gstoggdemux.c: Make oggdemux only find the final time in a chain, not per-pad, since the per-pad information ...
Original commit message from CVS:
2005-10-31 Michael Smith <msmith@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_collect_chain_info), (gst_ogg_print):
Patch from Alessandro Decina <alessandro@nnva.org>.
Make oggdemux only find the final time in a chain, not per-pad,
since the per-pad information can be very expensive to locate, and
it isn't used anywhere. This makes reading a file containing
OggSkeleton reasonably fast.
Also, make chain finding work when there are logical bitstreams that
can't be decoded. Fixes #319110.
2005-10-31 18:35:45 +00:00
|
|
|
chain->segment_stop = GST_CLOCK_TIME_NONE;
|
2004-07-02 03:41:22 +00:00
|
|
|
}
|
ext/ogg/gstoggdemux.c: Make oggdemux only find the final time in a chain, not per-pad, since the per-pad information ...
Original commit message from CVS:
2005-10-31 Michael Smith <msmith@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_collect_chain_info), (gst_ogg_print):
Patch from Alessandro Decina <alessandro@nnva.org>.
Make oggdemux only find the final time in a chain, not per-pad,
since the per-pad information can be very expensive to locate, and
it isn't used anywhere. This makes reading a file containing
OggSkeleton reasonably fast.
Also, make chain finding work when there are logical bitstreams that
can't be decoded. Fixes #319110.
2005-10-31 18:35:45 +00:00
|
|
|
|
2009-12-03 21:07:49 +00:00
|
|
|
GST_INFO ("segment stop %" G_GUINT64_FORMAT, chain->segment_stop);
|
2009-08-29 17:51:48 +00:00
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
return GST_FLOW_OK;
|
2004-07-02 03:41:22 +00:00
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
/* find a pad with a given serial number
|
|
|
|
*/
|
|
|
|
static GstOggPad *
|
2011-08-17 17:03:16 +00:00
|
|
|
gst_ogg_demux_find_pad (GstOggDemux * ogg, guint32 serialno)
|
2004-07-02 03:41:22 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
GstOggPad *pad;
|
|
|
|
gint i;
|
2004-07-02 03:41:22 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
/* first look in building chain if any */
|
|
|
|
if (ogg->building_chain) {
|
|
|
|
pad = gst_ogg_chain_get_stream (ogg->building_chain, serialno);
|
|
|
|
if (pad)
|
|
|
|
return pad;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* then look in current chain if any */
|
2005-03-31 09:43:49 +00:00
|
|
|
if (ogg->current_chain) {
|
|
|
|
pad = gst_ogg_chain_get_stream (ogg->current_chain, serialno);
|
|
|
|
if (pad)
|
|
|
|
return pad;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < ogg->chains->len; i++) {
|
|
|
|
GstOggChain *chain = g_array_index (ogg->chains, GstOggChain *, i);
|
|
|
|
|
|
|
|
pad = gst_ogg_chain_get_stream (chain, serialno);
|
|
|
|
if (pad)
|
|
|
|
return pad;
|
|
|
|
}
|
|
|
|
return NULL;
|
2004-07-02 03:41:22 +00:00
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
/* find a chain with a given serial number
|
|
|
|
*/
|
|
|
|
static GstOggChain *
|
2011-08-17 17:03:16 +00:00
|
|
|
gst_ogg_demux_find_chain (GstOggDemux * ogg, guint32 serialno)
|
2004-07-02 03:41:22 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
GstOggPad *pad;
|
2004-07-02 03:41:22 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
pad = gst_ogg_demux_find_pad (ogg, serialno);
|
|
|
|
if (pad) {
|
|
|
|
return pad->chain;
|
|
|
|
}
|
|
|
|
return NULL;
|
2004-07-02 03:41:22 +00:00
|
|
|
}
|
|
|
|
|
2007-05-12 16:16:22 +00:00
|
|
|
/* returns TRUE if all streams have valid start time */
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
static gboolean
|
|
|
|
gst_ogg_demux_collect_chain_info (GstOggDemux * ogg, GstOggChain * chain)
|
|
|
|
{
|
2007-05-12 16:16:22 +00:00
|
|
|
gboolean res = TRUE;
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Make oggdemux only find the final time in a chain, not per-pad, since the per-pad information ...
Original commit message from CVS:
2005-10-31 Michael Smith <msmith@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_collect_chain_info), (gst_ogg_print):
Patch from Alessandro Decina <alessandro@nnva.org>.
Make oggdemux only find the final time in a chain, not per-pad,
since the per-pad information can be very expensive to locate, and
it isn't used anywhere. This makes reading a file containing
OggSkeleton reasonably fast.
Also, make chain finding work when there are logical bitstreams that
can't be decoded. Fixes #319110.
2005-10-31 18:35:45 +00:00
|
|
|
chain->total_time = GST_CLOCK_TIME_NONE;
|
2007-06-05 16:02:57 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "trying to collect chain info");
|
|
|
|
|
2010-05-04 11:05:51 +00:00
|
|
|
/* see if we have a start time on all streams */
|
2010-05-04 09:19:39 +00:00
|
|
|
chain->segment_start = gst_ogg_demux_collect_start_time (ogg, chain);
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
2010-05-04 11:05:51 +00:00
|
|
|
if (chain->segment_start == G_MAXUINT64) {
|
|
|
|
/* not yet, stream some more data */
|
2010-05-04 09:19:39 +00:00
|
|
|
res = FALSE;
|
2010-05-04 11:05:51 +00:00
|
|
|
} else if (chain->segment_stop != GST_CLOCK_TIME_NONE) {
|
|
|
|
/* we can calculate a total time */
|
ext/ogg/gstoggdemux.c: Make oggdemux only find the final time in a chain, not per-pad, since the per-pad information ...
Original commit message from CVS:
2005-10-31 Michael Smith <msmith@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_collect_chain_info), (gst_ogg_print):
Patch from Alessandro Decina <alessandro@nnva.org>.
Make oggdemux only find the final time in a chain, not per-pad,
since the per-pad information can be very expensive to locate, and
it isn't used anywhere. This makes reading a file containing
OggSkeleton reasonably fast.
Also, make chain finding work when there are logical bitstreams that
can't be decoded. Fixes #319110.
2005-10-31 18:35:45 +00:00
|
|
|
chain->total_time = chain->segment_stop - chain->segment_start;
|
2010-05-04 11:05:51 +00:00
|
|
|
}
|
ext/ogg/gstoggdemux.c: Make oggdemux only find the final time in a chain, not per-pad, since the per-pad information ...
Original commit message from CVS:
2005-10-31 Michael Smith <msmith@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_collect_chain_info), (gst_ogg_print):
Patch from Alessandro Decina <alessandro@nnva.org>.
Make oggdemux only find the final time in a chain, not per-pad,
since the per-pad information can be very expensive to locate, and
it isn't used anywhere. This makes reading a file containing
OggSkeleton reasonably fast.
Also, make chain finding work when there are logical bitstreams that
can't be decoded. Fixes #319110.
2005-10-31 18:35:45 +00:00
|
|
|
|
2009-12-03 21:07:49 +00:00
|
|
|
GST_DEBUG ("total time %" G_GUINT64_FORMAT, chain->total_time);
|
2009-08-29 17:51:48 +00:00
|
|
|
|
2007-06-05 16:02:57 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "return %d", res);
|
|
|
|
|
2007-05-12 16:16:22 +00:00
|
|
|
return res;
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ogg_demux_collect_info (GstOggDemux * ogg)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
/* collect all info */
|
|
|
|
ogg->total_time = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < ogg->chains->len; i++) {
|
|
|
|
GstOggChain *chain = g_array_index (ogg->chains, GstOggChain *, i);
|
|
|
|
|
|
|
|
chain->begin_time = ogg->total_time;
|
|
|
|
|
|
|
|
gst_ogg_demux_collect_chain_info (ogg, chain);
|
|
|
|
|
|
|
|
ogg->total_time += chain->total_time;
|
|
|
|
}
|
2011-05-16 11:48:11 +00:00
|
|
|
ogg->segment.duration = ogg->total_time;
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
/* find all the chains in the ogg file, this reads the first and
|
|
|
|
* last page of the ogg stream, if they match then the ogg file has
|
|
|
|
* just one chain, else we do a binary search for all chains.
|
|
|
|
*/
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
static GstFlowReturn
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_ogg_demux_find_chains (GstOggDemux * ogg)
|
|
|
|
{
|
|
|
|
ogg_page og;
|
|
|
|
GstPad *peer;
|
|
|
|
gboolean res;
|
2011-08-17 17:03:16 +00:00
|
|
|
guint32 serialno;
|
2005-03-31 09:43:49 +00:00
|
|
|
GstOggChain *chain;
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GstFlowReturn ret;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
/* get peer to figure out length */
|
|
|
|
if ((peer = gst_pad_get_peer (ogg->sinkpad)) == NULL)
|
|
|
|
goto no_peer;
|
|
|
|
|
|
|
|
/* find length to read last page, we store this for later use. */
|
2011-07-27 00:16:53 +00:00
|
|
|
res = gst_pad_query_duration (peer, GST_FORMAT_BYTES, &ogg->length);
|
2005-06-28 10:16:13 +00:00
|
|
|
gst_object_unref (peer);
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
if (!res || ogg->length <= 0)
|
2005-03-31 09:43:49 +00:00
|
|
|
goto no_length;
|
|
|
|
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "file length %" G_GINT64_FORMAT, ogg->length);
|
Make gnomevfssrc extend the source base class.
Original commit message from CVS:
* ext/gnomevfs/Makefile.am:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get_type),
(gst_gnomevfssrc_class_init), (gst_gnomevfssrc_init),
(gst_gnomevfssrc_set_property), (gst_gnomevfssrc_get_property),
(gst_gnomevfssrc_create), (gst_gnomevfssrc_is_seekable),
(gst_gnomevfssrc_get_size), (gst_gnomevfssrc_start),
(gst_gnomevfssrc_stop):
* ext/ogg/Makefile.am:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_get_data),
(gst_ogg_demux_find_chains), (gst_ogg_demux_sink_activate):
* ext/theora/Makefile.am:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_sink_event), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* sys/xvimage/Makefile.am:
Make gnomevfssrc extend the source base class.
Fix linking against libs in various plugins.
2005-04-06 17:33:07 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
/* read chain from offset 0, this is the first chain of the
|
|
|
|
* ogg file. */
|
|
|
|
gst_ogg_demux_seek (ogg, 0);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
ret = gst_ogg_demux_read_chain (ogg, &chain);
|
|
|
|
if (ret != GST_FLOW_OK)
|
2005-03-31 09:43:49 +00:00
|
|
|
goto no_first_chain;
|
|
|
|
|
|
|
|
/* read page from end offset, we use this page to check if its serial
|
|
|
|
* number is contained in the first chain. If this is the case then
|
|
|
|
* this ogg is not a chained ogg and we can skip the scanning. */
|
|
|
|
gst_ogg_demux_seek (ogg, ogg->length);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
ret = gst_ogg_demux_get_prev_page (ogg, &og, NULL);
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto no_last_page;
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
serialno = ogg_page_serialno (&og);
|
|
|
|
|
|
|
|
if (!gst_ogg_chain_has_stream (chain, serialno)) {
|
|
|
|
/* the last page is not in the first stream, this means we should
|
|
|
|
* find all the chains in this chained ogg. */
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
ret =
|
|
|
|
gst_ogg_demux_bisect_forward_serialno (ogg, 0, 0, ogg->length, chain,
|
|
|
|
0);
|
2004-07-02 03:41:22 +00:00
|
|
|
} else {
|
2005-03-31 09:43:49 +00:00
|
|
|
/* we still call this function here but with an empty range so that
|
|
|
|
* we can reuse the setup code in this routine. */
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
ret =
|
2010-05-05 11:59:57 +00:00
|
|
|
gst_ogg_demux_bisect_forward_serialno (ogg, 0, ogg->length,
|
|
|
|
ogg->length, chain, 0);
|
2004-07-02 03:41:22 +00:00
|
|
|
}
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
/* all fine, collect and print */
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
gst_ogg_demux_collect_info (ogg);
|
2004-07-02 03:41:22 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
/* dump our chains and streams */
|
|
|
|
gst_ogg_print (ogg);
|
2004-07-02 03:41:22 +00:00
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
done:
|
|
|
|
return ret;
|
2004-07-02 03:41:22 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
/*** error cases ***/
|
|
|
|
no_peer:
|
|
|
|
{
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GST_ELEMENT_ERROR (ogg, STREAM, DEMUX, (NULL), ("we don't have a peer"));
|
|
|
|
return GST_FLOW_NOT_LINKED;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
no_length:
|
|
|
|
{
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GST_ELEMENT_ERROR (ogg, STREAM, DEMUX, (NULL), ("can't get file length"));
|
|
|
|
return GST_FLOW_NOT_SUPPORTED;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
no_first_chain:
|
|
|
|
{
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GST_ELEMENT_ERROR (ogg, STREAM, DEMUX, (NULL), ("can't get first chain"));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
no_last_page:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ogg, "can't get last page");
|
2007-06-23 14:44:07 +00:00
|
|
|
if (chain)
|
|
|
|
gst_ogg_chain_free (chain);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
return ret;
|
2004-07-02 03:41:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static GstFlowReturn
|
2006-11-09 00:50:00 +00:00
|
|
|
gst_ogg_demux_handle_page (GstOggDemux * ogg, ogg_page * page)
|
2003-11-24 04:08:48 +00:00
|
|
|
{
|
2006-11-09 00:50:00 +00:00
|
|
|
GstOggPad *pad;
|
|
|
|
gint64 granule;
|
2011-08-17 17:03:16 +00:00
|
|
|
guint32 serialno;
|
2006-11-09 00:50:00 +00:00
|
|
|
GstFlowReturn result = GST_FLOW_OK;
|
2003-11-24 04:08:48 +00:00
|
|
|
|
2006-11-09 00:50:00 +00:00
|
|
|
serialno = ogg_page_serialno (page);
|
|
|
|
granule = ogg_page_granulepos (page);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2006-11-09 00:50:00 +00:00
|
|
|
GST_LOG_OBJECT (ogg,
|
2011-08-18 15:20:57 +00:00
|
|
|
"processing ogg page (serial %08x, "
|
|
|
|
"pageno %ld, granulepos %" G_GINT64_FORMAT ", bos %d)", serialno,
|
2011-08-17 17:03:16 +00:00
|
|
|
ogg_page_pageno (page), granule, ogg_page_bos (page));
|
2006-11-09 00:50:00 +00:00
|
|
|
|
|
|
|
if (ogg_page_bos (page)) {
|
|
|
|
GstOggChain *chain;
|
|
|
|
|
|
|
|
/* first page */
|
|
|
|
/* see if we know about the chain already */
|
|
|
|
chain = gst_ogg_demux_find_chain (ogg, serialno);
|
|
|
|
if (chain) {
|
2007-05-15 16:46:10 +00:00
|
|
|
GstEvent *event;
|
2008-07-28 15:34:13 +00:00
|
|
|
gint64 start = 0;
|
2011-05-16 11:48:11 +00:00
|
|
|
GstSegment segment;
|
2008-07-28 15:34:13 +00:00
|
|
|
|
|
|
|
if (chain->segment_start != GST_CLOCK_TIME_NONE)
|
|
|
|
start = chain->segment_start;
|
2007-05-15 16:46:10 +00:00
|
|
|
|
|
|
|
/* create the newsegment event we are going to send out */
|
2011-05-16 11:48:11 +00:00
|
|
|
gst_segment_copy_into (&ogg->segment, &segment);
|
|
|
|
segment.start = start;
|
|
|
|
segment.stop = chain->segment_stop;
|
|
|
|
segment.time = chain->begin_time;
|
2013-08-22 15:33:45 +00:00
|
|
|
segment.base = chain->begin_time;
|
2011-05-16 11:48:11 +00:00
|
|
|
event = gst_event_new_segment (&segment);
|
2008-11-04 17:24:35 +00:00
|
|
|
gst_event_set_seqnum (event, ogg->seqnum);
|
2007-05-15 16:46:10 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"segment: start %" GST_TIME_FORMAT ", stop %" GST_TIME_FORMAT
|
2008-07-28 15:34:13 +00:00
|
|
|
", time %" GST_TIME_FORMAT, GST_TIME_ARGS (start),
|
2007-05-15 16:46:10 +00:00
|
|
|
GST_TIME_ARGS (chain->segment_stop),
|
|
|
|
GST_TIME_ARGS (chain->begin_time));
|
|
|
|
|
2008-04-02 14:58:05 +00:00
|
|
|
/* activate it as it means we have a non-header, this will also deactivate
|
|
|
|
* the currently running chain. */
|
2007-05-15 16:46:10 +00:00
|
|
|
gst_ogg_demux_activate_chain (ogg, chain, event);
|
2006-11-09 00:50:00 +00:00
|
|
|
pad = gst_ogg_demux_find_pad (ogg, serialno);
|
2005-03-31 09:43:49 +00:00
|
|
|
} else {
|
2006-11-09 00:50:00 +00:00
|
|
|
GstClockTime chain_time;
|
|
|
|
gint64 current_time;
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
|
2010-01-25 11:31:24 +00:00
|
|
|
/* this can only happen in push mode */
|
|
|
|
if (ogg->pullmode)
|
2006-11-09 00:50:00 +00:00
|
|
|
goto unknown_chain;
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
|
2011-05-16 11:48:11 +00:00
|
|
|
current_time = ogg->segment.position;
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
|
2007-05-15 17:11:09 +00:00
|
|
|
/* time of new chain is current time */
|
|
|
|
chain_time = current_time;
|
|
|
|
|
2006-11-09 00:50:00 +00:00
|
|
|
if (ogg->building_chain == NULL) {
|
|
|
|
GstOggChain *newchain;
|
|
|
|
|
|
|
|
newchain = gst_ogg_chain_new (ogg);
|
|
|
|
newchain->offset = 0;
|
|
|
|
/* set new chain begin time aligned with end time of old chain */
|
|
|
|
newchain->begin_time = chain_time;
|
|
|
|
GST_DEBUG_OBJECT (ogg, "new chain, begin time %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (chain_time));
|
|
|
|
|
|
|
|
/* and this is the one we are building now */
|
|
|
|
ogg->building_chain = newchain;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
2006-11-09 00:50:00 +00:00
|
|
|
pad = gst_ogg_chain_new_stream (ogg->building_chain, serialno);
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
2006-11-09 00:50:00 +00:00
|
|
|
} else {
|
|
|
|
pad = gst_ogg_demux_find_pad (ogg, serialno);
|
|
|
|
}
|
|
|
|
if (pad) {
|
|
|
|
result = gst_ogg_pad_submit_page (pad, page);
|
|
|
|
} else {
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_PUSH_LOCK (ogg);
|
|
|
|
if (!ogg->pullmode && !ogg->push_disable_seeking) {
|
|
|
|
/* no pad while probing for duration, we must have a chained stream,
|
|
|
|
and we don't support them, so back off */
|
|
|
|
GST_INFO_OBJECT (ogg, "We seem to have a chained stream, we won't seek");
|
|
|
|
if (ogg->push_state == PUSH_DURATION) {
|
|
|
|
GstFlowReturn res;
|
|
|
|
|
|
|
|
res = gst_ogg_demux_seek_back_after_push_duration_check_unlock (ogg);
|
|
|
|
if (res != GST_FLOW_OK)
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* only once we seeked back */
|
|
|
|
GST_PUSH_LOCK (ogg);
|
|
|
|
ogg->push_disable_seeking = TRUE;
|
|
|
|
} else {
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
|
|
|
/* no pad. This means an ogg page without bos has been seen for this
|
|
|
|
* serialno. we just ignore it but post a warning... */
|
|
|
|
GST_ELEMENT_WARNING (ogg, STREAM, DECODE,
|
|
|
|
(NULL), ("unknown ogg pad for serial %08x detected", serialno));
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
GST_PUSH_UNLOCK (ogg);
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
return result;
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
|
2006-11-09 00:50:00 +00:00
|
|
|
/* ERRORS */
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
unknown_chain:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (ogg, STREAM, DECODE,
|
2011-08-18 15:20:57 +00:00
|
|
|
(NULL), ("unknown ogg chain for serial %08x detected", serialno));
|
ext/ogg/gstoggdemux.c: Generate correct disconts for live chained oggs.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_collect_info), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop):
Generate correct disconts for live chained oggs.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render),
(gst_base_audio_sink_create_ringbuffer),
(gst_base_audio_sink_change_state):
Handle discont math correctly.
* gst/playback/gstplaybin.c: (add_sink):
Some small debug cleanup.
2005-07-21 17:25:40 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
|
|
|
|
2006-11-09 00:50:00 +00:00
|
|
|
/* streaming mode, receive a buffer, parse it, create pads for
|
|
|
|
* the serialno, submit pages and packets to the oggpads
|
|
|
|
*/
|
|
|
|
static GstFlowReturn
|
2011-11-17 11:48:25 +00:00
|
|
|
gst_ogg_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
2006-11-09 00:50:00 +00:00
|
|
|
{
|
|
|
|
GstOggDemux *ogg;
|
2009-09-10 08:00:16 +00:00
|
|
|
gint ret = 0;
|
2006-11-09 00:50:00 +00:00
|
|
|
GstFlowReturn result = GST_FLOW_OK;
|
|
|
|
|
2011-11-17 11:48:25 +00:00
|
|
|
ogg = GST_OGG_DEMUX (parent);
|
2006-11-09 00:50:00 +00:00
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "enter");
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
result = gst_ogg_demux_submit_buffer (ogg, buffer);
|
2011-08-13 13:18:56 +00:00
|
|
|
if (result < 0) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "gst_ogg_demux_submit_buffer returned %d", result);
|
|
|
|
}
|
2006-11-09 00:50:00 +00:00
|
|
|
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
while (result == GST_FLOW_OK) {
|
2006-11-09 00:50:00 +00:00
|
|
|
ogg_page page;
|
|
|
|
|
|
|
|
ret = ogg_sync_pageout (&ogg->sync, &page);
|
|
|
|
if (ret == 0)
|
|
|
|
/* need more data */
|
|
|
|
break;
|
|
|
|
if (ret == -1) {
|
|
|
|
/* discontinuity in the pages */
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "discont in page found, continuing");
|
2006-11-09 00:50:00 +00:00
|
|
|
} else {
|
2006-11-23 11:07:23 +00:00
|
|
|
result = gst_ogg_demux_handle_page (ogg, &page);
|
2011-08-13 13:18:56 +00:00
|
|
|
if (result < 0) {
|
|
|
|
GST_DEBUG_OBJECT (ogg, "gst_ogg_demux_handle_page returned %d", result);
|
|
|
|
}
|
2006-11-09 00:50:00 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-10 08:00:16 +00:00
|
|
|
if (ret == 0 || result == GST_FLOW_OK) {
|
|
|
|
gst_ogg_demux_sync_streams (ogg);
|
|
|
|
}
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg, "leave with %d", result);
|
2006-11-09 00:50:00 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2010-05-03 14:52:59 +00:00
|
|
|
static gboolean
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
gst_ogg_demux_send_event (GstOggDemux * ogg, GstEvent * event)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
|
|
|
GstOggChain *chain = ogg->current_chain;
|
2010-05-03 14:52:59 +00:00
|
|
|
gboolean res = TRUE;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2011-09-14 11:23:19 +00:00
|
|
|
if (!chain)
|
|
|
|
chain = ogg->building_chain;
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
if (chain) {
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
gst_event_ref (event);
|
2009-06-14 21:13:41 +00:00
|
|
|
GST_DEBUG_OBJECT (pad, "Pushing event %" GST_PTR_FORMAT, event);
|
2010-05-03 14:52:59 +00:00
|
|
|
res &= gst_pad_push_event (GST_PAD (pad), event);
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
2011-09-14 11:23:19 +00:00
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (ogg, "No chain to forward event to");
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
gst_event_unref (event);
|
2010-05-03 14:52:59 +00:00
|
|
|
|
|
|
|
return res;
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2006-06-15 15:27:49 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_ogg_demux_combine_flows (GstOggDemux * ogg, GstOggPad * pad,
|
|
|
|
GstFlowReturn ret)
|
|
|
|
{
|
|
|
|
GstOggChain *chain;
|
|
|
|
|
|
|
|
/* store the value */
|
|
|
|
pad->last_ret = ret;
|
|
|
|
|
|
|
|
/* any other error that is not-linked can be returned right
|
|
|
|
* away */
|
|
|
|
if (ret != GST_FLOW_NOT_LINKED)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
/* only return NOT_LINKED if all other pads returned NOT_LINKED */
|
|
|
|
chain = ogg->current_chain;
|
|
|
|
if (chain) {
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *opad = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
|
|
|
|
ret = opad->last_ret;
|
|
|
|
/* some other return value (must be SUCCESS but we can return
|
|
|
|
* other values as well) */
|
|
|
|
if (ret != GST_FLOW_NOT_LINKED)
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
/* if we get here, all other pads were unlinked and we return
|
|
|
|
* NOT_LINKED then */
|
|
|
|
}
|
|
|
|
done:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-04-02 14:37:21 +00:00
|
|
|
/* returns TRUE if all streams in current chain reached EOS, FALSE otherwise */
|
|
|
|
static gboolean
|
|
|
|
gst_ogg_demux_check_eos (GstOggDemux * ogg)
|
|
|
|
{
|
|
|
|
GstOggChain *chain;
|
|
|
|
gboolean eos = TRUE;
|
|
|
|
|
|
|
|
chain = ogg->current_chain;
|
|
|
|
if (G_LIKELY (chain)) {
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *opad = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
|
|
|
|
eos = eos && opad->is_eos;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
eos = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return eos;
|
|
|
|
}
|
|
|
|
|
2006-11-09 00:50:00 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_ogg_demux_loop_forward (GstOggDemux * ogg)
|
|
|
|
{
|
|
|
|
GstFlowReturn ret;
|
2012-03-16 20:46:47 +00:00
|
|
|
GstBuffer *buffer = NULL;
|
2006-11-09 00:50:00 +00:00
|
|
|
|
|
|
|
if (ogg->offset == ogg->length) {
|
|
|
|
GST_LOG_OBJECT (ogg, "no more data to pull %" G_GINT64_FORMAT
|
|
|
|
" == %" G_GINT64_FORMAT, ogg->offset, ogg->length);
|
2011-10-10 09:39:52 +00:00
|
|
|
ret = GST_FLOW_EOS;
|
2006-11-09 00:50:00 +00:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ogg, "pull data %" G_GINT64_FORMAT, ogg->offset);
|
|
|
|
ret = gst_pad_pull_range (ogg->sinkpad, ogg->offset, CHUNKSIZE, &buffer);
|
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
GST_LOG_OBJECT (ogg, "Failed pull_range");
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2011-03-27 16:30:24 +00:00
|
|
|
ogg->offset += gst_buffer_get_size (buffer);
|
2006-11-09 00:50:00 +00:00
|
|
|
|
|
|
|
if (G_UNLIKELY (ogg->newsegment)) {
|
|
|
|
gst_ogg_demux_send_event (ogg, ogg->newsegment);
|
|
|
|
ogg->newsegment = NULL;
|
|
|
|
}
|
|
|
|
|
2011-11-17 11:48:25 +00:00
|
|
|
ret = gst_ogg_demux_chain (ogg->sinkpad, GST_OBJECT_CAST (ogg), buffer);
|
2006-11-09 00:50:00 +00:00
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
GST_LOG_OBJECT (ogg, "Failed demux_chain");
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check for the end of the segment */
|
2010-04-02 14:37:21 +00:00
|
|
|
if (gst_ogg_demux_check_eos (ogg)) {
|
2010-05-04 13:47:29 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "got EOS");
|
2011-10-10 09:39:52 +00:00
|
|
|
ret = GST_FLOW_EOS;
|
2010-04-02 14:37:21 +00:00
|
|
|
goto done;
|
2006-11-09 00:50:00 +00:00
|
|
|
}
|
|
|
|
done:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-01-09 12:30:46 +00:00
|
|
|
/* reverse mode.
|
|
|
|
*
|
|
|
|
* We read the pages backwards and send the packets forwards. The first packet
|
|
|
|
* in the page will be pushed with the DISCONT flag set.
|
|
|
|
*
|
|
|
|
* Special care has to be taken for continued pages, which we can only decode
|
|
|
|
* when we have the previous page(s).
|
|
|
|
*/
|
2006-11-09 00:50:00 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_ogg_demux_loop_reverse (GstOggDemux * ogg)
|
|
|
|
{
|
|
|
|
GstFlowReturn ret;
|
|
|
|
ogg_page page;
|
|
|
|
gint64 offset;
|
|
|
|
|
|
|
|
if (ogg->offset == 0) {
|
|
|
|
GST_LOG_OBJECT (ogg, "no more data to pull %" G_GINT64_FORMAT
|
|
|
|
" == 0", ogg->offset);
|
2011-10-10 09:39:52 +00:00
|
|
|
ret = GST_FLOW_EOS;
|
2006-11-09 00:50:00 +00:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ogg, "read page from %" G_GINT64_FORMAT, ogg->offset);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
ret = gst_ogg_demux_get_prev_page (ogg, &page, &offset);
|
|
|
|
if (ret != GST_FLOW_OK)
|
2006-11-09 00:50:00 +00:00
|
|
|
goto done;
|
|
|
|
|
|
|
|
ogg->offset = offset;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (ogg->newsegment)) {
|
|
|
|
gst_ogg_demux_send_event (ogg, ogg->newsegment);
|
|
|
|
ogg->newsegment = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = gst_ogg_demux_handle_page (ogg, &page);
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
/* check for the end of the segment */
|
2010-04-02 14:37:21 +00:00
|
|
|
if (gst_ogg_demux_check_eos (ogg)) {
|
2010-05-04 13:47:29 +00:00
|
|
|
GST_LOG_OBJECT (ogg, "got EOS");
|
2011-10-10 09:39:52 +00:00
|
|
|
ret = GST_FLOW_EOS;
|
2010-04-02 14:37:21 +00:00
|
|
|
goto done;
|
2006-11-09 00:50:00 +00:00
|
|
|
}
|
|
|
|
done:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-09-10 08:00:16 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_demux_sync_streams (GstOggDemux * ogg)
|
|
|
|
{
|
|
|
|
GstClockTime cur;
|
|
|
|
GstOggChain *chain;
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
chain = ogg->current_chain;
|
2011-05-16 11:48:11 +00:00
|
|
|
cur = ogg->segment.position;
|
2009-09-10 08:00:16 +00:00
|
|
|
if (chain == NULL || cur == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < chain->streams->len; i++) {
|
|
|
|
GstOggPad *stream = g_array_index (chain->streams, GstOggPad *, i);
|
|
|
|
|
|
|
|
/* Theoretically, we should be doing this for all streams, but we're only
|
|
|
|
* doing it for known-to-be-sparse streams at the moment in order not to
|
|
|
|
* break things for wrongly-muxed streams (like we used to produce once) */
|
2011-05-16 11:48:11 +00:00
|
|
|
if (stream->map.is_sparse && stream->position != GST_CLOCK_TIME_NONE) {
|
2009-09-10 08:00:16 +00:00
|
|
|
|
|
|
|
/* Does this stream lag? Random threshold of 2 seconds */
|
2011-05-16 11:48:11 +00:00
|
|
|
if (GST_CLOCK_DIFF (stream->position, cur) > (2 * GST_SECOND)) {
|
2009-09-10 08:00:16 +00:00
|
|
|
GST_DEBUG_OBJECT (stream, "synchronizing stream with others by "
|
|
|
|
"advancing time from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
|
2011-05-16 11:48:11 +00:00
|
|
|
GST_TIME_ARGS (stream->position), GST_TIME_ARGS (cur));
|
|
|
|
|
|
|
|
stream->position = cur;
|
|
|
|
|
2009-09-10 08:00:16 +00:00
|
|
|
gst_pad_push_event (GST_PAD_CAST (stream),
|
2012-09-05 09:41:35 +00:00
|
|
|
gst_event_new_gap (stream->position, cur - stream->position));
|
2009-09-10 08:00:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
/* random access code
|
2005-03-31 09:43:49 +00:00
|
|
|
*
|
ext/ogg/gstoggdemux.c: add more debugging clean up printf formats for granulepos and serialno
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new_stream),
(gst_ogg_demux_seek), (gst_ogg_demux_get_data),
(gst_ogg_demux_get_next_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_chains),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
add more debugging
clean up printf formats for granulepos and serialno
2006-05-30 14:59:24 +00:00
|
|
|
* - first find all the chains and streams by scanning the file.
|
|
|
|
* - then get and chain buffers, just like the streaming case.
|
|
|
|
* - when seeking, we can use the chain info to perform the seek.
|
2005-03-31 09:43:49 +00:00
|
|
|
*/
|
2003-11-24 04:08:48 +00:00
|
|
|
static void
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_ogg_demux_loop (GstOggPad * pad)
|
2003-11-24 04:08:48 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
GstOggDemux *ogg;
|
|
|
|
GstFlowReturn ret;
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
GstEvent *event;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
ogg = GST_OGG_DEMUX (GST_OBJECT_PARENT (pad));
|
|
|
|
|
|
|
|
if (ogg->need_chains) {
|
2006-08-14 10:49:10 +00:00
|
|
|
gboolean res;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2006-08-14 10:49:10 +00:00
|
|
|
/* this is the only place where we write chains and thus need to lock. */
|
2005-03-31 09:43:49 +00:00
|
|
|
GST_CHAIN_LOCK (ogg);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
ret = gst_ogg_demux_find_chains (ogg);
|
2005-03-31 09:43:49 +00:00
|
|
|
GST_CHAIN_UNLOCK (ogg);
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
2005-07-14 18:13:08 +00:00
|
|
|
goto chain_read_failed;
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
ogg->need_chains = FALSE;
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
2005-11-21 16:35:24 +00:00
|
|
|
GST_OBJECT_LOCK (ogg);
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
ogg->running = TRUE;
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
event = ogg->event;
|
|
|
|
ogg->event = NULL;
|
2005-11-21 16:35:24 +00:00
|
|
|
GST_OBJECT_UNLOCK (ogg);
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
|
|
|
|
/* and seek to configured positions without FLUSH */
|
2010-04-30 16:03:37 +00:00
|
|
|
res = gst_ogg_demux_perform_seek_pull (ogg, event);
|
2006-04-10 19:13:30 +00:00
|
|
|
if (event)
|
|
|
|
gst_event_unref (event);
|
2006-08-14 10:49:10 +00:00
|
|
|
|
|
|
|
if (!res)
|
|
|
|
goto seek_failed;
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
2004-11-23 15:24:28 +00:00
|
|
|
|
2006-11-09 00:50:00 +00:00
|
|
|
if (ogg->segment.rate >= 0.0)
|
|
|
|
ret = gst_ogg_demux_loop_forward (ogg);
|
|
|
|
else
|
|
|
|
ret = gst_ogg_demux_loop_reverse (ogg);
|
2004-10-26 14:41:06 +00:00
|
|
|
|
2006-11-09 00:50:00 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
2005-03-31 09:43:49 +00:00
|
|
|
goto pause;
|
2006-04-11 14:42:33 +00:00
|
|
|
|
2009-09-10 08:00:16 +00:00
|
|
|
gst_ogg_demux_sync_streams (ogg);
|
2005-03-31 09:43:49 +00:00
|
|
|
return;
|
|
|
|
|
2005-07-14 18:13:08 +00:00
|
|
|
/* ERRORS */
|
|
|
|
chain_read_failed:
|
|
|
|
{
|
ext/ogg/gstoggdemux.*: Properly propagate streaming errors when we are scanning the file for chains so that we don't ...
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_submit_buffer),
(gst_ogg_demux_get_data), (gst_ogg_demux_get_next_page),
(gst_ogg_demux_get_prev_page), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek),
(gst_ogg_demux_bisect_forward_serialno),
(gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_handle_page),
(gst_ogg_demux_chain), (gst_ogg_demux_combine_flows),
(gst_ogg_demux_loop_reverse), (gst_ogg_demux_loop):
* ext/ogg/gstoggdemux.h:
Properly propagate streaming errors when we are scanning the file for
chains so that we don't crash when shut down. Might fix some crashers
when quickly switching oggs in RB such as #332503 and #378436.
2007-01-27 13:32:24 +00:00
|
|
|
/* error was posted */
|
2005-07-14 18:13:08 +00:00
|
|
|
goto pause;
|
2006-04-11 14:42:33 +00:00
|
|
|
}
|
2006-08-14 10:49:10 +00:00
|
|
|
seek_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (ogg, STREAM, DEMUX, (NULL),
|
|
|
|
("failed to start demuxing ogg"));
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto pause;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
pause:
|
2005-07-14 18:13:08 +00:00
|
|
|
{
|
2006-06-15 15:27:49 +00:00
|
|
|
const gchar *reason = gst_flow_get_name (ret);
|
2008-11-04 17:24:35 +00:00
|
|
|
GstEvent *event = NULL;
|
2006-06-15 15:27:49 +00:00
|
|
|
|
|
|
|
GST_LOG_OBJECT (ogg, "pausing task, reason %s", reason);
|
2005-07-14 18:13:08 +00:00
|
|
|
gst_pad_pause_task (ogg->sinkpad);
|
2006-06-15 15:27:49 +00:00
|
|
|
|
2011-10-10 09:39:52 +00:00
|
|
|
if (ret == GST_FLOW_EOS) {
|
2010-08-27 15:23:46 +00:00
|
|
|
/* perform EOS logic */
|
|
|
|
if (ogg->segment.flags & GST_SEEK_FLAG_SEGMENT) {
|
|
|
|
gint64 stop;
|
|
|
|
GstMessage *message;
|
|
|
|
|
|
|
|
/* for segment playback we need to post when (in stream time)
|
|
|
|
* we stopped, this is either stop (when set) or the duration. */
|
|
|
|
if ((stop = ogg->segment.stop) == -1)
|
|
|
|
stop = ogg->segment.duration;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ogg, "Sending segment done, at end of segment");
|
|
|
|
message =
|
|
|
|
gst_message_new_segment_done (GST_OBJECT (ogg), GST_FORMAT_TIME,
|
|
|
|
stop);
|
|
|
|
gst_message_set_seqnum (message, ogg->seqnum);
|
|
|
|
|
|
|
|
gst_element_post_message (GST_ELEMENT (ogg), message);
|
2012-07-05 11:06:04 +00:00
|
|
|
|
|
|
|
event = gst_event_new_segment_done (GST_FORMAT_TIME, stop);
|
|
|
|
gst_event_set_seqnum (event, ogg->seqnum);
|
|
|
|
gst_ogg_demux_send_event (ogg, event);
|
|
|
|
event = NULL;
|
2006-06-15 15:27:49 +00:00
|
|
|
} else {
|
2010-08-27 15:23:46 +00:00
|
|
|
/* normal playback, send EOS to all linked pads */
|
|
|
|
GST_LOG_OBJECT (ogg, "Sending EOS, at end of stream");
|
2008-11-04 17:24:35 +00:00
|
|
|
event = gst_event_new_eos ();
|
|
|
|
}
|
2011-10-10 09:39:52 +00:00
|
|
|
} else if (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_EOS) {
|
2010-08-27 15:23:46 +00:00
|
|
|
GST_ELEMENT_ERROR (ogg, STREAM, FAILED,
|
|
|
|
(_("Internal data stream error.")),
|
|
|
|
("stream stopped, reason %s", reason));
|
|
|
|
event = gst_event_new_eos ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* For wrong-state we still want to pause the task and stop
|
|
|
|
* but no error message or other things are necessary.
|
|
|
|
* wrong-state is no real error and will be caused by flushing,
|
|
|
|
* e.g. because of a flushing seek.
|
|
|
|
*/
|
|
|
|
if (event) {
|
2012-01-10 16:14:29 +00:00
|
|
|
/* guard against corrupt/truncated files, where one can hit EOS
|
|
|
|
before prerolling is done and a chain created. If we have no
|
|
|
|
chain to send the event to, error out. */
|
|
|
|
if (ogg->current_chain || ogg->building_chain) {
|
|
|
|
gst_event_set_seqnum (event, ogg->seqnum);
|
|
|
|
gst_ogg_demux_send_event (ogg, event);
|
|
|
|
} else {
|
|
|
|
gst_event_unref (event);
|
|
|
|
GST_ELEMENT_ERROR (ogg, STREAM, DEMUX, (NULL),
|
|
|
|
("EOS before finding a chain"));
|
|
|
|
}
|
2005-07-14 18:13:08 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
2005-05-26 12:08:55 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_demux_clear_chains (GstOggDemux * ogg)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
gst_ogg_demux_deactivate_current_chain (ogg);
|
|
|
|
|
|
|
|
GST_CHAIN_LOCK (ogg);
|
|
|
|
for (i = 0; i < ogg->chains->len; i++) {
|
|
|
|
GstOggChain *chain = g_array_index (ogg->chains, GstOggChain *, i);
|
|
|
|
|
|
|
|
gst_ogg_chain_free (chain);
|
|
|
|
}
|
|
|
|
ogg->chains = g_array_set_size (ogg->chains, 0);
|
|
|
|
GST_CHAIN_UNLOCK (ogg);
|
|
|
|
}
|
|
|
|
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
/* this function is called when the pad is activated and should start
|
|
|
|
* processing data.
|
|
|
|
*
|
|
|
|
* We check if we can do random access to decide if we work push or
|
|
|
|
* pull based.
|
|
|
|
*/
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean
|
2011-11-18 12:56:04 +00:00
|
|
|
gst_ogg_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
|
2005-06-27 18:41:22 +00:00
|
|
|
{
|
2011-05-24 15:37:45 +00:00
|
|
|
GstQuery *query;
|
2013-07-26 13:29:05 +00:00
|
|
|
gboolean pull_mode = FALSE;
|
|
|
|
GstSchedulingFlags flags;
|
2011-05-24 15:37:45 +00:00
|
|
|
|
|
|
|
query = gst_query_new_scheduling ();
|
|
|
|
|
|
|
|
if (!gst_pad_peer_query (sinkpad, query)) {
|
|
|
|
gst_query_unref (query);
|
|
|
|
goto activate_push;
|
|
|
|
}
|
|
|
|
|
2013-07-26 13:29:05 +00:00
|
|
|
gst_query_parse_scheduling (query, &flags, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
/* Don't use pull mode if sequential access is suggested */
|
|
|
|
if (gst_query_has_scheduling_mode (query, GST_PAD_MODE_PULL)) {
|
|
|
|
pull_mode = (flags & GST_SCHEDULING_FLAG_SEEKABLE) &&
|
|
|
|
!(flags & GST_SCHEDULING_FLAG_SEQUENTIAL);
|
|
|
|
}
|
2011-10-07 12:05:19 +00:00
|
|
|
gst_query_unref (query);
|
2011-05-24 15:37:45 +00:00
|
|
|
|
|
|
|
if (!pull_mode)
|
|
|
|
goto activate_push;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sinkpad, "activating pull");
|
2011-11-21 12:35:34 +00:00
|
|
|
return gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PULL, TRUE);
|
2011-05-24 15:37:45 +00:00
|
|
|
|
|
|
|
activate_push:
|
|
|
|
{
|
2007-02-28 15:10:06 +00:00
|
|
|
GST_DEBUG_OBJECT (sinkpad, "activating push");
|
2011-11-21 12:35:34 +00:00
|
|
|
return gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PUSH, TRUE);
|
2005-06-27 18:41:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-11-21 12:35:34 +00:00
|
|
|
gst_ogg_demux_sink_activate_mode (GstPad * sinkpad, GstObject * parent,
|
|
|
|
GstPadMode mode, gboolean active)
|
2005-06-27 18:41:22 +00:00
|
|
|
{
|
2011-11-21 12:35:34 +00:00
|
|
|
gboolean res;
|
2005-06-27 18:41:22 +00:00
|
|
|
GstOggDemux *ogg;
|
|
|
|
|
2011-11-18 12:56:04 +00:00
|
|
|
ogg = GST_OGG_DEMUX (parent);
|
2005-06-27 18:41:22 +00:00
|
|
|
|
2011-11-21 12:35:34 +00:00
|
|
|
switch (mode) {
|
|
|
|
case GST_PAD_MODE_PUSH:
|
|
|
|
ogg->pullmode = FALSE;
|
|
|
|
ogg->resync = FALSE;
|
|
|
|
res = TRUE;
|
|
|
|
break;
|
|
|
|
case GST_PAD_MODE_PULL:
|
|
|
|
if (active) {
|
|
|
|
ogg->need_chains = TRUE;
|
|
|
|
ogg->pullmode = TRUE;
|
2005-06-27 18:41:22 +00:00
|
|
|
|
2011-11-21 12:35:34 +00:00
|
|
|
res = gst_pad_start_task (sinkpad, (GstTaskFunction) gst_ogg_demux_loop,
|
2012-06-20 08:33:24 +00:00
|
|
|
sinkpad, NULL);
|
2011-11-21 12:35:34 +00:00
|
|
|
} else {
|
|
|
|
res = gst_pad_stop_task (sinkpad);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|
2011-11-21 12:35:34 +00:00
|
|
|
return res;
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_ogg_demux_change_state (GstElement * element, GstStateChange transition)
|
2003-11-24 04:08:48 +00:00
|
|
|
{
|
|
|
|
GstOggDemux *ogg;
|
2005-09-02 15:43:18 +00:00
|
|
|
GstStateChangeReturn result = GST_STATE_CHANGE_FAILURE;
|
2003-11-24 04:08:48 +00:00
|
|
|
|
|
|
|
ogg = GST_OGG_DEMUX (element);
|
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
ext/ogg/gstoggdemux.c: Annodex support in ogg demuxer. Doesn't do very much without the other annodex patches (to come).
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_parse_skeleton_fishead),
(gst_ogg_pad_parse_skeleton_fisbone), (gst_ogg_pad_query_convert),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_read_chain),
(gst_ogg_demux_read_end_chain), (gst_ogg_demux_collect_chain_info),
(gst_ogg_demux_change_state), (gst_annodex_granule_to_time):
Annodex support in ogg demuxer. Doesn't do very much without the
other annodex patches (to come).
2006-02-24 17:31:53 +00:00
|
|
|
ogg->basetime = 0;
|
2003-11-24 04:08:48 +00:00
|
|
|
ogg_sync_init (&ogg->sync);
|
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2003-11-24 04:08:48 +00:00
|
|
|
ogg_sync_reset (&ogg->sync);
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
ogg->running = FALSE;
|
2010-04-30 15:41:05 +00:00
|
|
|
ogg->bitrate = 0;
|
2010-05-04 11:05:51 +00:00
|
|
|
ogg->total_time = -1;
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_PUSH_LOCK (ogg);
|
|
|
|
ogg->push_byte_offset = 0;
|
|
|
|
ogg->push_byte_length = -1;
|
|
|
|
ogg->push_time_length = GST_CLOCK_TIME_NONE;
|
|
|
|
ogg->push_time_offset = GST_CLOCK_TIME_NONE;
|
|
|
|
ogg->push_state = PUSH_PLAYING;
|
2013-07-22 13:24:29 +00:00
|
|
|
ogg->have_group_id = FALSE;
|
|
|
|
ogg->group_id = G_MAXUINT;
|
2011-12-16 15:27:24 +00:00
|
|
|
|
|
|
|
ogg->push_disable_seeking = FALSE;
|
|
|
|
if (!ogg->pullmode) {
|
|
|
|
GstPad *peer;
|
|
|
|
if ((peer = gst_pad_get_peer (ogg->sinkpad)) != NULL) {
|
|
|
|
gint64 length = -1;
|
2011-12-30 12:21:35 +00:00
|
|
|
if (!gst_pad_query_duration (peer, GST_FORMAT_BYTES, &length)
|
|
|
|
|| length <= 0) {
|
2011-12-16 15:27:24 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg,
|
|
|
|
"Unable to determine stream size, assuming live, seeking disabled");
|
|
|
|
ogg->push_disable_seeking = TRUE;
|
|
|
|
}
|
2012-01-10 16:51:09 +00:00
|
|
|
gst_object_unref (peer);
|
2011-12-16 15:27:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-13 13:18:56 +00:00
|
|
|
GST_PUSH_UNLOCK (ogg);
|
ext/ogg/gstoggdemux.c: Use GstSegment infrastructure to remove duplicated code and handle more seek cases correctly.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event),
(gst_ogg_pad_event), (gst_ogg_pad_internal_chain),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_do_seek),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_loop), (gst_ogg_demux_change_state):
Use GstSegment infrastructure to remove duplicated code
and handle more seek cases correctly.
2006-02-28 11:04:47 +00:00
|
|
|
gst_segment_init (&ogg->segment, GST_FORMAT_TIME);
|
2003-11-24 04:08:48 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
|
|
|
break;
|
|
|
|
default:
|
2003-11-24 04:08:48 +00:00
|
|
|
break;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
2011-04-19 12:11:32 +00:00
|
|
|
result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
2003-11-24 04:08:48 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2005-05-26 12:08:55 +00:00
|
|
|
gst_ogg_demux_clear_chains (ogg);
|
2005-11-21 16:35:24 +00:00
|
|
|
GST_OBJECT_LOCK (ogg);
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
ogg->running = FALSE;
|
2005-11-21 16:35:24 +00:00
|
|
|
GST_OBJECT_UNLOCK (ogg);
|
2003-11-24 04:08:48 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
2003-11-24 04:08:48 +00:00
|
|
|
ogg_sync_clear (&ogg->sync);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
return result;
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
|
|
|
|
ext/ogg/: Added an ogg muxer.
Original commit message from CVS:
* ext/ogg/gstogg.c: (plugin_init):
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_plugin_init),
(gst_ogg_print):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_get_type),
(gst_ogg_mux_base_init), (gst_ogg_mux_class_init),
(gst_ogg_mux_get_sink_event_masks), (gst_ogg_mux_init),
(gst_ogg_mux_sinkconnect), (gst_ogg_mux_pad_link),
(gst_ogg_mux_pad_unlink), (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_handle_src_event), (gst_ogg_mux_next_buffer),
(gst_ogg_mux_push_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_loop),
(gst_ogg_mux_get_property), (gst_ogg_mux_set_property),
(gst_ogg_mux_change_state), (gst_ogg_mux_plugin_init):
Added an ogg muxer.
Small typo fixes in the demuxer.
2004-05-10 13:34:57 +00:00
|
|
|
gboolean
|
|
|
|
gst_ogg_demux_plugin_init (GstPlugin * plugin)
|
2003-11-24 04:08:48 +00:00
|
|
|
{
|
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_ogg_demux_debug, "oggdemux", 0, "ogg demuxer");
|
2004-07-02 03:41:22 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_ogg_demux_setup_debug, "oggdemux_setup", 0,
|
|
|
|
"ogg demuxer setup stage when parsing pipeline");
|
2003-11-24 04:08:48 +00:00
|
|
|
|
2010-03-16 17:31:15 +00:00
|
|
|
#ifdef ENABLE_NLS
|
2006-01-27 01:06:29 +00:00
|
|
|
GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
|
|
|
|
LOCALEDIR);
|
|
|
|
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
2008-08-07 15:58:58 +00:00
|
|
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
2006-01-27 01:06:29 +00:00
|
|
|
#endif
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
return gst_element_register (plugin, "oggdemux", GST_RANK_PRIMARY,
|
|
|
|
GST_TYPE_OGG_DEMUX);
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2004-01-29 02:50:20 +00:00
|
|
|
/* prints all info about the element */
|
2004-07-02 03:41:22 +00:00
|
|
|
#undef GST_CAT_DEFAULT
|
|
|
|
#define GST_CAT_DEFAULT gst_ogg_demux_setup_debug
|
compile fixes for --disable-gst-debug, G_DISABLE_ASSERT and friends
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/dvdnav/dvdnavsrc.c: (dvdnav_get_event_name),
(dvdnavsrc_print_event):
* ext/ogg/gstoggdemux.c: (_find_chain_process), (gst_ogg_print):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_pad_link),
(gst_ogg_mux_pad_unlink):
* gst/multipart/multipartmux.c: (gst_multipart_mux_pad_link),
(gst_multipart_mux_pad_unlink):
* gst/videofilter/gstvideobalance.c:
(gst_videobalance_colorbalance_set_value):
* gst/videomixer/videomixer.c: (gst_videomixer_pad_link),
(gst_videomixer_pad_unlink):
* po/uk.po:
* sys/oss/gstossmixer.c:
* sys/v4l/gstv4lcolorbalance.c:
* sys/v4l/gstv4ltuner.c:
* sys/v4l/v4lsrc_calls.c:
* sys/v4l2/gstv4l2colorbalance.c:
* sys/v4l2/gstv4l2tuner.c:
compile fixes for --disable-gst-debug, G_DISABLE_ASSERT and friends
2004-08-03 16:06:08 +00:00
|
|
|
|
|
|
|
#ifdef GST_DISABLE_GST_DEBUG
|
|
|
|
|
ext/ogg/: Added an ogg muxer.
Original commit message from CVS:
* ext/ogg/gstogg.c: (plugin_init):
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_plugin_init),
(gst_ogg_print):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_get_type),
(gst_ogg_mux_base_init), (gst_ogg_mux_class_init),
(gst_ogg_mux_get_sink_event_masks), (gst_ogg_mux_init),
(gst_ogg_mux_sinkconnect), (gst_ogg_mux_pad_link),
(gst_ogg_mux_pad_unlink), (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_handle_src_event), (gst_ogg_mux_next_buffer),
(gst_ogg_mux_push_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_loop),
(gst_ogg_mux_get_property), (gst_ogg_mux_set_property),
(gst_ogg_mux_change_state), (gst_ogg_mux_plugin_init):
Added an ogg muxer.
Small typo fixes in the demuxer.
2004-05-10 13:34:57 +00:00
|
|
|
static void
|
compile fixes for --disable-gst-debug, G_DISABLE_ASSERT and friends
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/dvdnav/dvdnavsrc.c: (dvdnav_get_event_name),
(dvdnavsrc_print_event):
* ext/ogg/gstoggdemux.c: (_find_chain_process), (gst_ogg_print):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_pad_link),
(gst_ogg_mux_pad_unlink):
* gst/multipart/multipartmux.c: (gst_multipart_mux_pad_link),
(gst_multipart_mux_pad_unlink):
* gst/videofilter/gstvideobalance.c:
(gst_videobalance_colorbalance_set_value):
* gst/videomixer/videomixer.c: (gst_videomixer_pad_link),
(gst_videomixer_pad_unlink):
* po/uk.po:
* sys/oss/gstossmixer.c:
* sys/v4l/gstv4lcolorbalance.c:
* sys/v4l/gstv4ltuner.c:
* sys/v4l/v4lsrc_calls.c:
* sys/v4l2/gstv4l2colorbalance.c:
* sys/v4l2/gstv4l2tuner.c:
compile fixes for --disable-gst-debug, G_DISABLE_ASSERT and friends
2004-08-03 16:06:08 +00:00
|
|
|
gst_ogg_print (GstOggDemux * ogg)
|
|
|
|
{
|
|
|
|
/* NOP */
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /* !GST_DISABLE_GST_DEBUG */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ogg_print (GstOggDemux * ogg)
|
2004-01-29 02:50:20 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
guint j, i;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Parse seeking events better.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_pad_event), (gst_ogg_demux_factory_filter),
(gst_ogg_pad_submit_packet), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
Parse seeking events better.
Unref static caps.
Generate correct newsegment events, fixes seeking in live oggs.
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_dec_src_event), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_dec_push), (theora_dec_chain):
Use newsegment values to report correct play time.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event):
* ext/vorbis/vorbisdec.h:
Parse and use newsegment values to report correct play time.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Clear ringbuffer on flush.
Use newsegment values to calculate playback time.
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Basesink does newsegment calculations for us now.
2005-08-24 18:04:45 +00:00
|
|
|
GST_INFO_OBJECT (ogg, "%u chains", ogg->chains->len);
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
GST_INFO_OBJECT (ogg, " total time: %" GST_TIME_FORMAT,
|
ext/ogg/gstoggdemux.c: Parse seeking events better.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_pad_event), (gst_ogg_demux_factory_filter),
(gst_ogg_pad_submit_packet), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
Parse seeking events better.
Unref static caps.
Generate correct newsegment events, fixes seeking in live oggs.
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_dec_src_event), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_dec_push), (theora_dec_chain):
Use newsegment values to report correct play time.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event):
* ext/vorbis/vorbisdec.h:
Parse and use newsegment values to report correct play time.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Clear ringbuffer on flush.
Use newsegment values to calculate playback time.
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Basesink does newsegment calculations for us now.
2005-08-24 18:04:45 +00:00
|
|
|
GST_TIME_ARGS (ogg->total_time));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
for (i = 0; i < ogg->chains->len; i++) {
|
|
|
|
GstOggChain *chain = g_array_index (ogg->chains, GstOggChain *, i);
|
|
|
|
|
|
|
|
GST_INFO_OBJECT (ogg, " chain %d (%u streams):", i, chain->streams->len);
|
2010-05-05 11:59:57 +00:00
|
|
|
GST_INFO_OBJECT (ogg,
|
|
|
|
" offset: %" G_GINT64_FORMAT " - %" G_GINT64_FORMAT, chain->offset,
|
|
|
|
chain->end_offset);
|
ext/ogg/gstoggdemux.c: Reorganize code to send the right disconts when in streaming mode.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_init), (gst_ogg_pad_event),
(gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
(gst_ogg_demux_chain_elem_pad), (gst_ogg_demux_queue_data),
(gst_ogg_demux_chain_peer), (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_read_chain), (gst_ogg_demux_find_pad),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_find_chains), (gst_ogg_demux_chain),
(gst_ogg_demux_send_event), (gst_ogg_demux_loop),
(gst_ogg_demux_change_state), (gst_ogg_print):
Reorganize code to send the right disconts when in streaming
mode.
2005-07-21 12:17:37 +00:00
|
|
|
GST_INFO_OBJECT (ogg, " begin time: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (chain->begin_time));
|
ext/ogg/gstoggdemux.c: Parse seeking events better.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_pad_event), (gst_ogg_demux_factory_filter),
(gst_ogg_pad_submit_packet), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
Parse seeking events better.
Unref static caps.
Generate correct newsegment events, fixes seeking in live oggs.
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_dec_src_event), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_dec_push), (theora_dec_chain):
Use newsegment values to report correct play time.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event):
* ext/vorbis/vorbisdec.h:
Parse and use newsegment values to report correct play time.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Clear ringbuffer on flush.
Use newsegment values to calculate playback time.
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Basesink does newsegment calculations for us now.
2005-08-24 18:04:45 +00:00
|
|
|
GST_INFO_OBJECT (ogg, " total time: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (chain->total_time));
|
|
|
|
GST_INFO_OBJECT (ogg, " segment start: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (chain->segment_start));
|
|
|
|
GST_INFO_OBJECT (ogg, " segment stop: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (chain->segment_stop));
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
for (j = 0; j < chain->streams->len; j++) {
|
|
|
|
GstOggPad *stream = g_array_index (chain->streams, GstOggPad *, j);
|
|
|
|
|
2011-08-23 10:08:25 +00:00
|
|
|
GST_INFO_OBJECT (ogg, " stream %08x: %s", stream->map.serialno,
|
|
|
|
gst_ogg_stream_get_media_type (&stream->map));
|
ext/ogg/: Ported ogg muxer.
Original commit message from CVS:
* ext/ogg/Makefile.am:
* ext/ogg/README:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_pad_submit_packet), (gst_ogg_demux_sink_activate),
(gst_ogg_print):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_init),
(gst_ogg_mux_request_new_pad), (gst_ogg_mux_next_buffer),
(gst_ogg_mux_push_page), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_get_headers), (gst_ogg_mux_set_header_on_caps),
(gst_ogg_mux_send_headers), (gst_ogg_mux_collected),
(gst_ogg_mux_change_state):
Ported ogg muxer.
2005-05-05 09:39:35 +00:00
|
|
|
GST_INFO_OBJECT (ogg, " start time: %" GST_TIME_FORMAT,
|
2005-03-31 09:43:49 +00:00
|
|
|
GST_TIME_ARGS (stream->start_time));
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
compile fixes for --disable-gst-debug, G_DISABLE_ASSERT and friends
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/dvdnav/dvdnavsrc.c: (dvdnav_get_event_name),
(dvdnavsrc_print_event):
* ext/ogg/gstoggdemux.c: (_find_chain_process), (gst_ogg_print):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_pad_link),
(gst_ogg_mux_pad_unlink):
* gst/multipart/multipartmux.c: (gst_multipart_mux_pad_link),
(gst_multipart_mux_pad_unlink):
* gst/videofilter/gstvideobalance.c:
(gst_videobalance_colorbalance_set_value):
* gst/videomixer/videomixer.c: (gst_videomixer_pad_link),
(gst_videomixer_pad_unlink):
* po/uk.po:
* sys/oss/gstossmixer.c:
* sys/v4l/gstv4lcolorbalance.c:
* sys/v4l/gstv4ltuner.c:
* sys/v4l/v4lsrc_calls.c:
* sys/v4l2/gstv4l2colorbalance.c:
* sys/v4l2/gstv4l2tuner.c:
compile fixes for --disable-gst-debug, G_DISABLE_ASSERT and friends
2004-08-03 16:06:08 +00:00
|
|
|
#endif /* GST_DISABLE_GST_DEBUG */
|