gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-videorate
|
2006-09-22 09:52:21 +00:00
|
|
|
* @short_description: retimestamps and drops/duplicates video frames to
|
|
|
|
* match the source pad's framerate and create a perfect stream
|
2006-03-02 16:47:34 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <para>
|
2006-09-22 09:52:21 +00:00
|
|
|
* This element takes an incoming stream of timestamped video frames.
|
|
|
|
* It will produce a perfect stream that matches the source pad's framerate.
|
|
|
|
*
|
|
|
|
* The correction is performed by dropping and duplicating frames, no fancy
|
|
|
|
* algorithm is used to interpolate frames (yet).
|
2006-03-02 16:47:34 +00:00
|
|
|
* </para>
|
|
|
|
* <para>
|
2006-04-28 14:49:22 +00:00
|
|
|
* By default the element will simply negotiate the same framerate on its
|
2006-09-22 09:52:21 +00:00
|
|
|
* source and sink pad.
|
|
|
|
* </para>
|
|
|
|
* <para>
|
|
|
|
* This operation is useful to link to elements that require a perfect stream.
|
|
|
|
* Typical examples are formats that do not store timestamps for video frames,
|
|
|
|
* but only store a framerate, like Ogg and AVI.
|
2006-03-02 16:47:34 +00:00
|
|
|
* </para>
|
|
|
|
* <para>
|
2006-09-22 09:52:21 +00:00
|
|
|
* A conversion to a specific framerate can be forced by using filtered caps on
|
2006-04-28 14:49:22 +00:00
|
|
|
* the source pad.
|
2006-03-02 16:47:34 +00:00
|
|
|
* </para>
|
|
|
|
* <para>
|
2006-04-28 14:49:22 +00:00
|
|
|
* The properties "in", "out", "duplicate" and "drop" can be read to obtain
|
|
|
|
* information about number of input frames, output frames, dropped frames
|
|
|
|
* (i.e. the number of unused input frames) and duplicated frames (i.e. the
|
|
|
|
* number of times an input frame was duplicated, beside being used normally).
|
|
|
|
*
|
|
|
|
* An input stream that needs no adjustments will thus never have dropped or
|
|
|
|
* duplicated frames.
|
|
|
|
*
|
|
|
|
* When the "silent" property is set to FALSE, a GObject property notification
|
|
|
|
* will be emitted whenever one of the "duplicate" or "drop" values changes.
|
|
|
|
* This can potentially cause performance degradation.
|
|
|
|
* Note that property notification will happen from the streaming thread, so
|
|
|
|
* applications should be prepared for this.
|
2006-03-02 16:47:34 +00:00
|
|
|
* </para>
|
|
|
|
* <title>Example pipelines</title>
|
|
|
|
* <para>
|
|
|
|
* <programlisting>
|
|
|
|
* gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videorate ! video/x-raw-yuv,framerate=15/1 ! xvimagesink
|
|
|
|
* </programlisting>
|
2006-04-28 14:49:22 +00:00
|
|
|
* Decode an Ogg/Theora file and adjust the framerate to 15 fps before playing.
|
2006-03-02 16:47:34 +00:00
|
|
|
* To create the test Ogg/Theora file refer to the documentation of theoraenc.
|
|
|
|
* </para>
|
2006-09-22 09:52:21 +00:00
|
|
|
* <para>
|
|
|
|
* <programlisting>
|
|
|
|
* gst-launch -v v4lsrc ! videorate ! video/x-raw-yuv,framerate=25/2 ! theoraenc ! oggmux ! filesink location=v4l.ogg
|
|
|
|
* </programlisting>
|
|
|
|
* Capture video from a V4L device, and adjust the stream to 12.5 fps before
|
|
|
|
* encoding to Ogg/Theora.
|
|
|
|
* </para>
|
|
|
|
* </refsect2>
|
2006-03-02 16:47:34 +00:00
|
|
|
*
|
2006-09-22 09:52:21 +00:00
|
|
|
* Last reviewed on 2006-09-02 (0.10.11)
|
2006-03-02 16:47:34 +00:00
|
|
|
*/
|
|
|
|
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
#include "gstvideorate.h"
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2006-06-23 09:53:09 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (video_rate_debug);
|
2005-12-01 01:12:55 +00:00
|
|
|
#define GST_CAT_DEFAULT video_rate_debug
|
|
|
|
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
/* elementfactory information */
|
2006-04-28 19:46:37 +00:00
|
|
|
static const GstElementDetails video_rate_details =
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
GST_ELEMENT_DETAILS ("Video rate adjuster",
|
|
|
|
"Filter/Effect/Video",
|
|
|
|
"Drops/duplicates/adjusts timestamps on video frames to make a perfect stream",
|
|
|
|
"Wim Taymans <wim@fluendo.com>");
|
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
/* GstVideoRate signals and args */
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2005-12-06 19:42:02 +00:00
|
|
|
#define DEFAULT_SILENT TRUE
|
|
|
|
#define DEFAULT_NEW_PREF 1.0
|
2004-06-22 11:19:46 +00:00
|
|
|
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ARG_0,
|
|
|
|
ARG_IN,
|
|
|
|
ARG_OUT,
|
|
|
|
ARG_DUP,
|
|
|
|
ARG_DROP,
|
2004-06-22 11:19:46 +00:00
|
|
|
ARG_SILENT,
|
|
|
|
ARG_NEW_PREF,
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
/* FILL ME */
|
|
|
|
};
|
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
static GstStaticPadTemplate gst_video_rate_src_template =
|
2004-11-23 12:39:27 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2004-11-23 12:39:27 +00:00
|
|
|
GST_STATIC_CAPS ("video/x-raw-yuv; video/x-raw-rgb")
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
);
|
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
static GstStaticPadTemplate gst_video_rate_sink_template =
|
2004-11-23 12:39:27 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2004-11-23 12:39:27 +00:00
|
|
|
GST_STATIC_CAPS ("video/x-raw-yuv; video/x-raw-rgb")
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
);
|
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
static void gst_video_rate_swap_prev (GstVideoRate * videorate,
|
|
|
|
GstBuffer * buffer, gint64 time);
|
2005-12-01 01:12:55 +00:00
|
|
|
static gboolean gst_video_rate_event (GstPad * pad, GstEvent * event);
|
2007-07-13 18:12:19 +00:00
|
|
|
static gboolean gst_video_rate_query (GstPad * pad, GstQuery * query);
|
2005-12-01 01:12:55 +00:00
|
|
|
static GstFlowReturn gst_video_rate_chain (GstPad * pad, GstBuffer * buffer);
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
static void gst_video_rate_set_property (GObject * object,
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
2005-12-01 01:12:55 +00:00
|
|
|
static void gst_video_rate_get_property (GObject * object,
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
static GstStateChangeReturn gst_video_rate_change_state (GstElement * element,
|
2005-09-02 15:43:18 +00:00
|
|
|
GstStateChange transition);
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
/*static guint gst_video_rate_signals[LAST_SIGNAL] = { 0 }; */
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2007-07-13 18:12:19 +00:00
|
|
|
GST_BOILERPLATE (GstVideoRate, gst_video_rate, GstElement, GST_TYPE_ELEMENT);
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
|
|
|
static void
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_rate_base_init (gpointer g_class)
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_element_class_set_details (element_class, &video_rate_details);
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_static_pad_template_get (&gst_video_rate_sink_template));
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_static_pad_template_get (&gst_video_rate_src_template));
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
|
|
|
static void
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_rate_class_init (GstVideoRateClass * klass)
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
object_class->set_property = gst_video_rate_set_property;
|
|
|
|
object_class->get_property = gst_video_rate_get_property;
|
2005-05-09 14:03:20 +00:00
|
|
|
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
g_object_class_install_property (object_class, ARG_IN,
|
|
|
|
g_param_spec_uint64 ("in", "In",
|
2008-03-22 15:00:53 +00:00
|
|
|
"Number of input frames", 0, G_MAXUINT64, 0,
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
g_object_class_install_property (object_class, ARG_OUT,
|
2008-03-22 15:00:53 +00:00
|
|
|
g_param_spec_uint64 ("out", "Out", "Number of output frames", 0,
|
|
|
|
G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
g_object_class_install_property (object_class, ARG_DUP,
|
|
|
|
g_param_spec_uint64 ("duplicate", "Duplicate",
|
2008-03-22 15:00:53 +00:00
|
|
|
"Number of duplicated frames", 0, G_MAXUINT64, 0,
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
g_object_class_install_property (object_class, ARG_DROP,
|
2008-03-22 15:00:53 +00:00
|
|
|
g_param_spec_uint64 ("drop", "Drop", "Number of dropped frames", 0,
|
|
|
|
G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
2004-06-22 11:19:46 +00:00
|
|
|
g_object_class_install_property (object_class, ARG_SILENT,
|
|
|
|
g_param_spec_boolean ("silent", "silent",
|
2008-03-22 15:00:53 +00:00
|
|
|
"Don't emit notify for dropped and duplicated frames", DEFAULT_SILENT,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2004-06-22 11:19:46 +00:00
|
|
|
g_object_class_install_property (object_class, ARG_NEW_PREF,
|
2008-03-22 15:00:53 +00:00
|
|
|
g_param_spec_double ("new-pref", "New Pref",
|
|
|
|
"Value indicating how much to prefer new frames (unused)", 0.0, 1.0,
|
|
|
|
DEFAULT_NEW_PREF, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
element_class->change_state = gst_video_rate_change_state;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
|
|
|
|
2005-05-09 14:33:05 +00:00
|
|
|
/* return the caps that can be used on out_pad given in_caps on in_pad */
|
|
|
|
static gboolean
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_rate_transformcaps (GstPad * in_pad, GstCaps * in_caps,
|
2005-05-09 14:33:05 +00:00
|
|
|
GstPad * out_pad, GstCaps ** out_caps)
|
|
|
|
{
|
|
|
|
GstCaps *intersect;
|
|
|
|
const GstCaps *in_templ;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
in_templ = gst_pad_get_pad_template_caps (in_pad);
|
|
|
|
intersect = gst_caps_intersect (in_caps, in_templ);
|
|
|
|
|
|
|
|
/* all possible framerates are allowed */
|
|
|
|
for (i = 0; i < gst_caps_get_size (intersect); i++) {
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
structure = gst_caps_get_structure (intersect, i);
|
|
|
|
|
|
|
|
gst_structure_set (structure,
|
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", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
|
2005-05-09 14:33:05 +00:00
|
|
|
}
|
|
|
|
*out_caps = intersect;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
static GstCaps *
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_rate_getcaps (GstPad * pad)
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
{
|
2005-12-01 01:12:55 +00:00
|
|
|
GstVideoRate *videorate;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
GstPad *otherpad;
|
2005-05-09 14:03:20 +00:00
|
|
|
GstCaps *caps;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
videorate = GST_VIDEO_RATE (GST_PAD_PARENT (pad));
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
|
|
|
otherpad = (pad == videorate->srcpad) ? videorate->sinkpad :
|
|
|
|
videorate->srcpad;
|
|
|
|
|
2005-05-09 14:03:20 +00:00
|
|
|
/* we can do what the peer can */
|
|
|
|
caps = gst_pad_peer_get_caps (otherpad);
|
|
|
|
if (caps) {
|
2005-05-09 14:33:05 +00:00
|
|
|
GstCaps *transform;
|
2005-05-09 14:03:20 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_rate_transformcaps (otherpad, caps, pad, &transform);
|
2005-05-09 14:03:20 +00:00
|
|
|
gst_caps_unref (caps);
|
2005-05-09 14:33:05 +00:00
|
|
|
caps = transform;
|
2005-05-09 14:03:20 +00:00
|
|
|
} else {
|
|
|
|
/* no peer, our padtemplate is enough then */
|
|
|
|
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
|
|
|
|
2005-05-09 14:03:20 +00:00
|
|
|
return caps;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
|
|
|
|
2005-05-09 14:03:20 +00:00
|
|
|
static gboolean
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_rate_setcaps (GstPad * pad, GstCaps * caps)
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
{
|
2005-12-01 01:12:55 +00:00
|
|
|
GstVideoRate *videorate;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
GstStructure *structure;
|
2005-05-09 14:03:20 +00:00
|
|
|
gboolean ret = TRUE;
|
|
|
|
GstPad *otherpad, *opeer;
|
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
|
|
|
gint rate_numerator, rate_denominator;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
videorate = GST_VIDEO_RATE (gst_pad_get_parent (pad));
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2007-04-12 15:00:03 +00:00
|
|
|
GST_DEBUG ("setcaps called %" GST_PTR_FORMAT, caps);
|
|
|
|
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
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
|
|
|
if (!gst_structure_get_fraction (structure, "framerate",
|
|
|
|
&rate_numerator, &rate_denominator))
|
2006-03-02 16:47:34 +00:00
|
|
|
goto no_framerate;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
|
|
|
if (pad == videorate->srcpad) {
|
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
|
|
|
videorate->to_rate_numerator = rate_numerator;
|
|
|
|
videorate->to_rate_denominator = rate_denominator;
|
2005-05-09 14:03:20 +00:00
|
|
|
otherpad = videorate->sinkpad;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
} else {
|
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
|
|
|
videorate->from_rate_numerator = rate_numerator;
|
|
|
|
videorate->from_rate_denominator = rate_denominator;
|
2005-05-09 14:03:20 +00:00
|
|
|
otherpad = videorate->srcpad;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
2005-05-09 14:03:20 +00:00
|
|
|
/* now try to find something for the peer */
|
|
|
|
opeer = gst_pad_get_peer (otherpad);
|
|
|
|
if (opeer) {
|
|
|
|
if (gst_pad_accept_caps (opeer, caps)) {
|
|
|
|
/* the peer accepts the caps as they are */
|
|
|
|
gst_pad_set_caps (otherpad, caps);
|
|
|
|
|
|
|
|
ret = TRUE;
|
|
|
|
} else {
|
|
|
|
GstCaps *peercaps;
|
|
|
|
GstCaps *intersect;
|
2005-05-09 14:33:05 +00:00
|
|
|
GstCaps *transform = NULL;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2005-05-09 14:33:05 +00:00
|
|
|
ret = FALSE;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2005-05-09 14:33:05 +00:00
|
|
|
/* see how we can transform the input caps */
|
2005-12-01 01:12:55 +00:00
|
|
|
if (!gst_video_rate_transformcaps (pad, caps, otherpad, &transform))
|
2006-03-02 16:47:34 +00:00
|
|
|
goto no_transform;
|
2005-05-09 14:03:20 +00:00
|
|
|
|
2005-05-09 14:33:05 +00:00
|
|
|
/* see what the peer can do */
|
|
|
|
peercaps = gst_pad_get_caps (opeer);
|
2005-05-09 14:03:20 +00:00
|
|
|
|
2005-06-23 16:23:12 +00:00
|
|
|
GST_DEBUG ("icaps %" GST_PTR_FORMAT, peercaps);
|
|
|
|
GST_DEBUG ("transform %" GST_PTR_FORMAT, transform);
|
|
|
|
|
2005-05-09 14:33:05 +00:00
|
|
|
/* filter against our possibilities */
|
|
|
|
intersect = gst_caps_intersect (peercaps, transform);
|
2005-05-09 14:03:20 +00:00
|
|
|
gst_caps_unref (peercaps);
|
2005-05-09 14:33:05 +00:00
|
|
|
gst_caps_unref (transform);
|
2005-05-09 14:03:20 +00:00
|
|
|
|
2005-06-23 16:23:12 +00:00
|
|
|
GST_DEBUG ("intersect %" GST_PTR_FORMAT, intersect);
|
|
|
|
|
2005-05-09 14:33:05 +00:00
|
|
|
/* take first possibility */
|
|
|
|
caps = gst_caps_copy_nth (intersect, 0);
|
|
|
|
gst_caps_unref (intersect);
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
2005-05-09 14:03:20 +00:00
|
|
|
|
2005-05-09 14:33:05 +00:00
|
|
|
/* and fixate */
|
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
|
|
|
gst_structure_fixate_field_nearest_fraction (structure, "framerate",
|
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
|
|
|
rate_numerator, rate_denominator);
|
2005-06-23 16:23:12 +00:00
|
|
|
|
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",
|
|
|
|
&rate_numerator, &rate_denominator);
|
2005-06-23 16:23:12 +00:00
|
|
|
|
|
|
|
if (otherpad == videorate->srcpad) {
|
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
|
|
|
videorate->to_rate_numerator = rate_numerator;
|
|
|
|
videorate->to_rate_denominator = rate_denominator;
|
2005-06-23 16:23:12 +00:00
|
|
|
} else {
|
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
|
|
|
videorate->from_rate_numerator = rate_numerator;
|
|
|
|
videorate->from_rate_denominator = rate_denominator;
|
2005-05-09 14:03:20 +00:00
|
|
|
}
|
2005-06-23 16:23:12 +00:00
|
|
|
gst_pad_set_caps (otherpad, caps);
|
2007-02-16 10:15:46 +00:00
|
|
|
gst_caps_unref (caps);
|
2005-06-23 16:23:12 +00:00
|
|
|
ret = TRUE;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
2005-06-28 10:16:13 +00:00
|
|
|
gst_object_unref (opeer);
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
2005-05-09 14:03:20 +00:00
|
|
|
done:
|
2007-03-23 12:32:33 +00:00
|
|
|
/* After a setcaps, our caps may have changed. In that case, we can't use
|
|
|
|
* the old buffer, if there was one (it might have different dimensions) */
|
2007-04-12 15:00:03 +00:00
|
|
|
GST_DEBUG ("swapping old buffers");
|
|
|
|
gst_video_rate_swap_prev (videorate, NULL, GST_CLOCK_TIME_NONE);
|
2007-03-23 12:32:33 +00:00
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
gst_object_unref (videorate);
|
2005-05-09 14:03:20 +00:00
|
|
|
return ret;
|
2006-03-02 16:47:34 +00:00
|
|
|
|
|
|
|
no_framerate:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (videorate, "no framerate specified");
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
no_transform:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (videorate, "no framerate transform possible");
|
|
|
|
ret = FALSE;
|
|
|
|
goto done;
|
|
|
|
}
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
|
|
|
|
2004-12-19 13:16:24 +00:00
|
|
|
static void
|
2006-03-02 16:47:34 +00:00
|
|
|
gst_video_rate_reset (GstVideoRate * videorate)
|
2004-12-19 13:16:24 +00:00
|
|
|
{
|
2006-04-28 14:49:22 +00:00
|
|
|
GST_DEBUG ("resetting internal variables");
|
2005-05-09 14:03:20 +00:00
|
|
|
|
2004-12-19 13:16:24 +00:00
|
|
|
videorate->in = 0;
|
|
|
|
videorate->out = 0;
|
2008-05-28 14:49:24 +00:00
|
|
|
videorate->segment_out = 0;
|
2004-12-19 13:16:24 +00:00
|
|
|
videorate->drop = 0;
|
|
|
|
videorate->dup = 0;
|
2007-03-23 12:32:33 +00:00
|
|
|
videorate->next_ts = GST_CLOCK_TIME_NONE;
|
2006-03-02 16:47:34 +00:00
|
|
|
gst_video_rate_swap_prev (videorate, NULL, 0);
|
2005-11-16 17:56:40 +00:00
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
gst_segment_init (&videorate->segment, GST_FORMAT_TIME);
|
2004-12-19 13:16:24 +00:00
|
|
|
}
|
|
|
|
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
static void
|
2007-07-13 18:12:19 +00:00
|
|
|
gst_video_rate_init (GstVideoRate * videorate, GstVideoRateClass * klass)
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
{
|
2005-12-01 01:12:55 +00:00
|
|
|
GST_DEBUG ("gst_video_rate_init");
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
videorate->sinkpad =
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_pad_new_from_static_template (&gst_video_rate_sink_template, "sink");
|
|
|
|
gst_pad_set_event_function (videorate->sinkpad, gst_video_rate_event);
|
|
|
|
gst_pad_set_chain_function (videorate->sinkpad, gst_video_rate_chain);
|
|
|
|
gst_pad_set_getcaps_function (videorate->sinkpad, gst_video_rate_getcaps);
|
|
|
|
gst_pad_set_setcaps_function (videorate->sinkpad, gst_video_rate_setcaps);
|
2007-07-13 18:12:19 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (videorate), videorate->sinkpad);
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
|
|
|
videorate->srcpad =
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_pad_new_from_static_template (&gst_video_rate_src_template, "src");
|
2007-07-13 18:12:19 +00:00
|
|
|
gst_pad_set_query_function (videorate->srcpad, gst_video_rate_query);
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_pad_set_getcaps_function (videorate->srcpad, gst_video_rate_getcaps);
|
|
|
|
gst_pad_set_setcaps_function (videorate->srcpad, gst_video_rate_setcaps);
|
2007-07-13 18:12:19 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (videorate), videorate->srcpad);
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
gst_video_rate_reset (videorate);
|
2004-06-22 11:19:46 +00:00
|
|
|
videorate->silent = DEFAULT_SILENT;
|
2004-06-22 11:57:22 +00:00
|
|
|
videorate->new_pref = DEFAULT_NEW_PREF;
|
2006-04-06 11:40:45 +00:00
|
|
|
|
|
|
|
videorate->from_rate_numerator = 0;
|
|
|
|
videorate->from_rate_denominator = 0;
|
|
|
|
videorate->to_rate_numerator = 0;
|
|
|
|
videorate->to_rate_denominator = 0;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
/* flush the oldest buffer */
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_video_rate_flush_prev (GstVideoRate * videorate)
|
|
|
|
{
|
|
|
|
GstFlowReturn res;
|
|
|
|
GstBuffer *outbuf;
|
|
|
|
GstClockTime push_ts;
|
|
|
|
|
2006-04-04 11:15:00 +00:00
|
|
|
if (!videorate->prevbuf)
|
|
|
|
goto eos_before_buffers;
|
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
/* make sure we can write to the metadata */
|
2006-04-04 11:20:24 +00:00
|
|
|
outbuf = gst_buffer_make_metadata_writable
|
|
|
|
(gst_buffer_ref (videorate->prevbuf));
|
2006-03-02 16:47:34 +00:00
|
|
|
|
2007-03-29 11:24:47 +00:00
|
|
|
GST_BUFFER_OFFSET (outbuf) = videorate->out;
|
|
|
|
GST_BUFFER_OFFSET_END (outbuf) = videorate->out + 1;
|
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
/* this is the timestamp we put on the buffer */
|
|
|
|
push_ts = videorate->next_ts;
|
|
|
|
|
|
|
|
videorate->out++;
|
2008-05-28 14:49:24 +00:00
|
|
|
videorate->segment_out++;
|
2006-03-02 16:47:34 +00:00
|
|
|
if (videorate->to_rate_numerator) {
|
2006-09-28 11:46:26 +00:00
|
|
|
/* interpolate next expected timestamp in the segment */
|
|
|
|
videorate->next_ts = videorate->segment.accum + videorate->segment.start +
|
2008-05-28 14:49:24 +00:00
|
|
|
gst_util_uint64_scale (videorate->segment_out,
|
2006-03-02 16:47:34 +00:00
|
|
|
videorate->to_rate_denominator * GST_SECOND,
|
|
|
|
videorate->to_rate_numerator);
|
2006-09-28 11:46:26 +00:00
|
|
|
GST_BUFFER_DURATION (outbuf) = videorate->next_ts - push_ts;
|
2006-03-02 16:47:34 +00:00
|
|
|
}
|
2006-09-28 11:46:26 +00:00
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
/* adapt for looping, bring back to time in current segment. */
|
2006-09-28 11:46:26 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = push_ts - videorate->segment.accum;
|
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (videorate->srcpad));
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (videorate,
|
|
|
|
"old is best, dup, pushing buffer outgoing ts %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (push_ts));
|
|
|
|
|
2006-04-06 11:40:45 +00:00
|
|
|
res = gst_pad_push (videorate->srcpad, outbuf);
|
2006-03-02 16:47:34 +00:00
|
|
|
|
|
|
|
return res;
|
|
|
|
|
2006-04-04 11:15:00 +00:00
|
|
|
/* WARNINGS */
|
|
|
|
eos_before_buffers:
|
|
|
|
{
|
|
|
|
GST_INFO_OBJECT (videorate, "got EOS before any buffer was received");
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2006-03-02 16:47:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_video_rate_swap_prev (GstVideoRate * videorate, GstBuffer * buffer,
|
|
|
|
gint64 time)
|
|
|
|
{
|
2006-04-28 14:49:22 +00:00
|
|
|
GST_LOG_OBJECT (videorate, "swap_prev: storing buffer %p in prev", buffer);
|
2006-03-02 16:47:34 +00:00
|
|
|
if (videorate->prevbuf)
|
|
|
|
gst_buffer_unref (videorate->prevbuf);
|
|
|
|
videorate->prevbuf = buffer;
|
|
|
|
videorate->prev_ts = time;
|
|
|
|
}
|
|
|
|
|
2008-05-28 14:49:24 +00:00
|
|
|
#define MAGIC_LIMIT 25
|
2006-10-10 12:49:03 +00:00
|
|
|
static gboolean
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_rate_event (GstPad * pad, GstEvent * event)
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
{
|
2005-12-01 01:12:55 +00:00
|
|
|
GstVideoRate *videorate;
|
2006-04-28 14:19:49 +00:00
|
|
|
gboolean ret;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
videorate = GST_VIDEO_RATE (gst_pad_get_parent (pad));
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2005-05-09 14:03:20 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
examples/seeking/seek.c: Update seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
2005-07-27 18:34:29 +00:00
|
|
|
case GST_EVENT_NEWSEGMENT:
|
2005-05-09 14:03:20 +00:00
|
|
|
{
|
2006-03-02 16:47:34 +00:00
|
|
|
gint64 start, stop, time;
|
2006-09-28 11:46:26 +00:00
|
|
|
gdouble rate, arate;
|
2005-11-16 17:56:40 +00:00
|
|
|
gboolean update;
|
examples/seeking/seek.c: Update seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
2005-07-27 18:34:29 +00:00
|
|
|
GstFormat format;
|
2005-05-09 14:03:20 +00:00
|
|
|
|
2006-09-28 11:46:26 +00:00
|
|
|
gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
|
|
|
|
&start, &stop, &time);
|
examples/seeking/seek.c: Update seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
2005-07-27 18:34:29 +00:00
|
|
|
|
2006-09-28 11:46:26 +00:00
|
|
|
if (format != GST_FORMAT_TIME)
|
2006-03-02 16:47:34 +00:00
|
|
|
goto format_error;
|
2005-05-09 14:03:20 +00:00
|
|
|
|
2006-09-28 11:46:26 +00:00
|
|
|
GST_DEBUG_OBJECT (videorate, "handle NEWSEGMENT");
|
|
|
|
|
2008-05-28 14:49:24 +00:00
|
|
|
/* close up the previous segment, if appropriate */
|
|
|
|
if (!update && videorate->prevbuf) {
|
|
|
|
gint count = 0;
|
|
|
|
GstFlowReturn res;
|
|
|
|
|
|
|
|
res = GST_FLOW_OK;
|
|
|
|
/* fill up to the end of current segment,
|
|
|
|
* or only send out the stored buffer if there is no specific stop.
|
|
|
|
* regardless, prevent going loopy in strange cases */
|
|
|
|
while (res == GST_FLOW_OK && count <= MAGIC_LIMIT &&
|
|
|
|
((GST_CLOCK_TIME_IS_VALID (videorate->segment.stop) &&
|
|
|
|
videorate->next_ts - videorate->segment.accum
|
|
|
|
< videorate->segment.stop)
|
|
|
|
|| count < 1)) {
|
|
|
|
gst_video_rate_flush_prev (videorate);
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
if (count > 1) {
|
|
|
|
videorate->dup += count - 1;
|
|
|
|
if (!videorate->silent)
|
|
|
|
g_object_notify (G_OBJECT (videorate), "duplicate");
|
|
|
|
} else if (count == 0) {
|
|
|
|
videorate->drop++;
|
|
|
|
if (!videorate->silent)
|
|
|
|
g_object_notify (G_OBJECT (videorate), "drop");
|
|
|
|
}
|
|
|
|
/* clean up for the new one; _chain will resume from the new start */
|
|
|
|
videorate->segment_out = 0;
|
|
|
|
gst_video_rate_swap_prev (videorate, NULL, 0);
|
|
|
|
videorate->next_ts = GST_CLOCK_TIME_NONE;
|
|
|
|
}
|
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
/* We just want to update the accumulated stream_time */
|
2006-09-28 11:46:26 +00:00
|
|
|
gst_segment_set_newsegment_full (&videorate->segment, update, rate, arate,
|
2006-03-02 16:47:34 +00:00
|
|
|
format, start, stop, time);
|
|
|
|
|
2006-09-28 11:46:26 +00:00
|
|
|
GST_DEBUG_OBJECT (videorate, "updated segment: %" GST_SEGMENT_FORMAT,
|
|
|
|
&videorate->segment);
|
2005-05-09 14:03:20 +00:00
|
|
|
break;
|
2004-12-19 13:16:24 +00:00
|
|
|
}
|
2006-03-02 16:47:34 +00:00
|
|
|
case GST_EVENT_EOS:
|
|
|
|
/* flush last queued frame */
|
2006-04-28 14:19:49 +00:00
|
|
|
GST_DEBUG_OBJECT (videorate, "Got EOS");
|
2006-03-02 16:47:34 +00:00
|
|
|
gst_video_rate_flush_prev (videorate);
|
|
|
|
break;
|
2005-11-16 17:56:40 +00:00
|
|
|
case GST_EVENT_FLUSH_STOP:
|
2006-03-02 16:47:34 +00:00
|
|
|
/* also resets the segment */
|
2006-04-28 14:19:49 +00:00
|
|
|
GST_DEBUG_OBJECT (videorate, "Got FLUSH_STOP");
|
2006-03-02 16:47:34 +00:00
|
|
|
gst_video_rate_reset (videorate);
|
|
|
|
break;
|
2005-05-09 14:03:20 +00:00
|
|
|
default:
|
|
|
|
break;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
2005-11-16 17:56:40 +00:00
|
|
|
|
2006-04-28 14:19:49 +00:00
|
|
|
ret = gst_pad_push_event (videorate->srcpad, event);
|
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
done:
|
|
|
|
gst_object_unref (videorate);
|
|
|
|
|
2006-04-28 14:19:49 +00:00
|
|
|
return ret;
|
2006-03-02 16:47:34 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
format_error:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (videorate,
|
|
|
|
"Got segment but doesn't have GST_FORMAT_TIME value");
|
2006-04-28 14:19:49 +00:00
|
|
|
gst_event_unref (event);
|
|
|
|
ret = FALSE;
|
2006-03-02 16:47:34 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2005-05-09 14:03:20 +00:00
|
|
|
}
|
|
|
|
|
2007-07-13 18:12:19 +00:00
|
|
|
static gboolean
|
|
|
|
gst_video_rate_query (GstPad * pad, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstVideoRate *videorate;
|
|
|
|
gboolean res = FALSE;
|
|
|
|
|
|
|
|
videorate = GST_VIDEO_RATE (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_LATENCY:
|
|
|
|
{
|
|
|
|
GstClockTime min, max;
|
|
|
|
gboolean live;
|
|
|
|
guint64 latency;
|
|
|
|
GstPad *peer;
|
|
|
|
|
|
|
|
if ((peer = gst_pad_get_peer (videorate->sinkpad))) {
|
|
|
|
if ((res = gst_pad_query (peer, query))) {
|
|
|
|
gst_query_parse_latency (query, &live, &min, &max);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (videorate, "Peer latency: min %"
|
|
|
|
GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (min), GST_TIME_ARGS (max));
|
|
|
|
|
|
|
|
/* add latency. We don't really know since we hold on to the frames
|
|
|
|
* until we get a next frame, which can be anything. We assume
|
|
|
|
* however that this will take from_rate time. */
|
|
|
|
latency = gst_util_uint64_scale (GST_SECOND,
|
|
|
|
videorate->from_rate_denominator, videorate->from_rate_numerator);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (videorate, "Our latency: %"
|
2007-08-10 10:08:05 +00:00
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (latency));
|
2007-07-13 18:12:19 +00:00
|
|
|
|
|
|
|
min += latency;
|
|
|
|
if (max != -1)
|
|
|
|
max += latency;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (videorate, "Calculated total latency : min %"
|
|
|
|
GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (min), GST_TIME_ARGS (max));
|
|
|
|
|
|
|
|
gst_query_set_latency (query, live, min, max);
|
|
|
|
}
|
|
|
|
gst_object_unref (peer);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = gst_pad_query_default (pad, query);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
gst_object_unref (videorate);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-05-09 14:03:20 +00:00
|
|
|
static GstFlowReturn
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_rate_chain (GstPad * pad, GstBuffer * buffer)
|
2005-05-09 14:03:20 +00:00
|
|
|
{
|
2005-12-01 01:12:55 +00:00
|
|
|
GstVideoRate *videorate;
|
2005-05-09 14:03:20 +00:00
|
|
|
GstFlowReturn res = GST_FLOW_OK;
|
2006-04-28 14:19:49 +00:00
|
|
|
GstClockTime intime, in_ts;
|
2005-05-09 14:03:20 +00:00
|
|
|
|
2007-04-24 15:00:07 +00:00
|
|
|
videorate = GST_VIDEO_RATE (GST_PAD_PARENT (pad));
|
2006-03-02 16:47:34 +00:00
|
|
|
|
2006-04-28 14:49:22 +00:00
|
|
|
/* make sure the denominators are not 0 */
|
2006-03-02 16:47:34 +00:00
|
|
|
if (videorate->from_rate_denominator == 0 ||
|
|
|
|
videorate->to_rate_denominator == 0)
|
|
|
|
goto not_negotiated;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2006-04-28 14:19:49 +00:00
|
|
|
in_ts = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
|
2007-05-03 10:47:22 +00:00
|
|
|
if (G_UNLIKELY (in_ts == GST_CLOCK_TIME_NONE))
|
|
|
|
goto invalid_buffer;
|
|
|
|
|
2006-04-28 14:19:49 +00:00
|
|
|
GST_DEBUG_OBJECT (videorate, "got buffer with timestamp %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (in_ts));
|
|
|
|
|
2006-09-28 11:46:26 +00:00
|
|
|
/* the input time is the time in the segment + all previously accumulated
|
|
|
|
* segments */
|
|
|
|
intime = in_ts + videorate->segment.accum;
|
2005-05-09 14:03:20 +00:00
|
|
|
|
2006-04-28 14:49:22 +00:00
|
|
|
/* we need to have two buffers to compare */
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
if (videorate->prevbuf == NULL) {
|
2006-03-02 16:47:34 +00:00
|
|
|
gst_video_rate_swap_prev (videorate, buffer, intime);
|
2006-04-28 14:49:22 +00:00
|
|
|
videorate->in++;
|
2007-03-23 12:32:33 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (videorate->next_ts)) {
|
|
|
|
/* new buffer, we expect to output a buffer that matches the first
|
|
|
|
* timestamp in the segment */
|
2008-05-28 14:49:24 +00:00
|
|
|
videorate->next_ts = videorate->segment.start + videorate->segment.accum;
|
2007-03-23 12:32:33 +00:00
|
|
|
}
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
} else {
|
2006-03-02 16:47:34 +00:00
|
|
|
GstClockTime prevtime;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
gint count = 0;
|
|
|
|
gint64 diff1, diff2;
|
|
|
|
|
2005-11-16 17:56:40 +00:00
|
|
|
prevtime = videorate->prev_ts;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2004-06-24 12:45:27 +00:00
|
|
|
GST_LOG_OBJECT (videorate,
|
2005-11-16 17:56:40 +00:00
|
|
|
"BEGINNING prev buf %" GST_TIME_FORMAT " new buf %" GST_TIME_FORMAT
|
2004-06-26 15:43:55 +00:00
|
|
|
" outgoing ts %" GST_TIME_FORMAT, GST_TIME_ARGS (prevtime),
|
2004-06-24 12:45:27 +00:00
|
|
|
GST_TIME_ARGS (intime), GST_TIME_ARGS (videorate->next_ts));
|
|
|
|
|
2005-05-09 14:03:20 +00:00
|
|
|
videorate->in++;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2006-04-26 16:44:20 +00:00
|
|
|
/* drop new buffer if it's before previous one */
|
|
|
|
if (intime < prevtime) {
|
|
|
|
GST_DEBUG_OBJECT (videorate,
|
|
|
|
"The new buffer (%" GST_TIME_FORMAT
|
|
|
|
") is before the previous buffer (%"
|
|
|
|
GST_TIME_FORMAT "). Dropping new buffer.",
|
|
|
|
GST_TIME_ARGS (intime), GST_TIME_ARGS (prevtime));
|
|
|
|
videorate->drop++;
|
|
|
|
if (!videorate->silent)
|
|
|
|
g_object_notify (G_OBJECT (videorate), "drop");
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
/* got 2 buffers, see which one is the best */
|
|
|
|
do {
|
2007-04-12 15:00:03 +00:00
|
|
|
|
2004-06-26 15:43:55 +00:00
|
|
|
diff1 = prevtime - videorate->next_ts;
|
|
|
|
diff2 = intime - videorate->next_ts;
|
2004-06-24 12:45:27 +00:00
|
|
|
|
|
|
|
/* take absolute values, beware: abs and ABS don't work for gint64 */
|
|
|
|
if (diff1 < 0)
|
|
|
|
diff1 = -diff1;
|
|
|
|
if (diff2 < 0)
|
|
|
|
diff2 = -diff2;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (videorate,
|
2004-06-26 15:43:55 +00:00
|
|
|
"diff with prev %" GST_TIME_FORMAT " diff with new %"
|
|
|
|
GST_TIME_FORMAT " outgoing ts %" GST_TIME_FORMAT,
|
2004-06-24 12:45:27 +00:00
|
|
|
GST_TIME_ARGS (diff1), GST_TIME_ARGS (diff2),
|
|
|
|
GST_TIME_ARGS (videorate->next_ts));
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
|
|
|
/* output first one when its the best */
|
2004-06-26 15:58:35 +00:00
|
|
|
if (diff1 < diff2) {
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
count++;
|
2004-06-24 12:45:27 +00:00
|
|
|
|
2006-03-02 16:47:34 +00:00
|
|
|
/* on error the _flush function posted a warning already */
|
2007-04-24 15:00:07 +00:00
|
|
|
if ((res = gst_video_rate_flush_prev (videorate)) != GST_FLOW_OK) {
|
|
|
|
gst_buffer_unref (buffer);
|
2006-03-02 16:47:34 +00:00
|
|
|
goto done;
|
2007-04-24 15:00:07 +00:00
|
|
|
}
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
|
|
|
/* continue while the first one was the best */
|
|
|
|
}
|
2004-06-26 15:58:35 +00:00
|
|
|
while (diff1 < diff2);
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
|
|
|
/* if we outputed the first buffer more then once, we have dups */
|
2004-06-17 17:07:50 +00:00
|
|
|
if (count > 1) {
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
videorate->dup += count - 1;
|
2004-06-22 11:19:46 +00:00
|
|
|
if (!videorate->silent)
|
|
|
|
g_object_notify (G_OBJECT (videorate), "duplicate");
|
2004-06-17 17:07:50 +00:00
|
|
|
}
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
/* if we didn't output the first buffer, we have a drop */
|
2004-06-17 17:07:50 +00:00
|
|
|
else if (count == 0) {
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
videorate->drop++;
|
2006-03-02 16:47:34 +00:00
|
|
|
|
2004-06-22 11:19:46 +00:00
|
|
|
if (!videorate->silent)
|
|
|
|
g_object_notify (G_OBJECT (videorate), "drop");
|
2006-03-02 16:47:34 +00:00
|
|
|
|
2004-06-24 12:45:27 +00:00
|
|
|
GST_LOG_OBJECT (videorate,
|
2004-06-26 15:43:55 +00:00
|
|
|
"new is best, old never used, drop, outgoing ts %"
|
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (videorate->next_ts));
|
2004-06-17 17:07:50 +00:00
|
|
|
}
|
2004-06-24 12:45:27 +00:00
|
|
|
GST_LOG_OBJECT (videorate,
|
2005-11-16 17:56:40 +00:00
|
|
|
"END, putting new in old, diff1 %" GST_TIME_FORMAT
|
2004-12-19 13:16:24 +00:00
|
|
|
", diff2 %" GST_TIME_FORMAT ", next_ts %" GST_TIME_FORMAT
|
2004-06-26 15:43:55 +00:00
|
|
|
", in %lld, out %lld, drop %lld, dup %lld", GST_TIME_ARGS (diff1),
|
2004-12-19 13:16:24 +00:00
|
|
|
GST_TIME_ARGS (diff2), GST_TIME_ARGS (videorate->next_ts),
|
|
|
|
videorate->in, videorate->out, videorate->drop, videorate->dup);
|
|
|
|
|
2005-05-09 14:03:20 +00:00
|
|
|
/* swap in new one when it's the best */
|
2006-03-02 16:47:34 +00:00
|
|
|
gst_video_rate_swap_prev (videorate, buffer, intime);
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
2005-05-09 14:03:20 +00:00
|
|
|
done:
|
|
|
|
return res;
|
2006-03-02 16:47:34 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
not_negotiated:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (videorate, "no framerate negotiated");
|
2006-04-28 14:49:22 +00:00
|
|
|
gst_buffer_unref (buffer);
|
2006-03-02 16:47:34 +00:00
|
|
|
res = GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
goto done;
|
|
|
|
}
|
2007-05-03 10:47:22 +00:00
|
|
|
|
|
|
|
invalid_buffer:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (videorate,
|
|
|
|
"Got buffer with GST_CLOCK_TIME_NONE timestamp, discarding it");
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
goto done;
|
|
|
|
}
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_rate_set_property (GObject * object,
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2005-12-01 01:12:55 +00:00
|
|
|
GstVideoRate *videorate = GST_VIDEO_RATE (object);
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2004-06-22 11:19:46 +00:00
|
|
|
case ARG_SILENT:
|
|
|
|
videorate->silent = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case ARG_NEW_PREF:
|
|
|
|
videorate->new_pref = g_value_get_double (value);
|
|
|
|
break;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_rate_get_property (GObject * object,
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2005-12-01 01:12:55 +00:00
|
|
|
GstVideoRate *videorate = GST_VIDEO_RATE (object);
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_IN:
|
|
|
|
g_value_set_uint64 (value, videorate->in);
|
|
|
|
break;
|
|
|
|
case ARG_OUT:
|
|
|
|
g_value_set_uint64 (value, videorate->out);
|
|
|
|
break;
|
|
|
|
case ARG_DUP:
|
|
|
|
g_value_set_uint64 (value, videorate->dup);
|
|
|
|
break;
|
|
|
|
case ARG_DROP:
|
|
|
|
g_value_set_uint64 (value, videorate->drop);
|
|
|
|
break;
|
2004-06-22 11:19:46 +00:00
|
|
|
case ARG_SILENT:
|
|
|
|
g_value_set_boolean (value, videorate->silent);
|
|
|
|
break;
|
|
|
|
case ARG_NEW_PREF:
|
|
|
|
g_value_set_double (value, videorate->new_pref);
|
|
|
|
break;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_video_rate_change_state (GstElement * element, GstStateChange transition)
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
{
|
2005-09-02 15:43:18 +00:00
|
|
|
GstStateChangeReturn ret;
|
2005-12-01 01:12:55 +00:00
|
|
|
GstVideoRate *videorate;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
videorate = GST_VIDEO_RATE (element);
|
2005-05-09 14:03:20 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
ret = parent_class->change_state (element, transition);
|
2005-05-09 14:03:20 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2006-03-02 16:47:34 +00:00
|
|
|
gst_video_rate_reset (videorate);
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-05-09 14:03:20 +00:00
|
|
|
return ret;
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
plugin_init (GstPlugin * plugin)
|
|
|
|
{
|
2005-12-01 01:12:55 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (video_rate_debug, "videorate", 0,
|
|
|
|
"VideoRate stream fixer");
|
2004-06-26 15:43:55 +00:00
|
|
|
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
return gst_element_register (plugin, "videorate", GST_RANK_NONE,
|
2005-12-01 01:12:55 +00:00
|
|
|
GST_TYPE_VIDEO_RATE);
|
gst/videorate/: Added a video timestamp corrector.
Original commit message from CVS:
* gst/videorate/Makefile.am:
* gst/videorate/gstvideorate.c: (gst_videorate_get_type),
(gst_videorate_base_init), (gst_videorate_class_init),
(gst_videorate_getcaps), (gst_videorate_link),
(gst_videorate_init), (gst_videorate_chain),
(gst_videorate_set_property), (gst_videorate_get_property),
(gst_videorate_change_state), (plugin_init):
Added a video timestamp corrector.
2004-06-16 09:39:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"videorate",
|
|
|
|
"Adjusts video frames",
|
2005-10-16 13:54:44 +00:00
|
|
|
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|