ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
|
|
*
|
|
|
|
* 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-14 21:36:02 +00:00
|
|
|
/**
|
2005-09-14 21:53:06 +00:00
|
|
|
* SECTION:element-theoraenc
|
2005-09-14 21:36:02 +00:00
|
|
|
* @see_also: theoradec, oggmux
|
|
|
|
*
|
|
|
|
* This element encodes raw video into a Theora stream.
|
|
|
|
* <ulink url="http://www.theora.org/">Theora</ulink> is a royalty-free
|
|
|
|
* video codec maintained by the <ulink url="http://www.xiph.org/">Xiph.org
|
|
|
|
* Foundation</ulink>, based on the VP3 codec.
|
2008-07-10 21:06:06 +00:00
|
|
|
*
|
2006-03-01 16:24:37 +00:00
|
|
|
* The theora codec internally only supports encoding of images that are a
|
2006-04-10 14:52:10 +00:00
|
|
|
* multiple of 16 pixels in both X and Y direction. It is however perfectly
|
|
|
|
* possible to encode images with other dimensions because an arbitrary
|
|
|
|
* rectangular cropping region can be set up. This element will automatically
|
|
|
|
* set up a correct cropping region if the dimensions are not multiples of 16
|
2008-07-10 21:06:06 +00:00
|
|
|
* pixels. The #GstTheoraEnc::border and #GstTheoraEnc::center properties
|
|
|
|
* control how this cropping region will be set up.
|
|
|
|
*
|
|
|
|
* To control the quality of the encoding, the #GstTheoraEnc::bitrate and
|
|
|
|
* #GstTheoraEnc::quality properties can be used. These two properties are
|
|
|
|
* mutualy exclusive. Setting the bitrate property will produce a constant
|
|
|
|
* bitrate (CBR) stream while setting the quality property will produce a
|
|
|
|
* variable bitrate (VBR) stream.
|
|
|
|
*
|
|
|
|
* <refsect2>
|
2005-09-14 21:36:02 +00:00
|
|
|
* <title>Example pipeline</title>
|
2008-07-10 21:06:06 +00:00
|
|
|
* |[
|
2005-09-14 21:36:02 +00:00
|
|
|
* gst-launch -v videotestsrc num-buffers=1000 ! theoraenc ! oggmux ! filesink location=videotestsrc.ogg
|
2008-07-10 21:06:06 +00:00
|
|
|
* ]| This example pipeline will encode a test video source to theora muxed in an
|
2006-04-10 14:52:10 +00:00
|
|
|
* ogg container. Refer to the theoradec documentation to decode the create
|
|
|
|
* stream.
|
2005-09-14 21:36:02 +00:00
|
|
|
* </refsect2>
|
2006-03-01 16:24:37 +00:00
|
|
|
*
|
|
|
|
* Last reviewed on 2006-03-01 (0.10.4)
|
2005-09-14 21:36:02 +00:00
|
|
|
*/
|
|
|
|
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2005-09-15 15:28:36 +00:00
|
|
|
#include "gsttheoraenc.h"
|
2006-04-29 09:48:16 +00:00
|
|
|
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
#include <string.h>
|
2006-04-29 09:48:16 +00:00
|
|
|
#include <stdlib.h> /* free */
|
|
|
|
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
#include <gst/tag/tag.h>
|
|
|
|
|
2004-07-14 13:42:23 +00:00
|
|
|
#define GST_CAT_DEFAULT theoraenc_debug
|
2006-05-23 20:38:56 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
ext/theora/theoradec.c: Adapt for post-alpha meaning of granulepos, when we have a newer version of libtheora.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(_theora_granule_frame), (_theora_granule_start_time),
(theora_dec_sink_convert), (theora_dec_decode_buffer):
Adapt for post-alpha meaning of granulepos, when we
have a newer version of libtheora.
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(theora_enc_get_ogg_packet_end_time), (theora_enc_sink_event),
(theora_enc_is_discontinuous), (theora_enc_chain):
Likewise.
* tests/check/Makefile.am:
Link libtheora into theoraenc test so we can check which version of
libtheora we're testing against.
* tests/check/pipelines/theoraenc.c: (check_libtheora),
(check_buffer_granulepos),
(check_buffer_granulepos_from_starttime), (GST_START_TEST),
(theoraenc_suite):
Adapt tests to check the values that are now defined for theora; make
the tests backwards-adapt the passed values if we're running against an
old libtheora.
Fixes #497964
2008-01-11 15:48:11 +00:00
|
|
|
/* With libtheora-1.0beta1 the granulepos scheme was changed:
|
|
|
|
* where earlier the granulepos refered to the index/beginning
|
|
|
|
* of a frame, it now refers to the end, which matches the use
|
|
|
|
* in vorbis/speex. There don't seem to be defines for the
|
|
|
|
* theora version we're compiling against, so we'll just use
|
|
|
|
* a run-time check for now. See theora_enc_get_ogg_packet_end_time().
|
|
|
|
*/
|
|
|
|
static gboolean use_old_granulepos;
|
|
|
|
|
ext/theora/: Added cropping option to theora decoder.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(gst_theora_dec_init), (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain), (theora_dec_set_property),
(theora_dec_get_property):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_chain),
(theora_enc_set_property), (theora_enc_get_property):
Added cropping option to theora decoder.
Added border option to theora encoder.
2004-07-30 10:18:42 +00:00
|
|
|
#define GST_TYPE_BORDER_MODE (gst_border_mode_get_type())
|
|
|
|
static GType
|
|
|
|
gst_border_mode_get_type (void)
|
|
|
|
{
|
|
|
|
static GType border_mode_type = 0;
|
Const-ify GEnumValue and GFlagsValue arrays. Use
Original commit message from CVS:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_valign_get_type),
(gst_text_overlay_halign_get_type),
(gst_text_overlay_wrap_mode_get_type):
* ext/theora/theoradec.c: (theora_handle_type_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(theora_enc_sink_setcaps), (theora_enc_chain):
* gst-libs/gst/cdda/gstcddabasesrc.c:
(gst_cdda_base_src_mode_get_type):
* gst/audiotestsrc/gstaudiotestsrc.c:
(gst_audiostestsrc_wave_get_type):
* gst/playback/gststreaminfo.c: (gst_stream_type_get_type):
* gst/tcp/gstfdset.c: (gst_fdset_mode_get_type):
* gst/tcp/gstmultifdsink.c: (gst_recover_policy_get_type),
(gst_sync_method_get_type), (gst_unit_type_get_type),
(gst_client_status_get_type):
* gst/videoscale/gstvideoscale.c:
(gst_video_scale_method_get_type):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_video_test_src_pattern_get_type):
* gst/videotestsrc/videotestsrc.c: (paint_setup_I420),
(paint_setup_YV12), (paint_setup_YUY2), (paint_setup_UYVY),
(paint_setup_YVYU), (paint_setup_IYU2), (paint_setup_Y41B),
(paint_setup_Y42B), (paint_setup_Y800), (paint_setup_YVU9),
(paint_setup_YUV9), (paint_setup_RGB888), (paint_setup_BGR888),
(paint_setup_RGB565), (paint_setup_xRGB1555):
Const-ify GEnumValue and GFlagsValue arrays. Use
GST_ROUND_UP_* macros instead of home-made ones.
2006-05-09 19:24:46 +00:00
|
|
|
static const GEnumValue border_mode[] = {
|
2005-11-22 17:39:29 +00:00
|
|
|
{BORDER_NONE, "No Border", "none"},
|
|
|
|
{BORDER_BLACK, "Black Border", "black"},
|
|
|
|
{BORDER_MIRROR, "Mirror image in borders", "mirror"},
|
ext/theora/: Added cropping option to theora decoder.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(gst_theora_dec_init), (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain), (theora_dec_set_property),
(theora_dec_get_property):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_chain),
(theora_enc_set_property), (theora_enc_get_property):
Added cropping option to theora decoder.
Added border option to theora encoder.
2004-07-30 10:18:42 +00:00
|
|
|
{0, NULL, NULL},
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!border_mode_type) {
|
|
|
|
border_mode_type =
|
|
|
|
g_enum_register_static ("GstTheoraEncBorderMode", border_mode);
|
|
|
|
}
|
|
|
|
return border_mode_type;
|
|
|
|
}
|
|
|
|
|
2006-01-30 19:21:07 +00:00
|
|
|
/* taken from theora/lib/toplevel.c */
|
|
|
|
static int
|
|
|
|
_ilog (unsigned int v)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
while (v) {
|
|
|
|
ret++;
|
|
|
|
v >>= 1;
|
|
|
|
}
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
2006-03-01 16:24:37 +00:00
|
|
|
#define THEORA_DEF_CENTER TRUE
|
|
|
|
#define THEORA_DEF_BORDER BORDER_BLACK
|
|
|
|
#define THEORA_DEF_BITRATE 0
|
|
|
|
#define THEORA_DEF_QUALITY 16
|
|
|
|
#define THEORA_DEF_QUICK TRUE
|
|
|
|
#define THEORA_DEF_KEYFRAME_AUTO TRUE
|
|
|
|
#define THEORA_DEF_KEYFRAME_FREQ 64
|
|
|
|
#define THEORA_DEF_KEYFRAME_FREQ_FORCE 64
|
|
|
|
#define THEORA_DEF_KEYFRAME_THRESHOLD 80
|
|
|
|
#define THEORA_DEF_KEYFRAME_MINDISTANCE 8
|
|
|
|
#define THEORA_DEF_NOISE_SENSITIVITY 1
|
|
|
|
#define THEORA_DEF_SHARPNESS 0
|
2009-02-19 20:18:29 +00:00
|
|
|
#define THEORA_DEF_SPEEDLEVEL 1
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ARG_0,
|
2004-07-30 08:14:36 +00:00
|
|
|
ARG_CENTER,
|
ext/theora/: Added cropping option to theora decoder.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(gst_theora_dec_init), (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain), (theora_dec_set_property),
(theora_dec_get_property):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_chain),
(theora_enc_set_property), (theora_enc_get_property):
Added cropping option to theora decoder.
Added border option to theora encoder.
2004-07-30 10:18:42 +00:00
|
|
|
ARG_BORDER,
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
ARG_BITRATE,
|
2004-06-10 14:59:17 +00:00
|
|
|
ARG_QUALITY,
|
|
|
|
ARG_QUICK,
|
|
|
|
ARG_KEYFRAME_AUTO,
|
|
|
|
ARG_KEYFRAME_FREQ,
|
|
|
|
ARG_KEYFRAME_FREQ_FORCE,
|
|
|
|
ARG_KEYFRAME_THRESHOLD,
|
|
|
|
ARG_KEYFRAME_MINDISTANCE,
|
|
|
|
ARG_NOISE_SENSITIVITY,
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
ARG_SHARPNESS,
|
2009-02-19 20:18:29 +00:00
|
|
|
ARG_SPEEDLEVEL,
|
2004-06-10 14:59:17 +00:00
|
|
|
/* FILL ME */
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +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 (GstTheoraEnc * theoraenc, ogg_int64_t granulepos)
|
|
|
|
{
|
|
|
|
guint64 iframe, pframe;
|
|
|
|
int shift = theoraenc->granule_shift;
|
|
|
|
|
|
|
|
if (granulepos < 0)
|
|
|
|
return GST_CLOCK_TIME_NONE;
|
|
|
|
|
|
|
|
iframe = granulepos >> shift;
|
|
|
|
pframe = granulepos - (iframe << shift);
|
|
|
|
|
|
|
|
/* num and den are 32 bit, so we can safely multiply with GST_SECOND */
|
|
|
|
return gst_util_uint64_scale ((guint64) (iframe + pframe),
|
|
|
|
GST_SECOND * theoraenc->info.fps_denominator,
|
|
|
|
theoraenc->info.fps_numerator);
|
|
|
|
}
|
|
|
|
|
2006-04-28 19:46:37 +00:00
|
|
|
static const GstElementDetails theora_enc_details =
|
2006-03-29 14:00:08 +00:00
|
|
|
GST_ELEMENT_DETAILS ("Theora video encoder",
|
2006-03-24 10:42:11 +00:00
|
|
|
"Codec/Encoder/Video",
|
|
|
|
"encode raw YUV video to a theora stream",
|
|
|
|
"Wim Taymans <wim@fluendo.com>");
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
|
|
|
static GstStaticPadTemplate theora_enc_sink_factory =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("video/x-raw-yuv, "
|
|
|
|
"format = (fourcc) I420, "
|
Convert elements to use fractions for their framerate.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_type_packet):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps),
(theora_enc_chain):
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):
* gst-libs/gst/video/video.c: (gst_video_frame_rate):
* gst-libs/gst/video/video.h:
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_caps_to_pixfmt):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_set_caps):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_setcaps), (gst_videorate_blank_data),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_getcaps),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_setcaps),
(gst_videotestsrc_event), (gst_videotestsrc_create):
* gst/videotestsrc/gstvideotestsrc.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_get_times), (gst_ximagesink_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_get_times), (gst_xvimagesink_init):
* sys/xvimage/xvimagesink.h:
Convert elements to use fractions for their framerate.
V4L elements to come later tonight.
2005-11-22 16:08:37 +00:00
|
|
|
"framerate = (fraction) [0/1, MAX], "
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
"width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
|
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate theora_enc_src_factory =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("video/x-theora")
|
|
|
|
);
|
|
|
|
|
|
|
|
GST_BOILERPLATE (GstTheoraEnc, gst_theora_enc, GstElement, GST_TYPE_ELEMENT);
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean theora_enc_sink_event (GstPad * pad, GstEvent * event);
|
2009-04-14 16:16:37 +00:00
|
|
|
static gboolean theora_enc_src_event (GstPad * pad, GstEvent * event);
|
2005-03-31 09:43:49 +00:00
|
|
|
static GstFlowReturn theora_enc_chain (GstPad * pad, GstBuffer * buffer);
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn theora_enc_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps);
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
static void theora_enc_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
static void theora_enc_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
2006-02-05 23:31:05 +00:00
|
|
|
static void theora_enc_finalize (GObject * object);
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_theora_enc_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&theora_enc_src_factory));
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&theora_enc_sink_factory));
|
|
|
|
gst_element_class_set_details (element_class, &theora_enc_details);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_theora_enc_class_init (GstTheoraEncClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class = (GObjectClass *) klass;
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
|
|
|
gobject_class->set_property = theora_enc_set_property;
|
|
|
|
gobject_class->get_property = theora_enc_get_property;
|
2006-02-05 23:31:05 +00:00
|
|
|
gobject_class->finalize = theora_enc_finalize;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
2004-07-30 08:14:36 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_CENTER,
|
|
|
|
g_param_spec_boolean ("center", "Center",
|
|
|
|
"Center image when sizes not multiple of 16", THEORA_DEF_CENTER,
|
2008-03-22 15:00:53 +00:00
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
ext/theora/: Added cropping option to theora decoder.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(gst_theora_dec_init), (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain), (theora_dec_set_property),
(theora_dec_get_property):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_chain),
(theora_enc_set_property), (theora_enc_get_property):
Added cropping option to theora decoder.
Added border option to theora encoder.
2004-07-30 10:18:42 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_BORDER,
|
|
|
|
g_param_spec_enum ("border", "Border",
|
|
|
|
"Border color to add when sizes not multiple of 16",
|
|
|
|
GST_TYPE_BORDER_MODE, THEORA_DEF_BORDER,
|
2008-03-22 15:00:53 +00:00
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
/* general encoding stream options */
|
|
|
|
g_object_class_install_property (gobject_class, ARG_BITRATE,
|
|
|
|
g_param_spec_int ("bitrate", "Bitrate", "Compressed video bitrate (kbps)",
|
2008-08-13 00:59:07 +00:00
|
|
|
0, (1 << 24) - 1, THEORA_DEF_BITRATE,
|
2008-03-22 15:00:53 +00:00
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_QUALITY,
|
2008-03-22 15:00:53 +00:00
|
|
|
g_param_spec_int ("quality", "Quality", "Video quality", 0, 63,
|
|
|
|
THEORA_DEF_QUALITY,
|
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-06-10 14:59:17 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_QUICK,
|
|
|
|
g_param_spec_boolean ("quick", "Quick", "Quick encoding",
|
2008-03-22 15:00:53 +00:00
|
|
|
THEORA_DEF_QUICK,
|
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-06-10 14:59:17 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_KEYFRAME_AUTO,
|
|
|
|
g_param_spec_boolean ("keyframe-auto", "Keyframe Auto",
|
|
|
|
"Automatic keyframe detection", THEORA_DEF_KEYFRAME_AUTO,
|
2008-03-22 15:00:53 +00:00
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-06-10 14:59:17 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_KEYFRAME_FREQ,
|
|
|
|
g_param_spec_int ("keyframe-freq", "Keyframe frequency",
|
|
|
|
"Keyframe frequency", 1, 32768, THEORA_DEF_KEYFRAME_FREQ,
|
2008-03-22 15:00:53 +00:00
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-06-10 14:59:17 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_KEYFRAME_FREQ_FORCE,
|
|
|
|
g_param_spec_int ("keyframe-force", "Keyframe force",
|
|
|
|
"Force keyframe every N frames", 1, 32768,
|
2008-03-22 15:00:53 +00:00
|
|
|
THEORA_DEF_KEYFRAME_FREQ_FORCE,
|
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-06-10 14:59:17 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_KEYFRAME_THRESHOLD,
|
|
|
|
g_param_spec_int ("keyframe-threshold", "Keyframe threshold",
|
|
|
|
"Keyframe threshold", 0, 32768, THEORA_DEF_KEYFRAME_THRESHOLD,
|
2008-03-22 15:00:53 +00:00
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-06-10 14:59:17 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_KEYFRAME_MINDISTANCE,
|
|
|
|
g_param_spec_int ("keyframe-mindistance", "Keyframe mindistance",
|
|
|
|
"Keyframe mindistance", 1, 32768, THEORA_DEF_KEYFRAME_MINDISTANCE,
|
2008-03-22 15:00:53 +00:00
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-06-10 14:59:17 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_NOISE_SENSITIVITY,
|
|
|
|
g_param_spec_int ("noise-sensitivity", "Noise sensitivity",
|
|
|
|
"Noise sensitivity", 0, 32768, THEORA_DEF_NOISE_SENSITIVITY,
|
2008-03-22 15:00:53 +00:00
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_SHARPNESS,
|
2008-03-22 15:00:53 +00:00
|
|
|
g_param_spec_int ("sharpness", "Sharpness", "Sharpness", 0, 2,
|
|
|
|
THEORA_DEF_SHARPNESS,
|
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2009-02-19 20:18:29 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_SPEEDLEVEL,
|
|
|
|
g_param_spec_int ("speed-level", "Speed level",
|
|
|
|
"Controls the amount of motion vector searching done while "
|
|
|
|
"encoding. This property requires libtheora version >= 1.0",
|
|
|
|
0, 2, THEORA_DEF_SPEEDLEVEL,
|
|
|
|
(GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-06-10 14:59:17 +00:00
|
|
|
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
gstelement_class->change_state = theora_enc_change_state;
|
2004-07-14 13:42:23 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (theoraenc_debug, "theoraenc", 0, "Theora encoder");
|
ext/theora/theoradec.c: Adapt for post-alpha meaning of granulepos, when we have a newer version of libtheora.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(_theora_granule_frame), (_theora_granule_start_time),
(theora_dec_sink_convert), (theora_dec_decode_buffer):
Adapt for post-alpha meaning of granulepos, when we
have a newer version of libtheora.
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(theora_enc_get_ogg_packet_end_time), (theora_enc_sink_event),
(theora_enc_is_discontinuous), (theora_enc_chain):
Likewise.
* tests/check/Makefile.am:
Link libtheora into theoraenc test so we can check which version of
libtheora we're testing against.
* tests/check/pipelines/theoraenc.c: (check_libtheora),
(check_buffer_granulepos),
(check_buffer_granulepos_from_starttime), (GST_START_TEST),
(theoraenc_suite):
Adapt tests to check the values that are now defined for theora; make
the tests backwards-adapt the passed values if we're running against an
old libtheora.
Fixes #497964
2008-01-11 15:48:11 +00:00
|
|
|
|
|
|
|
use_old_granulepos = (theora_version_number () <= 0x00030200);
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-08-28 17:52:45 +00:00
|
|
|
gst_theora_enc_init (GstTheoraEnc * enc, GstTheoraEncClass * g_class)
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
{
|
|
|
|
enc->sinkpad =
|
2005-11-16 18:21:46 +00:00
|
|
|
gst_pad_new_from_static_template (&theora_enc_sink_factory, "sink");
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
gst_pad_set_chain_function (enc->sinkpad, theora_enc_chain);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_pad_set_event_function (enc->sinkpad, theora_enc_sink_event);
|
|
|
|
gst_pad_set_setcaps_function (enc->sinkpad, theora_enc_sink_setcaps);
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (enc), enc->sinkpad);
|
|
|
|
|
|
|
|
enc->srcpad =
|
2005-11-16 18:21:46 +00:00
|
|
|
gst_pad_new_from_static_template (&theora_enc_src_factory, "src");
|
2009-04-14 16:16:37 +00:00
|
|
|
gst_pad_set_event_function (enc->srcpad, theora_enc_src_event);
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (enc), enc->srcpad);
|
|
|
|
|
2008-11-25 15:14:30 +00:00
|
|
|
gst_segment_init (&enc->segment, GST_FORMAT_UNDEFINED);
|
|
|
|
|
ext/theora/: Added cropping option to theora decoder.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(gst_theora_dec_init), (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain), (theora_dec_set_property),
(theora_dec_get_property):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_chain),
(theora_enc_set_property), (theora_enc_get_property):
Added cropping option to theora decoder.
Added border option to theora encoder.
2004-07-30 10:18:42 +00:00
|
|
|
enc->center = THEORA_DEF_CENTER;
|
|
|
|
enc->border = THEORA_DEF_BORDER;
|
|
|
|
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
enc->video_bitrate = THEORA_DEF_BITRATE;
|
|
|
|
enc->video_quality = THEORA_DEF_QUALITY;
|
2004-06-10 14:59:17 +00:00
|
|
|
enc->quick = THEORA_DEF_QUICK;
|
|
|
|
enc->keyframe_auto = THEORA_DEF_KEYFRAME_AUTO;
|
|
|
|
enc->keyframe_freq = THEORA_DEF_KEYFRAME_FREQ;
|
|
|
|
enc->keyframe_force = THEORA_DEF_KEYFRAME_FREQ_FORCE;
|
|
|
|
enc->keyframe_threshold = THEORA_DEF_KEYFRAME_THRESHOLD;
|
|
|
|
enc->keyframe_mindistance = THEORA_DEF_KEYFRAME_MINDISTANCE;
|
|
|
|
enc->noise_sensitivity = THEORA_DEF_NOISE_SENSITIVITY;
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
enc->sharpness = THEORA_DEF_SHARPNESS;
|
2006-01-30 19:21:07 +00:00
|
|
|
|
|
|
|
enc->granule_shift = _ilog (enc->info.keyframe_frequency_force - 1);
|
|
|
|
GST_DEBUG_OBJECT (enc,
|
|
|
|
"keyframe_frequency_force is %d, granule shift is %d",
|
|
|
|
enc->info.keyframe_frequency_force, enc->granule_shift);
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
enc->expected_ts = GST_CLOCK_TIME_NONE;
|
2009-02-19 20:18:29 +00:00
|
|
|
|
|
|
|
enc->speed_level = THEORA_DEF_SPEEDLEVEL;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
}
|
|
|
|
|
2006-02-05 23:31:05 +00:00
|
|
|
static void
|
|
|
|
theora_enc_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstTheoraEnc *enc = GST_THEORA_ENC (object);
|
|
|
|
|
2006-02-06 12:38:48 +00:00
|
|
|
GST_DEBUG_OBJECT (enc, "Finalizing");
|
2006-02-05 23:31:05 +00:00
|
|
|
theora_clear (&enc->state);
|
|
|
|
theora_comment_clear (&enc->comment);
|
|
|
|
theora_info_clear (&enc->info);
|
2006-02-06 12:38:48 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2006-02-05 23:31:05 +00:00
|
|
|
}
|
|
|
|
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
static void
|
|
|
|
theora_enc_reset (GstTheoraEnc * enc)
|
|
|
|
{
|
|
|
|
theora_clear (&enc->state);
|
|
|
|
theora_encode_init (&enc->state, &enc->info);
|
2009-02-19 20:18:29 +00:00
|
|
|
#ifdef TH_ENCCTL_SET_SPLEVEL
|
|
|
|
theora_control (&enc->state, TH_ENCCTL_SET_SPLEVEL, &enc->speed_level,
|
|
|
|
sizeof (enc->speed_level));
|
|
|
|
#endif
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
theora_enc_clear (GstTheoraEnc * enc)
|
|
|
|
{
|
|
|
|
enc->packetno = 0;
|
|
|
|
enc->bytes_out = 0;
|
|
|
|
enc->granulepos_offset = 0;
|
|
|
|
enc->timestamp_offset = 0;
|
|
|
|
|
|
|
|
enc->next_ts = GST_CLOCK_TIME_NONE;
|
|
|
|
enc->next_discont = FALSE;
|
|
|
|
enc->expected_ts = GST_CLOCK_TIME_NONE;
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean
|
|
|
|
theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
{
|
|
|
|
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
|
|
|
GstTheoraEnc *enc = GST_THEORA_ENC (gst_pad_get_parent (pad));
|
2004-07-27 16:43:24 +00:00
|
|
|
const GValue *par;
|
Updates for API changes
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps):
* gst/videorate/gstvideorate.c: (gst_videorate_setcaps),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_create):
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_get_fps),
(gst_v4lmjpegsrc_src_convert), (gst_v4lmjpegsrc_src_query),
(gst_v4lmjpegsrc_get), (gst_v4lmjpegsrc_getcaps):
* sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_get_fps),
(gst_v4lsrc_get_fps_list), (gst_v4lsrc_buffer_new):
Updates for API changes
2005-11-23 13:25:54 +00:00
|
|
|
gint fps_n, fps_d;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
|
|
|
gst_structure_get_int (structure, "width", &enc->width);
|
|
|
|
gst_structure_get_int (structure, "height", &enc->height);
|
Updates for API changes
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps):
* gst/videorate/gstvideorate.c: (gst_videorate_setcaps),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_create):
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_get_fps),
(gst_v4lmjpegsrc_src_convert), (gst_v4lmjpegsrc_src_query),
(gst_v4lmjpegsrc_get), (gst_v4lmjpegsrc_getcaps):
* sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_get_fps),
(gst_v4lsrc_get_fps_list), (gst_v4lsrc_buffer_new):
Updates for API changes
2005-11-23 13:25:54 +00:00
|
|
|
gst_structure_get_fraction (structure, "framerate", &fps_n, &fps_d);
|
2004-07-27 16:43:24 +00:00
|
|
|
par = gst_structure_get_value (structure, "pixel-aspect-ratio");
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
2006-02-06 12:38:48 +00:00
|
|
|
theora_info_clear (&enc->info);
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
theora_info_init (&enc->info);
|
2004-07-30 08:14:36 +00:00
|
|
|
/* Theora has a divisible-by-sixteen restriction for the encoded video size but
|
|
|
|
* we can define a visible area using the frame_width/frame_height */
|
|
|
|
enc->info_width = enc->info.width = (enc->width + 15) & ~15;
|
|
|
|
enc->info_height = enc->info.height = (enc->height + 15) & ~15;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
enc->info.frame_width = enc->width;
|
|
|
|
enc->info.frame_height = enc->height;
|
|
|
|
|
2004-07-30 08:14:36 +00:00
|
|
|
/* center image if needed */
|
|
|
|
if (enc->center) {
|
|
|
|
/* make sure offset is even, for easier decoding */
|
Const-ify GEnumValue and GFlagsValue arrays. Use
Original commit message from CVS:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_valign_get_type),
(gst_text_overlay_halign_get_type),
(gst_text_overlay_wrap_mode_get_type):
* ext/theora/theoradec.c: (theora_handle_type_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(theora_enc_sink_setcaps), (theora_enc_chain):
* gst-libs/gst/cdda/gstcddabasesrc.c:
(gst_cdda_base_src_mode_get_type):
* gst/audiotestsrc/gstaudiotestsrc.c:
(gst_audiostestsrc_wave_get_type):
* gst/playback/gststreaminfo.c: (gst_stream_type_get_type):
* gst/tcp/gstfdset.c: (gst_fdset_mode_get_type):
* gst/tcp/gstmultifdsink.c: (gst_recover_policy_get_type),
(gst_sync_method_get_type), (gst_unit_type_get_type),
(gst_client_status_get_type):
* gst/videoscale/gstvideoscale.c:
(gst_video_scale_method_get_type):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_video_test_src_pattern_get_type):
* gst/videotestsrc/videotestsrc.c: (paint_setup_I420),
(paint_setup_YV12), (paint_setup_YUY2), (paint_setup_UYVY),
(paint_setup_YVYU), (paint_setup_IYU2), (paint_setup_Y41B),
(paint_setup_Y42B), (paint_setup_Y800), (paint_setup_YVU9),
(paint_setup_YUV9), (paint_setup_RGB888), (paint_setup_BGR888),
(paint_setup_RGB565), (paint_setup_xRGB1555):
Const-ify GEnumValue and GFlagsValue arrays. Use
GST_ROUND_UP_* macros instead of home-made ones.
2006-05-09 19:24:46 +00:00
|
|
|
enc->offset_x = GST_ROUND_UP_2 ((enc->info_width - enc->width) / 2);
|
|
|
|
enc->offset_y = GST_ROUND_UP_2 ((enc->info_height - enc->height) / 2);
|
2004-07-30 08:14:36 +00:00
|
|
|
} else {
|
|
|
|
enc->offset_x = 0;
|
|
|
|
enc->offset_y = 0;
|
|
|
|
}
|
|
|
|
enc->info.offset_x = enc->offset_x;
|
|
|
|
enc->info.offset_y = enc->offset_y;
|
|
|
|
|
2006-01-30 17:01:54 +00:00
|
|
|
enc->info.fps_numerator = enc->fps_n = fps_n;
|
|
|
|
enc->info.fps_denominator = enc->fps_d = fps_d;
|
2004-07-27 16:43:24 +00:00
|
|
|
if (par) {
|
|
|
|
enc->info.aspect_numerator = gst_value_get_fraction_numerator (par);
|
|
|
|
enc->info.aspect_denominator = gst_value_get_fraction_denominator (par);
|
|
|
|
} else {
|
|
|
|
/* setting them to 0 indicates that the decoder can chose a good aspect
|
|
|
|
* ratio, defaulting to 1/1 */
|
|
|
|
enc->info.aspect_numerator = 0;
|
|
|
|
enc->info.aspect_denominator = 0;
|
|
|
|
}
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
|
|
|
enc->info.colorspace = OC_CS_UNSPECIFIED;
|
|
|
|
enc->info.target_bitrate = enc->video_bitrate;
|
|
|
|
enc->info.quality = enc->video_quality;
|
|
|
|
|
|
|
|
enc->info.dropframes_p = 0;
|
2004-06-10 14:59:17 +00:00
|
|
|
enc->info.quick_p = (enc->quick ? 1 : 0);
|
|
|
|
enc->info.keyframe_auto_p = (enc->keyframe_auto ? 1 : 0);
|
|
|
|
enc->info.keyframe_frequency = enc->keyframe_freq;
|
|
|
|
enc->info.keyframe_frequency_force = enc->keyframe_force;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
enc->info.keyframe_data_target_bitrate = enc->video_bitrate * 1.5;
|
2004-06-10 14:59:17 +00:00
|
|
|
enc->info.keyframe_auto_threshold = enc->keyframe_threshold;
|
|
|
|
enc->info.keyframe_mindistance = enc->keyframe_mindistance;
|
|
|
|
enc->info.noise_sensitivity = enc->noise_sensitivity;
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
enc->info.sharpness = enc->sharpness;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
2006-01-30 19:21:07 +00:00
|
|
|
/* as done in theora */
|
|
|
|
enc->granule_shift = _ilog (enc->info.keyframe_frequency_force - 1);
|
|
|
|
GST_DEBUG_OBJECT (enc,
|
|
|
|
"keyframe_frequency_force is %d, granule shift is %d",
|
|
|
|
enc->info.keyframe_frequency_force, enc->granule_shift);
|
|
|
|
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
theora_enc_reset (enc);
|
2007-04-19 16:58:53 +00:00
|
|
|
enc->initialised = TRUE;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
2006-02-05 23:31:05 +00:00
|
|
|
gst_object_unref (enc);
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
return TRUE;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
}
|
|
|
|
|
2006-01-30 19:21:07 +00:00
|
|
|
static guint64
|
|
|
|
granulepos_add (guint64 granulepos, guint64 addend, gint shift)
|
|
|
|
{
|
ogg muxing of vorbis and theora now has pages ordered correctly again, even with delays.
Original commit message from CVS:
ogg muxing of vorbis and theora now has pages ordered correctly again,
even with delays.
* ext/ogg/README:
updated with some examples
* ext/theora/theoraenc.c: (granulepos_to_timestamp),
(granulepos_add), (theora_buffer_from_packet):
* ext/vorbis/vorbisenc.c: (granulepos_to_timestamp_offset),
(granulepos_to_timestamp), (gst_vorbisenc_buffer_from_packet),
(gst_vorbisenc_chain):
implement strategy from ext/ogg/README
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_push_buffer), (gst_ogg_mux_dequeue_page),
(gst_ogg_mux_pad_queue_page), (gst_ogg_mux_compare_pads),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_collected):
Fix muxer so that oggz-validate is happy with all streams;
except for no eos mark, and the BOS page ordering
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(check_buffer_granulepos):
* tests/check/pipelines/vorbisenc.c: (check_buffer_granulepos):
update tests to check for OFFSET being set as requested
fixed type of granulepos, it's not a ClockTime
2006-03-05 22:57:58 +00:00
|
|
|
guint64 iframe, pframe;
|
2006-01-30 19:21:07 +00:00
|
|
|
|
|
|
|
iframe = granulepos >> shift;
|
|
|
|
pframe = granulepos - (iframe << shift);
|
|
|
|
iframe += addend;
|
|
|
|
|
|
|
|
return (iframe << shift) + pframe;
|
|
|
|
}
|
|
|
|
|
2004-06-08 16:41:42 +00:00
|
|
|
/* prepare a buffer for transmission by passing data through libtheora */
|
2005-10-17 13:42:38 +00:00
|
|
|
static GstFlowReturn
|
2004-06-22 16:29:20 +00:00
|
|
|
theora_buffer_from_packet (GstTheoraEnc * enc, ogg_packet * packet,
|
2008-11-25 15:14:30 +00:00
|
|
|
GstClockTime timestamp, GstClockTime running_time,
|
|
|
|
GstClockTime duration, GstBuffer ** buffer)
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
{
|
|
|
|
GstBuffer *buf;
|
2007-04-15 14:35:53 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
Cleanups and buffer alloc.
Original commit message from CVS:
* ext/ogg/README:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_clear_chains):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page):
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet):
* gst/audioconvert/bufferframesconvert.c:
(buffer_frames_convert_chain):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_bufferalloc),
(gst_ffmpegcsp_chain):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_getcaps), (gst_videorate_setcaps),
(gst_videorate_event), (gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_activate),
(gst_videotestsrc_src_query), (gst_videotestsrc_loop):
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_alloc):
Cleanups and buffer alloc.
2005-06-02 09:46:40 +00:00
|
|
|
|
2007-04-15 14:35:53 +00:00
|
|
|
buf = gst_buffer_new_and_alloc (packet->bytes);
|
|
|
|
if (!buf) {
|
|
|
|
GST_WARNING_OBJECT (enc, "Could not allocate buffer");
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto done;
|
|
|
|
}
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
|
|
|
memcpy (GST_BUFFER_DATA (buf), packet->packet, packet->bytes);
|
2007-04-15 14:35:53 +00:00
|
|
|
gst_buffer_set_caps (buf, GST_PAD_CAPS (enc->srcpad));
|
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 19:21:07 +00:00
|
|
|
GST_BUFFER_OFFSET_END (buf) =
|
|
|
|
granulepos_add (packet->granulepos, enc->granulepos_offset,
|
|
|
|
enc->granule_shift);
|
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 (buf) = granulepos_to_timestamp (enc,
|
|
|
|
GST_BUFFER_OFFSET_END (buf));
|
|
|
|
|
2008-11-25 15:14:30 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (buf) = timestamp;
|
2004-06-22 16:29:20 +00:00
|
|
|
GST_BUFFER_DURATION (buf) = duration;
|
2004-05-06 14:32:14 +00:00
|
|
|
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
if (enc->next_discont) {
|
|
|
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
|
|
|
|
enc->next_discont = FALSE;
|
|
|
|
}
|
|
|
|
|
2004-07-07 15:57:48 +00:00
|
|
|
/* the second most significant bit of the first data byte is cleared
|
|
|
|
* for keyframes */
|
2004-08-16 10:19:39 +00:00
|
|
|
if ((packet->packet[0] & 0x40) == 0) {
|
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_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
|
2004-08-16 10:19:39 +00:00
|
|
|
} else {
|
Port from GstData to GstMiniObject.
Original commit message from CVS:
Port from GstData to GstMiniObject.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_set_header_on_caps),
(gst_ogg_mux_collected):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_comment_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_set_header_on_caps), (theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_comment_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_set_header_on_caps):
* ext/vorbis/vorbisparse.c: (vorbis_parse_set_header_on_caps):
* gst-libs/gst/audio/gstaudiofilter.c: (gst_audiofilter_chain):
* gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_chain):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_get_buffer):
* gst/playback/gstdecodebin.c: (gst_decode_bin_class_init):
* gst/playback/gstplaybasebin.c: (check_queue), (probe_triggered),
(mute_stream), (silence_stream):
* gst/playback/gstplaybin.c: (gst_play_bin_class_init):
* gst/volume/gstvolume.c: (volume_transform):
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximage_buffer_init), (gst_ximage_buffer_class_init),
(gst_ximage_buffer_get_type), (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_imagepool_clear),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_free),
(gst_ximagesink_buffer_alloc):
* sys/ximage/ximagesink.h:
2005-05-16 15:35:52 +00:00
|
|
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
|
2004-07-07 15:57:48 +00:00
|
|
|
}
|
2004-05-06 14:32:14 +00:00
|
|
|
enc->packetno++;
|
2004-06-08 16:41:42 +00:00
|
|
|
|
2007-04-15 14:35:53 +00:00
|
|
|
done:
|
2005-10-17 13:42:38 +00:00
|
|
|
*buffer = buf;
|
|
|
|
return ret;
|
2004-06-08 16:41:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* push out the buffer and do internal bookkeeping */
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
static GstFlowReturn
|
2004-06-08 16:41:42 +00:00
|
|
|
theora_push_buffer (GstTheoraEnc * enc, GstBuffer * buffer)
|
|
|
|
{
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
GstFlowReturn ret;
|
|
|
|
|
2004-06-08 16:41:42 +00:00
|
|
|
enc->bytes_out += GST_BUFFER_SIZE (buffer);
|
|
|
|
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
ret = gst_pad_push (enc->srcpad, buffer);
|
|
|
|
|
|
|
|
return ret;
|
2004-06-08 16:41:42 +00:00
|
|
|
}
|
|
|
|
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
static GstFlowReturn
|
2004-06-22 16:29:20 +00:00
|
|
|
theora_push_packet (GstTheoraEnc * enc, ogg_packet * packet,
|
2008-11-25 15:14:30 +00:00
|
|
|
GstClockTime timestamp, GstClockTime running_time, GstClockTime duration)
|
2004-06-08 16:41:42 +00:00
|
|
|
{
|
|
|
|
GstBuffer *buf;
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
GstFlowReturn ret;
|
2004-06-08 16:41:42 +00:00
|
|
|
|
2008-11-25 15:14:30 +00:00
|
|
|
ret =
|
|
|
|
theora_buffer_from_packet (enc, packet, timestamp, running_time, duration,
|
|
|
|
&buf);
|
2005-10-17 13:42:38 +00:00
|
|
|
if (ret == GST_FLOW_OK)
|
|
|
|
ret = theora_push_buffer (enc, buf);
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
|
|
|
|
return ret;
|
2004-06-08 16:41:42 +00:00
|
|
|
}
|
|
|
|
|
2005-04-20 09:42:56 +00:00
|
|
|
static GstCaps *
|
2004-06-08 16:41:42 +00:00
|
|
|
theora_set_header_on_caps (GstCaps * caps, GstBuffer * buf1,
|
|
|
|
GstBuffer * buf2, GstBuffer * buf3)
|
|
|
|
{
|
2005-04-20 09:42:56 +00:00
|
|
|
GstStructure *structure;
|
2005-11-21 12:36:22 +00:00
|
|
|
GValue array = { 0 };
|
2004-06-08 16:41:42 +00:00
|
|
|
GValue value = { 0 };
|
|
|
|
|
2005-04-20 09:42:56 +00:00
|
|
|
caps = gst_caps_make_writable (caps);
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
|
2006-03-03 15:22:02 +00:00
|
|
|
/* mark buffers */
|
|
|
|
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);
|
|
|
|
|
2006-02-06 12:38:48 +00:00
|
|
|
/* Copy buffers, because we can't use the originals -
|
|
|
|
* it creates a circular refcount with the caps<->buffers */
|
|
|
|
buf1 = gst_buffer_copy (buf1);
|
|
|
|
buf2 = gst_buffer_copy (buf2);
|
|
|
|
buf3 = gst_buffer_copy (buf3);
|
|
|
|
|
|
|
|
/* put copies of the buffers in a fixed list */
|
2005-11-21 12:36:22 +00:00
|
|
|
g_value_init (&array, GST_TYPE_ARRAY);
|
2006-02-06 12:38:48 +00:00
|
|
|
|
2004-06-08 16:41:42 +00:00
|
|
|
g_value_init (&value, GST_TYPE_BUFFER);
|
2005-06-22 09:57:59 +00:00
|
|
|
gst_value_set_buffer (&value, buf1);
|
2005-11-21 12:36:22 +00:00
|
|
|
gst_value_array_append_value (&array, &value);
|
2004-06-08 16:41:42 +00:00
|
|
|
g_value_unset (&value);
|
2006-02-06 12:38:48 +00:00
|
|
|
|
2004-06-08 16:41:42 +00:00
|
|
|
g_value_init (&value, GST_TYPE_BUFFER);
|
2005-06-22 09:57:59 +00:00
|
|
|
gst_value_set_buffer (&value, buf2);
|
2005-11-21 12:36:22 +00:00
|
|
|
gst_value_array_append_value (&array, &value);
|
2004-06-08 16:41:42 +00:00
|
|
|
g_value_unset (&value);
|
2006-02-06 12:38:48 +00:00
|
|
|
|
2004-06-08 16:41:42 +00:00
|
|
|
g_value_init (&value, GST_TYPE_BUFFER);
|
2005-06-22 09:57:59 +00:00
|
|
|
gst_value_set_buffer (&value, buf3);
|
2005-11-21 12:36:22 +00:00
|
|
|
gst_value_array_append_value (&array, &value);
|
2004-06-08 16:41:42 +00:00
|
|
|
g_value_unset (&value);
|
2006-02-06 12:38:48 +00:00
|
|
|
|
|
|
|
gst_structure_set_value (structure, "streamheader", &array);
|
2005-11-21 12:36:22 +00:00
|
|
|
g_value_unset (&array);
|
2005-04-20 09:42:56 +00:00
|
|
|
|
2006-02-06 12:38:48 +00:00
|
|
|
/* Unref our copies */
|
|
|
|
gst_buffer_unref (buf1);
|
|
|
|
gst_buffer_unref (buf2);
|
|
|
|
gst_buffer_unref (buf3);
|
|
|
|
|
2005-04-20 09:42:56 +00:00
|
|
|
return caps;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
}
|
|
|
|
|
ext/theora/theoradec.c: Adapt for post-alpha meaning of granulepos, when we have a newer version of libtheora.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(_theora_granule_frame), (_theora_granule_start_time),
(theora_dec_sink_convert), (theora_dec_decode_buffer):
Adapt for post-alpha meaning of granulepos, when we
have a newer version of libtheora.
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(theora_enc_get_ogg_packet_end_time), (theora_enc_sink_event),
(theora_enc_is_discontinuous), (theora_enc_chain):
Likewise.
* tests/check/Makefile.am:
Link libtheora into theoraenc test so we can check which version of
libtheora we're testing against.
* tests/check/pipelines/theoraenc.c: (check_libtheora),
(check_buffer_granulepos),
(check_buffer_granulepos_from_starttime), (GST_START_TEST),
(theoraenc_suite):
Adapt tests to check the values that are now defined for theora; make
the tests backwards-adapt the passed values if we're running against an
old libtheora.
Fixes #497964
2008-01-11 15:48:11 +00:00
|
|
|
static GstClockTime
|
|
|
|
theora_enc_get_ogg_packet_end_time (GstTheoraEnc * enc, ogg_packet * op)
|
|
|
|
{
|
|
|
|
ogg_int64_t end_granule;
|
|
|
|
|
|
|
|
/* FIXME: remove this hack once we depend on libtheora >= 1.0beta1 */
|
|
|
|
if (G_UNLIKELY (use_old_granulepos)) {
|
|
|
|
/* This is where we hack around theora's broken idea of what granulepos
|
|
|
|
* is -- normally we wouldn't need to add the 1, because granulepos
|
|
|
|
* should be the presentation time of the last sample in the packet, but
|
|
|
|
* theora starts with 0 instead of 1... (update: this only applies to old
|
|
|
|
* bitstream/theora versions, this is fixed with bitstream version 3.2.1) */
|
|
|
|
end_granule = granulepos_add (op->granulepos, 1, enc->granule_shift);
|
|
|
|
} else {
|
|
|
|
end_granule = op->granulepos;
|
|
|
|
}
|
|
|
|
return theora_granule_time (&enc->state, end_granule) * GST_SECOND;
|
|
|
|
}
|
|
|
|
|
2009-04-14 15:31:31 +00:00
|
|
|
static void
|
|
|
|
theora_enc_force_keyframe (GstTheoraEnc * enc)
|
|
|
|
{
|
|
|
|
GstClockTime next_ts;
|
|
|
|
|
|
|
|
/* make sure timestamps increment after resetting the decoder */
|
|
|
|
next_ts = enc->next_ts + enc->timestamp_offset;
|
|
|
|
|
|
|
|
theora_enc_reset (enc);
|
|
|
|
enc->granulepos_offset =
|
|
|
|
gst_util_uint64_scale (next_ts, enc->fps_n, GST_SECOND * enc->fps_d);
|
|
|
|
enc->timestamp_offset = next_ts;
|
|
|
|
enc->next_ts = 0;
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean
|
|
|
|
theora_enc_sink_event (GstPad * pad, GstEvent * event)
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
{
|
|
|
|
GstTheoraEnc *enc;
|
|
|
|
ogg_packet op;
|
2005-10-27 11:33:09 +00:00
|
|
|
gboolean res;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
enc = GST_THEORA_ENC (GST_PAD_PARENT (pad));
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2008-11-25 15:14:30 +00:00
|
|
|
case GST_EVENT_NEWSEGMENT:
|
|
|
|
{
|
|
|
|
gboolean update;
|
|
|
|
gdouble rate, applied_rate;
|
|
|
|
GstFormat format;
|
|
|
|
gint64 start, stop, time;
|
|
|
|
|
|
|
|
gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
|
|
|
|
&format, &start, &stop, &time);
|
|
|
|
|
|
|
|
gst_segment_set_newsegment_full (&enc->segment, update, rate,
|
|
|
|
applied_rate, format, start, stop, time);
|
|
|
|
|
|
|
|
res = gst_pad_push_event (enc->srcpad, event);
|
|
|
|
break;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
case GST_EVENT_EOS:
|
2007-04-19 16:58:53 +00:00
|
|
|
if (enc->initialised) {
|
2008-11-25 15:14:30 +00:00
|
|
|
/* push last packet with eos flag, should not be called */
|
2007-04-19 16:58:53 +00:00
|
|
|
while (theora_encode_packetout (&enc->state, 1, &op)) {
|
ext/theora/theoradec.c: Adapt for post-alpha meaning of granulepos, when we have a newer version of libtheora.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(_theora_granule_frame), (_theora_granule_start_time),
(theora_dec_sink_convert), (theora_dec_decode_buffer):
Adapt for post-alpha meaning of granulepos, when we
have a newer version of libtheora.
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(theora_enc_get_ogg_packet_end_time), (theora_enc_sink_event),
(theora_enc_is_discontinuous), (theora_enc_chain):
Likewise.
* tests/check/Makefile.am:
Link libtheora into theoraenc test so we can check which version of
libtheora we're testing against.
* tests/check/pipelines/theoraenc.c: (check_libtheora),
(check_buffer_granulepos),
(check_buffer_granulepos_from_starttime), (GST_START_TEST),
(theoraenc_suite):
Adapt tests to check the values that are now defined for theora; make
the tests backwards-adapt the passed values if we're running against an
old libtheora.
Fixes #497964
2008-01-11 15:48:11 +00:00
|
|
|
GstClockTime next_time =
|
|
|
|
theora_enc_get_ogg_packet_end_time (enc, &op);
|
2007-04-19 16:58:53 +00:00
|
|
|
|
2008-11-25 15:14:30 +00:00
|
|
|
theora_push_packet (enc, &op, GST_CLOCK_TIME_NONE, enc->next_ts,
|
|
|
|
next_time - enc->next_ts);
|
2007-04-19 16:58:53 +00:00
|
|
|
enc->next_ts = next_time;
|
|
|
|
}
|
2005-01-31 19:23:08 +00:00
|
|
|
}
|
2005-10-27 11:33:09 +00:00
|
|
|
res = gst_pad_push_event (enc->srcpad, event);
|
|
|
|
break;
|
2008-11-25 15:14:30 +00:00
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
gst_segment_init (&enc->segment, GST_FORMAT_UNDEFINED);
|
|
|
|
res = gst_pad_push_event (enc->srcpad, event);
|
|
|
|
break;
|
2007-06-05 15:59:00 +00:00
|
|
|
case GST_EVENT_CUSTOM_DOWNSTREAM:
|
|
|
|
{
|
|
|
|
const GstStructure *s;
|
|
|
|
|
|
|
|
s = gst_event_get_structure (event);
|
|
|
|
|
2009-04-14 15:31:31 +00:00
|
|
|
if (gst_structure_has_name (s, "GstForceKeyUnit"))
|
|
|
|
theora_enc_force_keyframe (enc);
|
2007-06-05 15:59:00 +00:00
|
|
|
res = gst_pad_push_event (enc->srcpad, event);
|
|
|
|
break;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
default:
|
2005-10-27 11:33:09 +00:00
|
|
|
res = gst_pad_push_event (enc->srcpad, event);
|
2007-06-05 15:59:00 +00:00
|
|
|
break;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
}
|
2005-10-27 11:33:09 +00:00
|
|
|
return res;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
2009-04-14 16:16:37 +00:00
|
|
|
static gboolean
|
|
|
|
theora_enc_src_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstTheoraEnc *enc;
|
|
|
|
gboolean res = TRUE;
|
|
|
|
|
|
|
|
enc = GST_THEORA_ENC (GST_PAD_PARENT (pad));
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_CUSTOM_UPSTREAM:
|
|
|
|
{
|
|
|
|
const GstStructure *s;
|
|
|
|
|
|
|
|
s = gst_event_get_structure (event);
|
|
|
|
|
|
|
|
if (gst_structure_has_name (s, "GstForceKeyUnit")) {
|
|
|
|
GST_OBJECT_LOCK (enc);
|
|
|
|
enc->force_keyframe = TRUE;
|
|
|
|
GST_OBJECT_UNLOCK (enc);
|
|
|
|
/* consume the event */
|
|
|
|
res = TRUE;
|
|
|
|
gst_event_unref (event);
|
|
|
|
} else {
|
|
|
|
res = gst_pad_push_event (enc->sinkpad, event);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = gst_pad_push_event (enc->sinkpad, event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
static gboolean
|
2008-11-25 15:14:30 +00:00
|
|
|
theora_enc_is_discontinuous (GstTheoraEnc * enc, GstClockTime timestamp,
|
|
|
|
GstClockTime duration)
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
{
|
|
|
|
GstClockTimeDiff max_diff;
|
2006-11-30 12:50:42 +00:00
|
|
|
gboolean ret = FALSE;
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
|
|
|
|
/* Allow 3/4 a frame off */
|
|
|
|
max_diff = (enc->info.fps_denominator * GST_SECOND * 3) /
|
|
|
|
(enc->info.fps_numerator * 4);
|
|
|
|
|
2008-11-25 15:14:30 +00:00
|
|
|
if (timestamp != GST_CLOCK_TIME_NONE
|
|
|
|
&& enc->expected_ts != GST_CLOCK_TIME_NONE) {
|
|
|
|
if ((GstClockTimeDiff) (timestamp - enc->expected_ts) > max_diff) {
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
GST_DEBUG_OBJECT (enc, "Incoming TS %" GST_TIME_FORMAT
|
|
|
|
" exceeds expected value %" GST_TIME_FORMAT
|
|
|
|
" by too much, marking discontinuity",
|
2008-11-25 15:14:30 +00:00
|
|
|
GST_TIME_ARGS (timestamp), GST_TIME_ARGS (enc->expected_ts));
|
2006-11-30 12:50:42 +00:00
|
|
|
ret = TRUE;
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-25 15:14:30 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (duration))
|
|
|
|
enc->expected_ts = timestamp + duration;
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
else
|
|
|
|
enc->expected_ts = GST_CLOCK_TIME_NONE;
|
|
|
|
|
2006-11-30 12:50:42 +00:00
|
|
|
return ret;
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
theora_enc_chain (GstPad * pad, GstBuffer * buffer)
|
|
|
|
{
|
|
|
|
GstTheoraEnc *enc;
|
|
|
|
ogg_packet op;
|
2008-11-25 15:14:30 +00:00
|
|
|
GstClockTime timestamp, duration, running_time;
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
GstFlowReturn ret;
|
2009-04-14 16:16:37 +00:00
|
|
|
gboolean force_keyframe;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
enc = GST_THEORA_ENC (GST_PAD_PARENT (pad));
|
|
|
|
|
2008-11-25 15:14:30 +00:00
|
|
|
/* we keep track of two timelines.
|
|
|
|
* - The timestamps from the incomming buffers, which we copy to the outgoing
|
|
|
|
* encoded buffers as-is. We need to do this as we simply forward the
|
|
|
|
* newsegment events.
|
|
|
|
* - The running_time of the buffers, which we use to construct the granulepos
|
|
|
|
* in the packets.
|
|
|
|
*/
|
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
duration = GST_BUFFER_DURATION (buffer);
|
2009-04-14 16:16:37 +00:00
|
|
|
|
2008-11-25 15:14:30 +00:00
|
|
|
running_time =
|
|
|
|
gst_segment_to_running_time (&enc->segment, GST_FORMAT_TIME, timestamp);
|
2009-05-06 12:19:34 +00:00
|
|
|
if ((gint64) running_time < 0) {
|
|
|
|
GST_DEBUG_OBJECT (enc, "Dropping buffer, timestamp: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2008-11-25 15:14:30 +00:00
|
|
|
|
2009-04-14 16:16:37 +00:00
|
|
|
/* see if we need to schedule a keyframe */
|
|
|
|
GST_OBJECT_LOCK (enc);
|
|
|
|
force_keyframe = enc->force_keyframe;
|
|
|
|
enc->force_keyframe = FALSE;
|
|
|
|
GST_OBJECT_UNLOCK (enc);
|
|
|
|
|
|
|
|
if (force_keyframe) {
|
|
|
|
GstClockTime stream_time;
|
|
|
|
GstStructure *s;
|
|
|
|
|
|
|
|
stream_time = gst_segment_to_stream_time (&enc->segment,
|
|
|
|
GST_FORMAT_TIME, timestamp);
|
|
|
|
|
|
|
|
s = gst_structure_new ("GstForceKeyUnit",
|
|
|
|
"timestamp", G_TYPE_UINT64, timestamp,
|
|
|
|
"stream-time", G_TYPE_UINT64, stream_time,
|
|
|
|
"running-time", G_TYPE_UINT64, running_time, NULL);
|
|
|
|
|
|
|
|
theora_enc_force_keyframe (enc);
|
|
|
|
|
|
|
|
gst_pad_push_event (enc->srcpad,
|
|
|
|
gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, s));
|
|
|
|
}
|
|
|
|
|
2008-11-25 15:14:30 +00:00
|
|
|
/* make sure we copy the discont flag to the next outgoing buffer when it's
|
|
|
|
* set on the incomming buffer */
|
|
|
|
if (GST_BUFFER_IS_DISCONT (buffer)) {
|
|
|
|
enc->next_discont = TRUE;
|
|
|
|
}
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
if (enc->packetno == 0) {
|
2007-04-15 14:35:53 +00:00
|
|
|
/* no packets written yet, setup headers */
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
GstCaps *caps;
|
2004-06-08 16:41:42 +00:00
|
|
|
GstBuffer *buf1, *buf2, *buf3;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
2006-01-30 17:01:54 +00:00
|
|
|
enc->granulepos_offset = 0;
|
|
|
|
enc->timestamp_offset = 0;
|
|
|
|
|
2007-04-15 14:35:53 +00:00
|
|
|
GST_DEBUG_OBJECT (enc, "output headers");
|
2004-08-16 10:19:39 +00:00
|
|
|
/* Theora 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 libtheora one at a time;
|
|
|
|
libtheora handles the additional Ogg bitstream constraints */
|
|
|
|
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
/* first packet will get its own page automatically */
|
2007-01-29 18:14:25 +00:00
|
|
|
if (theora_encode_header (&enc->state, &op) != 0)
|
|
|
|
goto encoder_disabled;
|
|
|
|
|
2008-11-25 15:14:30 +00:00
|
|
|
ret =
|
|
|
|
theora_buffer_from_packet (enc, &op, GST_CLOCK_TIME_NONE,
|
|
|
|
GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE, &buf1);
|
2005-10-17 13:42:38 +00:00
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
goto header_buffer_alloc;
|
|
|
|
}
|
2004-05-06 14:32:14 +00:00
|
|
|
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
/* create the remaining theora headers */
|
2006-02-06 12:38:48 +00:00
|
|
|
theora_comment_clear (&enc->comment);
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
theora_comment_init (&enc->comment);
|
2006-02-06 12:38:48 +00:00
|
|
|
|
2007-01-29 18:14:25 +00:00
|
|
|
if (theora_encode_comment (&enc->comment, &op) != 0)
|
|
|
|
goto encoder_disabled;
|
|
|
|
|
2008-11-25 15:14:30 +00:00
|
|
|
ret =
|
|
|
|
theora_buffer_from_packet (enc, &op, GST_CLOCK_TIME_NONE,
|
|
|
|
GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE, &buf2);
|
2006-02-06 12:38:48 +00:00
|
|
|
/* Theora expects us to put this packet buffer into an ogg page,
|
|
|
|
* in which case it becomes the ogg library's responsibility to
|
|
|
|
* free it. Since we're copying and outputting a gst_buffer,
|
|
|
|
* we need to free it ourselves. */
|
|
|
|
if (op.packet)
|
|
|
|
free (op.packet);
|
|
|
|
|
2005-10-17 13:42:38 +00:00
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
gst_buffer_unref (buf1);
|
|
|
|
goto header_buffer_alloc;
|
|
|
|
}
|
|
|
|
|
2007-01-29 18:14:25 +00:00
|
|
|
if (theora_encode_tables (&enc->state, &op) != 0)
|
|
|
|
goto encoder_disabled;
|
|
|
|
|
2008-11-25 15:14:30 +00:00
|
|
|
ret =
|
|
|
|
theora_buffer_from_packet (enc, &op, GST_CLOCK_TIME_NONE,
|
|
|
|
GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE, &buf3);
|
2005-10-17 13:42:38 +00:00
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
gst_buffer_unref (buf1);
|
|
|
|
gst_buffer_unref (buf2);
|
|
|
|
goto header_buffer_alloc;
|
|
|
|
}
|
2004-06-08 16:41:42 +00:00
|
|
|
|
|
|
|
/* mark buffers and put on caps */
|
|
|
|
caps = gst_pad_get_caps (enc->srcpad);
|
2005-04-20 09:42:56 +00:00
|
|
|
caps = theora_set_header_on_caps (caps, buf1, buf2, buf3);
|
2004-06-08 16:41:42 +00:00
|
|
|
GST_DEBUG ("here are the caps: %" GST_PTR_FORMAT, caps);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_pad_set_caps (enc->srcpad, caps);
|
2004-06-08 16:41:42 +00:00
|
|
|
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
gst_buffer_set_caps (buf1, caps);
|
|
|
|
gst_buffer_set_caps (buf2, caps);
|
|
|
|
gst_buffer_set_caps (buf3, caps);
|
|
|
|
|
2006-02-06 12:38:48 +00:00
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
2004-06-08 16:41:42 +00:00
|
|
|
/* push out the header buffers */
|
2005-10-17 13:42:38 +00:00
|
|
|
if ((ret = theora_push_buffer (enc, buf1)) != GST_FLOW_OK) {
|
|
|
|
gst_buffer_unref (buf2);
|
|
|
|
gst_buffer_unref (buf3);
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
goto header_push;
|
2005-10-17 13:42:38 +00:00
|
|
|
}
|
|
|
|
if ((ret = theora_push_buffer (enc, buf2)) != GST_FLOW_OK) {
|
|
|
|
gst_buffer_unref (buf3);
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
goto header_push;
|
2005-10-17 13:42:38 +00:00
|
|
|
}
|
|
|
|
if ((ret = theora_push_buffer (enc, buf3)) != GST_FLOW_OK) {
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
goto header_push;
|
2005-10-17 13:42:38 +00:00
|
|
|
}
|
2006-01-30 17:01:54 +00:00
|
|
|
|
|
|
|
enc->granulepos_offset =
|
2008-11-25 15:14:30 +00:00
|
|
|
gst_util_uint64_scale (running_time, enc->fps_n,
|
|
|
|
GST_SECOND * enc->fps_d);
|
|
|
|
enc->timestamp_offset = running_time;
|
2006-01-30 17:01:54 +00:00
|
|
|
enc->next_ts = 0;
|
2004-05-06 14:32:14 +00:00
|
|
|
}
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
2004-05-10 13:32:11 +00:00
|
|
|
{
|
|
|
|
yuv_buffer yuv;
|
2004-07-30 08:14:36 +00:00
|
|
|
gint res;
|
2004-05-10 13:32:11 +00:00
|
|
|
gint y_size;
|
2004-07-30 08:14:36 +00:00
|
|
|
guint8 *pixels;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
2004-07-30 08:14:36 +00:00
|
|
|
yuv.y_width = enc->info_width;
|
|
|
|
yuv.y_height = enc->info_height;
|
|
|
|
yuv.y_stride = enc->info_width;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
2004-07-30 08:14:36 +00:00
|
|
|
yuv.uv_width = enc->info_width / 2;
|
|
|
|
yuv.uv_height = enc->info_height / 2;
|
2004-05-10 13:32:11 +00:00
|
|
|
yuv.uv_stride = yuv.uv_width;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
2004-07-30 08:14:36 +00:00
|
|
|
y_size = enc->info_width * enc->info_height;
|
|
|
|
|
|
|
|
if (enc->width == enc->info_width && enc->height == enc->info_height) {
|
2007-04-15 14:35:53 +00:00
|
|
|
GST_LOG_OBJECT (enc, "no cropping/conversion needed");
|
2004-07-30 08:14:36 +00:00
|
|
|
/* easy case, no cropping/conversion needed */
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
pixels = GST_BUFFER_DATA (buffer);
|
2004-07-30 08:14:36 +00:00
|
|
|
|
2005-06-08 22:18:05 +00:00
|
|
|
yuv.y = pixels;
|
2004-07-30 08:14:36 +00:00
|
|
|
yuv.u = yuv.y + y_size;
|
|
|
|
yuv.v = yuv.u + y_size / 4;
|
|
|
|
} else {
|
|
|
|
GstBuffer *newbuf;
|
|
|
|
gint i;
|
2005-06-08 22:18:05 +00:00
|
|
|
guchar *dest_y, *src_y;
|
|
|
|
guchar *dest_u, *src_u;
|
|
|
|
guchar *dest_v, *src_v;
|
2004-07-30 08:14:36 +00:00
|
|
|
gint src_y_stride, src_uv_stride;
|
|
|
|
gint dst_y_stride, dst_uv_stride;
|
|
|
|
gint width, height;
|
|
|
|
gint cwidth, cheight;
|
ext/theora/: Added cropping option to theora decoder.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(gst_theora_dec_init), (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain), (theora_dec_set_property),
(theora_dec_get_property):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_chain),
(theora_enc_set_property), (theora_enc_get_property):
Added cropping option to theora decoder.
Added border option to theora encoder.
2004-07-30 10:18:42 +00:00
|
|
|
gint offset_x, right_x, right_border;
|
2004-07-30 08:14:36 +00:00
|
|
|
|
2007-04-15 14:35:53 +00:00
|
|
|
GST_LOG_OBJECT (enc, "cropping/conversion needed for strides");
|
2004-07-30 08:14:36 +00:00
|
|
|
/* source width/height */
|
|
|
|
width = enc->width;
|
|
|
|
height = enc->height;
|
|
|
|
/* soucre chroma width/height */
|
|
|
|
cwidth = width / 2;
|
|
|
|
cheight = height / 2;
|
|
|
|
|
|
|
|
/* source strides as defined in videotestsrc */
|
Const-ify GEnumValue and GFlagsValue arrays. Use
Original commit message from CVS:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_valign_get_type),
(gst_text_overlay_halign_get_type),
(gst_text_overlay_wrap_mode_get_type):
* ext/theora/theoradec.c: (theora_handle_type_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(theora_enc_sink_setcaps), (theora_enc_chain):
* gst-libs/gst/cdda/gstcddabasesrc.c:
(gst_cdda_base_src_mode_get_type):
* gst/audiotestsrc/gstaudiotestsrc.c:
(gst_audiostestsrc_wave_get_type):
* gst/playback/gststreaminfo.c: (gst_stream_type_get_type):
* gst/tcp/gstfdset.c: (gst_fdset_mode_get_type):
* gst/tcp/gstmultifdsink.c: (gst_recover_policy_get_type),
(gst_sync_method_get_type), (gst_unit_type_get_type),
(gst_client_status_get_type):
* gst/videoscale/gstvideoscale.c:
(gst_video_scale_method_get_type):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_video_test_src_pattern_get_type):
* gst/videotestsrc/videotestsrc.c: (paint_setup_I420),
(paint_setup_YV12), (paint_setup_YUY2), (paint_setup_UYVY),
(paint_setup_YVYU), (paint_setup_IYU2), (paint_setup_Y41B),
(paint_setup_Y42B), (paint_setup_Y800), (paint_setup_YVU9),
(paint_setup_YUV9), (paint_setup_RGB888), (paint_setup_BGR888),
(paint_setup_RGB565), (paint_setup_xRGB1555):
Const-ify GEnumValue and GFlagsValue arrays. Use
GST_ROUND_UP_* macros instead of home-made ones.
2006-05-09 19:24:46 +00:00
|
|
|
src_y_stride = GST_ROUND_UP_4 (width);
|
|
|
|
src_uv_stride = GST_ROUND_UP_8 (width) / 2;
|
2004-07-30 08:14:36 +00:00
|
|
|
|
|
|
|
/* destination strides from the real picture width */
|
|
|
|
dst_y_stride = enc->info_width;
|
|
|
|
dst_uv_stride = enc->info_width / 2;
|
|
|
|
|
2007-04-15 14:35:53 +00:00
|
|
|
newbuf = gst_buffer_new_and_alloc (y_size * 3 / 2);
|
|
|
|
if (!newbuf) {
|
|
|
|
ret = GST_FLOW_ERROR;
|
Cleanups and buffer alloc.
Original commit message from CVS:
* ext/ogg/README:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_clear_chains):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page):
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet):
* gst/audioconvert/bufferframesconvert.c:
(buffer_frames_convert_chain):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_bufferalloc),
(gst_ffmpegcsp_chain):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_getcaps), (gst_videorate_setcaps),
(gst_videorate_event), (gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_activate),
(gst_videotestsrc_src_query), (gst_videotestsrc_loop):
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_alloc):
Cleanups and buffer alloc.
2005-06-02 09:46:40 +00:00
|
|
|
goto no_buffer;
|
2007-04-15 14:35:53 +00:00
|
|
|
}
|
|
|
|
GST_BUFFER_OFFSET (newbuf) = GST_BUFFER_OFFSET_NONE;
|
|
|
|
gst_buffer_set_caps (newbuf, GST_PAD_CAPS (enc->srcpad));
|
2004-07-30 08:14:36 +00:00
|
|
|
|
2005-06-08 22:18:05 +00:00
|
|
|
dest_y = yuv.y = GST_BUFFER_DATA (newbuf);
|
ext/theora/: Added cropping option to theora decoder.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(gst_theora_dec_init), (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain), (theora_dec_set_property),
(theora_dec_get_property):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_chain),
(theora_enc_set_property), (theora_enc_get_property):
Added cropping option to theora decoder.
Added border option to theora encoder.
2004-07-30 10:18:42 +00:00
|
|
|
dest_u = yuv.u = yuv.y + y_size;
|
|
|
|
dest_v = yuv.v = yuv.u + y_size / 4;
|
2004-07-30 08:14:36 +00:00
|
|
|
|
2005-06-08 22:18:05 +00:00
|
|
|
src_y = GST_BUFFER_DATA (buffer);
|
Const-ify GEnumValue and GFlagsValue arrays. Use
Original commit message from CVS:
* ext/pango/gsttextoverlay.c: (gst_text_overlay_valign_get_type),
(gst_text_overlay_halign_get_type),
(gst_text_overlay_wrap_mode_get_type):
* ext/theora/theoradec.c: (theora_handle_type_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(theora_enc_sink_setcaps), (theora_enc_chain):
* gst-libs/gst/cdda/gstcddabasesrc.c:
(gst_cdda_base_src_mode_get_type):
* gst/audiotestsrc/gstaudiotestsrc.c:
(gst_audiostestsrc_wave_get_type):
* gst/playback/gststreaminfo.c: (gst_stream_type_get_type):
* gst/tcp/gstfdset.c: (gst_fdset_mode_get_type):
* gst/tcp/gstmultifdsink.c: (gst_recover_policy_get_type),
(gst_sync_method_get_type), (gst_unit_type_get_type),
(gst_client_status_get_type):
* gst/videoscale/gstvideoscale.c:
(gst_video_scale_method_get_type):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_video_test_src_pattern_get_type):
* gst/videotestsrc/videotestsrc.c: (paint_setup_I420),
(paint_setup_YV12), (paint_setup_YUY2), (paint_setup_UYVY),
(paint_setup_YVYU), (paint_setup_IYU2), (paint_setup_Y41B),
(paint_setup_Y42B), (paint_setup_Y800), (paint_setup_YVU9),
(paint_setup_YUV9), (paint_setup_RGB888), (paint_setup_BGR888),
(paint_setup_RGB565), (paint_setup_xRGB1555):
Const-ify GEnumValue and GFlagsValue arrays. Use
GST_ROUND_UP_* macros instead of home-made ones.
2006-05-09 19:24:46 +00:00
|
|
|
src_u = src_y + src_y_stride * GST_ROUND_UP_2 (height);
|
|
|
|
src_v = src_u + src_uv_stride * GST_ROUND_UP_2 (height) / 2;
|
2004-07-30 08:14:36 +00:00
|
|
|
|
ext/theora/: Added cropping option to theora decoder.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(gst_theora_dec_init), (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain), (theora_dec_set_property),
(theora_dec_get_property):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_chain),
(theora_enc_set_property), (theora_enc_get_property):
Added cropping option to theora decoder.
Added border option to theora encoder.
2004-07-30 10:18:42 +00:00
|
|
|
if (enc->border != BORDER_NONE) {
|
|
|
|
/* fill top border */
|
|
|
|
for (i = 0; i < enc->offset_y; i++) {
|
|
|
|
memset (dest_y, 0, dst_y_stride);
|
|
|
|
dest_y += dst_y_stride;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
dest_y += dst_y_stride * enc->offset_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
offset_x = enc->offset_x;
|
|
|
|
right_x = width + enc->offset_x;
|
|
|
|
right_border = dst_y_stride - right_x;
|
|
|
|
|
2004-07-30 08:14:36 +00:00
|
|
|
/* copy Y plane */
|
|
|
|
for (i = 0; i < height; i++) {
|
ext/theora/: Added cropping option to theora decoder.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(gst_theora_dec_init), (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain), (theora_dec_set_property),
(theora_dec_get_property):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_chain),
(theora_enc_set_property), (theora_enc_get_property):
Added cropping option to theora decoder.
Added border option to theora encoder.
2004-07-30 10:18:42 +00:00
|
|
|
memcpy (dest_y + offset_x, src_y, width);
|
|
|
|
if (enc->border != BORDER_NONE) {
|
|
|
|
memset (dest_y, 0, offset_x);
|
|
|
|
memset (dest_y + right_x, 0, right_border);
|
|
|
|
}
|
2004-07-30 08:14:36 +00:00
|
|
|
|
|
|
|
dest_y += dst_y_stride;
|
|
|
|
src_y += src_y_stride;
|
|
|
|
}
|
|
|
|
|
ext/theora/: Added cropping option to theora decoder.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(gst_theora_dec_init), (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain), (theora_dec_set_property),
(theora_dec_get_property):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_chain),
(theora_enc_set_property), (theora_enc_get_property):
Added cropping option to theora decoder.
Added border option to theora encoder.
2004-07-30 10:18:42 +00:00
|
|
|
if (enc->border != BORDER_NONE) {
|
|
|
|
/* fill bottom border */
|
|
|
|
for (i = height + enc->offset_y; i < enc->info.height; i++) {
|
|
|
|
memset (dest_y, 0, dst_y_stride);
|
|
|
|
dest_y += dst_y_stride;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fill top border chroma */
|
|
|
|
for (i = 0; i < enc->offset_y / 2; i++) {
|
|
|
|
memset (dest_u, 128, dst_uv_stride);
|
|
|
|
memset (dest_v, 128, dst_uv_stride);
|
|
|
|
dest_u += dst_uv_stride;
|
|
|
|
dest_v += dst_uv_stride;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
dest_u += dst_uv_stride * enc->offset_y / 2;
|
|
|
|
dest_v += dst_uv_stride * enc->offset_y / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
offset_x = enc->offset_x / 2;
|
|
|
|
right_x = cwidth + offset_x;
|
|
|
|
right_border = dst_uv_stride - right_x;
|
|
|
|
|
2004-07-30 08:14:36 +00:00
|
|
|
/* copy UV planes */
|
|
|
|
for (i = 0; i < cheight; i++) {
|
ext/theora/: Added cropping option to theora decoder.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(gst_theora_dec_init), (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain), (theora_dec_set_property),
(theora_dec_get_property):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_chain),
(theora_enc_set_property), (theora_enc_get_property):
Added cropping option to theora decoder.
Added border option to theora encoder.
2004-07-30 10:18:42 +00:00
|
|
|
memcpy (dest_v + offset_x, src_v, cwidth);
|
|
|
|
memcpy (dest_u + offset_x, src_u, cwidth);
|
|
|
|
|
|
|
|
if (enc->border != BORDER_NONE) {
|
|
|
|
memset (dest_u, 128, offset_x);
|
|
|
|
memset (dest_u + right_x, 128, right_border);
|
|
|
|
memset (dest_v, 128, offset_x);
|
|
|
|
memset (dest_v + right_x, 128, right_border);
|
|
|
|
}
|
2004-07-30 08:14:36 +00:00
|
|
|
|
|
|
|
dest_u += dst_uv_stride;
|
|
|
|
dest_v += dst_uv_stride;
|
|
|
|
src_u += src_uv_stride;
|
|
|
|
src_v += src_uv_stride;
|
|
|
|
}
|
2004-05-06 14:32:14 +00:00
|
|
|
|
ext/theora/: Added cropping option to theora decoder.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(gst_theora_dec_init), (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain), (theora_dec_set_property),
(theora_dec_get_property):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_chain),
(theora_enc_set_property), (theora_enc_get_property):
Added cropping option to theora decoder.
Added border option to theora encoder.
2004-07-30 10:18:42 +00:00
|
|
|
if (enc->border != BORDER_NONE) {
|
|
|
|
/* fill bottom border */
|
|
|
|
for (i = cheight + enc->offset_y / 2; i < enc->info_height / 2; i++) {
|
|
|
|
memset (dest_u, 128, dst_uv_stride);
|
|
|
|
memset (dest_v, 128, dst_uv_stride);
|
|
|
|
dest_u += dst_uv_stride;
|
|
|
|
dest_v += dst_uv_stride;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
buffer = newbuf;
|
2004-07-30 08:14:36 +00:00
|
|
|
}
|
2004-05-06 14:32:14 +00:00
|
|
|
|
2008-11-25 15:14:30 +00:00
|
|
|
if (theora_enc_is_discontinuous (enc, running_time, duration)) {
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
theora_enc_reset (enc);
|
|
|
|
enc->granulepos_offset =
|
2008-11-25 15:14:30 +00:00
|
|
|
gst_util_uint64_scale (running_time, enc->fps_n,
|
|
|
|
GST_SECOND * enc->fps_d);
|
|
|
|
enc->timestamp_offset = running_time;
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
enc->next_ts = 0;
|
|
|
|
enc->next_discont = TRUE;
|
|
|
|
}
|
|
|
|
|
2004-07-30 08:14:36 +00:00
|
|
|
res = theora_encode_YUVin (&enc->state, &yuv);
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
|
|
|
|
ret = GST_FLOW_OK;
|
2004-06-22 16:29:20 +00:00
|
|
|
while (theora_encode_packetout (&enc->state, 0, &op)) {
|
2008-11-25 15:14:30 +00:00
|
|
|
GstClockTime next_time;
|
|
|
|
|
|
|
|
next_time = theora_enc_get_ogg_packet_end_time (enc, &op);
|
ext/theora/theoradec.c: Adapt for post-alpha meaning of granulepos, when we have a newer version of libtheora.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(_theora_granule_frame), (_theora_granule_start_time),
(theora_dec_sink_convert), (theora_dec_decode_buffer):
Adapt for post-alpha meaning of granulepos, when we
have a newer version of libtheora.
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(theora_enc_get_ogg_packet_end_time), (theora_enc_sink_event),
(theora_enc_is_discontinuous), (theora_enc_chain):
Likewise.
* tests/check/Makefile.am:
Link libtheora into theoraenc test so we can check which version of
libtheora we're testing against.
* tests/check/pipelines/theoraenc.c: (check_libtheora),
(check_buffer_granulepos),
(check_buffer_granulepos_from_starttime), (GST_START_TEST),
(theoraenc_suite):
Adapt tests to check the values that are now defined for theora; make
the tests backwards-adapt the passed values if we're running against an
old libtheora.
Fixes #497964
2008-01-11 15:48:11 +00:00
|
|
|
|
2006-01-30 17:01:54 +00:00
|
|
|
ret =
|
2008-11-25 15:14:30 +00:00
|
|
|
theora_push_packet (enc, &op, timestamp, enc->next_ts,
|
|
|
|
next_time - enc->next_ts);
|
|
|
|
|
2006-01-30 17:01:54 +00:00
|
|
|
enc->next_ts = next_time;
|
|
|
|
if (ret != GST_FLOW_OK)
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
goto data_push;
|
2004-06-22 16:29:20 +00:00
|
|
|
}
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
gst_buffer_unref (buffer);
|
2004-05-10 13:32:11 +00:00
|
|
|
}
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
|
|
|
|
return ret;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
/* ERRORS */
|
2005-10-17 13:42:38 +00:00
|
|
|
header_buffer_alloc:
|
|
|
|
{
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return ret;
|
|
|
|
}
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
header_push:
|
|
|
|
{
|
|
|
|
gst_buffer_unref (buffer);
|
Cleanups and buffer alloc.
Original commit message from CVS:
* ext/ogg/README:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_clear_chains):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page):
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet):
* gst/audioconvert/bufferframesconvert.c:
(buffer_frames_convert_chain):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_bufferalloc),
(gst_ffmpegcsp_chain):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_getcaps), (gst_videorate_setcaps),
(gst_videorate_event), (gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_activate),
(gst_videotestsrc_src_query), (gst_videotestsrc_loop):
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_alloc):
Cleanups and buffer alloc.
2005-06-02 09:46:40 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
no_buffer:
|
|
|
|
{
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
data_push:
|
|
|
|
{
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return ret;
|
|
|
|
}
|
2007-01-29 18:14:25 +00:00
|
|
|
encoder_disabled:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (enc, STREAM, ENCODE, (NULL),
|
|
|
|
("libtheora has been compiled with the encoder disabled"));
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
theora_enc_change_state (GstElement * element, GstStateChange transition)
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
{
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
GstTheoraEnc *enc;
|
2005-09-02 15:43:18 +00:00
|
|
|
GstStateChangeReturn ret;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
enc = GST_THEORA_ENC (element);
|
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2006-02-06 12:38:48 +00:00
|
|
|
GST_DEBUG_OBJECT (enc, "READY->PAUSED Initing theora state");
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
theora_info_init (&enc->info);
|
|
|
|
theora_comment_init (&enc->comment);
|
|
|
|
enc->packetno = 0;
|
2009-04-14 16:16:37 +00:00
|
|
|
enc->force_keyframe = FALSE;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
break;
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
ret = parent_class->change_state (element, transition);
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2006-02-06 12:38:48 +00:00
|
|
|
GST_DEBUG_OBJECT (enc, "PAUSED->READY Clearing theora state");
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
theora_clear (&enc->state);
|
|
|
|
theora_comment_clear (&enc->comment);
|
|
|
|
theora_info_clear (&enc->info);
|
ext/theora/: Mark discontinuities of > 3/4 of a frame, reinit encoder.
Original commit message from CVS:
* ext/theora/gsttheoraenc.h:
* ext/theora/theoraenc.c: (gst_theora_enc_init),
(theora_enc_reset), (theora_enc_clear), (theora_enc_sink_setcaps),
(theora_buffer_from_packet), (theora_enc_is_discontinuous),
(theora_enc_chain), (theora_enc_change_state):
Mark discontinuities of > 3/4 of a frame, reinit encoder.
* tests/check/pipelines/theoraenc.c: (check_buffer_granulepos),
(GST_START_TEST), (theoraenc_suite):
Enable discontinuity test, fix it.
2006-11-22 14:34:03 +00:00
|
|
|
|
|
|
|
theora_enc_clear (enc);
|
2007-04-19 16:58:53 +00:00
|
|
|
enc->initialised = FALSE;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
return ret;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
theora_enc_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstTheoraEnc *enc = GST_THEORA_ENC (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2004-07-30 08:14:36 +00:00
|
|
|
case ARG_CENTER:
|
|
|
|
enc->center = g_value_get_boolean (value);
|
|
|
|
break;
|
ext/theora/: Added cropping option to theora decoder.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(gst_theora_dec_init), (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain), (theora_dec_set_property),
(theora_dec_get_property):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_chain),
(theora_enc_set_property), (theora_enc_get_property):
Added cropping option to theora decoder.
Added border option to theora encoder.
2004-07-30 10:18:42 +00:00
|
|
|
case ARG_BORDER:
|
|
|
|
enc->border = g_value_get_enum (value);
|
|
|
|
break;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
case ARG_BITRATE:
|
|
|
|
enc->video_bitrate = g_value_get_int (value) * 1000;
|
|
|
|
enc->video_quality = 0;
|
|
|
|
break;
|
|
|
|
case ARG_QUALITY:
|
|
|
|
enc->video_quality = g_value_get_int (value);
|
|
|
|
enc->video_bitrate = 0;
|
|
|
|
break;
|
2004-06-10 14:59:17 +00:00
|
|
|
case ARG_QUICK:
|
|
|
|
enc->quick = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case ARG_KEYFRAME_AUTO:
|
|
|
|
enc->keyframe_auto = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case ARG_KEYFRAME_FREQ:
|
|
|
|
enc->keyframe_freq = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case ARG_KEYFRAME_FREQ_FORCE:
|
|
|
|
enc->keyframe_force = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case ARG_KEYFRAME_THRESHOLD:
|
|
|
|
enc->keyframe_threshold = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case ARG_KEYFRAME_MINDISTANCE:
|
|
|
|
enc->keyframe_mindistance = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case ARG_NOISE_SENSITIVITY:
|
|
|
|
enc->noise_sensitivity = g_value_get_int (value);
|
|
|
|
break;
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
case ARG_SHARPNESS:
|
|
|
|
enc->sharpness = g_value_get_int (value);
|
|
|
|
break;
|
2009-02-19 20:18:29 +00:00
|
|
|
case ARG_SPEEDLEVEL:
|
|
|
|
#ifdef TH_ENCCTL_SET_SPLEVEL
|
|
|
|
enc->speed_level = g_value_get_int (value);
|
|
|
|
#endif
|
|
|
|
break;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
theora_enc_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstTheoraEnc *enc = GST_THEORA_ENC (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2004-07-30 08:14:36 +00:00
|
|
|
case ARG_CENTER:
|
|
|
|
g_value_set_boolean (value, enc->center);
|
|
|
|
break;
|
ext/theora/: Added cropping option to theora decoder.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_class_init),
(gst_theora_dec_init), (theora_get_formats),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event), (theora_dec_event),
(theora_dec_chain), (theora_dec_set_property),
(theora_dec_get_property):
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_chain),
(theora_enc_set_property), (theora_enc_get_property):
Added cropping option to theora decoder.
Added border option to theora encoder.
2004-07-30 10:18:42 +00:00
|
|
|
case ARG_BORDER:
|
|
|
|
g_value_set_enum (value, enc->border);
|
|
|
|
break;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
case ARG_BITRATE:
|
2004-05-15 12:09:11 +00:00
|
|
|
g_value_set_int (value, enc->video_bitrate / 1000);
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
break;
|
|
|
|
case ARG_QUALITY:
|
|
|
|
g_value_set_int (value, enc->video_quality);
|
|
|
|
break;
|
2004-06-10 14:59:17 +00:00
|
|
|
case ARG_QUICK:
|
|
|
|
g_value_set_boolean (value, enc->quick);
|
|
|
|
break;
|
|
|
|
case ARG_KEYFRAME_AUTO:
|
|
|
|
g_value_set_boolean (value, enc->keyframe_auto);
|
|
|
|
break;
|
|
|
|
case ARG_KEYFRAME_FREQ:
|
|
|
|
g_value_set_int (value, enc->keyframe_freq);
|
|
|
|
break;
|
|
|
|
case ARG_KEYFRAME_FREQ_FORCE:
|
|
|
|
g_value_set_int (value, enc->keyframe_force);
|
|
|
|
break;
|
|
|
|
case ARG_KEYFRAME_THRESHOLD:
|
|
|
|
g_value_set_int (value, enc->keyframe_threshold);
|
|
|
|
break;
|
|
|
|
case ARG_KEYFRAME_MINDISTANCE:
|
|
|
|
g_value_set_int (value, enc->keyframe_mindistance);
|
|
|
|
break;
|
|
|
|
case ARG_NOISE_SENSITIVITY:
|
|
|
|
g_value_set_int (value, enc->noise_sensitivity);
|
|
|
|
break;
|
ext/theora/: Added stream lock to decoder so that we can serialize the discont event.
Original commit message from CVS:
* ext/theora/theoradec.c: (_inc_granulepos),
(theora_dec_src_event), (theora_dec_sink_event),
(theora_handle_comment_packet), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_handle_data_packet),
(theora_dec_chain):
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
(gst_theora_enc_init), (theora_enc_sink_setcaps),
(theora_push_buffer), (theora_push_packet),
(theora_enc_sink_event), (theora_enc_chain),
(theora_enc_change_state), (theora_enc_set_property),
(theora_enc_get_property):
Added stream lock to decoder so that we can serialize
the discont event.
More theoraenc porting, recover from errors, do clean
shutdown.
2005-05-05 09:44:01 +00:00
|
|
|
case ARG_SHARPNESS:
|
|
|
|
g_value_set_int (value, enc->sharpness);
|
|
|
|
break;
|
2009-02-19 20:18:29 +00:00
|
|
|
case ARG_SPEEDLEVEL:
|
|
|
|
g_value_set_int (value, enc->speed_level);
|
|
|
|
break;
|
ext/theora/: Added a theora encoder, grouped the encoder and decoder into the same plugin.
Original commit message from CVS:
* ext/theora/Makefile.am:
* ext/theora/theora.c: (plugin_init):
* ext/theora/theoradec.c: (theora_dec_change_state):
* ext/theora/theoraenc.c: (gst_theora_enc_base_init),
(gst_theora_enc_class_init), (gst_theora_enc_init),
(theora_enc_sink_link), (theora_enc_event), (theora_push_packet),
(theora_enc_chain), (theora_enc_change_state),
(theora_enc_set_property), (theora_enc_get_property):
Added a theora encoder, grouped the encoder and decoder into the
same plugin.
2004-05-06 09:10:31 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|