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
|
|
|
/* OGG muxer plugin for GStreamer
|
|
|
|
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
2006-03-05 23:06:22 +00:00
|
|
|
* Copyright (C) 2006 Thomas Vander Stichele <thomas at apestaart dot org>
|
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
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2008-04-03 14:58:06 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-oggmux
|
2010-03-29 09:53:11 +00:00
|
|
|
* @see_also: <link linkend="gst-plugins-base-plugins-oggdemux">oggdemux</link>
|
2008-04-03 14:58:06 +00:00
|
|
|
*
|
|
|
|
* This element merges streams (audio and video) into ogg files.
|
2008-07-10 21:06:06 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
2008-04-03 14:58:06 +00:00
|
|
|
* <title>Example pipelines</title>
|
2008-07-10 21:06:06 +00:00
|
|
|
* |[
|
2011-07-07 20:24:38 +00:00
|
|
|
* gst-launch v4l2src num-buffers=500 ! video/x-raw,width=320,height=240 ! videoconvert ! theoraenc ! oggmux ! filesink location=video.ogg
|
2008-07-10 21:06:06 +00:00
|
|
|
* ]| Encodes a video stream captured from a v4l2-compatible camera to Ogg/Theora
|
2008-04-03 15:58:37 +00:00
|
|
|
* (the encoding will stop automatically after 500 frames)
|
2008-04-03 14:58:06 +00:00
|
|
|
* </refsect2>
|
|
|
|
*
|
|
|
|
* Last reviewed on 2008-02-06 (0.10.17)
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
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
|
|
|
#include <gst/base/gstcollectpads.h>
|
2011-08-17 16:09:44 +00:00
|
|
|
#include <gst/base/gstbytewriter.h>
|
2010-05-05 11:59:57 +00:00
|
|
|
#include <gst/tag/tag.h>
|
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
|
|
|
|
2008-02-01 12:56:59 +00:00
|
|
|
#include "gstoggmux.h"
|
|
|
|
|
2006-04-29 09:48:16 +00:00
|
|
|
/* memcpy - if someone knows a way to get rid of it, please speak up
|
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
|
|
|
* note: the ogg docs even say you need this... */
|
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
2006-04-29 09:48:16 +00:00
|
|
|
#include <stdlib.h> /* rand, srand, atoi */
|
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
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_ogg_mux_debug);
|
|
|
|
#define GST_CAT_DEFAULT gst_ogg_mux_debug
|
|
|
|
|
2006-01-31 15:36:13 +00:00
|
|
|
/* This isn't generally what you'd want with an end-time macro, because
|
|
|
|
technically the end time of a buffer with invalid duration is invalid. But
|
|
|
|
for sorting ogg pages this is what we want. */
|
|
|
|
#define GST_BUFFER_END_TIME(buf) \
|
|
|
|
(GST_BUFFER_DURATION_IS_VALID (buf) \
|
|
|
|
? GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf) \
|
|
|
|
: GST_BUFFER_TIMESTAMP (buf))
|
|
|
|
|
2005-11-08 16:37:32 +00:00
|
|
|
#define GST_GP_FORMAT "[gp %8" G_GINT64_FORMAT "]"
|
2009-10-09 14:56:29 +00:00
|
|
|
#define GST_GP_CAST(_gp) ((gint64) _gp)
|
2005-11-08 16:37:32 +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
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GST_OGG_FLAG_BOS = GST_ELEMENT_FLAG_LAST,
|
|
|
|
GST_OGG_FLAG_EOS
|
|
|
|
}
|
|
|
|
GstOggFlag;
|
|
|
|
|
|
|
|
/* OggMux signals and args */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
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
|
|
|
/* set to 0.5 seconds by default */
|
2005-12-06 19:42:02 +00:00
|
|
|
#define DEFAULT_MAX_DELAY G_GINT64_CONSTANT(500000000)
|
|
|
|
#define DEFAULT_MAX_PAGE_DELAY G_GINT64_CONSTANT(500000000)
|
2011-06-06 10:48:23 +00:00
|
|
|
#define DEFAULT_MAX_TOLERANCE G_GINT64_CONSTANT(40000000)
|
2011-08-17 16:09:44 +00:00
|
|
|
#define DEFAULT_SKELETON FALSE
|
|
|
|
|
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
|
|
|
enum
|
|
|
|
{
|
2004-06-10 16:06:21 +00:00
|
|
|
ARG_0,
|
|
|
|
ARG_MAX_DELAY,
|
2004-06-11 14:38:59 +00:00
|
|
|
ARG_MAX_PAGE_DELAY,
|
2011-08-17 16:09:44 +00:00
|
|
|
ARG_MAX_TOLERANCE,
|
|
|
|
ARG_SKELETON
|
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 GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("application/ogg")
|
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink_%d",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_REQUEST,
|
ext/ogg/gstoggmux.c: Basic pad template which accepts OGM tracks, speex, flac, vorbis and theora. Any is incorrect.
Original commit message from CVS:
* ext/ogg/gstoggmux.c:
Basic pad template which accepts OGM tracks, speex, flac, vorbis
and theora. Any is incorrect.
* gst/asfdemux/gstasfmux.c: (gst_asfmux_vidsink_link):
Fix caps.
* sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_base_init):
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_base_init),
(gst_v4lmjpegsrc_init), (gst_v4lmjpegsrc_srcconnect),
(gst_v4lmjpegsrc_getcaps), (gst_v4lmjpegsrc_change_state):
* sys/v4l/gstv4lmjpegsrc.h:
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_src_link), (gst_v4lsrc_getcaps),
(gst_v4lsrc_change_state):
* sys/v4l/v4lmjpegsrc_calls.c: (gst_v4lmjpegsrc_capture_start),
(gst_v4lmjpegsrc_capture_stop):
Fix caps. Keep track of internal state. Work.
2004-10-24 13:41:18 +00:00
|
|
|
GST_STATIC_CAPS ("video/x-theora; "
|
2008-07-28 13:12:51 +00:00
|
|
|
"audio/x-vorbis; audio/x-flac; audio/x-speex; audio/x-celt; "
|
2006-06-14 09:13:54 +00:00
|
|
|
"application/x-ogm-video; application/x-ogm-audio; video/x-dirac; "
|
2010-05-05 11:59:57 +00:00
|
|
|
"video/x-smoke; video/x-vp8; text/x-cmml, encoded = (boolean) TRUE; "
|
2009-02-21 13:18:10 +00:00
|
|
|
"subtitle/x-kate; application/x-kate")
|
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
|
|
|
);
|
|
|
|
|
2005-11-16 19:32:50 +00:00
|
|
|
static void gst_ogg_mux_finalize (GObject * object);
|
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
|
|
|
|
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
|
|
|
static GstFlowReturn
|
|
|
|
gst_ogg_mux_collected (GstCollectPads * pads, GstOggMux * ogg_mux);
|
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 gboolean gst_ogg_mux_handle_src_event (GstPad * pad, GstEvent * event);
|
|
|
|
static GstPad *gst_ogg_mux_request_new_pad (GstElement * element,
|
2011-05-10 14:44:37 +00:00
|
|
|
GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
|
2006-01-27 01:36:01 +00:00
|
|
|
static void gst_ogg_mux_release_pad (GstElement * element, GstPad * pad);
|
|
|
|
|
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 gst_ogg_mux_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_ogg_mux_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn gst_ogg_mux_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
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 guint gst_ogg_mux_signals[LAST_SIGNAL] = { 0 }; */
|
2011-04-19 12:11:32 +00:00
|
|
|
#define gst_ogg_mux_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstOggMux, gst_ogg_mux, GST_TYPE_ELEMENT,
|
|
|
|
G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL));
|
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
|
|
|
|
gst_ogg_mux_class_init (GstOggMuxClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
|
|
|
|
2005-11-16 19:32:50 +00:00
|
|
|
gobject_class->finalize = gst_ogg_mux_finalize;
|
2005-03-31 09:43:49 +00:00
|
|
|
gobject_class->get_property = gst_ogg_mux_get_property;
|
|
|
|
gobject_class->set_property = gst_ogg_mux_set_property;
|
|
|
|
|
2011-04-19 12:11:32 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&src_factory));
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&sink_factory));
|
|
|
|
|
|
|
|
gst_element_class_set_details_simple (gstelement_class,
|
|
|
|
"Ogg muxer", "Codec/Muxer",
|
|
|
|
"mux ogg streams (info about ogg: http://xiph.org)",
|
|
|
|
"Wim Taymans <wim@fluendo.com>");
|
|
|
|
|
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
|
|
|
gstelement_class->request_new_pad = gst_ogg_mux_request_new_pad;
|
2006-01-27 01:36:01 +00:00
|
|
|
gstelement_class->release_pad = gst_ogg_mux_release_pad;
|
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
|
|
|
|
2004-06-10 16:06:21 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_MAX_DELAY,
|
|
|
|
g_param_spec_uint64 ("max-delay", "Max delay",
|
|
|
|
"Maximum delay in multiplexing streams", 0, G_MAXUINT64,
|
2008-03-22 15:00:53 +00:00
|
|
|
DEFAULT_MAX_DELAY,
|
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-06-11 14:38:59 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_MAX_PAGE_DELAY,
|
|
|
|
g_param_spec_uint64 ("max-page-delay", "Max page delay",
|
|
|
|
"Maximum delay for sending out a page", 0, G_MAXUINT64,
|
2008-03-22 15:00:53 +00:00
|
|
|
DEFAULT_MAX_PAGE_DELAY,
|
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2011-06-06 10:48:23 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_MAX_TOLERANCE,
|
|
|
|
g_param_spec_uint64 ("max-tolerance", "Max time tolerance",
|
|
|
|
"Maximum timestamp difference for maintaining perfect granules",
|
|
|
|
0, G_MAXUINT64, DEFAULT_MAX_TOLERANCE,
|
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2011-08-17 16:09:44 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_SKELETON,
|
|
|
|
g_param_spec_boolean ("skeleton", "Skeleton",
|
|
|
|
"Whether to include a Skeleton track",
|
|
|
|
DEFAULT_SKELETON,
|
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-06-10 16:06:21 +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
|
|
|
gstelement_class->change_state = gst_ogg_mux_change_state;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
#if 0
|
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 const GstEventMask *
|
|
|
|
gst_ogg_mux_get_sink_event_masks (GstPad * pad)
|
|
|
|
{
|
|
|
|
static const GstEventMask gst_ogg_mux_sink_event_masks[] = {
|
|
|
|
{GST_EVENT_EOS, 0},
|
2004-08-27 12:18:16 +00:00
|
|
|
{GST_EVENT_DISCONTINUOUS, 0},
|
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
|
|
|
{0,}
|
|
|
|
};
|
|
|
|
|
|
|
|
return gst_ogg_mux_sink_event_masks;
|
|
|
|
}
|
2005-05-09 10:56:13 +00:00
|
|
|
#endif
|
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
|
|
|
|
ext/: Fix a small memory leak in vorbisenc.
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_clear), (gst_ogg_mux_init),
(gst_ogg_mux_sinkconnect), (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_set_header_on_caps), (gst_ogg_mux_collected),
(gst_ogg_mux_clear_collectpads), (gst_ogg_mux_change_state):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_change_state):
Fix a small memory leak in vorbisenc.
Fix large memory leaks in oggmux, also fix lots of state change
bugs in oggmux.
2005-11-14 16:11:53 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_mux_clear (GstOggMux * ogg_mux)
|
|
|
|
{
|
|
|
|
ogg_mux->pulling = NULL;
|
|
|
|
ogg_mux->need_headers = TRUE;
|
|
|
|
ogg_mux->delta_pad = NULL;
|
2006-06-14 09:13:54 +00:00
|
|
|
ogg_mux->offset = 0;
|
|
|
|
ogg_mux->next_ts = 0;
|
2006-09-18 10:57:28 +00:00
|
|
|
ogg_mux->last_ts = GST_CLOCK_TIME_NONE;
|
ext/: Fix a small memory leak in vorbisenc.
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_clear), (gst_ogg_mux_init),
(gst_ogg_mux_sinkconnect), (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_set_header_on_caps), (gst_ogg_mux_collected),
(gst_ogg_mux_clear_collectpads), (gst_ogg_mux_change_state):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_change_state):
Fix a small memory leak in vorbisenc.
Fix large memory leaks in oggmux, also fix lots of state change
bugs in oggmux.
2005-11-14 16:11:53 +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
|
|
|
static void
|
|
|
|
gst_ogg_mux_init (GstOggMux * ogg_mux)
|
|
|
|
{
|
|
|
|
GstElementClass *klass = GST_ELEMENT_GET_CLASS (ogg_mux);
|
|
|
|
|
|
|
|
ogg_mux->srcpad =
|
|
|
|
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
|
|
|
|
"src"), "src");
|
|
|
|
gst_pad_set_event_function (ogg_mux->srcpad, gst_ogg_mux_handle_src_event);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (ogg_mux), ogg_mux->srcpad);
|
|
|
|
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* examples/indexing/indexmpeg.c: (main):
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_get),
(cdparanoia_open), (cdparanoia_close), (cdparanoia_event),
(cdparanoia_convert), (cdparanoia_query):
* ext/cdparanoia/gstcdparanoia.h:
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_init),
(gst_gnomevfssink_open_file), (gst_gnomevfssink_close_file),
(gst_gnomevfssink_chain), (gst_gnomevfssink_change_state):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_init):
* gst/audioscale/gstaudioscale.c: (gst_audioscale_init):
* gst/playback/gststreamselector.c: (gst_stream_selector_init):
* gst/tcp/gstmultifdsink.c: (gst_multifdsink_init),
(gst_multifdsink_render), (gst_multifdsink_start),
(gst_multifdsink_stop):
* gst/tcp/gstmultifdsink.h:
* gst/tcp/gsttcpclientsink.c: (gst_tcpclientsink_init),
(gst_tcpclientsink_render), (gst_tcpclientsink_start),
(gst_tcpclientsink_stop):
* gst/tcp/gsttcpclientsink.h:
* gst/tcp/gsttcpclientsrc.c: (gst_tcpclientsrc_init),
(gst_tcpclientsrc_getcaps), (gst_tcpclientsrc_create),
(gst_tcpclientsrc_start), (gst_tcpclientsrc_stop):
* gst/tcp/gsttcpclientsrc.h:
* gst/tcp/gsttcpserversink.h:
* gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_init),
(gst_tcpserversrc_create), (gst_tcpserversrc_start),
(gst_tcpserversrc_stop):
* gst/tcp/gsttcpserversrc.h:
* sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_init):
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_init):
* sys/ximage/ximagesink.c: (gst_ximagesink_init):
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:32:29 +00:00
|
|
|
GST_OBJECT_FLAG_SET (GST_ELEMENT (ogg_mux), GST_OGG_FLAG_BOS);
|
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
|
|
|
|
|
|
|
/* seed random number generator for creation of serial numbers */
|
|
|
|
srand (time (NULL));
|
|
|
|
|
2005-11-21 11:54:16 +00:00
|
|
|
ogg_mux->collect = gst_collect_pads_new ();
|
|
|
|
gst_collect_pads_set_function (ogg_mux->collect,
|
2006-03-24 17:11:53 +00:00
|
|
|
(GstCollectPadsFunction) GST_DEBUG_FUNCPTR (gst_ogg_mux_collected),
|
|
|
|
ogg_mux);
|
2005-11-16 18:09:15 +00:00
|
|
|
|
2009-09-04 07:11:38 +00:00
|
|
|
ogg_mux->max_delay = DEFAULT_MAX_DELAY;
|
|
|
|
ogg_mux->max_page_delay = DEFAULT_MAX_PAGE_DELAY;
|
2011-06-06 10:48:23 +00:00
|
|
|
ogg_mux->max_tolerance = DEFAULT_MAX_TOLERANCE;
|
2009-09-04 07:11:38 +00:00
|
|
|
|
ext/: Fix a small memory leak in vorbisenc.
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_clear), (gst_ogg_mux_init),
(gst_ogg_mux_sinkconnect), (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_set_header_on_caps), (gst_ogg_mux_collected),
(gst_ogg_mux_clear_collectpads), (gst_ogg_mux_change_state):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_change_state):
Fix a small memory leak in vorbisenc.
Fix large memory leaks in oggmux, also fix lots of state change
bugs in oggmux.
2005-11-14 16:11:53 +00:00
|
|
|
gst_ogg_mux_clear (ogg_mux);
|
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
|
|
|
}
|
|
|
|
|
2005-11-16 19:32:50 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_mux_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstOggMux *ogg_mux;
|
|
|
|
|
|
|
|
ogg_mux = GST_OGG_MUX (object);
|
|
|
|
|
|
|
|
if (ogg_mux->collect) {
|
|
|
|
gst_object_unref (ogg_mux->collect);
|
|
|
|
ogg_mux->collect = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2007-02-01 17:52:39 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_mux_ogg_pad_destroy_notify (GstCollectData * data)
|
|
|
|
{
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *oggpad = (GstOggPadData *) data;
|
2007-02-01 17:52:39 +00:00
|
|
|
GstBuffer *buf;
|
|
|
|
|
2011-01-21 16:05:46 +00:00
|
|
|
ogg_stream_clear (&oggpad->map.stream);
|
2011-02-02 17:30:15 +00:00
|
|
|
gst_caps_replace (&oggpad->map.caps, NULL);
|
2007-02-01 17:52:39 +00:00
|
|
|
|
|
|
|
if (oggpad->pagebuffers) {
|
|
|
|
while ((buf = g_queue_pop_head (oggpad->pagebuffers)) != NULL) {
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
g_queue_free (oggpad->pagebuffers);
|
|
|
|
oggpad->pagebuffers = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 GstPadLinkReturn
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_ogg_mux_sinkconnect (GstPad * pad, GstPad * peer)
|
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
|
|
|
{
|
|
|
|
GstOggMux *ogg_mux;
|
|
|
|
|
|
|
|
ogg_mux = GST_OGG_MUX (gst_pad_get_parent (pad));
|
|
|
|
|
2006-03-07 12:49:03 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg_mux, "sinkconnect triggered on %s", GST_PAD_NAME (pad));
|
ext/: Fix a small memory leak in vorbisenc.
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_clear), (gst_ogg_mux_init),
(gst_ogg_mux_sinkconnect), (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_set_header_on_caps), (gst_ogg_mux_collected),
(gst_ogg_mux_clear_collectpads), (gst_ogg_mux_change_state):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_change_state):
Fix a small memory leak in vorbisenc.
Fix large memory leaks in oggmux, also fix lots of state change
bugs in oggmux.
2005-11-14 16:11:53 +00:00
|
|
|
|
2006-03-07 12:49:03 +00:00
|
|
|
gst_object_unref (ogg_mux);
|
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
|
|
|
|
|
|
|
return GST_PAD_LINK_OK;
|
|
|
|
}
|
|
|
|
|
2008-08-07 16:11:14 +00:00
|
|
|
static gboolean
|
|
|
|
gst_ogg_mux_sink_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstOggMux *ogg_mux = GST_OGG_MUX (gst_pad_get_parent (pad));
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *ogg_pad = (GstOggPadData *) gst_pad_get_element_private (pad);
|
2011-04-12 11:41:06 +00:00
|
|
|
gboolean ret = FALSE;
|
2008-08-07 16:11:14 +00:00
|
|
|
|
2011-04-12 11:41:06 +00:00
|
|
|
GST_DEBUG_OBJECT (pad, "Got %s event", GST_EVENT_TYPE_NAME (event));
|
2008-08-07 16:11:14 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2011-05-16 11:48:11 +00:00
|
|
|
case GST_EVENT_SEGMENT:
|
|
|
|
{
|
2011-05-18 15:23:18 +00:00
|
|
|
const GstSegment *segment;
|
2011-02-16 19:07:49 +00:00
|
|
|
|
2011-05-16 11:48:11 +00:00
|
|
|
gst_event_parse_segment (event, &segment);
|
2011-02-16 19:07:49 +00:00
|
|
|
|
|
|
|
/* We don't support non time NEWSEGMENT events */
|
2011-05-18 15:23:18 +00:00
|
|
|
if (segment->format != GST_FORMAT_TIME) {
|
2011-02-16 19:07:49 +00:00
|
|
|
gst_event_unref (event);
|
2011-04-12 11:41:06 +00:00
|
|
|
event = NULL;
|
|
|
|
break;
|
2011-02-16 19:07:49 +00:00
|
|
|
}
|
2011-04-12 11:41:06 +00:00
|
|
|
|
2011-05-18 15:23:18 +00:00
|
|
|
gst_segment_copy_into (segment, &ogg_pad->segment);
|
2008-08-07 16:11:14 +00:00
|
|
|
break;
|
2011-02-16 19:07:49 +00:00
|
|
|
}
|
2011-04-01 08:57:08 +00:00
|
|
|
case GST_EVENT_FLUSH_STOP:{
|
2011-04-01 09:00:38 +00:00
|
|
|
gst_segment_init (&ogg_pad->segment, GST_FORMAT_TIME);
|
2008-08-07 16:11:14 +00:00
|
|
|
break;
|
2011-04-01 08:57:08 +00:00
|
|
|
}
|
2011-08-18 15:36:23 +00:00
|
|
|
case GST_EVENT_TAG:{
|
|
|
|
GstTagList *tags;
|
|
|
|
|
|
|
|
gst_event_parse_tag (event, &tags);
|
|
|
|
tags = gst_tag_list_merge (ogg_pad->tags, tags, GST_TAG_MERGE_APPEND);
|
|
|
|
if (ogg_pad->tags)
|
|
|
|
gst_tag_list_free (ogg_pad->tags);
|
|
|
|
ogg_pad->tags = tags;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ogg_mux, "Got tags %" GST_PTR_FORMAT, ogg_pad->tags);
|
|
|
|
break;
|
|
|
|
}
|
2008-08-07 16:11:14 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now GstCollectPads can take care of the rest, e.g. EOS */
|
2011-04-12 11:41:06 +00:00
|
|
|
if (event != NULL)
|
2008-08-07 16:11:14 +00:00
|
|
|
ret = ogg_pad->collect_event (pad, event);
|
|
|
|
|
|
|
|
gst_object_unref (ogg_mux);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-01-21 18:10:29 +00:00
|
|
|
static gboolean
|
|
|
|
gst_ogg_mux_is_serialno_present (GstOggMux * ogg_mux, guint32 serialno)
|
|
|
|
{
|
|
|
|
GSList *walk;
|
|
|
|
|
|
|
|
walk = ogg_mux->collect->data;
|
|
|
|
while (walk) {
|
|
|
|
GstOggPadData *pad = (GstOggPadData *) walk->data;
|
|
|
|
if (pad->map.serialno == serialno)
|
|
|
|
return TRUE;
|
|
|
|
walk = walk->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static guint32
|
|
|
|
gst_ogg_mux_generate_serialno (GstOggMux * ogg_mux)
|
|
|
|
{
|
|
|
|
guint32 serialno;
|
|
|
|
|
|
|
|
do {
|
|
|
|
serialno = g_random_int_range (0, G_MAXINT32);
|
|
|
|
} while (gst_ogg_mux_is_serialno_present (ogg_mux, serialno));
|
|
|
|
|
|
|
|
return serialno;
|
|
|
|
}
|
|
|
|
|
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 GstPad *
|
|
|
|
gst_ogg_mux_request_new_pad (GstElement * element,
|
2011-05-10 14:44:37 +00:00
|
|
|
GstPadTemplate * templ, const gchar * req_name, const GstCaps * caps)
|
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
|
|
|
{
|
|
|
|
GstOggMux *ogg_mux;
|
|
|
|
GstPad *newpad;
|
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
|
|
|
GstElementClass *klass;
|
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
|
|
|
|
|
|
|
g_return_val_if_fail (templ != NULL, NULL);
|
|
|
|
|
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
|
|
|
if (templ->direction != GST_PAD_SINK)
|
|
|
|
goto wrong_direction;
|
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
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_OGG_MUX (element), NULL);
|
|
|
|
ogg_mux = GST_OGG_MUX (element);
|
|
|
|
|
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
|
|
|
klass = GST_ELEMENT_GET_CLASS (element);
|
|
|
|
|
|
|
|
if (templ != gst_element_class_get_pad_template (klass, "sink_%d"))
|
|
|
|
goto wrong_template;
|
|
|
|
|
|
|
|
{
|
2011-08-17 17:03:16 +00:00
|
|
|
guint32 serial;
|
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
|
|
|
gchar *name;
|
|
|
|
|
|
|
|
if (req_name == NULL || strlen (req_name) < 6) {
|
|
|
|
/* no name given when requesting the pad, use random serial number */
|
2011-01-21 18:10:29 +00:00
|
|
|
serial = gst_ogg_mux_generate_serialno (ogg_mux);
|
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
|
|
|
} else {
|
|
|
|
/* parse serial number from requested padname */
|
2011-08-17 17:03:16 +00:00
|
|
|
unsigned long long_serial;
|
|
|
|
char *endptr = NULL;
|
|
|
|
long_serial = strtoul (&req_name[5], &endptr, 10);
|
|
|
|
if ((endptr && *endptr) || (long_serial & ~0xffffffff)) {
|
|
|
|
GST_WARNING_OBJECT (ogg_mux, "Invalid serial number specification: %s",
|
|
|
|
req_name + 5);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
serial = (guint32) long_serial;
|
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
|
|
|
}
|
|
|
|
/* create new pad with the name */
|
2007-04-13 21:09:04 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg_mux, "Creating new pad for serial %d", serial);
|
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
|
|
|
name = g_strdup_printf ("sink_%d", serial);
|
|
|
|
newpad = gst_pad_new_from_template (templ, name);
|
|
|
|
g_free (name);
|
|
|
|
|
|
|
|
/* construct our own wrapper data structure for the pad to
|
|
|
|
* keep track of its status */
|
|
|
|
{
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *oggpad;
|
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
|
|
|
|
2010-03-11 12:32:14 +00:00
|
|
|
oggpad = (GstOggPadData *)
|
2007-02-01 17:52:39 +00:00
|
|
|
gst_collect_pads_add_pad_full (ogg_mux->collect, newpad,
|
2010-03-11 12:32:14 +00:00
|
|
|
sizeof (GstOggPadData), gst_ogg_mux_ogg_pad_destroy_notify);
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
ogg_mux->active_pads++;
|
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
|
|
|
|
2011-01-21 16:05:46 +00:00
|
|
|
oggpad->map.serialno = serial;
|
|
|
|
ogg_stream_init (&oggpad->map.stream, oggpad->map.serialno);
|
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
|
|
|
oggpad->packetno = 0;
|
|
|
|
oggpad->pageno = 0;
|
|
|
|
oggpad->eos = FALSE;
|
|
|
|
/* we assume there will be some control data first for this pad */
|
|
|
|
oggpad->state = GST_OGG_PAD_STATE_CONTROL;
|
2004-08-17 10:40:50 +00:00
|
|
|
oggpad->new_page = TRUE;
|
|
|
|
oggpad->first_delta = FALSE;
|
|
|
|
oggpad->prev_delta = FALSE;
|
2011-01-21 10:56:00 +00:00
|
|
|
oggpad->data_pushed = FALSE;
|
2005-11-08 16:37:32 +00:00
|
|
|
oggpad->pagebuffers = g_queue_new ();
|
2011-01-21 16:05:46 +00:00
|
|
|
oggpad->map.headers = NULL;
|
|
|
|
oggpad->map.queued = NULL;
|
2011-06-06 10:48:23 +00:00
|
|
|
oggpad->next_granule = 0;
|
|
|
|
oggpad->keyframe_granule = -1;
|
2008-08-07 16:11:14 +00:00
|
|
|
|
2011-04-01 09:00:38 +00:00
|
|
|
gst_segment_init (&oggpad->segment, GST_FORMAT_TIME);
|
2008-08-07 16:11:14 +00:00
|
|
|
|
|
|
|
oggpad->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (newpad);
|
|
|
|
gst_pad_set_event_function (newpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_ogg_mux_sink_event));
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* setup some pad functions */
|
|
|
|
gst_pad_set_link_function (newpad, gst_ogg_mux_sinkconnect);
|
2008-08-07 16:11:14 +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
|
|
|
/* dd the pad to the element */
|
|
|
|
gst_element_add_pad (element, newpad);
|
|
|
|
|
|
|
|
return newpad;
|
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
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
wrong_direction:
|
|
|
|
{
|
|
|
|
g_warning ("ogg_mux: request pad that is not a SINK pad\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
wrong_template:
|
|
|
|
{
|
|
|
|
g_warning ("ogg_mux: this is not our template!\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2006-01-27 01:36:01 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_mux_release_pad (GstElement * element, GstPad * pad)
|
|
|
|
{
|
|
|
|
GstOggMux *ogg_mux;
|
|
|
|
|
|
|
|
ogg_mux = GST_OGG_MUX (gst_pad_get_parent (pad));
|
|
|
|
|
2011-02-21 11:04:09 +00:00
|
|
|
gst_collect_pads_remove_pad (ogg_mux->collect, pad);
|
2006-10-27 16:45:30 +00:00
|
|
|
gst_element_remove_pad (element, pad);
|
2007-08-09 11:37:28 +00:00
|
|
|
|
|
|
|
gst_object_unref (ogg_mux);
|
2006-01-27 01:36:01 +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
|
|
|
/* handle events */
|
|
|
|
static gboolean
|
|
|
|
gst_ogg_mux_handle_src_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstEventType type;
|
|
|
|
|
|
|
|
type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case GST_EVENT_SEEK:
|
|
|
|
/* disable seeking for now */
|
|
|
|
return FALSE;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return gst_pad_event_default (pad, event);
|
|
|
|
}
|
|
|
|
|
2004-06-09 12:22:46 +00:00
|
|
|
static GstBuffer *
|
2004-08-17 10:40:50 +00:00
|
|
|
gst_ogg_mux_buffer_from_page (GstOggMux * mux, ogg_page * page, gboolean delta)
|
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
|
|
|
{
|
|
|
|
GstBuffer *buffer;
|
|
|
|
|
|
|
|
/* allocate space for header and body */
|
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
|
|
|
buffer = gst_buffer_new_and_alloc (page->header_len + page->body_len);
|
2011-03-27 16:30:24 +00:00
|
|
|
gst_buffer_fill (buffer, 0, page->header, page->header_len);
|
|
|
|
gst_buffer_fill (buffer, page->header_len, page->body, page->body_len);
|
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
|
|
|
|
2005-11-08 16:37:32 +00:00
|
|
|
/* Here we set granulepos as our OFFSET_END to give easy direct access to
|
|
|
|
* this value later. Before we push it, we reset this to OFFSET + SIZE
|
|
|
|
* (see gst_ogg_mux_push_buffer). */
|
|
|
|
GST_BUFFER_OFFSET_END (buffer) = ogg_page_granulepos (page);
|
2004-08-17 10:40:50 +00:00
|
|
|
if (delta)
|
Port from GstData to GstMiniObject.
Original commit message from CVS:
Port from GstData to GstMiniObject.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_set_header_on_caps),
(gst_ogg_mux_collected):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_comment_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_set_header_on_caps), (theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_comment_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_set_header_on_caps):
* ext/vorbis/vorbisparse.c: (vorbis_parse_set_header_on_caps):
* gst-libs/gst/audio/gstaudiofilter.c: (gst_audiofilter_chain):
* gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_chain):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_get_buffer):
* gst/playback/gstdecodebin.c: (gst_decode_bin_class_init):
* gst/playback/gstplaybasebin.c: (check_queue), (probe_triggered),
(mute_stream), (silence_stream):
* gst/playback/gstplaybin.c: (gst_play_bin_class_init):
* gst/volume/gstvolume.c: (volume_transform):
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximage_buffer_init), (gst_ximage_buffer_class_init),
(gst_ximage_buffer_get_type), (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_imagepool_clear),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_free),
(gst_ximagesink_buffer_alloc):
* sys/ximage/ximagesink.h:
2005-05-16 15:35:52 +00:00
|
|
|
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
|
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
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GST_LOG_OBJECT (mux, GST_GP_FORMAT
|
2009-10-09 14:56:29 +00:00
|
|
|
" created buffer %p from ogg page",
|
|
|
|
GST_GP_CAST (ogg_page_granulepos (page)), buffer);
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
|
2004-06-09 12:22:46 +00:00
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
static GstFlowReturn
|
2011-03-03 11:45:15 +00:00
|
|
|
gst_ogg_mux_push_buffer (GstOggMux * mux, GstBuffer * buffer,
|
|
|
|
GstOggPadData * oggpad)
|
2004-06-09 12:22:46 +00:00
|
|
|
{
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* fix up OFFSET and OFFSET_END again */
|
|
|
|
GST_BUFFER_OFFSET (buffer) = mux->offset;
|
2011-03-27 16:30:24 +00:00
|
|
|
mux->offset += gst_buffer_get_size (buffer);
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GST_BUFFER_OFFSET_END (buffer) = mux->offset;
|
2005-11-08 16:37:32 +00:00
|
|
|
|
2006-09-18 10:57:28 +00:00
|
|
|
/* Ensure we have monotonically increasing timestamps in the output. */
|
|
|
|
if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) {
|
2011-06-06 10:46:05 +00:00
|
|
|
gint64 run_time = GST_BUFFER_TIMESTAMP (buffer);
|
2011-03-03 11:45:15 +00:00
|
|
|
if (mux->last_ts != GST_CLOCK_TIME_NONE && run_time < mux->last_ts)
|
2006-09-18 10:57:28 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (buffer) = mux->last_ts;
|
|
|
|
else
|
2011-03-03 11:45:15 +00:00
|
|
|
mux->last_ts = run_time;
|
2006-09-18 10:57:28 +00:00
|
|
|
}
|
|
|
|
|
2005-11-08 16:37:32 +00:00
|
|
|
return gst_pad_push (mux->srcpad, buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if all queues have at least one page, dequeue the page with the lowest
|
|
|
|
* timestamp */
|
|
|
|
static gboolean
|
|
|
|
gst_ogg_mux_dequeue_page (GstOggMux * mux, GstFlowReturn * flowret)
|
|
|
|
{
|
|
|
|
GSList *walk;
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *opad = NULL; /* "oldest" pad */
|
2005-11-08 16:37:32 +00:00
|
|
|
GstClockTime oldest = GST_CLOCK_TIME_NONE;
|
|
|
|
GstBuffer *buf = NULL;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
*flowret = GST_FLOW_OK;
|
|
|
|
|
|
|
|
walk = mux->collect->data;
|
|
|
|
while (walk) {
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *pad = (GstOggPadData *) walk->data;
|
2005-11-08 16:37:32 +00:00
|
|
|
|
|
|
|
/* We need each queue to either be at EOS, or have one or more pages
|
|
|
|
* available with a set granulepos (i.e. not -1), otherwise we don't have
|
|
|
|
* enough data yet to determine which stream needs to go next for correct
|
|
|
|
* time ordering. */
|
|
|
|
if (pad->pagebuffers->length == 0) {
|
|
|
|
if (pad->eos) {
|
2006-03-02 17:48:40 +00:00
|
|
|
GST_LOG_OBJECT (pad->collect.pad,
|
|
|
|
"pad is EOS, skipping for dequeue decision");
|
2005-11-08 16:37:32 +00:00
|
|
|
} else {
|
2006-03-02 17:48:40 +00:00
|
|
|
GST_LOG_OBJECT (pad->collect.pad,
|
|
|
|
"no pages in this queue, can't dequeue");
|
2005-11-08 16:37:32 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* We then need to check for a non-negative granulepos */
|
|
|
|
int i;
|
|
|
|
gboolean valid = FALSE;
|
|
|
|
|
|
|
|
for (i = 0; i < pad->pagebuffers->length; i++) {
|
|
|
|
buf = g_queue_peek_nth (pad->pagebuffers, i);
|
|
|
|
/* Here we check the OFFSET_END, which is actually temporarily the
|
|
|
|
* granulepos value for this buffer */
|
|
|
|
if (GST_BUFFER_OFFSET_END (buf) != -1) {
|
|
|
|
valid = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!valid) {
|
2006-03-02 17:48:40 +00:00
|
|
|
GST_LOG_OBJECT (pad->collect.pad,
|
|
|
|
"No page timestamps in queue, can't dequeue");
|
2005-11-08 16:37:32 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
walk = g_slist_next (walk);
|
|
|
|
}
|
|
|
|
|
|
|
|
walk = mux->collect->data;
|
|
|
|
while (walk) {
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *pad = (GstOggPadData *) walk->data;
|
2005-11-08 16:37:32 +00:00
|
|
|
|
2006-03-02 17:48:40 +00:00
|
|
|
/* any page with a granulepos of -1 can be pushed immediately.
|
2005-11-08 16:37:32 +00:00
|
|
|
* TODO: it CAN be, but it seems silly to do so? */
|
|
|
|
buf = g_queue_peek_head (pad->pagebuffers);
|
|
|
|
while (buf && GST_BUFFER_OFFSET_END (buf) == -1) {
|
2006-03-03 15:26:57 +00:00
|
|
|
GST_LOG_OBJECT (pad->collect.pad, "[gp -1] pushing page");
|
2005-11-08 16:37:32 +00:00
|
|
|
g_queue_pop_head (pad->pagebuffers);
|
2011-03-03 11:45:15 +00:00
|
|
|
*flowret = gst_ogg_mux_push_buffer (mux, buf, pad);
|
2005-11-08 16:37:32 +00:00
|
|
|
buf = g_queue_peek_head (pad->pagebuffers);
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (buf) {
|
|
|
|
/* if no oldest buffer yet, take this one */
|
|
|
|
if (oldest == GST_CLOCK_TIME_NONE) {
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GST_LOG_OBJECT (mux, "no oldest yet, taking buffer %p from pad %"
|
|
|
|
GST_PTR_FORMAT " with gp time %" GST_TIME_FORMAT,
|
|
|
|
buf, pad->collect.pad, GST_TIME_ARGS (GST_BUFFER_OFFSET (buf)));
|
|
|
|
oldest = GST_BUFFER_OFFSET (buf);
|
2005-11-08 16:37:32 +00:00
|
|
|
opad = pad;
|
|
|
|
} else {
|
|
|
|
/* if we have an oldest, compare with this one */
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
if (GST_BUFFER_OFFSET (buf) < oldest) {
|
|
|
|
GST_LOG_OBJECT (mux, "older buffer %p, taking from pad %"
|
|
|
|
GST_PTR_FORMAT " with gp time %" GST_TIME_FORMAT,
|
|
|
|
buf, pad->collect.pad, GST_TIME_ARGS (GST_BUFFER_OFFSET (buf)));
|
|
|
|
oldest = GST_BUFFER_OFFSET (buf);
|
2005-11-08 16:37:32 +00:00
|
|
|
opad = pad;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
walk = g_slist_next (walk);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oldest != GST_CLOCK_TIME_NONE) {
|
|
|
|
g_assert (opad);
|
|
|
|
buf = g_queue_pop_head (opad->pagebuffers);
|
2006-03-03 15:26:57 +00:00
|
|
|
GST_LOG_OBJECT (opad->collect.pad,
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GST_GP_FORMAT " pushing oldest page buffer %p (granulepos time %"
|
|
|
|
GST_TIME_FORMAT ")", GST_BUFFER_OFFSET_END (buf), buf,
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_OFFSET (buf)));
|
2011-03-03 11:45:15 +00:00
|
|
|
*flowret = gst_ogg_mux_push_buffer (mux, buf, opad);
|
2005-11-08 16:37:32 +00:00
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* put the given ogg page on a per-pad queue, timestamping it correctly.
|
|
|
|
* after that, dequeue and push as many pages as possible.
|
|
|
|
* Caller should make sure:
|
|
|
|
* pad->timestamp was set with the timestamp of the first packet put
|
|
|
|
* on the page
|
|
|
|
* pad->timestamp_end was set with the timestamp + duration of the last packet
|
|
|
|
* put on the page
|
|
|
|
* pad->gp_time was set with the time matching the gp of the last
|
|
|
|
* packet put on the page
|
|
|
|
*
|
|
|
|
* will also reset timestamp and timestamp_end, so caller func can restart
|
|
|
|
* counting.
|
|
|
|
*/
|
2005-11-08 16:37:32 +00:00
|
|
|
static GstFlowReturn
|
2010-03-11 12:32:14 +00:00
|
|
|
gst_ogg_mux_pad_queue_page (GstOggMux * mux, GstOggPadData * pad,
|
|
|
|
ogg_page * page, gboolean delta)
|
2005-11-08 16:37:32 +00:00
|
|
|
{
|
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
|
|
|
GstFlowReturn ret;
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GstBuffer *buffer = gst_ogg_mux_buffer_from_page (mux, page, delta);
|
2004-06-09 12:22:46 +00:00
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* take the timestamp of the first packet on this page */
|
2005-11-08 16:37:32 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (buffer) = pad->timestamp;
|
2006-02-09 19:05:23 +00:00
|
|
|
GST_BUFFER_DURATION (buffer) = pad->timestamp_end - pad->timestamp;
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* take the gp time of the last completed packet on this page */
|
|
|
|
GST_BUFFER_OFFSET (buffer) = pad->gp_time;
|
2006-02-09 19:05:23 +00:00
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* the next page will start where the current page's end time leaves off */
|
2006-02-09 19:05:23 +00:00
|
|
|
pad->timestamp = pad->timestamp_end;
|
|
|
|
|
2005-11-08 16:37:32 +00:00
|
|
|
g_queue_push_tail (pad->pagebuffers, buffer);
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GST_LOG_OBJECT (pad->collect.pad, GST_GP_FORMAT
|
|
|
|
" queued buffer page %p (gp time %"
|
|
|
|
GST_TIME_FORMAT ", timestamp %" GST_TIME_FORMAT
|
2009-10-09 14:56:29 +00:00
|
|
|
"), %d page buffers queued", GST_GP_CAST (ogg_page_granulepos (page)),
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
buffer, GST_TIME_ARGS (GST_BUFFER_OFFSET (buffer)),
|
2006-02-09 19:05:23 +00:00
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
|
|
|
|
g_queue_get_length (pad->pagebuffers));
|
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
|
|
|
|
2005-11-08 16:37:32 +00:00
|
|
|
while (gst_ogg_mux_dequeue_page (mux, &ret)) {
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
|
|
|
|
return ret;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
* Given two pads, compare the buffers queued on it.
|
|
|
|
* Returns:
|
|
|
|
* 0 if they have an equal priority
|
|
|
|
* -1 if the first is better
|
|
|
|
* 1 if the second is better
|
|
|
|
* Priority decided by: a) validity, b) older timestamp, c) smaller number
|
|
|
|
* of muxed pages
|
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 gint
|
2010-03-11 12:32:14 +00:00
|
|
|
gst_ogg_mux_compare_pads (GstOggMux * ogg_mux, GstOggPadData * first,
|
|
|
|
GstOggPadData * second)
|
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
|
|
|
{
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
guint64 firsttime, secondtime;
|
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
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* if the first pad doesn't contain anything or is even NULL, return
|
|
|
|
* the second pad as best candidate and vice versa */
|
2011-06-08 04:30:18 +00:00
|
|
|
if (first == NULL)
|
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
|
|
|
return 1;
|
2011-06-08 04:30:18 +00:00
|
|
|
if (second == NULL)
|
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
|
|
|
return -1;
|
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* no timestamp on first buffer, it must go first */
|
2011-06-08 04:30:18 +00:00
|
|
|
firsttime = GST_BUFFER_TIMESTAMP (first->buffer);
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
if (firsttime == GST_CLOCK_TIME_NONE)
|
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
|
|
|
return -1;
|
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* no timestamp on second buffer, it must go first */
|
2011-06-08 04:30:18 +00:00
|
|
|
secondtime = GST_BUFFER_TIMESTAMP (second->buffer);
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
if (secondtime == GST_CLOCK_TIME_NONE)
|
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
|
|
|
return 1;
|
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* first buffer has higher timestamp, second one should go first */
|
|
|
|
if (secondtime < firsttime)
|
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
|
|
|
return 1;
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* second buffer has higher timestamp, first one should go first */
|
|
|
|
else if (secondtime > firsttime)
|
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
|
|
|
return -1;
|
|
|
|
else {
|
|
|
|
/* buffers with equal timestamps, prefer the pad that has the
|
|
|
|
* least number of pages muxed */
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
if (second->pageno < first->pageno)
|
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
|
|
|
return 1;
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
else if (second->pageno > first->pageno)
|
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
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* same priority if all of the above failed */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-06-06 10:46:05 +00:00
|
|
|
static GstBuffer *
|
|
|
|
gst_ogg_mux_decorate_buffer (GstOggMux * ogg_mux, GstOggPadData * pad,
|
|
|
|
GstBuffer * buf)
|
|
|
|
{
|
|
|
|
GstClockTime time;
|
2011-06-06 10:48:23 +00:00
|
|
|
gint64 duration, granule, limit;
|
|
|
|
GstClockTime next_time;
|
|
|
|
GstClockTimeDiff diff;
|
|
|
|
ogg_packet packet;
|
2011-06-06 14:27:12 +00:00
|
|
|
gsize size;
|
2011-06-06 10:48:23 +00:00
|
|
|
|
|
|
|
/* ensure messing with metadata is ok */
|
2011-06-06 14:27:12 +00:00
|
|
|
buf = gst_buffer_make_writable (buf);
|
2011-06-06 10:46:05 +00:00
|
|
|
|
|
|
|
/* convert time to running time, so we need no longer bother about that */
|
|
|
|
time = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (time))) {
|
|
|
|
time = gst_segment_to_running_time (&pad->segment, GST_FORMAT_TIME, time);
|
|
|
|
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (time))) {
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
return NULL;
|
|
|
|
} else {
|
|
|
|
GST_BUFFER_TIMESTAMP (buf) = time;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-06 10:48:23 +00:00
|
|
|
/* now come up with granulepos stuff corresponding to time */
|
|
|
|
if (!pad->have_type ||
|
|
|
|
pad->map.granulerate_n <= 0 || pad->map.granulerate_d <= 0)
|
|
|
|
goto no_granule;
|
|
|
|
|
2011-06-06 14:27:12 +00:00
|
|
|
packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
|
|
|
packet.bytes = size;
|
2011-06-06 10:48:23 +00:00
|
|
|
duration = gst_ogg_stream_get_packet_duration (&pad->map, &packet);
|
2011-06-06 14:27:12 +00:00
|
|
|
gst_buffer_unmap (buf, packet.packet, size);
|
2011-06-06 10:48:23 +00:00
|
|
|
|
|
|
|
/* give up if no duration can be determined, relying on upstream */
|
|
|
|
if (G_UNLIKELY (duration < 0)) {
|
|
|
|
/* well, if some day we really could handle sparse input ... */
|
|
|
|
if (pad->map.is_sparse) {
|
|
|
|
limit = 1;
|
|
|
|
diff = 2;
|
|
|
|
goto resync;
|
|
|
|
}
|
|
|
|
GST_WARNING_OBJECT (pad->collect.pad,
|
|
|
|
"failed to determine packet duration");
|
|
|
|
goto no_granule;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (pad->collect.pad, "buffer ts %" GST_TIME_FORMAT
|
|
|
|
", duration %" GST_TIME_FORMAT ", granule duration %" G_GINT64_FORMAT,
|
|
|
|
GST_TIME_ARGS (time), GST_TIME_ARGS (GST_BUFFER_DURATION (buf)),
|
|
|
|
duration);
|
|
|
|
|
|
|
|
/* determine granule corresponding to time,
|
|
|
|
* using the inverse of oggdemux' granule -> time */
|
|
|
|
|
|
|
|
/* see if interpolated granule matches good enough */
|
|
|
|
granule = pad->next_granule;
|
|
|
|
next_time = gst_ogg_stream_granule_to_time (&pad->map, pad->next_granule);
|
|
|
|
diff = GST_CLOCK_DIFF (next_time, time);
|
|
|
|
|
|
|
|
/* we tolerate deviation up to configured or within granule granularity */
|
|
|
|
limit = gst_ogg_stream_granule_to_time (&pad->map, 1) / 2;
|
|
|
|
limit = MAX (limit, ogg_mux->max_tolerance);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (pad->collect.pad, "expected granule %" G_GINT64_FORMAT " == "
|
|
|
|
"time %" GST_TIME_FORMAT " --> ts diff %" GST_TIME_FORMAT
|
|
|
|
" < tolerance %" GST_TIME_FORMAT " (?)",
|
|
|
|
granule, GST_TIME_ARGS (next_time), GST_TIME_ARGS (ABS (diff)),
|
|
|
|
GST_TIME_ARGS (limit));
|
|
|
|
|
|
|
|
resync:
|
|
|
|
/* if not good enough, determine granule based on time */
|
|
|
|
if (diff > limit || diff < -limit) {
|
|
|
|
granule = gst_util_uint64_scale_round (time, pad->map.granulerate_n,
|
|
|
|
GST_SECOND * pad->map.granulerate_d);
|
|
|
|
GST_DEBUG_OBJECT (pad->collect.pad,
|
|
|
|
"resyncing to determined granule %" G_GINT64_FORMAT, granule);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pad->map.is_ogm || pad->map.is_sparse) {
|
|
|
|
pad->next_granule = granule;
|
|
|
|
} else {
|
|
|
|
granule += duration;
|
|
|
|
pad->next_granule = granule;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* track previous keyframe */
|
|
|
|
if (!GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT))
|
|
|
|
pad->keyframe_granule = granule;
|
|
|
|
|
|
|
|
/* determine corresponding time and granulepos */
|
|
|
|
GST_BUFFER_OFFSET (buf) = gst_ogg_stream_granule_to_time (&pad->map, granule);
|
|
|
|
GST_BUFFER_OFFSET_END (buf) =
|
|
|
|
gst_ogg_stream_granule_to_granulepos (&pad->map, granule,
|
|
|
|
pad->keyframe_granule);
|
|
|
|
|
2011-06-06 10:46:05 +00:00
|
|
|
return buf;
|
2011-06-06 10:48:23 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_granule:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (pad->collect.pad, "could not determine granulepos, "
|
|
|
|
"falling back to upstream provided metadata");
|
|
|
|
return buf;
|
|
|
|
}
|
2011-06-06 10:46:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
/* make sure at least one buffer is queued on all pads, two if possible
|
|
|
|
*
|
|
|
|
* if pad->buffer == NULL, pad->next_buffer != NULL, then
|
|
|
|
* we do not know if the buffer is the last or not
|
|
|
|
* if pad->buffer != NULL, pad->next_buffer != NULL, then
|
|
|
|
* pad->buffer is not the last buffer for the pad
|
|
|
|
* if pad->buffer != NULL, pad->next_buffer == NULL, then
|
|
|
|
* pad->buffer if the last buffer for the pad
|
|
|
|
*
|
|
|
|
* returns a pointer to an oggpad that holds the best buffer, or
|
|
|
|
* NULL when no pad was usable. "best" means the buffer marked
|
2011-06-08 04:30:18 +00:00
|
|
|
* with the lowest timestamp. If best->buffer == NULL then either
|
|
|
|
* we're at EOS (popped = FALSE), or a buffer got dropped, so retry. */
|
2010-03-11 12:32:14 +00:00
|
|
|
static GstOggPadData *
|
2011-06-08 04:30:18 +00:00
|
|
|
gst_ogg_mux_queue_pads (GstOggMux * ogg_mux, gboolean * popped)
|
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
|
|
|
{
|
2011-06-08 04:30:18 +00:00
|
|
|
GstOggPadData *bestpad = NULL;
|
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
|
|
|
GSList *walk;
|
|
|
|
|
2011-06-08 04:30:18 +00:00
|
|
|
*popped = FALSE;
|
|
|
|
|
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
|
|
|
/* try to make sure we have a buffer from each usable pad first */
|
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
|
|
|
walk = ogg_mux->collect->data;
|
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
|
|
|
while (walk) {
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *pad;
|
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
|
|
|
GstCollectData *data;
|
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
|
|
|
|
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
|
|
|
data = (GstCollectData *) walk->data;
|
2010-03-11 12:32:14 +00:00
|
|
|
pad = (GstOggPadData *) data;
|
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
|
|
|
|
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
|
|
|
walk = g_slist_next (walk);
|
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GST_LOG_OBJECT (data->pad, "looking at pad for buffer");
|
2005-11-17 10:56:14 +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
|
|
|
/* try to get a new buffer for this pad if needed and possible */
|
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
|
|
|
if (pad->buffer == NULL) {
|
|
|
|
GstBuffer *buf;
|
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
|
|
|
|
2005-11-21 11:54:16 +00:00
|
|
|
buf = gst_collect_pads_pop (ogg_mux->collect, data);
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GST_LOG_OBJECT (data->pad, "popped buffer %" GST_PTR_FORMAT, buf);
|
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
|
|
|
|
2005-10-11 17:19:36 +00:00
|
|
|
/* On EOS we get a NULL buffer */
|
|
|
|
if (buf != NULL) {
|
2011-06-08 04:30:18 +00:00
|
|
|
*popped = TRUE;
|
|
|
|
|
2007-06-15 11:15:28 +00:00
|
|
|
if (ogg_mux->delta_pad == NULL &&
|
|
|
|
GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT))
|
|
|
|
ogg_mux->delta_pad = pad;
|
|
|
|
|
2005-10-11 17:19:36 +00:00
|
|
|
/* if we need headers */
|
|
|
|
if (pad->state == GST_OGG_PAD_STATE_CONTROL) {
|
|
|
|
/* and we have one */
|
2011-01-21 16:05:46 +00:00
|
|
|
ogg_packet packet;
|
2011-02-02 17:23:43 +00:00
|
|
|
gboolean is_header;
|
2011-03-27 16:30:24 +00:00
|
|
|
gsize size;
|
2011-02-02 17:23:43 +00:00
|
|
|
|
2011-03-27 16:30:24 +00:00
|
|
|
packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
|
|
|
packet.bytes = size;
|
2011-02-02 17:23:43 +00:00
|
|
|
|
2011-01-21 16:05:46 +00:00
|
|
|
/* if we're not yet in data mode, ensure we're setup on the first packet */
|
|
|
|
if (!pad->have_type) {
|
2011-05-09 11:05:12 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
2011-04-15 12:36:39 +00:00
|
|
|
/* Use headers in caps, if any; this will allow us to be resilient
|
|
|
|
* to starting streams on the fly, and some streams (like VP8
|
|
|
|
* at least) do not send headers packets, as other muxers don't
|
|
|
|
* expect/need them. */
|
2011-06-03 17:00:39 +00:00
|
|
|
caps = gst_pad_get_current_caps (GST_PAD_CAST (data->pad));
|
2011-04-15 12:36:39 +00:00
|
|
|
pad->have_type =
|
2011-05-09 11:05:12 +00:00
|
|
|
gst_ogg_stream_setup_map_from_caps_headers (&pad->map, caps);
|
2011-04-15 12:36:39 +00:00
|
|
|
|
|
|
|
if (!pad->have_type) {
|
|
|
|
/* fallback on the packet */
|
|
|
|
pad->have_type = gst_ogg_stream_setup_map (&pad->map, &packet);
|
|
|
|
}
|
2011-01-21 16:05:46 +00:00
|
|
|
if (!pad->have_type) {
|
2011-02-02 17:23:43 +00:00
|
|
|
GST_ERROR_OBJECT (pad, "mapper didn't recognise input stream "
|
2011-05-09 11:05:12 +00:00
|
|
|
"(pad caps: %" GST_PTR_FORMAT ")", caps);
|
2011-02-02 17:23:43 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (pad, "caps detected: %" GST_PTR_FORMAT,
|
|
|
|
pad->map.caps);
|
2011-01-21 16:05:46 +00:00
|
|
|
}
|
2011-05-09 11:05:12 +00:00
|
|
|
if (caps)
|
|
|
|
gst_caps_unref (caps);
|
2011-01-21 16:05:46 +00:00
|
|
|
}
|
|
|
|
|
2011-02-02 17:23:43 +00:00
|
|
|
if (pad->have_type)
|
|
|
|
is_header = gst_ogg_stream_packet_is_header (&pad->map, &packet);
|
|
|
|
else /* fallback (FIXME 0.11: remove IN_CAPS hack) */
|
|
|
|
is_header = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
|
2011-01-21 16:05:46 +00:00
|
|
|
|
2011-03-27 16:30:24 +00:00
|
|
|
gst_buffer_unmap (buf, packet.packet, size);
|
|
|
|
|
2011-02-02 17:23:43 +00:00
|
|
|
if (is_header) {
|
2005-11-17 10:56:14 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg_mux,
|
2011-01-21 16:05:46 +00:00
|
|
|
"got header buffer in control state, ignoring");
|
2005-10-11 17:19:36 +00:00
|
|
|
/* just ignore */
|
2011-03-14 18:42:49 +00:00
|
|
|
pad->map.n_header_packets_seen++;
|
2005-10-11 17:19:36 +00:00
|
|
|
gst_buffer_unref (buf);
|
|
|
|
buf = NULL;
|
|
|
|
} else {
|
2005-11-17 10:56:14 +00:00
|
|
|
GST_DEBUG_OBJECT (ogg_mux,
|
2011-01-21 14:56:28 +00:00
|
|
|
"got data buffer in control state, switching to data mode");
|
2005-10-11 17:19:36 +00:00
|
|
|
/* this is a data buffer so switch to data state */
|
|
|
|
pad->state = GST_OGG_PAD_STATE_DATA;
|
2011-06-06 10:48:23 +00:00
|
|
|
|
|
|
|
/* check if this type of stream allows generating granulepos
|
|
|
|
* metadata here, if not, upstream will have to provide */
|
|
|
|
if (gst_ogg_stream_granule_to_granulepos (&pad->map, 1, 1) < 0) {
|
|
|
|
GST_WARNING_OBJECT (data->pad, "can not generate metadata; "
|
|
|
|
"relying on upstream");
|
|
|
|
/* disable metadata code path, otherwise not used anyway */
|
|
|
|
pad->map.granulerate_n = 0;
|
|
|
|
}
|
2005-10-11 17:19:36 +00:00
|
|
|
}
|
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
|
|
|
}
|
2011-06-06 10:46:05 +00:00
|
|
|
|
|
|
|
/* so now we should have a real data packet;
|
|
|
|
* see that it is properly decorated */
|
|
|
|
if (G_LIKELY (buf)) {
|
|
|
|
buf = gst_ogg_mux_decorate_buffer (ogg_mux, pad, buf);
|
|
|
|
if (G_UNLIKELY (!buf))
|
|
|
|
GST_DEBUG_OBJECT (data->pad, "buffer clipped");
|
|
|
|
}
|
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
|
|
|
}
|
2005-11-10 10:45:07 +00:00
|
|
|
|
2011-06-08 04:30:18 +00:00
|
|
|
pad->buffer = buf;
|
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
|
|
|
}
|
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
|
|
|
|
|
|
|
/* we should have a buffer now, see if it is the best pad to
|
|
|
|
* pull on */
|
2011-06-08 04:30:18 +00:00
|
|
|
if (pad->buffer) {
|
2005-11-17 10:56:14 +00:00
|
|
|
if (gst_ogg_mux_compare_pads (ogg_mux, bestpad, pad) > 0) {
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
GST_LOG_OBJECT (data->pad,
|
2011-06-08 04:30:18 +00:00
|
|
|
"new best pad, with buffer %" GST_PTR_FORMAT, pad->buffer);
|
2006-01-11 18:03:24 +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
|
|
|
bestpad = pad;
|
2005-11-17 10:56:14 +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
|
|
|
}
|
|
|
|
}
|
2005-10-17 15:36:33 +00:00
|
|
|
|
2011-06-08 04:30:18 +00:00
|
|
|
return bestpad;
|
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
|
|
|
}
|
|
|
|
|
2004-06-09 12:22:46 +00:00
|
|
|
static GList *
|
2010-03-11 12:32:14 +00:00
|
|
|
gst_ogg_mux_get_headers (GstOggPadData * pad)
|
2004-06-09 12:22:46 +00:00
|
|
|
{
|
|
|
|
GList *res = NULL;
|
|
|
|
GstStructure *structure;
|
2006-06-14 09:13:54 +00:00
|
|
|
GstCaps *caps;
|
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
|
|
|
GstPad *thepad;
|
2004-06-09 12:22:46 +00:00
|
|
|
|
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
|
|
|
thepad = pad->collect.pad;
|
2004-06-09 12:22:46 +00:00
|
|
|
|
2005-11-17 10:56:14 +00:00
|
|
|
GST_LOG_OBJECT (thepad, "getting headers");
|
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
|
|
|
|
2011-08-15 10:18:15 +00:00
|
|
|
caps = gst_pad_get_current_caps (thepad);
|
2004-06-09 12:22:46 +00:00
|
|
|
if (caps != NULL) {
|
|
|
|
const GValue *streamheader;
|
|
|
|
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
2008-04-22 06:18:04 +00:00
|
|
|
streamheader = gst_structure_get_value (structure, "streamheader");
|
|
|
|
if (streamheader != NULL) {
|
|
|
|
GST_LOG_OBJECT (thepad, "got header");
|
|
|
|
if (G_VALUE_TYPE (streamheader) == GST_TYPE_ARRAY) {
|
|
|
|
GArray *bufarr = g_value_peek_pointer (streamheader);
|
|
|
|
gint i;
|
2004-06-09 12:22:46 +00:00
|
|
|
|
2008-04-22 06:18:04 +00:00
|
|
|
GST_LOG_OBJECT (thepad, "got fixed list");
|
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
|
|
|
|
2008-04-22 06:18:04 +00:00
|
|
|
for (i = 0; i < bufarr->len; i++) {
|
|
|
|
GValue *bufval = &g_array_index (bufarr, GValue, i);
|
2004-06-09 12:22:46 +00:00
|
|
|
|
2008-04-22 06:18:04 +00:00
|
|
|
GST_LOG_OBJECT (thepad, "item %d", i);
|
|
|
|
if (G_VALUE_TYPE (bufval) == GST_TYPE_BUFFER) {
|
|
|
|
GstBuffer *buf = g_value_peek_pointer (bufval);
|
2004-06-09 12:22:46 +00:00
|
|
|
|
2008-04-22 06:18:04 +00:00
|
|
|
GST_LOG_OBJECT (thepad, "adding item %d to header list", i);
|
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
|
|
|
|
2008-04-22 06:18:04 +00:00
|
|
|
gst_buffer_ref (buf);
|
|
|
|
res = g_list_append (res, buf);
|
2004-06-09 12:22:46 +00:00
|
|
|
}
|
|
|
|
}
|
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
|
|
|
} else {
|
2008-04-22 06:18:04 +00:00
|
|
|
GST_LOG_OBJECT (thepad, "streamheader is not fixed list");
|
2004-06-09 12:22:46 +00:00
|
|
|
}
|
2010-06-08 05:34:08 +00:00
|
|
|
|
2008-04-22 06:18:04 +00:00
|
|
|
} else if (gst_structure_has_name (structure, "video/x-dirac")) {
|
|
|
|
res = g_list_append (res, pad->buffer);
|
2011-06-08 04:30:18 +00:00
|
|
|
pad->buffer = NULL;
|
2008-04-22 06:18:04 +00:00
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (thepad, "caps don't have streamheader");
|
2004-06-09 12:22:46 +00:00
|
|
|
}
|
2006-06-14 09:13:54 +00:00
|
|
|
gst_caps_unref (caps);
|
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
|
|
|
} else {
|
2005-11-17 10:56:14 +00:00
|
|
|
GST_LOG_OBJECT (thepad, "got empty caps as negotiated format");
|
2004-06-09 12:22:46 +00:00
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
static GstCaps *
|
2004-06-09 12:22:46 +00:00
|
|
|
gst_ogg_mux_set_header_on_caps (GstCaps * caps, GList * buffers)
|
|
|
|
{
|
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
|
|
|
GstStructure *structure;
|
2005-11-21 12:36:22 +00:00
|
|
|
GValue array = { 0 };
|
2004-06-09 12:22:46 +00:00
|
|
|
GList *walk = buffers;
|
|
|
|
|
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
|
|
|
caps = gst_caps_make_writable (caps);
|
|
|
|
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
|
2004-06-09 12:22:46 +00:00
|
|
|
/* put buffers in a fixed list */
|
2005-11-21 12:36:22 +00:00
|
|
|
g_value_init (&array, GST_TYPE_ARRAY);
|
2004-06-09 12:22:46 +00:00
|
|
|
|
|
|
|
while (walk) {
|
|
|
|
GstBuffer *buf = GST_BUFFER (walk->data);
|
2006-06-14 09:13:54 +00:00
|
|
|
GstBuffer *copy;
|
2004-06-09 12:22:46 +00:00
|
|
|
GValue value = { 0 };
|
|
|
|
|
|
|
|
walk = walk->next;
|
|
|
|
|
|
|
|
/* mark buffer */
|
2011-08-09 14:39:31 +00:00
|
|
|
GST_LOG ("Setting IN_CAPS on buffer of length %" G_GSIZE_FORMAT,
|
2011-03-27 16:30:24 +00:00
|
|
|
gst_buffer_get_size (buf));
|
Port from GstData to GstMiniObject.
Original commit message from CVS:
Port from GstData to GstMiniObject.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_set_header_on_caps),
(gst_ogg_mux_collected):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_comment_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_set_header_on_caps), (theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_comment_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_set_header_on_caps):
* ext/vorbis/vorbisparse.c: (vorbis_parse_set_header_on_caps):
* gst-libs/gst/audio/gstaudiofilter.c: (gst_audiofilter_chain):
* gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_chain):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_get_buffer):
* gst/playback/gstdecodebin.c: (gst_decode_bin_class_init):
* gst/playback/gstplaybasebin.c: (check_queue), (probe_triggered),
(mute_stream), (silence_stream):
* gst/playback/gstplaybin.c: (gst_play_bin_class_init):
* gst/volume/gstvolume.c: (volume_transform):
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximage_buffer_init), (gst_ximage_buffer_class_init),
(gst_ximage_buffer_get_type), (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_imagepool_clear),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_free),
(gst_ximagesink_buffer_alloc):
* sys/ximage/ximagesink.h:
2005-05-16 15:35:52 +00:00
|
|
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
|
2004-06-09 12:22:46 +00:00
|
|
|
|
|
|
|
g_value_init (&value, GST_TYPE_BUFFER);
|
2006-06-14 09:13:54 +00:00
|
|
|
copy = gst_buffer_copy (buf);
|
|
|
|
gst_value_set_buffer (&value, copy);
|
|
|
|
gst_buffer_unref (copy);
|
2005-11-21 12:36:22 +00:00
|
|
|
gst_value_array_append_value (&array, &value);
|
2004-06-09 12:22:46 +00:00
|
|
|
g_value_unset (&value);
|
|
|
|
}
|
2005-11-21 12:36:22 +00:00
|
|
|
gst_structure_set_value (structure, "streamheader", &array);
|
|
|
|
g_value_unset (&array);
|
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
|
|
|
|
|
|
|
return caps;
|
2004-06-09 12:22:46 +00:00
|
|
|
}
|
|
|
|
|
2011-08-17 16:39:18 +00:00
|
|
|
static void
|
2011-08-17 16:09:44 +00:00
|
|
|
gst_ogg_mux_create_header_packet_with_flags (ogg_packet * packet,
|
2011-08-24 09:04:53 +00:00
|
|
|
gboolean bos, gboolean eos)
|
2011-08-17 16:39:18 +00:00
|
|
|
{
|
|
|
|
packet->granulepos = 0;
|
|
|
|
/* mark BOS and packet number */
|
2011-08-17 16:09:44 +00:00
|
|
|
packet->b_o_s = bos;
|
2011-08-17 16:39:18 +00:00
|
|
|
/* mark EOS */
|
2011-08-17 16:09:44 +00:00
|
|
|
packet->e_o_s = eos;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-08-24 09:04:53 +00:00
|
|
|
gst_ogg_mux_create_header_packet (ogg_packet * packet, GstOggPadData * pad)
|
2011-08-17 16:09:44 +00:00
|
|
|
{
|
2011-08-24 09:04:53 +00:00
|
|
|
gst_ogg_mux_create_header_packet_with_flags (packet, pad->packetno == 0, 0);
|
2011-08-17 16:09:44 +00:00
|
|
|
packet->packetno = pad->packetno++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ogg_mux_submit_skeleton_header_packet (GstOggMux * mux,
|
|
|
|
ogg_stream_state * os, GstBuffer * buf, gboolean bos, gboolean eos)
|
|
|
|
{
|
|
|
|
ogg_packet packet;
|
2011-08-24 09:04:53 +00:00
|
|
|
gsize size;
|
|
|
|
|
|
|
|
packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
|
|
|
packet.bytes = size;
|
|
|
|
gst_ogg_mux_create_header_packet_with_flags (&packet, bos, eos);
|
2011-08-17 16:09:44 +00:00
|
|
|
ogg_stream_packetin (os, &packet);
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ogg_mux_make_fishead (GstOggMux * mux, ogg_stream_state * os)
|
|
|
|
{
|
|
|
|
GstByteWriter bw;
|
|
|
|
GstBuffer *fishead;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (mux, "Creating fishead");
|
|
|
|
|
2011-08-24 09:04:53 +00:00
|
|
|
gst_byte_writer_init_with_size (&bw, 64, TRUE);
|
2011-08-17 16:09:44 +00:00
|
|
|
gst_byte_writer_put_string_utf8 (&bw, "fishead");
|
|
|
|
gst_byte_writer_put_int16_le (&bw, 3); /* version major */
|
|
|
|
gst_byte_writer_put_int16_le (&bw, 0); /* version minor */
|
|
|
|
gst_byte_writer_put_int64_le (&bw, 0); /* presentation time numerator */
|
|
|
|
gst_byte_writer_put_int64_le (&bw, 1000); /* ...and denominator */
|
|
|
|
gst_byte_writer_put_int64_le (&bw, 0); /* base time numerator */
|
|
|
|
gst_byte_writer_put_int64_le (&bw, 1000); /* ...and denominator */
|
|
|
|
gst_byte_writer_fill (&bw, ' ', 20); /* UTC time */
|
2011-08-24 09:04:53 +00:00
|
|
|
g_assert (gst_byte_writer_get_pos (&bw) == 64);
|
|
|
|
fishead = gst_byte_writer_reset_and_get_buffer (&bw);
|
2011-08-17 16:09:44 +00:00
|
|
|
gst_ogg_mux_submit_skeleton_header_packet (mux, os, fishead, 1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ogg_mux_byte_writer_put_string_utf8 (GstByteWriter * bw, const char *s)
|
|
|
|
{
|
|
|
|
gst_byte_writer_put_data (bw, (const guint8 *) s, strlen (s));
|
|
|
|
}
|
|
|
|
|
2011-08-18 15:36:23 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_mux_add_fisbone_message_header (GstOggMux * mux, GstByteWriter * bw,
|
|
|
|
const char *tag, const char *value)
|
|
|
|
{
|
|
|
|
/* It is valid to pass NULL as the value to omit the tag */
|
|
|
|
if (!value)
|
|
|
|
return;
|
|
|
|
GST_DEBUG_OBJECT (mux, "Adding fisbone message header %s: %s", tag, value);
|
|
|
|
gst_ogg_mux_byte_writer_put_string_utf8 (bw, tag);
|
|
|
|
gst_ogg_mux_byte_writer_put_string_utf8 (bw, ": ");
|
|
|
|
gst_ogg_mux_byte_writer_put_string_utf8 (bw, value);
|
|
|
|
gst_ogg_mux_byte_writer_put_string_utf8 (bw, "\r\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ogg_mux_add_fisbone_message_header_from_tags (GstOggMux * mux,
|
|
|
|
GstByteWriter * bw, const char *header, const char *tag,
|
|
|
|
const GstTagList * tags)
|
|
|
|
{
|
|
|
|
GString *s;
|
|
|
|
guint size = gst_tag_list_get_tag_size (tags, tag), n;
|
|
|
|
GST_DEBUG_OBJECT (mux, "Found %u tags for name %s", size, tag);
|
|
|
|
if (size == 0)
|
|
|
|
return;
|
|
|
|
s = g_string_new ("");
|
|
|
|
for (n = 0; n < size; ++n) {
|
|
|
|
gchar *tmp;
|
|
|
|
if (n)
|
|
|
|
g_string_append (s, ", ");
|
|
|
|
gst_tag_list_get_string_index (tags, tag, n, &tmp);
|
|
|
|
g_string_append (s, tmp);
|
2011-08-24 16:39:11 +00:00
|
|
|
g_free (tmp);
|
2011-08-18 15:36:23 +00:00
|
|
|
}
|
|
|
|
gst_ogg_mux_add_fisbone_message_header (mux, bw, header, s->str);
|
2011-08-24 16:39:11 +00:00
|
|
|
g_string_free (s, TRUE);
|
2011-08-18 15:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This is a basic placeholder to generate roles for the tracks.
|
|
|
|
For tracks with more than one video, both video tracks will get
|
|
|
|
tagged with a "video/main" role, but we have no way of knowing
|
|
|
|
which one is the main one, if any. We could just pick one. For
|
|
|
|
audio, it's more complicated as we don't know which is music,
|
|
|
|
which is dubbing, etc. For kate, we could take a pretty good
|
|
|
|
guess based on the category, as role essentially is category.
|
|
|
|
For now, leave this as is. */
|
|
|
|
static const char *
|
|
|
|
gst_ogg_mux_get_default_role (GstOggPadData * pad)
|
|
|
|
{
|
|
|
|
const char *type = gst_ogg_stream_get_media_type (&pad->map);
|
|
|
|
if (type) {
|
|
|
|
if (!strncmp (type, "video/", strlen ("video/")))
|
|
|
|
return "video/main";
|
|
|
|
if (!strncmp (type, "audio/", strlen ("audio/")))
|
|
|
|
return "audio/main";
|
|
|
|
if (!strcmp (type + strlen (type) - strlen ("kate"), "kate"))
|
|
|
|
return "text/caption";
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-08-17 16:09:44 +00:00
|
|
|
static void
|
|
|
|
gst_ogg_mux_make_fisbone (GstOggMux * mux, ogg_stream_state * os,
|
|
|
|
GstOggPadData * pad)
|
|
|
|
{
|
|
|
|
GstByteWriter bw;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (mux,
|
|
|
|
"Creating %s fisbone for serial %08x",
|
|
|
|
gst_ogg_stream_get_media_type (&pad->map), pad->map.serialno);
|
|
|
|
|
|
|
|
gst_byte_writer_init (&bw);
|
|
|
|
gst_byte_writer_put_string_utf8 (&bw, "fisbone");
|
|
|
|
gst_byte_writer_put_int32_le (&bw, 44); /* offset to message headers */
|
|
|
|
gst_byte_writer_put_uint32_le (&bw, pad->map.serialno);
|
|
|
|
gst_byte_writer_put_uint32_le (&bw, pad->map.n_header_packets);
|
|
|
|
gst_byte_writer_put_uint64_le (&bw, pad->map.granulerate_n);
|
|
|
|
gst_byte_writer_put_uint64_le (&bw, pad->map.granulerate_d);
|
|
|
|
gst_byte_writer_put_uint64_le (&bw, 0); /* base granule */
|
|
|
|
gst_byte_writer_put_uint32_le (&bw, pad->map.preroll);
|
|
|
|
gst_byte_writer_put_uint8 (&bw, pad->map.granuleshift);
|
|
|
|
gst_byte_writer_fill (&bw, 0, 3); /* padding */
|
|
|
|
/* message header fields - MIME type for now */
|
2011-08-18 15:36:23 +00:00
|
|
|
gst_ogg_mux_add_fisbone_message_header (mux, &bw, "Content-Type",
|
2011-08-17 16:09:44 +00:00
|
|
|
gst_ogg_stream_get_media_type (&pad->map));
|
2011-08-18 15:36:23 +00:00
|
|
|
gst_ogg_mux_add_fisbone_message_header (mux, &bw, "Role",
|
|
|
|
gst_ogg_mux_get_default_role (pad));
|
|
|
|
gst_ogg_mux_add_fisbone_message_header_from_tags (mux, &bw, "Language",
|
|
|
|
GST_TAG_LANGUAGE_CODE, pad->tags);
|
|
|
|
gst_ogg_mux_add_fisbone_message_header_from_tags (mux, &bw, "Title",
|
|
|
|
GST_TAG_TITLE, pad->tags);
|
2011-08-17 16:09:44 +00:00
|
|
|
|
|
|
|
gst_ogg_mux_submit_skeleton_header_packet (mux, os,
|
|
|
|
gst_byte_writer_reset_and_get_buffer (&bw), 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ogg_mux_make_fistail (GstOggMux * mux, ogg_stream_state * os)
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (mux, "Creating fistail");
|
|
|
|
|
|
|
|
gst_ogg_mux_submit_skeleton_header_packet (mux, os,
|
|
|
|
gst_buffer_new_and_alloc (0), 0, 1);
|
2011-08-17 16:39:18 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 18:51:29 +00:00
|
|
|
/*
|
2004-06-09 12:22:46 +00:00
|
|
|
* For each pad we need to write out one (small) header in one
|
|
|
|
* page that allows decoders to identify the type of the stream.
|
|
|
|
* After that we need to write out all extra info for the decoders.
|
|
|
|
* In the case of a codec that also needs data as configuration, we can
|
|
|
|
* find that info in the streamcaps.
|
|
|
|
* After writing the headers we must start a new page for the data.
|
|
|
|
*/
|
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
|
|
|
static GstFlowReturn
|
2004-06-09 12:22:46 +00:00
|
|
|
gst_ogg_mux_send_headers (GstOggMux * mux)
|
|
|
|
{
|
|
|
|
GSList *walk;
|
|
|
|
GList *hbufs, *hwalk;
|
|
|
|
GstCaps *caps;
|
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
|
|
|
GstFlowReturn ret;
|
2011-08-17 16:09:44 +00:00
|
|
|
ogg_page page;
|
|
|
|
ogg_stream_state skeleton_stream;
|
2004-06-09 12:22:46 +00:00
|
|
|
|
|
|
|
hbufs = NULL;
|
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
|
|
|
ret = GST_FLOW_OK;
|
2004-06-09 12:22:46 +00:00
|
|
|
|
2005-11-17 10:56:14 +00:00
|
|
|
GST_LOG_OBJECT (mux, "collecting headers");
|
2004-06-09 12:22:46 +00:00
|
|
|
|
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
|
|
|
walk = mux->collect->data;
|
2004-06-09 12:22:46 +00:00
|
|
|
while (walk) {
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *pad;
|
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
|
|
|
GstPad *thepad;
|
2004-06-09 12:22:46 +00:00
|
|
|
|
2010-03-11 12:32:14 +00:00
|
|
|
pad = (GstOggPadData *) walk->data;
|
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
|
|
|
thepad = pad->collect.pad;
|
2004-06-09 12:22:46 +00:00
|
|
|
|
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
|
|
|
walk = g_slist_next (walk);
|
|
|
|
|
2005-11-17 10:56:14 +00:00
|
|
|
GST_LOG_OBJECT (mux, "looking at pad %s:%s", GST_DEBUG_PAD_NAME (thepad));
|
2004-06-09 12:22:46 +00:00
|
|
|
|
|
|
|
/* if the pad has no buffer, we don't care */
|
2011-06-08 04:30:18 +00:00
|
|
|
if (pad->buffer == NULL)
|
2004-06-09 12:22:46 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
/* now figure out the headers */
|
2011-01-21 16:05:46 +00:00
|
|
|
pad->map.headers = gst_ogg_mux_get_headers (pad);
|
2004-06-09 12:22:46 +00:00
|
|
|
}
|
|
|
|
|
2006-03-05 23:39:50 +00:00
|
|
|
GST_LOG_OBJECT (mux, "creating BOS pages");
|
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
|
|
|
walk = mux->collect->data;
|
2004-06-09 12:22:46 +00:00
|
|
|
while (walk) {
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *pad;
|
2004-06-09 12:22:46 +00:00
|
|
|
GstBuffer *buf;
|
|
|
|
ogg_packet packet;
|
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
|
|
|
GstPad *thepad;
|
2006-03-05 23:39:50 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
GstStructure *structure;
|
|
|
|
GstBuffer *hbuf;
|
2011-03-27 16:30:24 +00:00
|
|
|
gsize size;
|
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
|
|
|
|
2010-03-11 12:32:14 +00:00
|
|
|
pad = (GstOggPadData *) walk->data;
|
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
|
|
|
thepad = pad->collect.pad;
|
2011-08-15 10:18:15 +00:00
|
|
|
caps = gst_pad_get_current_caps (thepad);
|
2006-03-05 23:39:50 +00:00
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
2004-06-09 12:22:46 +00:00
|
|
|
|
|
|
|
walk = walk->next;
|
|
|
|
|
|
|
|
pad->packetno = 0;
|
|
|
|
|
2006-03-05 23:39:50 +00:00
|
|
|
GST_LOG_OBJECT (thepad, "looping over headers");
|
2004-06-09 12:22:46 +00:00
|
|
|
|
2011-01-21 16:05:46 +00:00
|
|
|
if (pad->map.headers) {
|
|
|
|
buf = GST_BUFFER (pad->map.headers->data);
|
|
|
|
pad->map.headers = g_list_remove (pad->map.headers, buf);
|
2005-10-17 11:32:46 +00:00
|
|
|
} else if (pad->buffer) {
|
2004-09-15 15:37:36 +00:00
|
|
|
buf = pad->buffer;
|
|
|
|
gst_buffer_ref (buf);
|
2005-10-17 11:32:46 +00:00
|
|
|
} else {
|
2005-10-17 15:36:33 +00:00
|
|
|
/* fixme -- should be caught in the previous list traversal. */
|
2011-02-24 15:22:53 +00:00
|
|
|
GST_OBJECT_LOCK (thepad);
|
2005-10-17 15:36:33 +00:00
|
|
|
g_critical ("No headers or buffers on pad %s:%s",
|
2011-02-24 15:22:53 +00:00
|
|
|
GST_DEBUG_PAD_NAME (thepad));
|
|
|
|
GST_OBJECT_UNLOCK (thepad);
|
2005-10-17 11:32:46 +00:00
|
|
|
continue;
|
2004-06-09 12:22:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* create a packet from the buffer */
|
2011-08-22 10:21:08 +00:00
|
|
|
packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
|
|
|
packet.bytes = size;
|
|
|
|
|
2011-08-24 09:04:53 +00:00
|
|
|
gst_ogg_mux_create_header_packet (&packet, pad);
|
2004-06-09 12:22:46 +00:00
|
|
|
|
|
|
|
/* swap the packet in */
|
2011-01-21 16:05:46 +00:00
|
|
|
ogg_stream_packetin (&pad->map.stream, &packet);
|
2011-03-27 16:30:24 +00:00
|
|
|
|
|
|
|
gst_buffer_unmap (buf, packet.packet, size);
|
2004-06-09 12:22:46 +00:00
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
2006-03-05 23:39:50 +00:00
|
|
|
GST_LOG_OBJECT (thepad, "flushing out BOS page");
|
2011-01-21 16:05:46 +00:00
|
|
|
if (!ogg_stream_flush (&pad->map.stream, &page))
|
2006-03-05 23:39:50 +00:00
|
|
|
g_critical ("Could not flush BOS page");
|
|
|
|
|
|
|
|
hbuf = gst_ogg_mux_buffer_from_page (mux, &page, FALSE);
|
2004-06-09 12:22:46 +00:00
|
|
|
|
2006-03-05 23:39:50 +00:00
|
|
|
GST_LOG_OBJECT (mux, "swapped out page with mime type %s",
|
|
|
|
gst_structure_get_name (structure));
|
|
|
|
|
2011-08-17 17:38:39 +00:00
|
|
|
/* quick hack: put video pages at the front.
|
2006-03-05 23:39:50 +00:00
|
|
|
* Ideally, we would have a settable enum for which Ogg
|
2007-06-07 14:25:32 +00:00
|
|
|
* profile we work with, and order based on that.
|
|
|
|
* (FIXME: if there is more than one video stream, shouldn't we only put
|
|
|
|
* one's BOS into the first page, followed by an audio stream's BOS, and
|
|
|
|
* only then followed by the remaining video and audio streams?) */
|
2011-08-17 17:38:39 +00:00
|
|
|
if (pad->map.is_video) {
|
|
|
|
GST_DEBUG_OBJECT (thepad, "putting %s page at the front",
|
|
|
|
gst_structure_get_name (structure));
|
2010-05-05 11:59:57 +00:00
|
|
|
hbufs = g_list_prepend (hbufs, hbuf);
|
2006-03-05 23:39:50 +00:00
|
|
|
} else {
|
2004-06-09 12:22:46 +00:00
|
|
|
hbufs = g_list_append (hbufs, hbuf);
|
|
|
|
}
|
2011-08-17 17:38:39 +00:00
|
|
|
|
2006-03-05 23:39:50 +00:00
|
|
|
gst_caps_unref (caps);
|
2004-06-09 12:22:46 +00:00
|
|
|
}
|
|
|
|
|
2011-08-17 16:09:44 +00:00
|
|
|
/* The Skeleton BOS goes first - even before the video that went first before */
|
|
|
|
if (mux->use_skeleton) {
|
|
|
|
ogg_stream_init (&skeleton_stream, gst_ogg_mux_generate_serialno (mux));
|
|
|
|
gst_ogg_mux_make_fishead (mux, &skeleton_stream);
|
|
|
|
while (ogg_stream_flush (&skeleton_stream, &page) > 0) {
|
|
|
|
GstBuffer *hbuf = gst_ogg_mux_buffer_from_page (mux, &page, FALSE);
|
|
|
|
hbufs = g_list_append (hbufs, hbuf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-17 10:56:14 +00:00
|
|
|
GST_LOG_OBJECT (mux, "creating next headers");
|
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
|
|
|
walk = mux->collect->data;
|
2004-06-09 12:22:46 +00:00
|
|
|
while (walk) {
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *pad;
|
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
|
|
|
GstPad *thepad;
|
|
|
|
|
2010-03-11 12:32:14 +00:00
|
|
|
pad = (GstOggPadData *) walk->data;
|
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
|
|
|
thepad = pad->collect.pad;
|
2004-06-09 12:22:46 +00:00
|
|
|
|
|
|
|
walk = walk->next;
|
|
|
|
|
2011-08-17 16:09:44 +00:00
|
|
|
if (mux->use_skeleton)
|
|
|
|
gst_ogg_mux_make_fisbone (mux, &skeleton_stream, pad);
|
|
|
|
|
2005-11-17 10:56:14 +00:00
|
|
|
GST_LOG_OBJECT (mux, "looping over headers for pad %s:%s",
|
|
|
|
GST_DEBUG_PAD_NAME (thepad));
|
2004-06-09 12:22:46 +00:00
|
|
|
|
2011-01-21 16:05:46 +00:00
|
|
|
hwalk = pad->map.headers;
|
2004-06-09 12:22:46 +00:00
|
|
|
while (hwalk) {
|
|
|
|
GstBuffer *buf = GST_BUFFER (hwalk->data);
|
|
|
|
ogg_packet packet;
|
|
|
|
ogg_page page;
|
2011-03-27 16:30:24 +00:00
|
|
|
gsize size;
|
2004-06-09 12:22:46 +00:00
|
|
|
|
|
|
|
hwalk = hwalk->next;
|
|
|
|
|
|
|
|
/* create a packet from the buffer */
|
2011-08-22 10:21:08 +00:00
|
|
|
packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
|
|
|
packet.bytes = size;
|
|
|
|
|
2011-08-24 09:04:53 +00:00
|
|
|
gst_ogg_mux_create_header_packet (&packet, pad);
|
2004-06-09 12:22:46 +00:00
|
|
|
|
|
|
|
/* swap the packet in */
|
2011-01-21 16:05:46 +00:00
|
|
|
ogg_stream_packetin (&pad->map.stream, &packet);
|
2011-03-27 16:30:24 +00:00
|
|
|
gst_buffer_unmap (buf, packet.packet, size);
|
2004-06-09 12:22:46 +00:00
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
|
|
|
/* if last header, flush page */
|
|
|
|
if (hwalk == NULL) {
|
2005-11-17 10:56:14 +00:00
|
|
|
GST_LOG_OBJECT (mux,
|
2006-10-05 15:55:21 +00:00
|
|
|
"flushing page as packet %" G_GUINT64_FORMAT " is first or "
|
2011-04-01 13:34:30 +00:00
|
|
|
"last packet", (guint64) packet.packetno);
|
2011-01-21 16:05:46 +00:00
|
|
|
while (ogg_stream_flush (&pad->map.stream, &page)) {
|
2004-08-17 10:40:50 +00:00
|
|
|
GstBuffer *hbuf = gst_ogg_mux_buffer_from_page (mux, &page, FALSE);
|
2004-06-09 12:22:46 +00:00
|
|
|
|
2005-11-17 10:56:14 +00:00
|
|
|
GST_LOG_OBJECT (mux, "swapped out page");
|
2004-06-09 12:22:46 +00:00
|
|
|
hbufs = g_list_append (hbufs, hbuf);
|
|
|
|
}
|
|
|
|
} else {
|
2005-11-17 10:56:14 +00:00
|
|
|
GST_LOG_OBJECT (mux, "try to swap out page");
|
2004-06-09 12:22:46 +00:00
|
|
|
/* just try to swap out a page then */
|
2011-01-21 16:05:46 +00:00
|
|
|
while (ogg_stream_pageout (&pad->map.stream, &page) > 0) {
|
2004-08-17 10:40:50 +00:00
|
|
|
GstBuffer *hbuf = gst_ogg_mux_buffer_from_page (mux, &page, FALSE);
|
2004-06-09 12:22:46 +00:00
|
|
|
|
2005-11-17 10:56:14 +00:00
|
|
|
GST_LOG_OBJECT (mux, "swapped out page");
|
2004-06-09 12:22:46 +00:00
|
|
|
hbufs = g_list_append (hbufs, hbuf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-01-21 16:05:46 +00:00
|
|
|
g_list_free (pad->map.headers);
|
|
|
|
pad->map.headers = NULL;
|
2004-06-09 12:22:46 +00:00
|
|
|
}
|
2011-08-17 16:09:44 +00:00
|
|
|
|
|
|
|
if (mux->use_skeleton) {
|
|
|
|
/* flush accumulated fisbones, the fistail must be on a separate page */
|
|
|
|
while (ogg_stream_flush (&skeleton_stream, &page) > 0) {
|
|
|
|
GstBuffer *hbuf = gst_ogg_mux_buffer_from_page (mux, &page, FALSE);
|
|
|
|
hbufs = g_list_append (hbufs, hbuf);
|
|
|
|
}
|
|
|
|
gst_ogg_mux_make_fistail (mux, &skeleton_stream);
|
|
|
|
while (ogg_stream_flush (&skeleton_stream, &page) > 0) {
|
|
|
|
GstBuffer *hbuf = gst_ogg_mux_buffer_from_page (mux, &page, FALSE);
|
|
|
|
hbufs = g_list_append (hbufs, hbuf);
|
|
|
|
}
|
|
|
|
ogg_stream_clear (&skeleton_stream);
|
|
|
|
}
|
|
|
|
|
2004-06-09 12:22:46 +00:00
|
|
|
/* hbufs holds all buffers for the headers now */
|
|
|
|
|
|
|
|
/* create caps with the buffers */
|
2011-05-16 10:20:34 +00:00
|
|
|
caps = gst_pad_get_caps (mux->srcpad, NULL);
|
2004-06-09 12:22:46 +00:00
|
|
|
if (caps) {
|
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
|
|
|
caps = gst_ogg_mux_set_header_on_caps (caps, hbufs);
|
|
|
|
gst_pad_set_caps (mux->srcpad, caps);
|
2005-11-28 22:54:48 +00:00
|
|
|
gst_caps_unref (caps);
|
2004-06-09 12:22:46 +00:00
|
|
|
}
|
|
|
|
/* and send the buffers */
|
2009-08-20 12:11:07 +00:00
|
|
|
while (hbufs != NULL) {
|
|
|
|
GstBuffer *buf = GST_BUFFER (hbufs->data);
|
2004-06-09 12:22:46 +00:00
|
|
|
|
2009-08-20 12:11:07 +00:00
|
|
|
hbufs = g_list_delete_link (hbufs, hbufs);
|
2004-06-09 12:22:46 +00:00
|
|
|
|
2011-03-03 11:45:15 +00:00
|
|
|
if ((ret = gst_ogg_mux_push_buffer (mux, buf, NULL)) != GST_FLOW_OK)
|
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
|
|
|
break;
|
2004-06-09 12:22:46 +00:00
|
|
|
}
|
2009-08-20 12:11:07 +00:00
|
|
|
/* free any remaining nodes/buffers in case we couldn't push them */
|
|
|
|
g_list_foreach (hbufs, (GFunc) gst_mini_object_unref, NULL);
|
2004-06-10 11:33:05 +00:00
|
|
|
g_list_free (hbufs);
|
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
|
|
|
|
|
|
|
return ret;
|
2004-06-09 12:22:46 +00:00
|
|
|
}
|
|
|
|
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
/* this function is called to process data on the best pending pad.
|
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
|
|
|
*
|
|
|
|
* basic idea:
|
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
|
|
|
*
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
* 1) store the selected pad and keep on pulling until we fill a
|
2006-03-02 17:04:55 +00:00
|
|
|
* complete ogg page or the ogg page is filled above the max-delay
|
2004-06-29 15:25:10 +00:00
|
|
|
* threshold. This is needed because the ogg spec says that
|
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
|
|
|
* you should fill a complete page with data from the same logical
|
|
|
|
* stream. When the page is filled, go back to 1).
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
* 2) before filling a page, read ahead one more buffer to see if this
|
2004-06-29 15:25:10 +00:00
|
|
|
* packet is the last of the stream. We need to do this because the ogg
|
|
|
|
* spec mandates that the last packet should have the EOS flag set before
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
* sending it to ogg. if pad->buffer is NULL we need to wait to find out
|
|
|
|
* whether there are any more buffers.
|
|
|
|
* 3) pages get queued on a per-pad queue. Every time a page is queued, a
|
2005-11-08 16:37:32 +00:00
|
|
|
* dequeue is called, which will dequeue the oldest page on any pad, provided
|
2005-11-10 10:45:07 +00:00
|
|
|
* that ALL pads have at least one marked page in the queue (or remaining
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
* pads are at EOS)
|
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
|
|
|
*/
|
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
|
|
|
static GstFlowReturn
|
2010-03-11 12:32:14 +00:00
|
|
|
gst_ogg_mux_process_best_pad (GstOggMux * ogg_mux, GstOggPadData * best)
|
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
|
|
|
{
|
2009-07-16 10:29:20 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2004-08-17 10:40:50 +00:00
|
|
|
gboolean delta_unit;
|
2005-11-08 16:37:32 +00:00
|
|
|
gint64 granulepos = 0;
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GstClockTime timestamp, gp_time;
|
2011-06-08 04:30:18 +00:00
|
|
|
GstBuffer *next_buf;
|
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
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GST_LOG_OBJECT (ogg_mux, "best pad %" GST_PTR_FORMAT
|
|
|
|
", currently pulling from %" GST_PTR_FORMAT, best->collect.pad,
|
2011-07-10 01:24:26 +00:00
|
|
|
ogg_mux->pulling ? ogg_mux->pulling->collect.pad : NULL);
|
|
|
|
|
|
|
|
if (ogg_mux->pulling) {
|
|
|
|
next_buf = gst_collect_pads_peek (ogg_mux->collect,
|
|
|
|
&ogg_mux->pulling->collect);
|
|
|
|
if (next_buf) {
|
|
|
|
ogg_mux->pulling->eos = FALSE;
|
|
|
|
gst_buffer_unref (next_buf);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (ogg_mux->pulling->collect.pad, "setting eos to true");
|
|
|
|
ogg_mux->pulling->eos = TRUE;
|
|
|
|
}
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
}
|
2006-03-02 17:04:55 +00:00
|
|
|
|
2011-07-10 01:33:38 +00:00
|
|
|
/* We could end up pushing from the best pad instead, so check that
|
|
|
|
* as well */
|
|
|
|
if (best && best != ogg_mux->pulling) {
|
|
|
|
next_buf = gst_collect_pads_peek (ogg_mux->collect, &best->collect);
|
|
|
|
if (next_buf) {
|
|
|
|
best->eos = FALSE;
|
|
|
|
gst_buffer_unref (next_buf);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (best->collect.pad, "setting eos to true");
|
|
|
|
best->eos = TRUE;
|
|
|
|
}
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
}
|
|
|
|
|
2005-11-08 16:37:32 +00:00
|
|
|
/* if we were already pulling from one pad, but the new "best" buffer is
|
|
|
|
* from another pad, we need to check if we have reason to flush a page
|
|
|
|
* for the pad we were pulling from before */
|
2004-06-10 16:06:21 +00:00
|
|
|
if (ogg_mux->pulling && best &&
|
|
|
|
ogg_mux->pulling != best && ogg_mux->pulling->buffer) {
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *pad = ogg_mux->pulling;
|
2006-02-09 19:05:23 +00:00
|
|
|
GstClockTime last_ts = GST_BUFFER_END_TIME (pad->buffer);
|
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
|
|
|
|
2006-03-02 17:15:38 +00:00
|
|
|
/* if the next packet in the current page is going to make the page
|
2004-06-10 16:06:21 +00:00
|
|
|
* too long, we need to flush */
|
|
|
|
if (last_ts > ogg_mux->next_ts + ogg_mux->max_delay) {
|
|
|
|
ogg_page page;
|
|
|
|
|
2006-03-02 17:30:57 +00:00
|
|
|
GST_LOG_OBJECT (pad->collect.pad,
|
2006-03-02 17:15:38 +00:00
|
|
|
GST_GP_FORMAT " stored packet %" G_GINT64_FORMAT
|
|
|
|
" will make page too long, flushing",
|
2011-01-21 16:05:46 +00:00
|
|
|
GST_BUFFER_OFFSET_END (pad->buffer),
|
|
|
|
(gint64) pad->map.stream.packetno);
|
2006-03-02 17:15:38 +00:00
|
|
|
|
2011-01-21 16:05:46 +00:00
|
|
|
while (ogg_stream_flush (&pad->map.stream, &page)) {
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* end time of this page is the timestamp of the next buffer */
|
|
|
|
ogg_mux->pulling->timestamp_end = GST_BUFFER_TIMESTAMP (pad->buffer);
|
2005-11-08 16:37:32 +00:00
|
|
|
/* Place page into the per-pad queue */
|
|
|
|
ret = gst_ogg_mux_pad_queue_page (ogg_mux, pad, &page,
|
|
|
|
pad->first_delta);
|
2004-06-10 16:06:21 +00:00
|
|
|
/* increment the page number counter */
|
2004-09-15 15:37:36 +00:00
|
|
|
pad->pageno++;
|
|
|
|
/* mark other pages as delta */
|
|
|
|
pad->first_delta = TRUE;
|
2004-06-10 16:06:21 +00:00
|
|
|
}
|
2004-09-15 15:37:36 +00:00
|
|
|
pad->new_page = TRUE;
|
2004-06-10 16:06:21 +00:00
|
|
|
ogg_mux->pulling = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we don't know which pad to pull on, use the best one */
|
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
|
|
|
if (ogg_mux->pulling == NULL) {
|
2004-06-10 16:06:21 +00:00
|
|
|
ogg_mux->pulling = best;
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GST_LOG_OBJECT (ogg_mux->pulling->collect.pad, "pulling from best pad");
|
2006-01-11 18:03:24 +00:00
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* remember timestamp and gp time of first buffer for this new pad */
|
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
|
|
|
if (ogg_mux->pulling != NULL) {
|
|
|
|
ogg_mux->next_ts = GST_BUFFER_TIMESTAMP (ogg_mux->pulling->buffer);
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GST_LOG_OBJECT (ogg_mux->pulling->collect.pad, "updated times, next ts %"
|
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (ogg_mux->next_ts));
|
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
|
|
|
} else {
|
|
|
|
/* no pad to pull on, send EOS */
|
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_pad_push_event (ogg_mux->srcpad, gst_event_new_eos ());
|
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
|
|
|
return GST_FLOW_WRONG_STATE;
|
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
|
|
|
}
|
|
|
|
}
|
ext/: remove explicit newmedia support from oggmux and vorbisenc add debug category to vorbisenc
Original commit message from CVS:
2004-09-22 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* ext/ogg/gstoggmux.c: (gst_ogg_mux_init),
(gst_ogg_mux_next_buffer), (gst_ogg_mux_loop):
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_init),
(gst_vorbisenc_chain):
* ext/vorbis/vorbisenc.h:
remove explicit newmedia support from oggmux and vorbisenc
add debug category to vorbisenc
* gst/multifilesink/gstmultifilesink.c:
(gst_multifilesink_class_init), (gst_multifilesink_init),
(gst_multifilesink_dispose), (gst_multifilesink_set_location),
(gst_multifilesink_set_property), (gst_multifilesink_next_file),
(gst_multifilesink_handle_event), (gst_multifilesink_chain),
(plugin_init):
* gst/multifilesink/gstmultifilesink.h:
add support for streamheader in multifilesink
2004-09-22 14:35:13 +00:00
|
|
|
|
2006-03-02 17:15:38 +00:00
|
|
|
if (ogg_mux->need_headers) {
|
|
|
|
ret = gst_ogg_mux_send_headers (ogg_mux);
|
|
|
|
ogg_mux->need_headers = FALSE;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* we are pulling from a pad, continue to do so until a page
|
2005-11-08 16:37:32 +00:00
|
|
|
* has been filled and queued */
|
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
|
|
|
if (ogg_mux->pulling != NULL) {
|
|
|
|
ogg_packet packet;
|
|
|
|
ogg_page page;
|
|
|
|
GstBuffer *buf, *tmpbuf;
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *pad = ogg_mux->pulling;
|
2004-06-11 14:38:59 +00:00
|
|
|
gint64 duration;
|
2004-08-17 10:40:50 +00:00
|
|
|
gboolean force_flush;
|
2011-03-27 16:30:24 +00:00
|
|
|
gsize size;
|
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
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GST_LOG_OBJECT (ogg_mux->pulling->collect.pad, "pulling from pad");
|
2005-11-17 10:56:14 +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
|
|
|
/* now see if we have a buffer */
|
|
|
|
buf = pad->buffer;
|
2005-11-17 10:56:14 +00:00
|
|
|
if (buf == NULL) {
|
|
|
|
GST_DEBUG_OBJECT (ogg_mux, "pad was EOS");
|
|
|
|
ogg_mux->pulling = NULL;
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
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
|
|
|
|
Port from GstData to GstMiniObject.
Original commit message from CVS:
Port from GstData to GstMiniObject.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_set_header_on_caps),
(gst_ogg_mux_collected):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_comment_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_set_header_on_caps), (theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_comment_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_set_header_on_caps):
* ext/vorbis/vorbisparse.c: (vorbis_parse_set_header_on_caps):
* gst-libs/gst/audio/gstaudiofilter.c: (gst_audiofilter_chain):
* gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_chain):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_get_buffer):
* gst/playback/gstdecodebin.c: (gst_decode_bin_class_init):
* gst/playback/gstplaybasebin.c: (check_queue), (probe_triggered),
(mute_stream), (silence_stream):
* gst/playback/gstplaybin.c: (gst_play_bin_class_init):
* gst/volume/gstvolume.c: (volume_transform):
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximage_buffer_init), (gst_ximage_buffer_class_init),
(gst_ximage_buffer_get_type), (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_imagepool_clear),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_free),
(gst_ximagesink_buffer_alloc):
* sys/ximage/ximagesink.h:
2005-05-16 15:35:52 +00:00
|
|
|
delta_unit = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
|
2004-06-11 14:38:59 +00:00
|
|
|
duration = GST_BUFFER_DURATION (buf);
|
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* if the current "next timestamp" on the pad is unset, then this is the
|
|
|
|
* first packet on the new page. Update our pad's page timestamp */
|
|
|
|
if (ogg_mux->pulling->timestamp == GST_CLOCK_TIME_NONE) {
|
|
|
|
ogg_mux->pulling->timestamp = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
GST_LOG_OBJECT (ogg_mux->pulling->collect.pad,
|
|
|
|
"updated pad timestamp to %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
|
|
|
|
}
|
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
|
|
|
/* create a packet from the buffer */
|
2011-03-27 16:30:24 +00:00
|
|
|
packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
|
|
|
packet.bytes = size;
|
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
|
|
|
packet.granulepos = GST_BUFFER_OFFSET_END (buf);
|
2004-08-22 09:31:06 +00:00
|
|
|
if (packet.granulepos == -1)
|
|
|
|
packet.granulepos = 0;
|
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
|
|
|
/* mark BOS and packet number */
|
|
|
|
packet.b_o_s = (pad->packetno == 0);
|
|
|
|
packet.packetno = pad->packetno++;
|
2006-03-02 17:30:57 +00:00
|
|
|
GST_LOG_OBJECT (pad->collect.pad, GST_GP_FORMAT
|
2006-03-02 17:15:38 +00:00
|
|
|
" packet %" G_GINT64_FORMAT " (%ld bytes) created from buffer",
|
2009-10-09 14:56:29 +00:00
|
|
|
GST_GP_CAST (packet.granulepos), (gint64) packet.packetno,
|
|
|
|
packet.bytes);
|
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
|
|
|
|
2011-07-10 01:24:26 +00:00
|
|
|
packet.e_o_s = ogg_mux->pulling->eos ? 1 : 0;
|
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
|
|
|
tmpbuf = NULL;
|
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
|
|
|
|
2004-08-17 10:40:50 +00:00
|
|
|
/* we flush when we see a new keyframe */
|
2011-08-17 17:48:54 +00:00
|
|
|
force_flush = (pad->prev_delta && !delta_unit)
|
|
|
|
|| pad->map.always_flush_page;
|
2004-06-11 14:38:59 +00:00
|
|
|
if (duration != -1) {
|
|
|
|
pad->duration += duration;
|
|
|
|
/* if page duration exceeds max, flush page */
|
|
|
|
if (pad->duration > ogg_mux->max_page_delay) {
|
2004-08-17 10:40:50 +00:00
|
|
|
force_flush = TRUE;
|
2004-06-11 14:38:59 +00:00
|
|
|
pad->duration = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-23 11:02:11 +00:00
|
|
|
if (GST_BUFFER_IS_DISCONT (buf)) {
|
2011-01-21 10:56:00 +00:00
|
|
|
if (pad->data_pushed) {
|
|
|
|
GST_LOG_OBJECT (pad->collect.pad, "got discont");
|
|
|
|
packet.packetno++;
|
|
|
|
/* No public API for this; hack things in */
|
2011-01-21 16:05:46 +00:00
|
|
|
pad->map.stream.pageno++;
|
2011-01-21 10:56:00 +00:00
|
|
|
force_flush = TRUE;
|
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (pad->collect.pad, "discont at stream start");
|
|
|
|
}
|
2006-11-23 11:02:11 +00:00
|
|
|
}
|
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* flush the currently built page if necessary */
|
2004-08-17 10:40:50 +00:00
|
|
|
if (force_flush) {
|
2006-03-02 17:30:57 +00:00
|
|
|
GST_LOG_OBJECT (pad->collect.pad,
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GST_GP_FORMAT " forced flush of page before this packet",
|
2006-03-02 17:15:38 +00:00
|
|
|
GST_BUFFER_OFFSET_END (pad->buffer));
|
2011-01-21 16:05:46 +00:00
|
|
|
while (ogg_stream_flush (&pad->map.stream, &page)) {
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* end time of this page is the timestamp of the next buffer */
|
|
|
|
ogg_mux->pulling->timestamp_end = GST_BUFFER_TIMESTAMP (pad->buffer);
|
2005-11-08 16:37:32 +00:00
|
|
|
ret = gst_ogg_mux_pad_queue_page (ogg_mux, pad, &page,
|
|
|
|
pad->first_delta);
|
2006-03-02 17:15:38 +00:00
|
|
|
|
2004-08-17 10:40:50 +00:00
|
|
|
/* increment the page number counter */
|
|
|
|
pad->pageno++;
|
2004-09-15 15:37:36 +00:00
|
|
|
/* mark other pages as delta */
|
2004-08-17 10:40:50 +00:00
|
|
|
pad->first_delta = TRUE;
|
|
|
|
}
|
|
|
|
pad->new_page = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if this is the first packet of a new page figure out the delta flag */
|
|
|
|
if (pad->new_page) {
|
|
|
|
if (delta_unit) {
|
|
|
|
/* mark the page as delta */
|
|
|
|
pad->first_delta = TRUE;
|
|
|
|
} else {
|
|
|
|
/* got a keyframe */
|
|
|
|
if (ogg_mux->delta_pad == pad) {
|
|
|
|
/* if we get it on the pad with deltaunits,
|
|
|
|
* we mark the page as non delta */
|
|
|
|
pad->first_delta = FALSE;
|
2004-09-15 15:37:36 +00:00
|
|
|
} else if (ogg_mux->delta_pad != NULL) {
|
|
|
|
/* if there are pads with delta frames, we
|
|
|
|
* must mark this one as delta */
|
|
|
|
pad->first_delta = TRUE;
|
|
|
|
} else {
|
|
|
|
pad->first_delta = FALSE;
|
2004-08-17 10:40:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pad->new_page = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* save key unit to track delta->key unit transitions */
|
|
|
|
pad->prev_delta = delta_unit;
|
|
|
|
|
|
|
|
/* swap the packet in */
|
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
|
|
|
if (packet.e_o_s == 1)
|
2006-03-02 17:48:40 +00:00
|
|
|
GST_DEBUG_OBJECT (pad->collect.pad, "swapping in EOS packet");
|
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
|
|
|
if (packet.b_o_s == 1)
|
2006-03-02 17:48:40 +00:00
|
|
|
GST_DEBUG_OBJECT (pad->collect.pad, "swapping in BOS packet");
|
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
|
|
|
|
2011-01-21 16:05:46 +00:00
|
|
|
ogg_stream_packetin (&pad->map.stream, &packet);
|
2011-03-27 16:30:24 +00:00
|
|
|
gst_buffer_unmap (buf, packet.packet, size);
|
2011-01-21 10:56:00 +00:00
|
|
|
pad->data_pushed = TRUE;
|
2004-08-17 10:40:50 +00:00
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
gp_time = GST_BUFFER_OFFSET (pad->buffer);
|
2005-11-08 16:37:32 +00:00
|
|
|
granulepos = GST_BUFFER_OFFSET_END (pad->buffer);
|
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (pad->buffer);
|
|
|
|
|
2006-03-02 17:30:57 +00:00
|
|
|
GST_LOG_OBJECT (pad->collect.pad,
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GST_GP_FORMAT " packet %" G_GINT64_FORMAT ", gp time %"
|
|
|
|
GST_TIME_FORMAT ", timestamp %" GST_TIME_FORMAT " packetin'd",
|
2009-10-09 14:56:29 +00:00
|
|
|
granulepos, (gint64) packet.packetno, GST_TIME_ARGS (gp_time),
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
GST_TIME_ARGS (timestamp));
|
2004-08-17 10:40:50 +00:00
|
|
|
/* don't need the old buffer anymore */
|
|
|
|
gst_buffer_unref (pad->buffer);
|
|
|
|
/* store new readahead buffer */
|
|
|
|
pad->buffer = tmpbuf;
|
|
|
|
|
2006-03-02 17:15:38 +00:00
|
|
|
/* let ogg write out the pages now. The packet we got could end
|
2004-08-17 10:40:50 +00:00
|
|
|
* up in more than one page so we need to write them all */
|
2011-01-21 16:05:46 +00:00
|
|
|
if (ogg_stream_pageout (&pad->map.stream, &page) > 0) {
|
2006-03-02 17:48:40 +00:00
|
|
|
/* we have a new page, so we need to timestamp it correctly.
|
|
|
|
* if this fresh packet ends on this page, then the page's granulepos
|
|
|
|
* comes from that packet, and we should set this buffer's timestamp */
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (pad->collect.pad,
|
|
|
|
GST_GP_FORMAT " packet %" G_GINT64_FORMAT ", time %"
|
|
|
|
GST_TIME_FORMAT ") caused new page",
|
2009-10-09 14:56:29 +00:00
|
|
|
granulepos, (gint64) packet.packetno, GST_TIME_ARGS (timestamp));
|
2006-03-02 17:48:40 +00:00
|
|
|
GST_LOG_OBJECT (pad->collect.pad,
|
2009-10-09 14:56:29 +00:00
|
|
|
GST_GP_FORMAT " new page %ld",
|
2011-01-21 16:05:46 +00:00
|
|
|
GST_GP_CAST (ogg_page_granulepos (&page)), pad->map.stream.pageno);
|
2006-03-02 17:48:40 +00:00
|
|
|
|
2005-11-08 16:37:32 +00:00
|
|
|
if (ogg_page_granulepos (&page) == granulepos) {
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* the packet we streamed in finishes on the current page,
|
2005-11-08 16:37:32 +00:00
|
|
|
* because the page's granulepos is the granulepos of the last
|
|
|
|
* packet completed on that page,
|
|
|
|
* so update the timestamp that we will give to the page */
|
2006-03-02 17:48:40 +00:00
|
|
|
GST_LOG_OBJECT (pad->collect.pad,
|
|
|
|
GST_GP_FORMAT
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
" packet finishes on current page, updating gp time to %"
|
|
|
|
GST_TIME_FORMAT, granulepos, GST_TIME_ARGS (gp_time));
|
|
|
|
pad->gp_time = gp_time;
|
2006-03-02 17:48:40 +00:00
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (pad->collect.pad,
|
|
|
|
GST_GP_FORMAT
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
" packet spans beyond current page, keeping old gp time %"
|
|
|
|
GST_TIME_FORMAT, granulepos, GST_TIME_ARGS (pad->gp_time));
|
2005-11-08 16:37:32 +00:00
|
|
|
}
|
|
|
|
|
2004-09-15 15:37:36 +00:00
|
|
|
/* push the page */
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* end time of this page is the timestamp of the next buffer */
|
|
|
|
pad->timestamp_end = timestamp;
|
2005-11-08 16:37:32 +00:00
|
|
|
ret = gst_ogg_mux_pad_queue_page (ogg_mux, pad, &page, pad->first_delta);
|
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
|
|
|
pad->pageno++;
|
2004-09-15 15:37:36 +00:00
|
|
|
/* mark next pages as delta */
|
|
|
|
pad->first_delta = TRUE;
|
|
|
|
|
2005-11-08 16:37:32 +00:00
|
|
|
/* use an inner loop here to flush the remaining pages and
|
2004-09-15 15:37:36 +00:00
|
|
|
* mark them as delta frames as well */
|
2011-01-21 16:05:46 +00:00
|
|
|
while (ogg_stream_pageout (&pad->map.stream, &page) > 0) {
|
2005-11-08 16:37:32 +00:00
|
|
|
if (ogg_page_granulepos (&page) == granulepos) {
|
|
|
|
/* the page has taken up the new packet completely, which means
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
* the packet ends the page and we can update the gp time
|
2005-11-08 16:37:32 +00:00
|
|
|
* before pushing out */
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
pad->gp_time = gp_time;
|
2005-11-08 16:37:32 +00:00
|
|
|
}
|
|
|
|
|
2006-03-02 17:30:57 +00:00
|
|
|
/* we have a complete page now, we can push the page
|
2004-09-15 15:37:36 +00:00
|
|
|
* and make sure to pull on a new pad the next time around */
|
2005-11-08 16:37:32 +00:00
|
|
|
ret = gst_ogg_mux_pad_queue_page (ogg_mux, pad, &page,
|
|
|
|
pad->first_delta);
|
2004-09-15 15:37:36 +00:00
|
|
|
/* increment the page number counter */
|
|
|
|
pad->pageno++;
|
|
|
|
}
|
|
|
|
/* need a new page as well */
|
|
|
|
pad->new_page = TRUE;
|
|
|
|
pad->duration = 0;
|
2006-03-02 17:30:57 +00:00
|
|
|
/* we're done pulling on this pad, make sure to choose a new
|
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
|
|
|
* pad for pulling in the next iteration */
|
|
|
|
ogg_mux->pulling = NULL;
|
|
|
|
}
|
2005-11-08 16:37:32 +00:00
|
|
|
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
/* Update the gp time, if necessary, since any future page will have at
|
|
|
|
* least this gp time.
|
2005-11-08 16:37:32 +00:00
|
|
|
*/
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
if (pad->gp_time < gp_time) {
|
|
|
|
pad->gp_time = gp_time;
|
|
|
|
GST_LOG_OBJECT (pad->collect.pad,
|
|
|
|
"Updated running gp time of pad %" GST_PTR_FORMAT
|
|
|
|
" to %" GST_TIME_FORMAT, pad->collect.pad, GST_TIME_ARGS (gp_time));
|
2005-11-08 16:37:32 +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
|
|
|
}
|
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
|
|
|
|
2009-07-16 10:29:20 +00:00
|
|
|
return ret;
|
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
|
|
|
}
|
|
|
|
|
2008-05-22 22:09:16 +00:00
|
|
|
/* all_pads_eos:
|
2007-01-23 14:30:28 +00:00
|
|
|
*
|
|
|
|
* Checks if all pads are EOS'd by peeking.
|
|
|
|
*
|
|
|
|
* Returns TRUE if all pads are EOS.
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
all_pads_eos (GstCollectPads * pads)
|
|
|
|
{
|
|
|
|
GSList *walk;
|
|
|
|
|
|
|
|
walk = pads->data;
|
|
|
|
while (walk) {
|
2011-06-08 04:30:18 +00:00
|
|
|
GstOggPadData *oggpad = (GstOggPadData *) walk->data;
|
2007-01-23 14:30:28 +00:00
|
|
|
|
2011-07-10 01:24:26 +00:00
|
|
|
GST_DEBUG_OBJECT (oggpad->collect.pad,
|
|
|
|
"oggpad %p eos %d", oggpad, oggpad->eos);
|
2011-06-08 04:30:18 +00:00
|
|
|
|
|
|
|
if (oggpad->eos == FALSE)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
walk = g_slist_next (walk);
|
2007-01-23 14:30:28 +00:00
|
|
|
}
|
2011-06-08 04:30:18 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2007-01-23 14:30:28 +00:00
|
|
|
}
|
|
|
|
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
/* This function is called when there is data on all pads.
|
|
|
|
*
|
|
|
|
* It finds a pad to pull on, this is done by looking at the buffers
|
|
|
|
* to decide which one to use, and using the 'oldest' one first. It then calls
|
|
|
|
* gst_ogg_mux_process_best_pad() to process as much data as possible.
|
|
|
|
*
|
|
|
|
* If all the pads have received EOS, it flushes out all data by continually
|
|
|
|
* getting the best pad and calling gst_ogg_mux_process_best_pad() until they
|
|
|
|
* are all empty, and then sends EOS.
|
|
|
|
*/
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_ogg_mux_collected (GstCollectPads * pads, GstOggMux * ogg_mux)
|
|
|
|
{
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *best;
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
GstFlowReturn ret;
|
2011-06-08 04:30:18 +00:00
|
|
|
gboolean popped;
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
|
|
|
|
GST_LOG_OBJECT (ogg_mux, "collected");
|
|
|
|
|
|
|
|
/* queue buffers on all pads; find a buffer with the lowest timestamp */
|
2011-06-08 04:30:18 +00:00
|
|
|
best = gst_ogg_mux_queue_pads (ogg_mux, &popped);
|
|
|
|
|
|
|
|
if (popped)
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
2011-06-08 04:30:18 +00:00
|
|
|
if (best == NULL || best->buffer == NULL) {
|
|
|
|
/* This is not supposed to happen */
|
|
|
|
return GST_FLOW_ERROR;
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ret = gst_ogg_mux_process_best_pad (ogg_mux, best);
|
|
|
|
|
2011-06-08 04:30:18 +00:00
|
|
|
if (best->eos && all_pads_eos (pads)) {
|
|
|
|
gst_pad_push_event (ogg_mux->srcpad, gst_event_new_eos ());
|
2011-10-10 09:39:52 +00:00
|
|
|
return GST_FLOW_EOS;
|
ext/ogg/gstoggmux.c: Commit patch from James "Doc" Livingston, adds proper EOS handling in oggmux. GStreamer can, for...
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_release_pad), (gst_ogg_mux_push_buffer),
(gst_ogg_mux_compare_pads), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_send_headers), (gst_ogg_mux_process_best_pad),
(gst_ogg_mux_collected):
Commit patch from James "Doc" Livingston, adds proper EOS handling
in oggmux. GStreamer can, for the first time ever, create a valid
Ogg file! Yay!
* tests/check/pipelines/oggmux.c: (check_chain_final_state),
(oggmux_suite):
Reenable tests now that they pass.
2006-09-29 10:43:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
gst_ogg_mux_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2004-06-10 16:06:21 +00:00
|
|
|
GstOggMux *ogg_mux;
|
|
|
|
|
|
|
|
ogg_mux = GST_OGG_MUX (object);
|
|
|
|
|
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
|
|
|
switch (prop_id) {
|
2004-06-10 16:06:21 +00:00
|
|
|
case ARG_MAX_DELAY:
|
|
|
|
g_value_set_uint64 (value, ogg_mux->max_delay);
|
|
|
|
break;
|
2004-06-11 14:38:59 +00:00
|
|
|
case ARG_MAX_PAGE_DELAY:
|
|
|
|
g_value_set_uint64 (value, ogg_mux->max_page_delay);
|
|
|
|
break;
|
2011-06-06 10:48:23 +00:00
|
|
|
case ARG_MAX_TOLERANCE:
|
|
|
|
g_value_set_uint64 (value, ogg_mux->max_tolerance);
|
|
|
|
break;
|
2011-08-17 16:09:44 +00:00
|
|
|
case ARG_SKELETON:
|
|
|
|
g_value_set_boolean (value, ogg_mux->use_skeleton);
|
|
|
|
break;
|
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
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ogg_mux_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2004-06-10 16:06:21 +00:00
|
|
|
GstOggMux *ogg_mux;
|
|
|
|
|
|
|
|
ogg_mux = GST_OGG_MUX (object);
|
|
|
|
|
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
|
|
|
switch (prop_id) {
|
2004-06-10 16:06:21 +00:00
|
|
|
case ARG_MAX_DELAY:
|
|
|
|
ogg_mux->max_delay = g_value_get_uint64 (value);
|
|
|
|
break;
|
2004-06-11 14:38:59 +00:00
|
|
|
case ARG_MAX_PAGE_DELAY:
|
|
|
|
ogg_mux->max_page_delay = g_value_get_uint64 (value);
|
|
|
|
break;
|
2011-06-06 10:48:23 +00:00
|
|
|
case ARG_MAX_TOLERANCE:
|
|
|
|
ogg_mux->max_tolerance = g_value_get_uint64 (value);
|
|
|
|
break;
|
2011-08-17 16:09:44 +00:00
|
|
|
case ARG_SKELETON:
|
|
|
|
ogg_mux->use_skeleton = g_value_get_boolean (value);
|
|
|
|
break;
|
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
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-14 09:13:54 +00:00
|
|
|
/* reset all variables in the ogg pads. */
|
ext/: Fix a small memory leak in vorbisenc.
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_clear), (gst_ogg_mux_init),
(gst_ogg_mux_sinkconnect), (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_set_header_on_caps), (gst_ogg_mux_collected),
(gst_ogg_mux_clear_collectpads), (gst_ogg_mux_change_state):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_change_state):
Fix a small memory leak in vorbisenc.
Fix large memory leaks in oggmux, also fix lots of state change
bugs in oggmux.
2005-11-14 16:11:53 +00:00
|
|
|
static void
|
2006-06-14 09:13:54 +00:00
|
|
|
gst_ogg_mux_init_collectpads (GstCollectPads * collect)
|
ext/: Fix a small memory leak in vorbisenc.
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_clear), (gst_ogg_mux_init),
(gst_ogg_mux_sinkconnect), (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_set_header_on_caps), (gst_ogg_mux_collected),
(gst_ogg_mux_clear_collectpads), (gst_ogg_mux_change_state):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_change_state):
Fix a small memory leak in vorbisenc.
Fix large memory leaks in oggmux, also fix lots of state change
bugs in oggmux.
2005-11-14 16:11:53 +00:00
|
|
|
{
|
|
|
|
GSList *walk;
|
|
|
|
|
|
|
|
walk = collect->data;
|
|
|
|
while (walk) {
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *oggpad = (GstOggPadData *) walk->data;
|
ext/: Fix a small memory leak in vorbisenc.
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_clear), (gst_ogg_mux_init),
(gst_ogg_mux_sinkconnect), (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_set_header_on_caps), (gst_ogg_mux_collected),
(gst_ogg_mux_clear_collectpads), (gst_ogg_mux_change_state):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_change_state):
Fix a small memory leak in vorbisenc.
Fix large memory leaks in oggmux, also fix lots of state change
bugs in oggmux.
2005-11-14 16:11:53 +00:00
|
|
|
|
2011-01-21 16:05:46 +00:00
|
|
|
ogg_stream_init (&oggpad->map.stream, oggpad->map.serialno);
|
2006-01-27 01:36:01 +00:00
|
|
|
oggpad->packetno = 0;
|
|
|
|
oggpad->pageno = 0;
|
|
|
|
oggpad->eos = FALSE;
|
|
|
|
/* we assume there will be some control data first for this pad */
|
|
|
|
oggpad->state = GST_OGG_PAD_STATE_CONTROL;
|
|
|
|
oggpad->new_page = TRUE;
|
|
|
|
oggpad->first_delta = FALSE;
|
|
|
|
oggpad->prev_delta = FALSE;
|
2011-01-21 10:56:00 +00:00
|
|
|
oggpad->data_pushed = FALSE;
|
2006-01-27 01:36:01 +00:00
|
|
|
oggpad->pagebuffers = g_queue_new ();
|
|
|
|
|
2011-04-01 09:00:38 +00:00
|
|
|
gst_segment_init (&oggpad->segment, GST_FORMAT_TIME);
|
2006-01-27 01:36:01 +00:00
|
|
|
|
|
|
|
walk = g_slist_next (walk);
|
ext/: Fix a small memory leak in vorbisenc.
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_clear), (gst_ogg_mux_init),
(gst_ogg_mux_sinkconnect), (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_set_header_on_caps), (gst_ogg_mux_collected),
(gst_ogg_mux_clear_collectpads), (gst_ogg_mux_change_state):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_change_state):
Fix a small memory leak in vorbisenc.
Fix large memory leaks in oggmux, also fix lots of state change
bugs in oggmux.
2005-11-14 16:11:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-14 09:13:54 +00:00
|
|
|
/* Clear all buffers from the collectpads object */
|
|
|
|
static void
|
|
|
|
gst_ogg_mux_clear_collectpads (GstCollectPads * collect)
|
|
|
|
{
|
|
|
|
GSList *walk;
|
|
|
|
|
|
|
|
for (walk = collect->data; walk; walk = g_slist_next (walk)) {
|
2010-03-11 12:32:14 +00:00
|
|
|
GstOggPadData *oggpad = (GstOggPadData *) walk->data;
|
2006-06-14 09:13:54 +00:00
|
|
|
GstBuffer *buf;
|
|
|
|
|
2011-01-21 16:05:46 +00:00
|
|
|
ogg_stream_clear (&oggpad->map.stream);
|
2006-06-14 09:13:54 +00:00
|
|
|
|
|
|
|
while ((buf = g_queue_pop_head (oggpad->pagebuffers)) != NULL) {
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
g_queue_free (oggpad->pagebuffers);
|
|
|
|
oggpad->pagebuffers = NULL;
|
2008-10-08 12:12:01 +00:00
|
|
|
|
|
|
|
if (oggpad->buffer) {
|
|
|
|
gst_buffer_unref (oggpad->buffer);
|
|
|
|
oggpad->buffer = NULL;
|
|
|
|
}
|
2011-04-01 08:57:08 +00:00
|
|
|
|
2011-08-18 15:36:23 +00:00
|
|
|
if (oggpad->tags) {
|
|
|
|
gst_tag_list_free (oggpad->tags);
|
|
|
|
oggpad->tags = NULL;
|
|
|
|
}
|
|
|
|
|
2011-04-01 09:00:38 +00:00
|
|
|
gst_segment_init (&oggpad->segment, GST_FORMAT_TIME);
|
2006-06-14 09:13:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_ogg_mux_change_state (GstElement * element, GstStateChange transition)
|
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
|
|
|
{
|
|
|
|
GstOggMux *ogg_mux;
|
2005-09-02 15:43:18 +00:00
|
|
|
GstStateChangeReturn ret;
|
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
|
|
|
|
|
|
|
ogg_mux = GST_OGG_MUX (element);
|
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
ext/: Fix a small memory leak in vorbisenc.
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_clear), (gst_ogg_mux_init),
(gst_ogg_mux_sinkconnect), (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_set_header_on_caps), (gst_ogg_mux_collected),
(gst_ogg_mux_clear_collectpads), (gst_ogg_mux_change_state):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_change_state):
Fix a small memory leak in vorbisenc.
Fix large memory leaks in oggmux, also fix lots of state change
bugs in oggmux.
2005-11-14 16:11:53 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2005-11-16 19:32:50 +00:00
|
|
|
gst_ogg_mux_clear (ogg_mux);
|
2006-06-14 09:13:54 +00:00
|
|
|
gst_ogg_mux_init_collectpads (ogg_mux->collect);
|
|
|
|
gst_collect_pads_start (ogg_mux->collect);
|
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
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
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
|
|
|
break;
|
2005-11-17 10:56:14 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2005-11-21 11:54:16 +00:00
|
|
|
gst_collect_pads_stop (ogg_mux->collect);
|
2005-11-17 10:56:14 +00:00
|
|
|
break;
|
ext/: Fix a small memory leak in vorbisenc.
Original commit message from CVS:
* ext/ogg/gstoggmux.c: (gst_ogg_mux_clear), (gst_ogg_mux_init),
(gst_ogg_mux_sinkconnect), (gst_ogg_mux_request_new_pad),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_queue_pads),
(gst_ogg_mux_set_header_on_caps), (gst_ogg_mux_collected),
(gst_ogg_mux_clear_collectpads), (gst_ogg_mux_change_state):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_change_state):
Fix a small memory leak in vorbisenc.
Fix large memory leaks in oggmux, also fix lots of state change
bugs in oggmux.
2005-11-14 16:11:53 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
|
|
|
break;
|
2006-06-14 09:13:54 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2005-11-16 19:32:50 +00:00
|
|
|
gst_ogg_mux_clear_collectpads (ogg_mux->collect);
|
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
|
|
|
break;
|
2006-06-14 09:13:54 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
|
|
|
break;
|
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
|
|
|
default:
|
|
|
|
break;
|
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
|
|
|
}
|
2005-08-02 09:41:05 +00:00
|
|
|
|
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
|
|
|
return ret;
|
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_mux_plugin_init (GstPlugin * plugin)
|
|
|
|
{
|
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_ogg_mux_debug, "oggmux", 0, "ogg muxer");
|
|
|
|
|
2009-05-12 11:17:55 +00:00
|
|
|
return gst_element_register (plugin, "oggmux", GST_RANK_PRIMARY,
|
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
|
|
|
GST_TYPE_OGG_MUX);
|
|
|
|
}
|