2002-03-20 21:45:03 +00:00
|
|
|
/* GStreamer
|
2001-12-20 22:30:14 +00:00
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2005-09-15 15:28:36 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-vorbisenc
|
|
|
|
* @see_also: vorbisdec, oggmux
|
|
|
|
*
|
|
|
|
* This element encodes raw float audio into a Vorbis stream.
|
|
|
|
* <ulink url="http://www.vorbis.com/">Vorbis</ulink> is a royalty-free
|
|
|
|
* audio codec maintained by the <ulink url="http://www.xiph.org/">Xiph.org
|
|
|
|
* Foundation</ulink>.
|
2008-07-10 21:06:06 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
2005-09-15 15:28:36 +00:00
|
|
|
* <title>Example pipelines</title>
|
2008-07-10 21:06:06 +00:00
|
|
|
* |[
|
2005-11-23 15:36:58 +00:00
|
|
|
* gst-launch -v audiotestsrc wave=sine num-buffers=100 ! audioconvert ! vorbisenc ! oggmux ! filesink location=sine.ogg
|
2008-07-10 21:06:06 +00:00
|
|
|
* ]| Encode a test sine signal to Ogg/Vorbis. Note that the resulting file
|
|
|
|
* will be really small because a sine signal compresses very well.
|
|
|
|
* |[
|
2005-09-15 15:28:36 +00:00
|
|
|
* gst-launch -v alsasrc ! audioconvert ! vorbisenc ! oggmux ! filesink location=alsasrc.ogg
|
2008-07-10 21:06:06 +00:00
|
|
|
* ]| Record from a sound card using ALSA and encode to Ogg/Vorbis.
|
2006-03-01 17:39:28 +00:00
|
|
|
* </refsect2>
|
2005-08-20 20:40:25 +00:00
|
|
|
*
|
2006-03-01 17:39:28 +00:00
|
|
|
* Last reviewed on 2006-03-01 (0.10.4)
|
2005-08-20 20:40:25 +00:00
|
|
|
*/
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2009-02-24 13:36:39 +00:00
|
|
|
|
2001-12-20 22:30:14 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2002-11-02 08:07:22 +00:00
|
|
|
#include <time.h>
|
2001-12-20 22:30:14 +00:00
|
|
|
#include <vorbis/vorbisenc.h>
|
|
|
|
|
2005-09-07 13:55:08 +00:00
|
|
|
#include <gst/gsttagsetter.h>
|
2004-02-22 15:14:25 +00:00
|
|
|
#include <gst/tag/tag.h>
|
ext/vorbis/vorbisenc.*: Multi-channel caps negotiation, so we can do proper multichannel vorbis encoding, negotiated ...
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (raw_caps_factory),
(gst_vorbis_enc_class_init), (gst_vorbis_enc_dispose),
(gst_vorbis_enc_generate_sink_caps), (gst_vorbis_enc_sink_getcaps),
(gst_vorbis_enc_init), (gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_chain), (gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Multi-channel caps negotiation, so we can do proper multichannel
vorbis encoding, negotiated through audioconvert.
2006-05-30 13:22:58 +00:00
|
|
|
#include <gst/audio/multichannel.h>
|
2009-05-06 12:19:34 +00:00
|
|
|
#include <gst/audio/audio.h>
|
2009-02-24 13:36:39 +00:00
|
|
|
#include "gstvorbisenc.h"
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2010-01-14 09:05:35 +00:00
|
|
|
#include "gstvorbiscommon.h"
|
|
|
|
|
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
|
|
|
GST_DEBUG_CATEGORY_EXTERN (vorbisenc_debug);
|
|
|
|
#define GST_CAT_DEFAULT vorbisenc_debug
|
|
|
|
|
2008-12-12 07:17:21 +00:00
|
|
|
static GstStaticPadTemplate vorbis_enc_sink_factory =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("audio/x-raw-float, "
|
|
|
|
"rate = (int) [ 1, 200000 ], "
|
|
|
|
"channels = (int) [ 1, 256 ], " "endianness = (int) BYTE_ORDER, "
|
|
|
|
"width = (int) 32")
|
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate vorbis_enc_src_factory =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("audio/x-vorbis")
|
|
|
|
);
|
|
|
|
|
2001-12-21 01:14:21 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-20 22:30:14 +00:00
|
|
|
ARG_0,
|
2002-10-20 01:55:28 +00:00
|
|
|
ARG_MAX_BITRATE,
|
2001-12-20 22:30:14 +00:00
|
|
|
ARG_BITRATE,
|
2002-10-20 01:55:28 +00:00
|
|
|
ARG_MIN_BITRATE,
|
|
|
|
ARG_QUALITY,
|
|
|
|
ARG_MANAGED,
|
2004-05-21 23:28:57 +00:00
|
|
|
ARG_LAST_MESSAGE
|
2001-12-20 22:30:14 +00:00
|
|
|
};
|
|
|
|
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
static GstFlowReturn gst_vorbis_enc_output_buffers (GstVorbisEnc * vorbisenc);
|
2005-09-15 19:59: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
|
|
|
/* this function takes into account the granulepos_offset and the subgranule
|
|
|
|
* time offset */
|
2006-01-30 15:01:28 +00:00
|
|
|
static GstClockTime
|
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
|
|
|
granulepos_to_timestamp_offset (GstVorbisEnc * vorbisenc,
|
|
|
|
ogg_int64_t granulepos)
|
2004-05-12 07:18:03 +00:00
|
|
|
{
|
|
|
|
if (granulepos >= 0)
|
2006-01-30 15:01:28 +00:00
|
|
|
return gst_util_uint64_scale ((guint64) granulepos
|
|
|
|
+ vorbisenc->granulepos_offset, GST_SECOND, vorbisenc->frequency)
|
|
|
|
+ vorbisenc->subgranule_offset;
|
|
|
|
return GST_CLOCK_TIME_NONE;
|
2004-05-12 07:18:03 +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
|
|
|
/* this function does a straight granulepos -> timestamp conversion */
|
|
|
|
static GstClockTime
|
|
|
|
granulepos_to_timestamp (GstVorbisEnc * vorbisenc, ogg_int64_t granulepos)
|
|
|
|
{
|
|
|
|
if (granulepos >= 0)
|
|
|
|
return gst_util_uint64_scale ((guint64) granulepos,
|
|
|
|
GST_SECOND, vorbisenc->frequency);
|
|
|
|
return GST_CLOCK_TIME_NONE;
|
|
|
|
}
|
|
|
|
|
2005-12-06 19:42:02 +00:00
|
|
|
#define MAX_BITRATE_DEFAULT -1
|
|
|
|
#define BITRATE_DEFAULT -1
|
|
|
|
#define MIN_BITRATE_DEFAULT -1
|
|
|
|
#define QUALITY_DEFAULT 0.3
|
|
|
|
#define LOWEST_BITRATE 6000 /* lowest allowed for a 8 kHz stream */
|
|
|
|
#define HIGHEST_BITRATE 250001 /* highest allowed for a 44 kHz stream */
|
2001-12-20 22:30:14 +00:00
|
|
|
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
static gboolean gst_vorbis_enc_sink_event (GstPad * pad, GstEvent * event);
|
|
|
|
static GstFlowReturn gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer);
|
|
|
|
static gboolean gst_vorbis_enc_setup (GstVorbisEnc * vorbisenc);
|
2002-10-20 01:55:28 +00:00
|
|
|
|
ext/vorbis/vorbisenc.*: Multi-channel caps negotiation, so we can do proper multichannel vorbis encoding, negotiated ...
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (raw_caps_factory),
(gst_vorbis_enc_class_init), (gst_vorbis_enc_dispose),
(gst_vorbis_enc_generate_sink_caps), (gst_vorbis_enc_sink_getcaps),
(gst_vorbis_enc_init), (gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_chain), (gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Multi-channel caps negotiation, so we can do proper multichannel
vorbis encoding, negotiated through audioconvert.
2006-05-30 13:22:58 +00:00
|
|
|
static void gst_vorbis_enc_dispose (GObject * object);
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
static void gst_vorbis_enc_get_property (GObject * object, guint prop_id,
|
2004-03-14 22:34:34 +00:00
|
|
|
GValue * value, GParamSpec * pspec);
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
static void gst_vorbis_enc_set_property (GObject * object, guint prop_id,
|
2004-03-14 22:34:34 +00:00
|
|
|
const GValue * value, GParamSpec * pspec);
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
static GstStateChangeReturn gst_vorbis_enc_change_state (GstElement * element,
|
2005-09-02 15:43:18 +00:00
|
|
|
GstStateChange transition);
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
static void gst_vorbis_enc_add_interfaces (GType vorbisenc_type);
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2011-04-19 12:11:32 +00:00
|
|
|
#define gst_vorbis_enc_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstVorbisEnc, gst_vorbis_enc,
|
|
|
|
GST_TYPE_ELEMENT, gst_vorbis_enc_add_interfaces (g_define_type_id));
|
2001-12-20 22:30:14 +00:00
|
|
|
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
static void
|
|
|
|
gst_vorbis_enc_add_interfaces (GType vorbisenc_type)
|
2001-12-20 22:30:14 +00:00
|
|
|
{
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
static const GInterfaceInfo tag_setter_info = { NULL, NULL, NULL };
|
2009-05-14 09:44:27 +00:00
|
|
|
static const GInterfaceInfo preset_info = { NULL, NULL, NULL };
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
|
|
|
|
g_type_add_interface_static (vorbisenc_type, GST_TYPE_TAG_SETTER,
|
|
|
|
&tag_setter_info);
|
2009-05-14 09:44:27 +00:00
|
|
|
g_type_add_interface_static (vorbisenc_type, GST_TYPE_PRESET, &preset_info);
|
2001-12-20 22:30:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_class_init (GstVorbisEncClass * klass)
|
2001-12-20 22:30:14 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2001-12-21 01:14:21 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2001-12-20 22:30:14 +00:00
|
|
|
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gobject_class->set_property = gst_vorbis_enc_set_property;
|
|
|
|
gobject_class->get_property = gst_vorbis_enc_get_property;
|
ext/vorbis/vorbisenc.*: Multi-channel caps negotiation, so we can do proper multichannel vorbis encoding, negotiated ...
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (raw_caps_factory),
(gst_vorbis_enc_class_init), (gst_vorbis_enc_dispose),
(gst_vorbis_enc_generate_sink_caps), (gst_vorbis_enc_sink_getcaps),
(gst_vorbis_enc_init), (gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_chain), (gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Multi-channel caps negotiation, so we can do proper multichannel
vorbis encoding, negotiated through audioconvert.
2006-05-30 13:22:58 +00:00
|
|
|
gobject_class->dispose = gst_vorbis_enc_dispose;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_BITRATE,
|
2004-06-24 14:56:21 +00:00
|
|
|
g_param_spec_int ("max-bitrate", "Maximum Bitrate",
|
2004-10-18 13:55:48 +00:00
|
|
|
"Specify a maximum bitrate (in bps). Useful for streaming "
|
|
|
|
"applications. (-1 == disabled)",
|
2008-03-22 15:00:53 +00:00
|
|
|
-1, HIGHEST_BITRATE, MAX_BITRATE_DEFAULT,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE,
|
2004-06-24 14:56:21 +00:00
|
|
|
g_param_spec_int ("bitrate", "Target Bitrate",
|
2004-10-18 13:55:48 +00:00
|
|
|
"Attempt to encode at a bitrate averaging this (in bps). "
|
|
|
|
"This uses the bitrate management engine, and is not recommended for most users. "
|
2008-03-22 15:00:53 +00:00
|
|
|
"Quality is a better alternative. (-1 == disabled)", -1,
|
|
|
|
HIGHEST_BITRATE, BITRATE_DEFAULT,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MIN_BITRATE,
|
2008-03-22 15:00:53 +00:00
|
|
|
g_param_spec_int ("min-bitrate", "Minimum Bitrate",
|
2004-10-18 13:55:48 +00:00
|
|
|
"Specify a minimum bitrate (in bps). Useful for encoding for a "
|
2008-03-22 15:00:53 +00:00
|
|
|
"fixed-size channel. (-1 == disabled)", -1, HIGHEST_BITRATE,
|
|
|
|
MIN_BITRATE_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
|
|
|
|
g_param_spec_float ("quality", "Quality",
|
2008-03-22 15:00:53 +00:00
|
|
|
"Specify quality instead of specifying a particular bitrate.", -0.1,
|
|
|
|
1.0, QUALITY_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-03-14 22:34:34 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MANAGED,
|
|
|
|
g_param_spec_boolean ("managed", "Managed",
|
2008-03-22 15:00:53 +00:00
|
|
|
"Enable bitrate management engine", FALSE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2002-10-20 01:55:28 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
2004-03-14 22:34:34 +00:00
|
|
|
g_param_spec_string ("last-message", "last-message",
|
2008-03-22 15:00:53 +00:00
|
|
|
"The last status message", NULL,
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2011-04-19 12:11:32 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&vorbis_enc_src_factory));
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&vorbis_enc_sink_factory));
|
|
|
|
gst_element_class_set_details_simple (gstelement_class,
|
|
|
|
"Vorbis audio encoder", "Codec/Encoder/Audio",
|
|
|
|
"Encodes audio in Vorbis format",
|
|
|
|
"Monty <monty@xiph.org>, " "Wim Taymans <wim@fluendo.com>");
|
|
|
|
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gstelement_class->change_state =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_vorbis_enc_change_state);
|
2001-12-20 22:30:14 +00:00
|
|
|
}
|
|
|
|
|
ext/vorbis/vorbisenc.*: Multi-channel caps negotiation, so we can do proper multichannel vorbis encoding, negotiated ...
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (raw_caps_factory),
(gst_vorbis_enc_class_init), (gst_vorbis_enc_dispose),
(gst_vorbis_enc_generate_sink_caps), (gst_vorbis_enc_sink_getcaps),
(gst_vorbis_enc_init), (gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_chain), (gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Multi-channel caps negotiation, so we can do proper multichannel
vorbis encoding, negotiated through audioconvert.
2006-05-30 13:22:58 +00:00
|
|
|
static void
|
|
|
|
gst_vorbis_enc_dispose (GObject * object)
|
|
|
|
{
|
|
|
|
GstVorbisEnc *vorbisenc = GST_VORBISENC (object);
|
|
|
|
|
|
|
|
if (vorbisenc->sinkcaps) {
|
|
|
|
gst_caps_unref (vorbisenc->sinkcaps);
|
|
|
|
vorbisenc->sinkcaps = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps *
|
|
|
|
gst_vorbis_enc_generate_sink_caps (void)
|
|
|
|
{
|
|
|
|
GstCaps *caps = gst_caps_new_empty ();
|
|
|
|
int i, c;
|
|
|
|
|
|
|
|
gst_caps_append_structure (caps, gst_structure_new ("audio/x-raw-float",
|
|
|
|
"rate", GST_TYPE_INT_RANGE, 1, 200000,
|
|
|
|
"channels", G_TYPE_INT, 1,
|
|
|
|
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
|
|
|
|
NULL));
|
|
|
|
|
|
|
|
gst_caps_append_structure (caps, gst_structure_new ("audio/x-raw-float",
|
|
|
|
"rate", GST_TYPE_INT_RANGE, 1, 200000,
|
|
|
|
"channels", G_TYPE_INT, 2,
|
|
|
|
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
|
|
|
|
NULL));
|
|
|
|
|
2008-05-29 07:02:50 +00:00
|
|
|
for (i = 3; i <= 8; i++) {
|
ext/vorbis/vorbisenc.*: Multi-channel caps negotiation, so we can do proper multichannel vorbis encoding, negotiated ...
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (raw_caps_factory),
(gst_vorbis_enc_class_init), (gst_vorbis_enc_dispose),
(gst_vorbis_enc_generate_sink_caps), (gst_vorbis_enc_sink_getcaps),
(gst_vorbis_enc_init), (gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_chain), (gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Multi-channel caps negotiation, so we can do proper multichannel
vorbis encoding, negotiated through audioconvert.
2006-05-30 13:22:58 +00:00
|
|
|
GValue chanpos = { 0 };
|
|
|
|
GValue pos = { 0 };
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_value_init (&chanpos, GST_TYPE_ARRAY);
|
|
|
|
g_value_init (&pos, GST_TYPE_AUDIO_CHANNEL_POSITION);
|
|
|
|
|
|
|
|
for (c = 0; c < i; c++) {
|
2010-01-14 09:05:35 +00:00
|
|
|
g_value_set_enum (&pos, gst_vorbis_channel_positions[i - 1][c]);
|
ext/vorbis/vorbisenc.*: Multi-channel caps negotiation, so we can do proper multichannel vorbis encoding, negotiated ...
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (raw_caps_factory),
(gst_vorbis_enc_class_init), (gst_vorbis_enc_dispose),
(gst_vorbis_enc_generate_sink_caps), (gst_vorbis_enc_sink_getcaps),
(gst_vorbis_enc_init), (gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_chain), (gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Multi-channel caps negotiation, so we can do proper multichannel
vorbis encoding, negotiated through audioconvert.
2006-05-30 13:22:58 +00:00
|
|
|
gst_value_array_append_value (&chanpos, &pos);
|
|
|
|
}
|
|
|
|
g_value_unset (&pos);
|
|
|
|
|
|
|
|
structure = gst_structure_new ("audio/x-raw-float",
|
|
|
|
"rate", GST_TYPE_INT_RANGE, 1, 200000,
|
|
|
|
"channels", G_TYPE_INT, i,
|
|
|
|
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32, NULL);
|
|
|
|
gst_structure_set_value (structure, "channel-positions", &chanpos);
|
|
|
|
g_value_unset (&chanpos);
|
|
|
|
|
|
|
|
gst_caps_append_structure (caps, structure);
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_caps_append_structure (caps, gst_structure_new ("audio/x-raw-float",
|
|
|
|
"rate", GST_TYPE_INT_RANGE, 1, 200000,
|
2008-05-29 07:02:50 +00:00
|
|
|
"channels", GST_TYPE_INT_RANGE, 9, 256,
|
ext/vorbis/vorbisenc.*: Multi-channel caps negotiation, so we can do proper multichannel vorbis encoding, negotiated ...
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (raw_caps_factory),
(gst_vorbis_enc_class_init), (gst_vorbis_enc_dispose),
(gst_vorbis_enc_generate_sink_caps), (gst_vorbis_enc_sink_getcaps),
(gst_vorbis_enc_init), (gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_chain), (gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Multi-channel caps negotiation, so we can do proper multichannel
vorbis encoding, negotiated through audioconvert.
2006-05-30 13:22:58 +00:00
|
|
|
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
|
|
|
|
NULL));
|
|
|
|
|
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps *
|
2011-05-16 13:25:34 +00:00
|
|
|
gst_vorbis_enc_sink_getcaps (GstPad * pad, GstCaps * filter)
|
ext/vorbis/vorbisenc.*: Multi-channel caps negotiation, so we can do proper multichannel vorbis encoding, negotiated ...
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (raw_caps_factory),
(gst_vorbis_enc_class_init), (gst_vorbis_enc_dispose),
(gst_vorbis_enc_generate_sink_caps), (gst_vorbis_enc_sink_getcaps),
(gst_vorbis_enc_init), (gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_chain), (gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Multi-channel caps negotiation, so we can do proper multichannel
vorbis encoding, negotiated through audioconvert.
2006-05-30 13:22:58 +00:00
|
|
|
{
|
|
|
|
GstVorbisEnc *vorbisenc = GST_VORBISENC (GST_PAD_PARENT (pad));
|
|
|
|
|
|
|
|
if (vorbisenc->sinkcaps == NULL)
|
|
|
|
vorbisenc->sinkcaps = gst_vorbis_enc_generate_sink_caps ();
|
|
|
|
|
2011-05-16 13:25:34 +00:00
|
|
|
if (filter)
|
|
|
|
return gst_caps_intersect_full (filter, vorbisenc->sinkcaps,
|
|
|
|
GST_CAPS_INTERSECT_FIRST);
|
|
|
|
else
|
|
|
|
return gst_caps_ref (vorbisenc->sinkcaps);
|
ext/vorbis/vorbisenc.*: Multi-channel caps negotiation, so we can do proper multichannel vorbis encoding, negotiated ...
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (raw_caps_factory),
(gst_vorbis_enc_class_init), (gst_vorbis_enc_dispose),
(gst_vorbis_enc_generate_sink_caps), (gst_vorbis_enc_sink_getcaps),
(gst_vorbis_enc_init), (gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_chain), (gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Multi-channel caps negotiation, so we can do proper multichannel
vorbis encoding, negotiated through audioconvert.
2006-05-30 13:22:58 +00:00
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean
|
2011-06-07 09:55:36 +00:00
|
|
|
gst_vorbis_enc_sink_setcaps (GstVorbisEnc * vorbisenc, GstCaps * caps)
|
2001-12-20 22:30:14 +00:00
|
|
|
{
|
2003-12-22 01:47:09 +00:00
|
|
|
GstStructure *structure;
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2004-05-24 19:19:29 +00:00
|
|
|
vorbisenc->setup = FALSE;
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_structure_get_int (structure, "channels", &vorbisenc->channels);
|
|
|
|
gst_structure_get_int (structure, "rate", &vorbisenc->frequency);
|
2001-12-20 22:30:14 +00:00
|
|
|
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_setup (vorbisenc);
|
2002-01-13 22:27:25 +00:00
|
|
|
|
|
|
|
if (vorbisenc->setup)
|
2005-03-31 09:43:49 +00:00
|
|
|
return TRUE;
|
2002-01-13 22:27:25 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
return FALSE;
|
2001-12-20 22:30:14 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 17:11:10 +00:00
|
|
|
static gboolean
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_convert_src (GstPad * pad, GstFormat src_format,
|
|
|
|
gint64 src_value, GstFormat * dest_format, gint64 * dest_value)
|
2002-10-20 17:11:10 +00:00
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
2005-08-20 20:40:25 +00:00
|
|
|
GstVorbisEnc *vorbisenc;
|
2002-10-20 17:11:10 +00:00
|
|
|
gint64 avg;
|
|
|
|
|
|
|
|
vorbisenc = GST_VORBISENC (gst_pad_get_parent (pad));
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
if (vorbisenc->samples_in == 0 ||
|
2006-03-07 12:49:03 +00:00
|
|
|
vorbisenc->bytes_out == 0 || vorbisenc->frequency == 0) {
|
|
|
|
gst_object_unref (vorbisenc);
|
2002-10-20 17:11:10 +00:00
|
|
|
return FALSE;
|
2006-03-07 12:49:03 +00:00
|
|
|
}
|
2002-10-20 17:11:10 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
avg = (vorbisenc->bytes_out * vorbisenc->frequency) / (vorbisenc->samples_in);
|
2002-10-20 17:11:10 +00:00
|
|
|
|
|
|
|
switch (src_format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:28 +00:00
|
|
|
case GST_FORMAT_TIME:
|
2006-02-17 19:31:12 +00:00
|
|
|
*dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND, avg);
|
2004-03-15 19:32:28 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
2002-10-20 17:11:10 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:28 +00:00
|
|
|
case GST_FORMAT_BYTES:
|
2006-02-17 19:31:12 +00:00
|
|
|
*dest_value = gst_util_uint64_scale_int (src_value, avg, GST_SECOND);
|
2004-03-15 19:32:28 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
2002-10-20 17:11:10 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
}
|
2006-03-07 12:49:03 +00:00
|
|
|
gst_object_unref (vorbisenc);
|
2002-10-20 17:11:10 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_convert_sink (GstPad * pad, GstFormat src_format,
|
2004-03-14 22:34:34 +00:00
|
|
|
gint64 src_value, GstFormat * dest_format, gint64 * dest_value)
|
2002-10-20 17:11:10 +00:00
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
guint scale = 1;
|
|
|
|
gint bytes_per_sample;
|
2005-08-20 20:40:25 +00:00
|
|
|
GstVorbisEnc *vorbisenc;
|
2002-10-20 17:11:10 +00:00
|
|
|
|
|
|
|
vorbisenc = GST_VORBISENC (gst_pad_get_parent (pad));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-10-20 17:11:10 +00:00
|
|
|
bytes_per_sample = vorbisenc->channels * 2;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-10-20 17:11:10 +00:00
|
|
|
switch (src_format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:28 +00:00
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
if (bytes_per_sample == 0)
|
|
|
|
return FALSE;
|
|
|
|
*dest_value = src_value / bytes_per_sample;
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
{
|
|
|
|
gint byterate = bytes_per_sample * vorbisenc->frequency;
|
|
|
|
|
|
|
|
if (byterate == 0)
|
|
|
|
return FALSE;
|
2006-02-17 19:31:12 +00:00
|
|
|
*dest_value =
|
|
|
|
gst_util_uint64_scale_int (src_value, GST_SECOND, byterate);
|
2004-03-15 19:32:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
2002-10-20 17:11:10 +00:00
|
|
|
}
|
|
|
|
break;
|
2003-05-24 10:41:58 +00:00
|
|
|
case GST_FORMAT_DEFAULT:
|
2002-10-20 17:11:10 +00:00
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:28 +00:00
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
*dest_value = src_value * bytes_per_sample;
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
if (vorbisenc->frequency == 0)
|
|
|
|
return FALSE;
|
2006-02-17 19:31:12 +00:00
|
|
|
*dest_value =
|
|
|
|
gst_util_uint64_scale_int (src_value, GST_SECOND,
|
|
|
|
vorbisenc->frequency);
|
2004-03-15 19:32:28 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
2002-10-20 17:11:10 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:28 +00:00
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
scale = bytes_per_sample;
|
|
|
|
/* fallthrough */
|
|
|
|
case GST_FORMAT_DEFAULT:
|
2006-02-17 19:31:12 +00:00
|
|
|
*dest_value =
|
|
|
|
gst_util_uint64_scale_int (src_value,
|
|
|
|
scale * vorbisenc->frequency, GST_SECOND);
|
2004-03-15 19:32:28 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
2002-10-20 17:11:10 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
}
|
2006-03-07 12:49:03 +00:00
|
|
|
gst_object_unref (vorbisenc);
|
2002-10-20 17:11:10 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2008-06-20 09:25:44 +00:00
|
|
|
static gint64
|
|
|
|
gst_vorbis_enc_get_latency (GstVorbisEnc * vorbisenc)
|
|
|
|
{
|
|
|
|
/* FIXME, this probably depends on the bitrate and other setting but for now
|
|
|
|
* we return this value, which was obtained by totally unscientific
|
|
|
|
* measurements */
|
|
|
|
return 58 * GST_MSECOND;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static const GstQueryType *
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_get_query_types (GstPad * pad)
|
2002-10-20 17:11:10 +00:00
|
|
|
{
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
static const GstQueryType gst_vorbis_enc_src_query_types[] = {
|
2002-12-30 17:53:18 +00:00
|
|
|
GST_QUERY_POSITION,
|
2005-10-20 19:06:43 +00:00
|
|
|
GST_QUERY_DURATION,
|
|
|
|
GST_QUERY_CONVERT,
|
2002-10-20 17:11:10 +00:00
|
|
|
0
|
|
|
|
};
|
2004-03-15 19:32:28 +00:00
|
|
|
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
return gst_vorbis_enc_src_query_types;
|
2002-10-20 17:11:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_vorbis_enc_src_query (GstPad * pad, GstQuery * query)
|
2002-10-20 17:11:10 +00:00
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
2005-08-20 20:40:25 +00:00
|
|
|
GstVorbisEnc *vorbisenc;
|
2005-10-20 19:06:43 +00:00
|
|
|
GstPad *peerpad;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-10-20 19:06:43 +00:00
|
|
|
vorbisenc = GST_VORBISENC (gst_pad_get_parent (pad));
|
|
|
|
peerpad = gst_pad_get_peer (GST_PAD (vorbisenc->sinkpad));
|
2002-10-20 17:11:10 +00:00
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_POSITION:
|
2002-10-20 17:11:10 +00:00
|
|
|
{
|
2005-10-20 19:06:43 +00:00
|
|
|
GstFormat fmt, req_fmt;
|
|
|
|
gint64 pos, val;
|
2004-03-15 19:32:28 +00:00
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_parse_position (query, &req_fmt, NULL);
|
2005-10-20 19:06:43 +00:00
|
|
|
if ((res = gst_pad_query_position (peerpad, &req_fmt, &val))) {
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_position (query, req_fmt, val);
|
2005-10-20 19:06:43 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-03-15 19:32:28 +00:00
|
|
|
|
2005-10-20 19:06:43 +00:00
|
|
|
fmt = GST_FORMAT_TIME;
|
|
|
|
if (!(res = gst_pad_query_position (peerpad, &fmt, &pos)))
|
|
|
|
break;
|
2004-03-15 19:32:28 +00:00
|
|
|
|
2005-10-20 19:06:43 +00:00
|
|
|
if ((res = gst_pad_query_convert (peerpad, fmt, pos, &req_fmt, &val))) {
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_position (query, req_fmt, val);
|
2005-10-20 19:06:43 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_QUERY_DURATION:
|
|
|
|
{
|
|
|
|
GstFormat fmt, req_fmt;
|
|
|
|
gint64 dur, val;
|
2004-03-15 19:32:28 +00:00
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_parse_duration (query, &req_fmt, NULL);
|
2005-10-20 19:06:43 +00:00
|
|
|
if ((res = gst_pad_query_duration (peerpad, &req_fmt, &val))) {
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_duration (query, req_fmt, val);
|
2005-10-20 19:06:43 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-03-15 19:32:28 +00:00
|
|
|
|
2005-10-20 19:06:43 +00:00
|
|
|
fmt = GST_FORMAT_TIME;
|
|
|
|
if (!(res = gst_pad_query_duration (peerpad, &fmt, &dur)))
|
|
|
|
break;
|
2004-03-15 19:32:28 +00:00
|
|
|
|
2005-10-20 19:06:43 +00:00
|
|
|
if ((res = gst_pad_query_convert (peerpad, fmt, dur, &req_fmt, &val))) {
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_duration (query, req_fmt, val);
|
2002-10-20 17:11:10 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2005-05-09 10:56:13 +00:00
|
|
|
case GST_QUERY_CONVERT:
|
|
|
|
{
|
|
|
|
GstFormat src_fmt, dest_fmt;
|
|
|
|
gint64 src_val, dest_val;
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
|
2005-05-09 10:56:13 +00:00
|
|
|
if (!(res =
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_convert_src (pad, src_fmt, src_val, &dest_fmt,
|
2005-05-09 10:56:13 +00:00
|
|
|
&dest_val)))
|
|
|
|
goto error;
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
2005-05-09 10:56:13 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-06-20 09:25:44 +00:00
|
|
|
case GST_QUERY_LATENCY:
|
|
|
|
{
|
|
|
|
gboolean live;
|
|
|
|
GstClockTime min_latency, max_latency;
|
|
|
|
gint64 latency;
|
|
|
|
|
|
|
|
if ((res = gst_pad_query (peerpad, query))) {
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_parse_latency (query, &live, &min_latency, &max_latency);
|
2008-06-20 09:25:44 +00:00
|
|
|
|
|
|
|
latency = gst_vorbis_enc_get_latency (vorbisenc);
|
|
|
|
|
|
|
|
/* add our latency */
|
|
|
|
min_latency += latency;
|
|
|
|
if (max_latency != -1)
|
|
|
|
max_latency += latency;
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_latency (query, live, min_latency, max_latency);
|
2008-06-20 09:25:44 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2005-05-09 10:56:13 +00:00
|
|
|
default:
|
2008-06-20 09:25:44 +00:00
|
|
|
res = gst_pad_query (peerpad, query);
|
2005-05-09 10:56:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
error:
|
2005-10-20 19:06:43 +00:00
|
|
|
gst_object_unref (peerpad);
|
|
|
|
gst_object_unref (vorbisenc);
|
2005-05-09 10:56:13 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_vorbis_enc_sink_query (GstPad * pad, GstQuery * query)
|
2005-05-09 10:56:13 +00:00
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
2005-05-09 10:56:13 +00:00
|
|
|
case GST_QUERY_CONVERT:
|
|
|
|
{
|
|
|
|
GstFormat src_fmt, dest_fmt;
|
|
|
|
gint64 src_val, dest_val;
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
|
2005-05-09 10:56:13 +00:00
|
|
|
if (!(res =
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_convert_sink (pad, src_fmt, src_val, &dest_fmt,
|
2005-05-09 10:56:13 +00:00
|
|
|
&dest_val)))
|
|
|
|
goto error;
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
2002-10-20 17:11:10 +00:00
|
|
|
break;
|
2005-05-09 10:56:13 +00:00
|
|
|
}
|
2002-10-20 17:11:10 +00:00
|
|
|
default:
|
2006-02-01 11:56:11 +00:00
|
|
|
res = gst_pad_query_default (pad, query);
|
2002-10-20 17:11:10 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-05-09 10:56:13 +00:00
|
|
|
|
|
|
|
error:
|
2002-10-20 17:11:10 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2001-12-20 22:30:14 +00:00
|
|
|
static void
|
2011-04-19 12:11:32 +00:00
|
|
|
gst_vorbis_enc_init (GstVorbisEnc * vorbisenc)
|
2001-12-20 22:30:14 +00:00
|
|
|
{
|
2004-03-14 22:34:34 +00:00
|
|
|
vorbisenc->sinkpad =
|
2008-12-12 07:17:21 +00:00
|
|
|
gst_pad_new_from_static_template (&vorbis_enc_sink_factory, "sink");
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_pad_set_event_function (vorbisenc->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_vorbis_enc_sink_event));
|
|
|
|
gst_pad_set_chain_function (vorbisenc->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_vorbis_enc_chain));
|
ext/vorbis/vorbisenc.*: Multi-channel caps negotiation, so we can do proper multichannel vorbis encoding, negotiated ...
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (raw_caps_factory),
(gst_vorbis_enc_class_init), (gst_vorbis_enc_dispose),
(gst_vorbis_enc_generate_sink_caps), (gst_vorbis_enc_sink_getcaps),
(gst_vorbis_enc_init), (gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_chain), (gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Multi-channel caps negotiation, so we can do proper multichannel
vorbis encoding, negotiated through audioconvert.
2006-05-30 13:22:58 +00:00
|
|
|
gst_pad_set_getcaps_function (vorbisenc->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_vorbis_enc_sink_getcaps));
|
2005-05-09 10:56:13 +00:00
|
|
|
gst_pad_set_query_function (vorbisenc->sinkpad,
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_vorbis_enc_sink_query));
|
|
|
|
gst_element_add_pad (GST_ELEMENT (vorbisenc), vorbisenc->sinkpad);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
vorbisenc->srcpad =
|
2008-12-12 07:17:21 +00:00
|
|
|
gst_pad_new_from_static_template (&vorbis_enc_src_factory, "src");
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_pad_set_query_function (vorbisenc->srcpad,
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_vorbis_enc_src_query));
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_pad_set_query_type_function (vorbisenc->srcpad,
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_vorbis_enc_get_query_types));
|
2001-12-21 01:14:21 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (vorbisenc), vorbisenc->srcpad);
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2002-10-19 16:57:08 +00:00
|
|
|
vorbisenc->channels = -1;
|
|
|
|
vorbisenc->frequency = -1;
|
2002-10-20 01:55:28 +00:00
|
|
|
|
|
|
|
vorbisenc->managed = FALSE;
|
|
|
|
vorbisenc->max_bitrate = MAX_BITRATE_DEFAULT;
|
|
|
|
vorbisenc->bitrate = BITRATE_DEFAULT;
|
|
|
|
vorbisenc->min_bitrate = MIN_BITRATE_DEFAULT;
|
|
|
|
vorbisenc->quality = QUALITY_DEFAULT;
|
|
|
|
vorbisenc->quality_set = FALSE;
|
|
|
|
vorbisenc->last_message = NULL;
|
2001-12-20 22:30:14 +00:00
|
|
|
}
|
|
|
|
|
2003-11-24 04:08:48 +00:00
|
|
|
static void
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_metadata_set1 (const GstTagList * list, const gchar * tag,
|
2004-03-14 22:34:34 +00:00
|
|
|
gpointer vorbisenc)
|
2002-10-20 01:55:28 +00:00
|
|
|
{
|
2005-08-20 20:40:25 +00:00
|
|
|
GstVorbisEnc *enc = GST_VORBISENC (vorbisenc);
|
2006-08-21 16:39:25 +00:00
|
|
|
GList *vc_list, *l;
|
2003-11-24 04:08:48 +00:00
|
|
|
|
2006-08-21 16:39:25 +00:00
|
|
|
vc_list = gst_tag_to_vorbis_comments (list, tag);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2006-08-21 16:39:25 +00:00
|
|
|
for (l = vc_list; l != NULL; l = l->next) {
|
|
|
|
const gchar *vc_string = (const gchar *) l->data;
|
|
|
|
gchar *key = NULL, *val = NULL;
|
2006-02-05 22:44:55 +00:00
|
|
|
|
2006-09-23 13:21:07 +00:00
|
|
|
GST_LOG_OBJECT (vorbisenc, "vorbis comment: %s", vc_string);
|
2006-08-21 16:39:25 +00:00
|
|
|
if (gst_tag_parse_extended_comment (vc_string, &key, NULL, &val, TRUE)) {
|
|
|
|
vorbis_comment_add_tag (&enc->vc, key, val);
|
|
|
|
g_free (key);
|
|
|
|
g_free (val);
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
|
|
|
}
|
2006-08-21 16:39:25 +00:00
|
|
|
|
|
|
|
g_list_foreach (vc_list, (GFunc) g_free, NULL);
|
|
|
|
g_list_free (vc_list);
|
2003-11-24 04:08:48 +00:00
|
|
|
}
|
2004-02-22 15:14:25 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static void
|
2006-08-21 16:39:25 +00:00
|
|
|
gst_vorbis_enc_set_metadata (GstVorbisEnc * enc)
|
2003-11-24 04:08:48 +00:00
|
|
|
{
|
2006-08-21 16:39:25 +00:00
|
|
|
GstTagList *merged_tags;
|
2003-11-24 04:08:48 +00:00
|
|
|
const GstTagList *user_tags;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2006-08-21 16:39:25 +00:00
|
|
|
vorbis_comment_init (&enc->vc);
|
|
|
|
|
|
|
|
user_tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (enc));
|
2002-10-20 01:55:28 +00:00
|
|
|
|
2006-08-21 16:39:25 +00:00
|
|
|
GST_DEBUG_OBJECT (enc, "upstream tags = %" GST_PTR_FORMAT, enc->tags);
|
|
|
|
GST_DEBUG_OBJECT (enc, "user-set tags = %" GST_PTR_FORMAT, user_tags);
|
|
|
|
|
|
|
|
/* gst_tag_list_merge() will handle NULL for either or both lists fine */
|
|
|
|
merged_tags = gst_tag_list_merge (user_tags, enc->tags,
|
|
|
|
gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (enc)));
|
|
|
|
|
|
|
|
if (merged_tags) {
|
|
|
|
GST_DEBUG_OBJECT (enc, "merged tags = %" GST_PTR_FORMAT, merged_tags);
|
|
|
|
gst_tag_list_foreach (merged_tags, gst_vorbis_enc_metadata_set1, enc);
|
|
|
|
gst_tag_list_free (merged_tags);
|
|
|
|
}
|
2002-10-20 01:55:28 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static gchar *
|
2005-08-20 20:40:25 +00:00
|
|
|
get_constraints_string (GstVorbisEnc * vorbisenc)
|
2002-10-20 01:55:28 +00:00
|
|
|
{
|
|
|
|
gint min = vorbisenc->min_bitrate;
|
|
|
|
gint max = vorbisenc->max_bitrate;
|
|
|
|
gchar *result;
|
|
|
|
|
|
|
|
if (min > 0 && max > 0)
|
2004-03-14 22:34:34 +00:00
|
|
|
result = g_strdup_printf ("(min %d bps, max %d bps)", min, max);
|
2002-10-20 01:55:28 +00:00
|
|
|
else if (min > 0)
|
|
|
|
result = g_strdup_printf ("(min %d bps, no max)", min);
|
|
|
|
else if (max > 0)
|
|
|
|
result = g_strdup_printf ("(no min, max %d bps)", max);
|
|
|
|
else
|
|
|
|
result = g_strdup_printf ("(no min or max)");
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2001-12-20 22:30:14 +00:00
|
|
|
static void
|
2005-08-20 20:40:25 +00:00
|
|
|
update_start_message (GstVorbisEnc * vorbisenc)
|
2002-10-20 01:55:28 +00:00
|
|
|
{
|
|
|
|
gchar *constraints;
|
|
|
|
|
|
|
|
g_free (vorbisenc->last_message);
|
|
|
|
|
|
|
|
if (vorbisenc->bitrate > 0) {
|
|
|
|
if (vorbisenc->managed) {
|
|
|
|
constraints = get_constraints_string (vorbisenc);
|
2004-03-14 22:34:34 +00:00
|
|
|
vorbisenc->last_message =
|
2004-03-15 19:32:28 +00:00
|
|
|
g_strdup_printf ("encoding at average bitrate %d bps %s",
|
|
|
|
vorbisenc->bitrate, constraints);
|
2002-10-20 01:55:28 +00:00
|
|
|
g_free (constraints);
|
2004-03-14 22:34:34 +00:00
|
|
|
} else {
|
|
|
|
vorbisenc->last_message =
|
2004-03-15 19:32:28 +00:00
|
|
|
g_strdup_printf
|
|
|
|
("encoding at approximate bitrate %d bps (VBR encoding enabled)",
|
|
|
|
vorbisenc->bitrate);
|
2002-10-20 01:55:28 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
} else {
|
2002-10-20 01:55:28 +00:00
|
|
|
if (vorbisenc->quality_set) {
|
|
|
|
if (vorbisenc->managed) {
|
2004-03-15 19:32:28 +00:00
|
|
|
constraints = get_constraints_string (vorbisenc);
|
|
|
|
vorbisenc->last_message =
|
|
|
|
g_strdup_printf
|
|
|
|
("encoding at quality level %2.2f using constrained VBR %s",
|
|
|
|
vorbisenc->quality, constraints);
|
|
|
|
g_free (constraints);
|
2004-03-14 22:34:34 +00:00
|
|
|
} else {
|
2004-03-15 19:32:28 +00:00
|
|
|
vorbisenc->last_message =
|
|
|
|
g_strdup_printf ("encoding at quality level %2.2f",
|
|
|
|
vorbisenc->quality);
|
2002-10-20 01:55:28 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
} else {
|
2002-10-20 01:55:28 +00:00
|
|
|
constraints = get_constraints_string (vorbisenc);
|
2004-03-14 22:34:34 +00:00
|
|
|
vorbisenc->last_message =
|
2004-03-15 19:32:28 +00:00
|
|
|
g_strdup_printf ("encoding using bitrate management %s", constraints);
|
2002-10-20 01:55:28 +00:00
|
|
|
g_free (constraints);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (vorbisenc), "last_message");
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_setup (GstVorbisEnc * vorbisenc)
|
2001-12-20 22:30:14 +00:00
|
|
|
{
|
2004-05-24 19:19:29 +00:00
|
|
|
vorbisenc->setup = FALSE;
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
if (vorbisenc->bitrate < 0 && vorbisenc->min_bitrate < 0
|
|
|
|
&& vorbisenc->max_bitrate < 0) {
|
2002-10-20 01:55:28 +00:00
|
|
|
vorbisenc->quality_set = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
update_start_message (vorbisenc);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2001-12-20 22:30:14 +00:00
|
|
|
/* choose an encoding mode */
|
|
|
|
/* (mode 0: 44kHz stereo uncoupled, roughly 128kbps VBR) */
|
2001-12-21 01:14:21 +00:00
|
|
|
vorbis_info_init (&vorbisenc->vi);
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
if (vorbisenc->quality_set) {
|
|
|
|
if (vorbis_encode_setup_vbr (&vorbisenc->vi,
|
2004-05-24 19:19:29 +00:00
|
|
|
vorbisenc->channels, vorbisenc->frequency,
|
|
|
|
vorbisenc->quality) != 0) {
|
|
|
|
GST_ERROR_OBJECT (vorbisenc,
|
|
|
|
"vorbisenc: initialisation failed: invalid parameters for quality");
|
2004-03-14 22:34:34 +00:00
|
|
|
vorbis_info_clear (&vorbisenc->vi);
|
|
|
|
return FALSE;
|
2002-10-20 01:55:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* do we have optional hard quality restrictions? */
|
2004-03-14 22:34:34 +00:00
|
|
|
if (vorbisenc->max_bitrate > 0 || vorbisenc->min_bitrate > 0) {
|
2002-10-20 01:55:28 +00:00
|
|
|
struct ovectl_ratemanage_arg ai;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-10-20 01:55:28 +00:00
|
|
|
vorbis_encode_ctl (&vorbisenc->vi, OV_ECTL_RATEMANAGE_GET, &ai);
|
|
|
|
|
2005-11-21 15:16:29 +00:00
|
|
|
ai.bitrate_hard_min = vorbisenc->min_bitrate;
|
|
|
|
ai.bitrate_hard_max = vorbisenc->max_bitrate;
|
2002-10-20 01:55:28 +00:00
|
|
|
ai.management_active = 1;
|
|
|
|
|
|
|
|
vorbis_encode_ctl (&vorbisenc->vi, OV_ECTL_RATEMANAGE_SET, &ai);
|
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
} else {
|
2004-06-24 15:44:53 +00:00
|
|
|
long min_bitrate, max_bitrate;
|
|
|
|
|
|
|
|
min_bitrate = vorbisenc->min_bitrate > 0 ? vorbisenc->min_bitrate : -1;
|
|
|
|
max_bitrate = vorbisenc->max_bitrate > 0 ? vorbisenc->max_bitrate : -1;
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
if (vorbis_encode_setup_managed (&vorbisenc->vi,
|
2004-03-15 19:32:28 +00:00
|
|
|
vorbisenc->channels,
|
|
|
|
vorbisenc->frequency,
|
2004-06-24 15:44:53 +00:00
|
|
|
max_bitrate, vorbisenc->bitrate, min_bitrate) != 0) {
|
2004-05-24 19:19:29 +00:00
|
|
|
GST_ERROR_OBJECT (vorbisenc,
|
2004-06-24 15:44:53 +00:00
|
|
|
"vorbis_encode_setup_managed "
|
2006-10-05 15:55:21 +00:00
|
|
|
"(c %d, rate %d, max br %ld, br %d, min br %ld) failed",
|
2004-06-24 15:44:53 +00:00
|
|
|
vorbisenc->channels, vorbisenc->frequency, max_bitrate,
|
|
|
|
vorbisenc->bitrate, min_bitrate);
|
2004-03-14 22:34:34 +00:00
|
|
|
vorbis_info_clear (&vorbisenc->vi);
|
2002-10-20 01:55:28 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
if (vorbisenc->managed && vorbisenc->bitrate < 0) {
|
|
|
|
vorbis_encode_ctl (&vorbisenc->vi, OV_ECTL_RATEMANAGE_AVG, NULL);
|
|
|
|
} else if (!vorbisenc->managed) {
|
2002-10-20 01:55:28 +00:00
|
|
|
/* Turn off management entirely (if it was turned on). */
|
2004-03-14 22:34:34 +00:00
|
|
|
vorbis_encode_ctl (&vorbisenc->vi, OV_ECTL_RATEMANAGE_SET, NULL);
|
2002-10-20 01:55:28 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
vorbis_encode_setup_init (&vorbisenc->vi);
|
2002-10-20 01:55:28 +00:00
|
|
|
|
2001-12-20 22:30:14 +00:00
|
|
|
/* set up the analysis state and auxiliary encoding storage */
|
2001-12-21 01:14:21 +00:00
|
|
|
vorbis_analysis_init (&vorbisenc->vd, &vorbisenc->vi);
|
|
|
|
vorbis_block_init (&vorbisenc->vd, &vorbisenc->vb);
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2006-01-30 15:01:28 +00:00
|
|
|
vorbisenc->next_ts = 0;
|
2005-11-11 16:35:39 +00:00
|
|
|
|
2001-12-21 01:14:21 +00:00
|
|
|
vorbisenc->setup = TRUE;
|
2002-10-20 01:55:28 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2001-12-20 22:30:14 +00:00
|
|
|
}
|
|
|
|
|
2005-11-21 10:09:16 +00:00
|
|
|
static GstFlowReturn
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_clear (GstVorbisEnc * vorbisenc)
|
2005-09-22 14:35:57 +00:00
|
|
|
{
|
2005-11-21 10:09:16 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
|
2005-09-22 14:35:57 +00:00
|
|
|
if (vorbisenc->setup) {
|
|
|
|
vorbis_analysis_wrote (&vorbisenc->vd, 0);
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
ret = gst_vorbis_enc_output_buffers (vorbisenc);
|
2005-09-22 14:35:57 +00:00
|
|
|
|
|
|
|
vorbisenc->setup = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clean up and exit. vorbis_info_clear() must be called last */
|
|
|
|
vorbis_block_clear (&vorbisenc->vb);
|
|
|
|
vorbis_dsp_clear (&vorbisenc->vd);
|
|
|
|
vorbis_info_clear (&vorbisenc->vi);
|
|
|
|
|
|
|
|
vorbisenc->header_sent = FALSE;
|
2005-11-21 10:09:16 +00:00
|
|
|
|
|
|
|
return ret;
|
2005-09-22 14:35:57 +00:00
|
|
|
}
|
|
|
|
|
2004-05-20 14:45:57 +00:00
|
|
|
/* prepare a buffer for transmission by passing data through libvorbis */
|
|
|
|
static GstBuffer *
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_buffer_from_packet (GstVorbisEnc * vorbisenc,
|
|
|
|
ogg_packet * packet)
|
2002-10-20 22:27:53 +00:00
|
|
|
{
|
|
|
|
GstBuffer *outbuf;
|
|
|
|
|
ext/vorbis/: Added a raw vorbis encoder to be used with the oggmuxer.
Original commit message from CVS:
* ext/vorbis/Makefile.am:
* ext/vorbis/README:
* ext/vorbis/oggvorbisenc.c: (gst_oggvorbisenc_get_formats),
(oggvorbisenc_get_type), (vorbis_caps_factory), (raw_caps_factory),
(gst_oggvorbisenc_base_init), (gst_oggvorbisenc_class_init),
(gst_oggvorbisenc_sinkconnect), (gst_oggvorbisenc_convert_src),
(gst_oggvorbisenc_convert_sink),
(gst_oggvorbisenc_get_query_types), (gst_oggvorbisenc_src_query),
(gst_oggvorbisenc_init), (gst_oggvorbisenc_get_tag_value),
(gst_oggvorbisenc_metadata_set1), (gst_oggvorbisenc_set_metadata),
(get_constraints_string), (update_start_message),
(gst_oggvorbisenc_setup), (gst_oggvorbisenc_write_page),
(gst_oggvorbisenc_chain), (gst_oggvorbisenc_get_property),
(gst_oggvorbisenc_set_property), (gst_oggvorbisenc_change_state):
* ext/vorbis/oggvorbisenc.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisenc.c: (vorbis_caps_factory),
(raw_caps_factory), (gst_vorbisenc_class_init),
(gst_vorbisenc_init), (gst_vorbisenc_setup),
(gst_vorbisenc_push_packet), (gst_vorbisenc_chain),
(gst_vorbisenc_get_property), (gst_vorbisenc_set_property):
* ext/vorbis/vorbisenc.h:
Added a raw vorbis encoder to be used with the oggmuxer.
We still need the old encoder for some gnome applications,
read the README to find out how that works.
The raw encoder is called "rawvorbisenc" until 0.9.
2004-05-10 17:44:07 +00:00
|
|
|
outbuf = gst_buffer_new_and_alloc (packet->bytes);
|
2011-03-28 08:20:06 +00:00
|
|
|
gst_buffer_fill (outbuf, 0, packet->packet, packet->bytes);
|
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
|
|
|
/* see ext/ogg/README; OFFSET_END takes "our" granulepos, OFFSET its
|
|
|
|
* time representation */
|
2006-01-30 15:01:28 +00:00
|
|
|
GST_BUFFER_OFFSET_END (outbuf) = packet->granulepos +
|
|
|
|
vorbisenc->granulepos_offset;
|
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 (outbuf) = granulepos_to_timestamp (vorbisenc,
|
|
|
|
GST_BUFFER_OFFSET_END (outbuf));
|
2006-01-30 15:01:28 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = vorbisenc->next_ts;
|
|
|
|
|
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 next timestamp, taking granulepos_offset and subgranule offset
|
|
|
|
* into account */
|
|
|
|
vorbisenc->next_ts =
|
2011-05-16 11:48:11 +00:00
|
|
|
granulepos_to_timestamp_offset (vorbisenc, packet->granulepos);
|
2005-11-11 16:35:39 +00:00
|
|
|
GST_BUFFER_DURATION (outbuf) =
|
2006-01-30 15:01:28 +00:00
|
|
|
vorbisenc->next_ts - GST_BUFFER_TIMESTAMP (outbuf);
|
2002-10-20 22:27:53 +00:00
|
|
|
|
2006-07-28 12:48:21 +00:00
|
|
|
if (vorbisenc->next_discont) {
|
|
|
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
|
|
|
vorbisenc->next_discont = FALSE;
|
|
|
|
}
|
|
|
|
|
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 (vorbisenc, "encoded buffer of %d bytes",
|
2011-03-28 08:20:06 +00:00
|
|
|
gst_buffer_get_size (outbuf));
|
2004-05-20 14:45:57 +00:00
|
|
|
return outbuf;
|
|
|
|
}
|
2002-10-20 22:27:53 +00:00
|
|
|
|
2006-01-30 15:01:28 +00:00
|
|
|
/* the same as above, but different logic for setting timestamp and granulepos
|
|
|
|
* */
|
|
|
|
static GstBuffer *
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_buffer_from_header_packet (GstVorbisEnc * vorbisenc,
|
2006-01-30 15:01:28 +00:00
|
|
|
ogg_packet * packet)
|
|
|
|
{
|
|
|
|
GstBuffer *outbuf;
|
|
|
|
|
|
|
|
outbuf = gst_buffer_new_and_alloc (packet->bytes);
|
2011-03-28 08:20:06 +00:00
|
|
|
gst_buffer_fill (outbuf, 0, packet->packet, packet->bytes);
|
2006-01-30 15:01:28 +00:00
|
|
|
GST_BUFFER_OFFSET (outbuf) = vorbisenc->bytes_out;
|
|
|
|
GST_BUFFER_OFFSET_END (outbuf) = 0;
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
|
|
|
|
GST_BUFFER_DURATION (outbuf) = GST_CLOCK_TIME_NONE;
|
|
|
|
|
|
|
|
GST_DEBUG ("created header packet buffer, %d bytes",
|
2011-03-28 08:20:06 +00:00
|
|
|
gst_buffer_get_size (outbuf));
|
2006-01-30 15:01:28 +00:00
|
|
|
return outbuf;
|
|
|
|
}
|
|
|
|
|
2004-05-20 14:45:57 +00:00
|
|
|
/* push out the buffer and do internal bookkeeping */
|
2005-11-20 14:09:40 +00:00
|
|
|
static GstFlowReturn
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_push_buffer (GstVorbisEnc * vorbisenc, GstBuffer * buffer)
|
2004-05-20 14:45:57 +00:00
|
|
|
{
|
2011-03-28 08:20:06 +00:00
|
|
|
vorbisenc->bytes_out += gst_buffer_get_size (buffer);
|
2002-10-20 22:27:53 +00:00
|
|
|
|
2009-10-09 20:00:45 +00:00
|
|
|
GST_DEBUG_OBJECT (vorbisenc,
|
|
|
|
"Pushing buffer with GP %" G_GINT64_FORMAT ", ts %" GST_TIME_FORMAT,
|
|
|
|
GST_BUFFER_OFFSET_END (buffer),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
|
2005-11-20 14:09:40 +00:00
|
|
|
return gst_pad_push (vorbisenc->srcpad, buffer);
|
2002-10-20 22:27:53 +00:00
|
|
|
}
|
|
|
|
|
2005-11-20 14:09:40 +00:00
|
|
|
static GstFlowReturn
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_push_packet (GstVorbisEnc * vorbisenc, ogg_packet * packet)
|
2004-05-20 14:45:57 +00:00
|
|
|
{
|
|
|
|
GstBuffer *outbuf;
|
|
|
|
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
outbuf = gst_vorbis_enc_buffer_from_packet (vorbisenc, packet);
|
|
|
|
return gst_vorbis_enc_push_buffer (vorbisenc, outbuf);
|
2004-05-20 14:45:57 +00:00
|
|
|
}
|
2004-06-16 09:54:18 +00:00
|
|
|
|
2006-04-07 13:24:54 +00:00
|
|
|
/* Set a copy of these buffers as 'streamheader' on the caps.
|
|
|
|
* We need a copy to avoid these buffers ending up with (indirect) refs on
|
|
|
|
* themselves
|
|
|
|
*/
|
Make caps writable before writing to it.
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_setcaps),
(gst_vorbisenc_src_query), (gst_vorbisenc_sink_query),
(gst_vorbisenc_set_header_on_caps), (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
Make caps writable before writing to it.
Fix negotiation in audioconvert some more.
2005-05-09 17:07:27 +00:00
|
|
|
static GstCaps *
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_set_header_on_caps (GstCaps * caps, GstBuffer * buf1,
|
2004-05-20 17:26:53 +00:00
|
|
|
GstBuffer * buf2, GstBuffer * buf3)
|
|
|
|
{
|
2006-04-07 13:24:54 +00:00
|
|
|
GstBuffer *buf;
|
Make caps writable before writing to it.
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_setcaps),
(gst_vorbisenc_src_query), (gst_vorbisenc_sink_query),
(gst_vorbisenc_set_header_on_caps), (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
Make caps writable before writing to it.
Fix negotiation in audioconvert some more.
2005-05-09 17:07:27 +00:00
|
|
|
GstStructure *structure;
|
2005-11-21 12:36:22 +00:00
|
|
|
GValue array = { 0 };
|
2004-05-20 17:26:53 +00:00
|
|
|
GValue value = { 0 };
|
|
|
|
|
Make caps writable before writing to it.
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_setcaps),
(gst_vorbisenc_src_query), (gst_vorbisenc_sink_query),
(gst_vorbisenc_set_header_on_caps), (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
Make caps writable before writing to it.
Fix negotiation in audioconvert some more.
2005-05-09 17:07:27 +00:00
|
|
|
caps = gst_caps_make_writable (caps);
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
|
2004-05-20 17:26:53 +00:00
|
|
|
/* mark buffers */
|
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 (buf1, GST_BUFFER_FLAG_IN_CAPS);
|
|
|
|
GST_BUFFER_FLAG_SET (buf2, GST_BUFFER_FLAG_IN_CAPS);
|
|
|
|
GST_BUFFER_FLAG_SET (buf3, GST_BUFFER_FLAG_IN_CAPS);
|
2004-05-20 17:26:53 +00:00
|
|
|
|
|
|
|
/* put buffers in a fixed list */
|
2005-11-21 12:36:22 +00:00
|
|
|
g_value_init (&array, GST_TYPE_ARRAY);
|
2004-05-20 17:26:53 +00:00
|
|
|
g_value_init (&value, GST_TYPE_BUFFER);
|
2006-04-07 13:24:54 +00:00
|
|
|
buf = gst_buffer_copy (buf1);
|
|
|
|
gst_value_set_buffer (&value, buf);
|
|
|
|
gst_buffer_unref (buf);
|
2005-11-21 12:36:22 +00:00
|
|
|
gst_value_array_append_value (&array, &value);
|
2004-05-20 17:26:53 +00:00
|
|
|
g_value_unset (&value);
|
|
|
|
g_value_init (&value, GST_TYPE_BUFFER);
|
2006-04-07 13:24:54 +00:00
|
|
|
buf = gst_buffer_copy (buf2);
|
|
|
|
gst_value_set_buffer (&value, buf);
|
|
|
|
gst_buffer_unref (buf);
|
2005-11-21 12:36:22 +00:00
|
|
|
gst_value_array_append_value (&array, &value);
|
2004-05-20 17:26:53 +00:00
|
|
|
g_value_unset (&value);
|
|
|
|
g_value_init (&value, GST_TYPE_BUFFER);
|
2006-04-07 13:24:54 +00:00
|
|
|
buf = gst_buffer_copy (buf3);
|
|
|
|
gst_value_set_buffer (&value, buf);
|
|
|
|
gst_buffer_unref (buf);
|
2005-11-21 12:36:22 +00:00
|
|
|
gst_value_array_append_value (&array, &value);
|
|
|
|
gst_structure_set_value (structure, "streamheader", &array);
|
2004-05-20 17:26:53 +00:00
|
|
|
g_value_unset (&value);
|
2005-11-21 12:36:22 +00:00
|
|
|
g_value_unset (&array);
|
Make caps writable before writing to it.
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_setcaps),
(gst_vorbisenc_src_query), (gst_vorbisenc_sink_query),
(gst_vorbisenc_set_header_on_caps), (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
Make caps writable before writing to it.
Fix negotiation in audioconvert some more.
2005-05-09 17:07:27 +00:00
|
|
|
|
|
|
|
return caps;
|
2004-05-20 17:26:53 +00:00
|
|
|
}
|
2004-05-20 14:45:57 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_sink_event (GstPad * pad, GstEvent * event)
|
2001-12-20 22:30:14 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
gboolean res = TRUE;
|
2005-08-20 20:40:25 +00:00
|
|
|
GstVorbisEnc *vorbisenc;
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
vorbisenc = GST_VORBISENC (GST_PAD_PARENT (pad));
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2011-06-07 09:55:36 +00:00
|
|
|
case GST_EVENT_CAPS:
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
gst_event_parse_caps (event, &caps);
|
|
|
|
res = gst_vorbis_enc_sink_setcaps (vorbisenc, caps);
|
|
|
|
gst_event_unref (event);
|
|
|
|
break;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
case GST_EVENT_EOS:
|
2005-09-15 19:59:50 +00:00
|
|
|
/* Tell the library we're at end of stream so that it can handle
|
|
|
|
* the last frame and mark end of stream in the output properly */
|
|
|
|
GST_DEBUG_OBJECT (vorbisenc, "EOS, clearing state and sending event on");
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_clear (vorbisenc);
|
2005-09-15 19:59:50 +00:00
|
|
|
|
2005-10-27 11:33:09 +00:00
|
|
|
res = gst_pad_push_event (vorbisenc->srcpad, event);
|
2005-03-31 09:43:49 +00:00
|
|
|
break;
|
|
|
|
case GST_EVENT_TAG:
|
|
|
|
if (vorbisenc->tags) {
|
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
|
|
|
GstTagList *list;
|
|
|
|
|
|
|
|
gst_event_parse_tag (event, &list);
|
|
|
|
gst_tag_list_insert (vorbisenc->tags, list,
|
2005-11-22 12:34:27 +00:00
|
|
|
gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (vorbisenc)));
|
2005-03-31 09:43:49 +00:00
|
|
|
} else {
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
2005-10-27 11:33:09 +00:00
|
|
|
res = gst_pad_push_event (vorbisenc->srcpad, event);
|
2005-03-31 09:43:49 +00:00
|
|
|
break;
|
2011-05-16 11:48:11 +00:00
|
|
|
case GST_EVENT_SEGMENT:
|
2008-10-08 12:08:01 +00:00
|
|
|
{
|
2011-05-18 15:23:18 +00:00
|
|
|
const GstSegment *segment;
|
2011-05-16 11:48:11 +00:00
|
|
|
|
|
|
|
gst_event_parse_segment (event, &segment);
|
|
|
|
|
2011-05-18 15:23:18 +00:00
|
|
|
if (segment->format == GST_FORMAT_TIME) {
|
|
|
|
gst_segment_copy_into (segment, &vorbisenc->segment);
|
2009-04-29 15:45:27 +00:00
|
|
|
}
|
2008-10-08 12:08:01 +00:00
|
|
|
}
|
|
|
|
/* fall through */
|
2005-03-31 09:43:49 +00:00
|
|
|
default:
|
2005-10-27 11:33:09 +00:00
|
|
|
res = gst_pad_push_event (vorbisenc->srcpad, event);
|
2005-03-31 09:43:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2006-07-28 12:48:21 +00:00
|
|
|
static gboolean
|
|
|
|
gst_vorbis_enc_buffer_check_discontinuous (GstVorbisEnc * vorbisenc,
|
2008-10-08 12:08:01 +00:00
|
|
|
GstClockTime timestamp, GstClockTime duration)
|
2006-07-28 12:48:21 +00:00
|
|
|
{
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
2011-03-28 17:23:38 +00:00
|
|
|
GST_DEBUG_OBJECT (vorbisenc, "exp %" GST_TIME_FORMAT " time %" GST_TIME_FORMAT
|
|
|
|
"dur %" GST_TIME_FORMAT, GST_TIME_ARGS (vorbisenc->expected_ts),
|
|
|
|
GST_TIME_ARGS (timestamp), GST_TIME_ARGS (duration));
|
|
|
|
|
2008-10-08 12:08:01 +00:00
|
|
|
if (timestamp != GST_CLOCK_TIME_NONE &&
|
2006-08-25 09:54:56 +00:00
|
|
|
vorbisenc->expected_ts != GST_CLOCK_TIME_NONE &&
|
2008-10-10 15:21:38 +00:00
|
|
|
timestamp + duration != vorbisenc->expected_ts) {
|
2006-08-25 09:54:56 +00:00
|
|
|
/* It turns out that a lot of elements don't generate perfect streams due
|
|
|
|
* to rounding errors. So, we permit small errors (< 1/2 a sample) without
|
|
|
|
* causing a discont.
|
|
|
|
*/
|
|
|
|
int halfsample = GST_SECOND / vorbisenc->frequency / 2;
|
|
|
|
|
2008-10-08 12:08:01 +00:00
|
|
|
if ((GstClockTimeDiff) (timestamp - vorbisenc->expected_ts) > halfsample) {
|
2006-10-05 15:55:21 +00:00
|
|
|
GST_DEBUG_OBJECT (vorbisenc, "Expected TS %" GST_TIME_FORMAT
|
|
|
|
", buffer TS %" GST_TIME_FORMAT,
|
2008-10-08 12:08:01 +00:00
|
|
|
GST_TIME_ARGS (vorbisenc->expected_ts), GST_TIME_ARGS (timestamp));
|
2006-08-25 09:54:56 +00:00
|
|
|
ret = TRUE;
|
|
|
|
}
|
2006-07-28 12:48:21 +00:00
|
|
|
}
|
|
|
|
|
2008-10-08 12:08:01 +00:00
|
|
|
if (timestamp != GST_CLOCK_TIME_NONE && duration != GST_CLOCK_TIME_NONE) {
|
|
|
|
vorbisenc->expected_ts = timestamp + duration;
|
2006-07-28 12:48:21 +00:00
|
|
|
} else
|
|
|
|
vorbisenc->expected_ts = GST_CLOCK_TIME_NONE;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static GstFlowReturn
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
2005-08-20 20:40:25 +00:00
|
|
|
GstVorbisEnc *vorbisenc;
|
2005-11-21 10:09:16 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2011-03-28 08:20:06 +00:00
|
|
|
gfloat *data, *ptr;
|
2006-01-30 15:01:28 +00:00
|
|
|
gulong size;
|
|
|
|
gulong i, j;
|
|
|
|
float **vorbis_buffer;
|
2006-04-07 13:24:54 +00:00
|
|
|
GstBuffer *buf1, *buf2, *buf3;
|
2006-07-28 12:48:21 +00:00
|
|
|
gboolean first = FALSE;
|
2008-10-08 12:08:01 +00:00
|
|
|
GstClockTime timestamp = GST_CLOCK_TIME_NONE;
|
2009-05-06 12:19:34 +00:00
|
|
|
GstClockTime running_time = GST_CLOCK_TIME_NONE;
|
2011-03-28 08:20:06 +00:00
|
|
|
gsize bsize;
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
vorbisenc = GST_VORBISENC (GST_PAD_PARENT (pad));
|
|
|
|
|
2006-01-30 15:01:28 +00:00
|
|
|
if (!vorbisenc->setup)
|
|
|
|
goto not_setup;
|
|
|
|
|
2009-05-06 12:19:34 +00:00
|
|
|
buffer = gst_audio_buffer_clip (buffer, &vorbisenc->segment,
|
|
|
|
vorbisenc->frequency, 4 * vorbisenc->channels);
|
|
|
|
if (buffer == NULL) {
|
|
|
|
GST_DEBUG_OBJECT (vorbisenc, "Dropping buffer, out of segment");
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
running_time =
|
2008-10-08 12:08:01 +00:00
|
|
|
gst_segment_to_running_time (&vorbisenc->segment, GST_FORMAT_TIME,
|
2009-05-06 12:19:34 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (buffer));
|
2011-05-16 11:48:11 +00:00
|
|
|
timestamp = running_time;
|
|
|
|
GST_DEBUG_OBJECT (vorbisenc, " timestamp %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (timestamp));
|
2006-01-30 15:01:28 +00:00
|
|
|
if (!vorbisenc->header_sent) {
|
|
|
|
/* Vorbis streams begin with three headers; the initial header (with
|
|
|
|
most of the codec setup parameters) which is mandated by the Ogg
|
|
|
|
bitstream spec. The second header holds any comment fields. The
|
|
|
|
third header holds the bitstream codebook. We merely need to
|
|
|
|
make the headers, then pass them to libvorbis one at a time;
|
|
|
|
libvorbis handles the additional Ogg bitstream constraints */
|
|
|
|
ogg_packet header;
|
|
|
|
ogg_packet header_comm;
|
|
|
|
ogg_packet header_code;
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
/* first, make sure header buffers get timestamp == 0 */
|
|
|
|
vorbisenc->next_ts = 0;
|
|
|
|
vorbisenc->granulepos_offset = 0;
|
|
|
|
vorbisenc->subgranule_offset = 0;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (vorbisenc, "creating and sending header packets");
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_set_metadata (vorbisenc);
|
2006-01-30 15:01:28 +00:00
|
|
|
vorbis_analysis_headerout (&vorbisenc->vd, &vorbisenc->vc, &header,
|
|
|
|
&header_comm, &header_code);
|
2006-02-05 23:31:05 +00:00
|
|
|
vorbis_comment_clear (&vorbisenc->vc);
|
2006-01-30 15:01:28 +00:00
|
|
|
|
|
|
|
/* create header buffers */
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
buf1 = gst_vorbis_enc_buffer_from_header_packet (vorbisenc, &header);
|
|
|
|
buf2 = gst_vorbis_enc_buffer_from_header_packet (vorbisenc, &header_comm);
|
|
|
|
buf3 = gst_vorbis_enc_buffer_from_header_packet (vorbisenc, &header_code);
|
2006-01-30 15:01:28 +00:00
|
|
|
|
|
|
|
/* mark and put on caps */
|
ext/vorbis/vorbisenc.*: Multi-channel caps negotiation, so we can do proper multichannel vorbis encoding, negotiated ...
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (raw_caps_factory),
(gst_vorbis_enc_class_init), (gst_vorbis_enc_dispose),
(gst_vorbis_enc_generate_sink_caps), (gst_vorbis_enc_sink_getcaps),
(gst_vorbis_enc_init), (gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_chain), (gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Multi-channel caps negotiation, so we can do proper multichannel
vorbis encoding, negotiated through audioconvert.
2006-05-30 13:22:58 +00:00
|
|
|
vorbisenc->srccaps = gst_caps_new_simple ("audio/x-vorbis", NULL);
|
|
|
|
caps = vorbisenc->srccaps;
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
caps = gst_vorbis_enc_set_header_on_caps (caps, buf1, buf2, buf3);
|
2006-01-30 15:01:28 +00:00
|
|
|
|
|
|
|
/* negotiate with these caps */
|
|
|
|
GST_DEBUG ("here are the caps: %" GST_PTR_FORMAT, caps);
|
|
|
|
gst_pad_set_caps (vorbisenc->srcpad, caps);
|
|
|
|
|
|
|
|
/* push out buffers */
|
2006-08-29 08:03:05 +00:00
|
|
|
/* push_buffer takes the reference even for failure */
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
if ((ret = gst_vorbis_enc_push_buffer (vorbisenc, buf1)) != GST_FLOW_OK)
|
2006-01-30 15:01:28 +00:00
|
|
|
goto failed_header_push;
|
2006-08-29 08:03:05 +00:00
|
|
|
if ((ret = gst_vorbis_enc_push_buffer (vorbisenc, buf2)) != GST_FLOW_OK) {
|
|
|
|
buf2 = NULL;
|
2006-01-30 15:01:28 +00:00
|
|
|
goto failed_header_push;
|
2006-08-29 08:03:05 +00:00
|
|
|
}
|
|
|
|
if ((ret = gst_vorbis_enc_push_buffer (vorbisenc, buf3)) != GST_FLOW_OK) {
|
|
|
|
buf3 = NULL;
|
2006-01-30 15:01:28 +00:00
|
|
|
goto failed_header_push;
|
2006-08-29 08:03:05 +00:00
|
|
|
}
|
2006-01-30 15:01:28 +00:00
|
|
|
|
|
|
|
/* now adjust starting granulepos accordingly if the buffer's timestamp is
|
|
|
|
nonzero */
|
2008-10-08 12:08:01 +00:00
|
|
|
vorbisenc->next_ts = timestamp;
|
|
|
|
vorbisenc->expected_ts = timestamp;
|
2006-01-30 15:01:28 +00:00
|
|
|
vorbisenc->granulepos_offset = gst_util_uint64_scale
|
2009-05-06 12:19:34 +00:00
|
|
|
(running_time, vorbisenc->frequency, GST_SECOND);
|
2006-01-30 15:01:28 +00:00
|
|
|
vorbisenc->subgranule_offset = 0;
|
|
|
|
vorbisenc->subgranule_offset =
|
2011-05-16 11:48:11 +00:00
|
|
|
vorbisenc->next_ts - granulepos_to_timestamp_offset (vorbisenc, 0);
|
2006-01-30 15:01:28 +00:00
|
|
|
|
|
|
|
vorbisenc->header_sent = TRUE;
|
2006-07-28 12:48:21 +00:00
|
|
|
first = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (vorbisenc->expected_ts != GST_CLOCK_TIME_NONE &&
|
2008-10-08 12:08:01 +00:00
|
|
|
timestamp < vorbisenc->expected_ts) {
|
|
|
|
guint64 diff = vorbisenc->expected_ts - timestamp;
|
2008-08-22 07:24:13 +00:00
|
|
|
guint64 diff_bytes;
|
2011-03-28 08:20:06 +00:00
|
|
|
gsize size;
|
2008-08-22 07:24:13 +00:00
|
|
|
|
2006-07-28 12:48:21 +00:00
|
|
|
GST_WARNING_OBJECT (vorbisenc, "Buffer is older than previous "
|
2007-08-09 11:37:28 +00:00
|
|
|
"timestamp + duration (%" GST_TIME_FORMAT "< %" GST_TIME_FORMAT
|
2008-08-22 07:24:13 +00:00
|
|
|
"), cannot handle. Clipping buffer.",
|
2008-10-08 12:08:01 +00:00
|
|
|
GST_TIME_ARGS (timestamp), GST_TIME_ARGS (vorbisenc->expected_ts));
|
2008-08-22 07:24:13 +00:00
|
|
|
|
2011-03-28 08:20:06 +00:00
|
|
|
size = gst_buffer_get_size (buffer);
|
|
|
|
|
2008-08-22 07:24:13 +00:00
|
|
|
diff_bytes =
|
|
|
|
GST_CLOCK_TIME_TO_FRAMES (diff,
|
|
|
|
vorbisenc->frequency) * vorbisenc->channels * sizeof (gfloat);
|
2011-03-28 08:20:06 +00:00
|
|
|
if (diff_bytes >= size) {
|
2008-08-22 07:24:13 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2011-03-28 08:20:06 +00:00
|
|
|
buffer = gst_buffer_make_writable (buffer);
|
2011-03-30 14:50:45 +00:00
|
|
|
gst_buffer_resize (buffer, diff_bytes, size - diff_bytes);
|
2008-08-22 07:24:13 +00:00
|
|
|
|
|
|
|
GST_BUFFER_TIMESTAMP (buffer) += diff;
|
|
|
|
if (GST_BUFFER_DURATION_IS_VALID (buffer))
|
|
|
|
GST_BUFFER_DURATION (buffer) -= diff;
|
2006-07-28 12:48:21 +00:00
|
|
|
}
|
|
|
|
|
2008-10-08 12:08:01 +00:00
|
|
|
if (gst_vorbis_enc_buffer_check_discontinuous (vorbisenc, timestamp,
|
|
|
|
GST_BUFFER_DURATION (buffer)) && !first) {
|
|
|
|
GST_WARNING_OBJECT (vorbisenc,
|
|
|
|
"Buffer is discontinuous, flushing encoder "
|
|
|
|
"and restarting (Discont from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT
|
|
|
|
")", GST_TIME_ARGS (vorbisenc->next_ts), GST_TIME_ARGS (timestamp));
|
2006-07-28 12:48:21 +00:00
|
|
|
/* Re-initialise encoder (there's unfortunately no API to flush it) */
|
|
|
|
if ((ret = gst_vorbis_enc_clear (vorbisenc)) != GST_FLOW_OK)
|
|
|
|
return ret;
|
|
|
|
if (!gst_vorbis_enc_setup (vorbisenc))
|
|
|
|
return GST_FLOW_ERROR; /* Should be impossible, we can only get here if
|
|
|
|
we successfully initialised earlier */
|
|
|
|
|
|
|
|
/* Now, set our granulepos offset appropriately. */
|
2008-10-08 12:08:01 +00:00
|
|
|
vorbisenc->next_ts = timestamp;
|
2006-07-28 12:48:21 +00:00
|
|
|
/* We need to round to the nearest whole number of samples, not just do
|
|
|
|
* a truncating division here */
|
|
|
|
vorbisenc->granulepos_offset = gst_util_uint64_scale
|
2009-05-06 12:19:34 +00:00
|
|
|
(running_time + GST_SECOND / vorbisenc->frequency / 2
|
2006-07-28 12:48:21 +00:00
|
|
|
- vorbisenc->subgranule_offset, vorbisenc->frequency, GST_SECOND);
|
|
|
|
|
|
|
|
vorbisenc->header_sent = TRUE;
|
|
|
|
|
|
|
|
/* And our next output buffer must have DISCONT set on it */
|
|
|
|
vorbisenc->next_discont = TRUE;
|
2006-01-30 15:01:28 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2007-03-20 11:49:55 +00:00
|
|
|
/* Sending zero samples to libvorbis marks EOS, so we mustn't do that */
|
2011-03-28 08:20:06 +00:00
|
|
|
data = gst_buffer_map (buffer, &bsize, NULL, GST_MAP_WRITE);
|
|
|
|
if (bsize == 0) {
|
|
|
|
gst_buffer_unmap (buffer, data, bsize);
|
2007-03-20 11:49:55 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
2006-01-30 15:01:28 +00:00
|
|
|
/* data to encode */
|
2011-03-28 08:20:06 +00:00
|
|
|
size = bsize / (vorbisenc->channels * sizeof (float));
|
|
|
|
|
|
|
|
ptr = data;
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2006-01-30 15:01:28 +00:00
|
|
|
/* expose the buffer to submit data */
|
|
|
|
vorbis_buffer = vorbis_analysis_buffer (&vorbisenc->vd, size);
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2006-01-30 15:01:28 +00:00
|
|
|
/* deinterleave samples, write the buffer data */
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
for (j = 0; j < vorbisenc->channels; j++) {
|
2011-03-28 08:20:06 +00:00
|
|
|
vorbis_buffer[j][i] = *ptr++;
|
2001-12-20 22:30:14 +00:00
|
|
|
}
|
2006-01-30 15:01:28 +00:00
|
|
|
}
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2006-01-30 15:01:28 +00:00
|
|
|
/* tell the library how much we actually submitted */
|
|
|
|
vorbis_analysis_wrote (&vorbisenc->vd, size);
|
2011-03-28 08:20:06 +00:00
|
|
|
gst_buffer_unmap (buffer, data, bsize);
|
2002-10-20 17:11:10 +00:00
|
|
|
|
2008-06-20 09:25:44 +00:00
|
|
|
GST_LOG_OBJECT (vorbisenc, "wrote %lu samples to vorbis", size);
|
|
|
|
|
2006-01-30 15:01:28 +00:00
|
|
|
vorbisenc->samples_in += size;
|
2001-12-21 01:14:21 +00:00
|
|
|
|
2006-01-30 15:01:28 +00:00
|
|
|
gst_buffer_unref (buffer);
|
2001-12-20 22:30:14 +00:00
|
|
|
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
ret = gst_vorbis_enc_output_buffers (vorbisenc);
|
2005-09-15 19:59:50 +00:00
|
|
|
|
2005-11-21 10:09:16 +00:00
|
|
|
return ret;
|
2006-01-30 15:01:28 +00:00
|
|
|
|
|
|
|
/* error cases */
|
|
|
|
not_setup:
|
|
|
|
{
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
GST_ELEMENT_ERROR (vorbisenc, CORE, NEGOTIATION, (NULL),
|
|
|
|
("encoder not initialized (input is not audio?)"));
|
|
|
|
return GST_FLOW_UNEXPECTED;
|
|
|
|
}
|
|
|
|
failed_header_push:
|
|
|
|
{
|
2006-04-07 13:24:54 +00:00
|
|
|
GST_WARNING_OBJECT (vorbisenc, "Failed to push headers");
|
2006-08-29 08:03:05 +00:00
|
|
|
/* buf1 is always already unreffed */
|
2006-04-07 13:24:54 +00:00
|
|
|
if (buf2)
|
|
|
|
gst_buffer_unref (buf2);
|
|
|
|
if (buf3)
|
|
|
|
gst_buffer_unref (buf3);
|
2006-01-30 15:01:28 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return ret;
|
|
|
|
}
|
2005-09-15 19:59:50 +00:00
|
|
|
}
|
|
|
|
|
2005-11-21 10:09:16 +00:00
|
|
|
static GstFlowReturn
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_output_buffers (GstVorbisEnc * vorbisenc)
|
2005-09-15 19:59:50 +00:00
|
|
|
{
|
2005-11-21 10:09:16 +00:00
|
|
|
GstFlowReturn ret;
|
|
|
|
|
ext/vorbis/: Added a raw vorbis encoder to be used with the oggmuxer.
Original commit message from CVS:
* ext/vorbis/Makefile.am:
* ext/vorbis/README:
* ext/vorbis/oggvorbisenc.c: (gst_oggvorbisenc_get_formats),
(oggvorbisenc_get_type), (vorbis_caps_factory), (raw_caps_factory),
(gst_oggvorbisenc_base_init), (gst_oggvorbisenc_class_init),
(gst_oggvorbisenc_sinkconnect), (gst_oggvorbisenc_convert_src),
(gst_oggvorbisenc_convert_sink),
(gst_oggvorbisenc_get_query_types), (gst_oggvorbisenc_src_query),
(gst_oggvorbisenc_init), (gst_oggvorbisenc_get_tag_value),
(gst_oggvorbisenc_metadata_set1), (gst_oggvorbisenc_set_metadata),
(get_constraints_string), (update_start_message),
(gst_oggvorbisenc_setup), (gst_oggvorbisenc_write_page),
(gst_oggvorbisenc_chain), (gst_oggvorbisenc_get_property),
(gst_oggvorbisenc_set_property), (gst_oggvorbisenc_change_state):
* ext/vorbis/oggvorbisenc.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisenc.c: (vorbis_caps_factory),
(raw_caps_factory), (gst_vorbisenc_class_init),
(gst_vorbisenc_init), (gst_vorbisenc_setup),
(gst_vorbisenc_push_packet), (gst_vorbisenc_chain),
(gst_vorbisenc_get_property), (gst_vorbisenc_set_property):
* ext/vorbis/vorbisenc.h:
Added a raw vorbis encoder to be used with the oggmuxer.
We still need the old encoder for some gnome applications,
read the README to find out how that works.
The raw encoder is called "rawvorbisenc" until 0.9.
2004-05-10 17:44:07 +00:00
|
|
|
/* vorbis does some data preanalysis, then divides up blocks for
|
2001-12-20 22:30:14 +00:00
|
|
|
more involved (potentially parallel) processing. Get a single
|
|
|
|
block for encoding now */
|
2001-12-21 01:14:21 +00:00
|
|
|
while (vorbis_analysis_blockout (&vorbisenc->vd, &vorbisenc->vb) == 1) {
|
ext/vorbis/: Added a raw vorbis encoder to be used with the oggmuxer.
Original commit message from CVS:
* ext/vorbis/Makefile.am:
* ext/vorbis/README:
* ext/vorbis/oggvorbisenc.c: (gst_oggvorbisenc_get_formats),
(oggvorbisenc_get_type), (vorbis_caps_factory), (raw_caps_factory),
(gst_oggvorbisenc_base_init), (gst_oggvorbisenc_class_init),
(gst_oggvorbisenc_sinkconnect), (gst_oggvorbisenc_convert_src),
(gst_oggvorbisenc_convert_sink),
(gst_oggvorbisenc_get_query_types), (gst_oggvorbisenc_src_query),
(gst_oggvorbisenc_init), (gst_oggvorbisenc_get_tag_value),
(gst_oggvorbisenc_metadata_set1), (gst_oggvorbisenc_set_metadata),
(get_constraints_string), (update_start_message),
(gst_oggvorbisenc_setup), (gst_oggvorbisenc_write_page),
(gst_oggvorbisenc_chain), (gst_oggvorbisenc_get_property),
(gst_oggvorbisenc_set_property), (gst_oggvorbisenc_change_state):
* ext/vorbis/oggvorbisenc.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisenc.c: (vorbis_caps_factory),
(raw_caps_factory), (gst_vorbisenc_class_init),
(gst_vorbisenc_init), (gst_vorbisenc_setup),
(gst_vorbisenc_push_packet), (gst_vorbisenc_chain),
(gst_vorbisenc_get_property), (gst_vorbisenc_set_property):
* ext/vorbis/vorbisenc.h:
Added a raw vorbis encoder to be used with the oggmuxer.
We still need the old encoder for some gnome applications,
read the README to find out how that works.
The raw encoder is called "rawvorbisenc" until 0.9.
2004-05-10 17:44:07 +00:00
|
|
|
ogg_packet op;
|
2001-12-20 22:30:14 +00:00
|
|
|
|
2005-08-20 20:40:25 +00:00
|
|
|
GST_LOG_OBJECT (vorbisenc, "analysed to a block");
|
|
|
|
|
2001-12-20 22:30:14 +00:00
|
|
|
/* analysis */
|
2002-04-15 09:27:03 +00:00
|
|
|
vorbis_analysis (&vorbisenc->vb, NULL);
|
2004-03-14 22:34:34 +00:00
|
|
|
vorbis_bitrate_addblock (&vorbisenc->vb);
|
|
|
|
|
ext/vorbis/: Added a raw vorbis encoder to be used with the oggmuxer.
Original commit message from CVS:
* ext/vorbis/Makefile.am:
* ext/vorbis/README:
* ext/vorbis/oggvorbisenc.c: (gst_oggvorbisenc_get_formats),
(oggvorbisenc_get_type), (vorbis_caps_factory), (raw_caps_factory),
(gst_oggvorbisenc_base_init), (gst_oggvorbisenc_class_init),
(gst_oggvorbisenc_sinkconnect), (gst_oggvorbisenc_convert_src),
(gst_oggvorbisenc_convert_sink),
(gst_oggvorbisenc_get_query_types), (gst_oggvorbisenc_src_query),
(gst_oggvorbisenc_init), (gst_oggvorbisenc_get_tag_value),
(gst_oggvorbisenc_metadata_set1), (gst_oggvorbisenc_set_metadata),
(get_constraints_string), (update_start_message),
(gst_oggvorbisenc_setup), (gst_oggvorbisenc_write_page),
(gst_oggvorbisenc_chain), (gst_oggvorbisenc_get_property),
(gst_oggvorbisenc_set_property), (gst_oggvorbisenc_change_state):
* ext/vorbis/oggvorbisenc.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisenc.c: (vorbis_caps_factory),
(raw_caps_factory), (gst_vorbisenc_class_init),
(gst_vorbisenc_init), (gst_vorbisenc_setup),
(gst_vorbisenc_push_packet), (gst_vorbisenc_chain),
(gst_vorbisenc_get_property), (gst_vorbisenc_set_property):
* ext/vorbis/vorbisenc.h:
Added a raw vorbis encoder to be used with the oggmuxer.
We still need the old encoder for some gnome applications,
read the README to find out how that works.
The raw encoder is called "rawvorbisenc" until 0.9.
2004-05-10 17:44:07 +00:00
|
|
|
while (vorbis_bitrate_flushpacket (&vorbisenc->vd, &op)) {
|
2005-08-20 20:40:25 +00:00
|
|
|
GST_LOG_OBJECT (vorbisenc, "pushing out a data packet");
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
ret = gst_vorbis_enc_push_packet (vorbisenc, &op);
|
2005-11-21 10:09:16 +00:00
|
|
|
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
return ret;
|
2001-12-20 22:30:14 +00:00
|
|
|
}
|
|
|
|
}
|
2005-11-21 10:09:16 +00:00
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
2001-12-20 22:30:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
2004-03-14 22:34:34 +00:00
|
|
|
GParamSpec * pspec)
|
2001-12-20 22:30:14 +00:00
|
|
|
{
|
2005-08-20 20:40:25 +00:00
|
|
|
GstVorbisEnc *vorbisenc;
|
2001-12-20 22:30:14 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_VORBISENC (object));
|
|
|
|
|
|
|
|
vorbisenc = GST_VORBISENC (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2002-10-20 01:55:28 +00:00
|
|
|
case ARG_MAX_BITRATE:
|
|
|
|
g_value_set_int (value, vorbisenc->max_bitrate);
|
|
|
|
break;
|
2001-12-20 22:30:14 +00:00
|
|
|
case ARG_BITRATE:
|
|
|
|
g_value_set_int (value, vorbisenc->bitrate);
|
|
|
|
break;
|
2002-10-20 01:55:28 +00:00
|
|
|
case ARG_MIN_BITRATE:
|
|
|
|
g_value_set_int (value, vorbisenc->min_bitrate);
|
|
|
|
break;
|
|
|
|
case ARG_QUALITY:
|
|
|
|
g_value_set_float (value, vorbisenc->quality);
|
|
|
|
break;
|
|
|
|
case ARG_MANAGED:
|
|
|
|
g_value_set_boolean (value, vorbisenc->managed);
|
|
|
|
break;
|
|
|
|
case ARG_LAST_MESSAGE:
|
|
|
|
g_value_set_string (value, vorbisenc->last_message);
|
|
|
|
break;
|
2001-12-20 22:30:14 +00:00
|
|
|
default:
|
2002-10-20 17:11:10 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2001-12-20 22:30:14 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_set_property (GObject * object, guint prop_id,
|
2004-03-14 22:34:34 +00:00
|
|
|
const GValue * value, GParamSpec * pspec)
|
2001-12-20 22:30:14 +00:00
|
|
|
{
|
2005-08-20 20:40:25 +00:00
|
|
|
GstVorbisEnc *vorbisenc;
|
2001-12-20 22:30:14 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_VORBISENC (object));
|
|
|
|
|
|
|
|
vorbisenc = GST_VORBISENC (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2002-10-20 01:55:28 +00:00
|
|
|
case ARG_MAX_BITRATE:
|
|
|
|
{
|
|
|
|
gboolean old_value = vorbisenc->managed;
|
|
|
|
|
|
|
|
vorbisenc->max_bitrate = g_value_get_int (value);
|
2004-06-24 15:51:24 +00:00
|
|
|
if (vorbisenc->max_bitrate >= 0
|
|
|
|
&& vorbisenc->max_bitrate < LOWEST_BITRATE) {
|
|
|
|
g_warning ("Lowest allowed bitrate is %d", LOWEST_BITRATE);
|
|
|
|
vorbisenc->max_bitrate = LOWEST_BITRATE;
|
|
|
|
}
|
2002-10-20 01:55:28 +00:00
|
|
|
if (vorbisenc->min_bitrate > 0 && vorbisenc->max_bitrate > 0)
|
2004-03-15 19:32:28 +00:00
|
|
|
vorbisenc->managed = TRUE;
|
2002-10-20 01:55:28 +00:00
|
|
|
else
|
2004-03-15 19:32:28 +00:00
|
|
|
vorbisenc->managed = FALSE;
|
2002-10-20 01:55:28 +00:00
|
|
|
|
|
|
|
if (old_value != vorbisenc->managed)
|
2004-03-15 19:32:28 +00:00
|
|
|
g_object_notify (object, "managed");
|
2002-10-20 01:55:28 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-12-20 22:30:14 +00:00
|
|
|
case ARG_BITRATE:
|
|
|
|
vorbisenc->bitrate = g_value_get_int (value);
|
2004-06-24 15:51:24 +00:00
|
|
|
if (vorbisenc->bitrate >= 0 && vorbisenc->bitrate < LOWEST_BITRATE) {
|
|
|
|
g_warning ("Lowest allowed bitrate is %d", LOWEST_BITRATE);
|
|
|
|
vorbisenc->bitrate = LOWEST_BITRATE;
|
|
|
|
}
|
2001-12-20 22:30:14 +00:00
|
|
|
break;
|
2002-10-20 01:55:28 +00:00
|
|
|
case ARG_MIN_BITRATE:
|
|
|
|
{
|
|
|
|
gboolean old_value = vorbisenc->managed;
|
|
|
|
|
|
|
|
vorbisenc->min_bitrate = g_value_get_int (value);
|
2004-06-24 15:51:24 +00:00
|
|
|
if (vorbisenc->min_bitrate >= 0
|
|
|
|
&& vorbisenc->min_bitrate < LOWEST_BITRATE) {
|
|
|
|
g_warning ("Lowest allowed bitrate is %d", LOWEST_BITRATE);
|
|
|
|
vorbisenc->min_bitrate = LOWEST_BITRATE;
|
|
|
|
}
|
2002-10-20 01:55:28 +00:00
|
|
|
if (vorbisenc->min_bitrate > 0 && vorbisenc->max_bitrate > 0)
|
2004-03-15 19:32:28 +00:00
|
|
|
vorbisenc->managed = TRUE;
|
2002-10-20 01:55:28 +00:00
|
|
|
else
|
2004-03-15 19:32:28 +00:00
|
|
|
vorbisenc->managed = FALSE;
|
2002-10-20 01:55:28 +00:00
|
|
|
|
|
|
|
if (old_value != vorbisenc->managed)
|
2004-03-15 19:32:28 +00:00
|
|
|
g_object_notify (object, "managed");
|
2002-10-20 01:55:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ARG_QUALITY:
|
|
|
|
vorbisenc->quality = g_value_get_float (value);
|
|
|
|
if (vorbisenc->quality >= 0.0)
|
2004-03-15 19:32:28 +00:00
|
|
|
vorbisenc->quality_set = TRUE;
|
2002-10-20 01:55:28 +00:00
|
|
|
else
|
2004-03-15 19:32:28 +00:00
|
|
|
vorbisenc->quality_set = FALSE;
|
2002-10-20 01:55:28 +00:00
|
|
|
break;
|
|
|
|
case ARG_MANAGED:
|
|
|
|
vorbisenc->managed = g_value_get_boolean (value);
|
|
|
|
break;
|
2001-12-20 22:30:14 +00:00
|
|
|
default:
|
2002-10-20 17:11:10 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2001-12-20 22:30:14 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2002-10-19 16:57:08 +00:00
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gst_vorbis_enc_change_state (GstElement * element, GstStateChange transition)
|
2002-10-19 16:57:08 +00:00
|
|
|
{
|
2005-08-20 20:40:25 +00:00
|
|
|
GstVorbisEnc *vorbisenc = GST_VORBISENC (element);
|
2005-09-02 15:43:18 +00:00
|
|
|
GstStateChangeReturn res;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
switch (transition) {
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
2005-08-24 21:03:32 +00:00
|
|
|
vorbisenc->tags = gst_tag_list_new ();
|
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2005-10-27 11:33:09 +00:00
|
|
|
vorbisenc->setup = FALSE;
|
2006-07-28 12:48:21 +00:00
|
|
|
vorbisenc->next_discont = FALSE;
|
2005-10-27 11:33:09 +00:00
|
|
|
vorbisenc->header_sent = FALSE;
|
2008-10-08 12:08:01 +00:00
|
|
|
gst_segment_init (&vorbisenc->segment, GST_FORMAT_TIME);
|
2005-10-27 11:33:09 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
2005-10-27 11:33:09 +00:00
|
|
|
break;
|
2005-03-31 09:43:49 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
res = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
2002-10-19 16:57:08 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2005-10-27 11:33:09 +00:00
|
|
|
vorbis_block_clear (&vorbisenc->vb);
|
|
|
|
vorbis_dsp_clear (&vorbisenc->vd);
|
|
|
|
vorbis_info_clear (&vorbisenc->vi);
|
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
|
|
|
g_free (vorbisenc->last_message);
|
|
|
|
vorbisenc->last_message = NULL;
|
ext/vorbis/vorbisenc.*: Multi-channel caps negotiation, so we can do proper multichannel vorbis encoding, negotiated ...
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (raw_caps_factory),
(gst_vorbis_enc_class_init), (gst_vorbis_enc_dispose),
(gst_vorbis_enc_generate_sink_caps), (gst_vorbis_enc_sink_getcaps),
(gst_vorbis_enc_init), (gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_chain), (gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Multi-channel caps negotiation, so we can do proper multichannel
vorbis encoding, negotiated through audioconvert.
2006-05-30 13:22:58 +00:00
|
|
|
if (vorbisenc->srccaps) {
|
|
|
|
gst_caps_unref (vorbisenc->srccaps);
|
|
|
|
vorbisenc->srccaps = NULL;
|
|
|
|
}
|
2002-10-19 16:57:08 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
2005-08-24 21:03:32 +00:00
|
|
|
gst_tag_list_free (vorbisenc->tags);
|
|
|
|
vorbisenc->tags = NULL;
|
2002-10-19 16:57:08 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
return res;
|
2002-10-19 16:57:08 +00:00
|
|
|
}
|