2005-05-13 15:46:42 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* This file:
|
|
|
|
* Copyright (C) 2005 Luca Ognibene <luogni@tin.it>
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
* Copyright (C) 2006 Martin Zlomek <martin.zlomek@itonis.tv>
|
2005-05-13 15:46:42 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_FFMPEG_UNINSTALLED
|
|
|
|
#include <avcodec.h>
|
|
|
|
#else
|
|
|
|
#include <ffmpeg/avcodec.h>
|
|
|
|
#endif
|
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/base/gstbasetransform.h>
|
2005-05-13 15:46:42 +00:00
|
|
|
#include <gst/video/video.h>
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
|
2005-05-13 15:46:42 +00:00
|
|
|
#include "gstffmpeg.h"
|
|
|
|
#include "gstffmpegcodecmap.h"
|
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
typedef struct _GstFFMpegScale
|
2005-05-13 15:46:42 +00:00
|
|
|
{
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
GstBaseTransform element;
|
2005-05-13 15:46:42 +00:00
|
|
|
|
|
|
|
GstPad *sinkpad, *srcpad;
|
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
gint in_width, in_height;
|
|
|
|
gint out_width, out_height;
|
2005-05-13 15:46:42 +00:00
|
|
|
|
|
|
|
enum PixelFormat pixfmt;
|
|
|
|
|
|
|
|
ImgReSampleContext *res;
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
} GstFFMpegScale;
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
typedef struct _GstFFMpegScaleClass
|
2005-05-13 15:46:42 +00:00
|
|
|
{
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
GstBaseTransformClass parent_class;
|
|
|
|
} GstFFMpegScaleClass;
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
#define GST_TYPE_FFMPEGSCALE \
|
|
|
|
(gst_ffmpegscale_get_type())
|
|
|
|
#define GST_FFMPEGSCALE(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGSCALE,GstFFMpegScale))
|
|
|
|
#define GST_FFMPEGSCALE_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGSCALE,GstFFMpegScaleClass))
|
|
|
|
#define GST_IS_FFMPEGSCALE(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGSCALE))
|
2006-09-16 22:19:40 +00:00
|
|
|
#define GST_IS_FFMPEGSCALE_CLASS(klass) \
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGSCALE))
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
2005-05-13 15:46:42 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
|
|
|
|
);
|
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
2005-05-13 15:46:42 +00:00
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
|
|
|
|
);
|
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
GST_BOILERPLATE (GstFFMpegScale, gst_ffmpegscale, GstBaseTransform,
|
|
|
|
GST_TYPE_BASE_TRANSFORM);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
static void gst_ffmpegscale_finalize (GObject * object);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
static GstCaps *gst_ffmpegscale_transform_caps (GstBaseTransform * trans,
|
|
|
|
GstPadDirection direction, GstCaps * caps);
|
|
|
|
static void gst_ffmpegscale_fixate_caps (GstBaseTransform * trans,
|
|
|
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
|
|
|
|
static gboolean gst_ffmpegscale_get_unit_size (GstBaseTransform * trans,
|
|
|
|
GstCaps * caps, guint * size);
|
|
|
|
static gboolean gst_ffmpegscale_set_caps (GstBaseTransform * trans,
|
|
|
|
GstCaps * incaps, GstCaps * outcaps);
|
|
|
|
static GstFlowReturn gst_ffmpegscale_transform (GstBaseTransform * trans,
|
|
|
|
GstBuffer * inbuf, GstBuffer * outbuf);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
static gboolean gst_ffmpegscale_handle_src_event (GstPad * pad,
|
|
|
|
GstEvent * event);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
static void
|
|
|
|
gst_ffmpegscale_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&src_factory));
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&sink_factory));
|
2010-03-24 10:51:26 +00:00
|
|
|
gst_element_class_set_details_simple (element_class, "FFMPEG Scale element",
|
2010-12-16 09:12:02 +00:00
|
|
|
"Filter/Converter/Video/Scaler",
|
2010-03-24 10:51:26 +00:00
|
|
|
"Converts video from one resolution to another",
|
|
|
|
"Luca Ognibene <luogni@tin.it>");
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
}
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
static void
|
|
|
|
gst_ffmpegscale_class_init (GstFFMpegScaleClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
GstBaseTransformClass *trans_class = GST_BASE_TRANSFORM_CLASS (klass);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
gobject_class->finalize = gst_ffmpegscale_finalize;
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
trans_class->transform_caps =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_ffmpegscale_transform_caps);
|
|
|
|
trans_class->fixate_caps = GST_DEBUG_FUNCPTR (gst_ffmpegscale_fixate_caps);
|
|
|
|
trans_class->get_unit_size =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_ffmpegscale_get_unit_size);
|
|
|
|
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_ffmpegscale_set_caps);
|
|
|
|
trans_class->transform = GST_DEBUG_FUNCPTR (gst_ffmpegscale_transform);
|
|
|
|
|
|
|
|
trans_class->passthrough_on_same_caps = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ffmpegscale_init (GstFFMpegScale * scale, GstFFMpegScaleClass * klass)
|
2005-05-13 15:46:42 +00:00
|
|
|
{
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
GstBaseTransform *trans = GST_BASE_TRANSFORM (scale);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
gst_pad_set_event_function (trans->srcpad, gst_ffmpegscale_handle_src_event);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
scale->pixfmt = PIX_FMT_NB;
|
|
|
|
scale->res = NULL;
|
|
|
|
}
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
static void
|
|
|
|
gst_ffmpegscale_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstFFMpegScale *scale = GST_FFMPEGSCALE (object);
|
|
|
|
|
|
|
|
if (scale->res != NULL)
|
|
|
|
img_resample_close (scale->res);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps *
|
|
|
|
gst_ffmpegscale_transform_caps (GstBaseTransform * trans,
|
|
|
|
GstPadDirection direction, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstCaps *retcaps;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
retcaps = gst_caps_copy (caps);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
for (i = 0; i < gst_caps_get_size (retcaps); i++) {
|
|
|
|
GstStructure *structure = gst_caps_get_structure (retcaps, i);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
|
|
|
gst_structure_set (structure,
|
|
|
|
"width", GST_TYPE_INT_RANGE, 16, 4096,
|
|
|
|
"height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
|
|
|
|
gst_structure_remove_field (structure, "pixel-aspect-ratio");
|
|
|
|
}
|
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
return retcaps;
|
2005-05-13 15:46:42 +00:00
|
|
|
}
|
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
static void
|
|
|
|
gst_ffmpegscale_fixate_caps (GstBaseTransform * trans,
|
|
|
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
2005-05-13 15:46:42 +00:00
|
|
|
{
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
GstStructure *instructure = gst_caps_get_structure (caps, 0);
|
|
|
|
GstStructure *outstructure = gst_caps_get_structure (othercaps, 0);
|
|
|
|
const GValue *in_par, *out_par;
|
|
|
|
|
|
|
|
in_par = gst_structure_get_value (instructure, "pixel-aspect-ratio");
|
|
|
|
out_par = gst_structure_get_value (outstructure, "pixel-aspect-ratio");
|
|
|
|
|
|
|
|
if (in_par && out_par) {
|
|
|
|
GValue out_ratio = { 0, }; /* w/h of output video */
|
|
|
|
int in_w, in_h, in_par_n, in_par_d, out_par_n, out_par_d;
|
|
|
|
int count = 0, w = 0, h = 0, num, den;
|
|
|
|
|
|
|
|
/* if both width and height are already fixed, we can't do anything
|
|
|
|
* about it anymore */
|
|
|
|
if (gst_structure_get_int (outstructure, "width", &w))
|
|
|
|
++count;
|
|
|
|
if (gst_structure_get_int (outstructure, "height", &h))
|
|
|
|
++count;
|
|
|
|
if (count == 2) {
|
|
|
|
GST_DEBUG_OBJECT (trans, "dimensions already set to %dx%d, not fixating",
|
|
|
|
w, h);
|
|
|
|
return;
|
|
|
|
}
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
gst_structure_get_int (instructure, "width", &in_w);
|
|
|
|
gst_structure_get_int (instructure, "height", &in_h);
|
|
|
|
in_par_n = gst_value_get_fraction_numerator (in_par);
|
|
|
|
in_par_d = gst_value_get_fraction_denominator (in_par);
|
|
|
|
out_par_n = gst_value_get_fraction_numerator (out_par);
|
|
|
|
out_par_d = gst_value_get_fraction_denominator (out_par);
|
|
|
|
|
|
|
|
g_value_init (&out_ratio, GST_TYPE_FRACTION);
|
|
|
|
gst_value_set_fraction (&out_ratio, in_w * in_par_n * out_par_d,
|
|
|
|
in_h * in_par_d * out_par_n);
|
|
|
|
num = gst_value_get_fraction_numerator (&out_ratio);
|
|
|
|
den = gst_value_get_fraction_denominator (&out_ratio);
|
|
|
|
GST_DEBUG_OBJECT (trans,
|
|
|
|
"scaling input with %dx%d and PAR %d/%d to output PAR %d/%d",
|
|
|
|
in_w, in_h, in_par_n, in_par_d, out_par_n, out_par_d);
|
|
|
|
GST_DEBUG_OBJECT (trans, "resulting output should respect ratio of %d/%d",
|
|
|
|
num, den);
|
|
|
|
|
|
|
|
/* now find a width x height that respects this display ratio.
|
|
|
|
* prefer those that have one of w/h the same as the incoming video
|
|
|
|
* using wd / hd = num / den */
|
|
|
|
|
|
|
|
/* start with same height, because of interlaced video */
|
|
|
|
/* check hd / den is an integer scale factor, and scale wd with the PAR */
|
|
|
|
if (in_h % den == 0) {
|
|
|
|
GST_DEBUG_OBJECT (trans, "keeping video height");
|
|
|
|
h = in_h;
|
|
|
|
w = h * num / den;
|
|
|
|
} else if (in_w % num == 0) {
|
|
|
|
GST_DEBUG_OBJECT (trans, "keeping video width");
|
|
|
|
w = in_w;
|
|
|
|
h = w * den / num;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (trans, "approximating but keeping video height");
|
|
|
|
h = in_h;
|
|
|
|
w = h * num / den;
|
|
|
|
}
|
|
|
|
GST_DEBUG_OBJECT (trans, "scaling to %dx%d", w, h);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
/* now fixate */
|
|
|
|
gst_structure_fixate_field_nearest_int (outstructure, "width", w);
|
|
|
|
gst_structure_fixate_field_nearest_int (outstructure, "height", h);
|
|
|
|
} else {
|
|
|
|
gint width, height;
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
if (gst_structure_get_int (instructure, "width", &width)) {
|
|
|
|
if (gst_structure_has_field (outstructure, "width"))
|
|
|
|
gst_structure_fixate_field_nearest_int (outstructure, "width", width);
|
|
|
|
}
|
|
|
|
if (gst_structure_get_int (instructure, "height", &height)) {
|
|
|
|
if (gst_structure_has_field (outstructure, "height"))
|
|
|
|
gst_structure_fixate_field_nearest_int (outstructure, "height", height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
static gboolean
|
|
|
|
gst_ffmpegscale_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
|
|
|
|
guint * size)
|
|
|
|
{
|
|
|
|
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
|
|
|
gint width, height;
|
|
|
|
AVCodecContext *ctx;
|
|
|
|
|
|
|
|
if (!gst_structure_get_int (structure, "width", &width))
|
|
|
|
return FALSE;
|
|
|
|
if (!gst_structure_get_int (structure, "height", &height))
|
|
|
|
return FALSE;
|
2005-05-13 15:46:42 +00:00
|
|
|
|
|
|
|
ctx = avcodec_alloc_context ();
|
|
|
|
ctx->width = width;
|
|
|
|
ctx->height = height;
|
|
|
|
ctx->pix_fmt = PIX_FMT_NB;
|
|
|
|
gst_ffmpeg_caps_with_codectype (CODEC_TYPE_VIDEO, caps, ctx);
|
|
|
|
if (ctx->pix_fmt == PIX_FMT_NB) {
|
|
|
|
av_free (ctx);
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
return FALSE;
|
2005-05-13 15:46:42 +00:00
|
|
|
}
|
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
*size = (guint) avpicture_get_size (ctx->pix_fmt, ctx->width, ctx->height);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
av_free (ctx);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
return TRUE;
|
2005-05-13 15:46:42 +00:00
|
|
|
}
|
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
static gboolean
|
|
|
|
gst_ffmpegscale_set_caps (GstBaseTransform * trans, GstCaps * incaps,
|
|
|
|
GstCaps * outcaps)
|
2005-05-13 15:46:42 +00:00
|
|
|
{
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
GstFFMpegScale *scale = GST_FFMPEGSCALE (trans);
|
|
|
|
GstStructure *instructure = gst_caps_get_structure (incaps, 0);
|
|
|
|
GstStructure *outstructure = gst_caps_get_structure (outcaps, 0);
|
|
|
|
gint par_num, par_den;
|
|
|
|
AVCodecContext *ctx;
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
if (!gst_structure_get_int (instructure, "width", &scale->in_width))
|
|
|
|
return FALSE;
|
|
|
|
if (!gst_structure_get_int (instructure, "height", &scale->in_height))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!gst_structure_get_int (outstructure, "width", &scale->out_width))
|
|
|
|
return FALSE;
|
|
|
|
if (!gst_structure_get_int (outstructure, "height", &scale->out_height))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (gst_structure_get_fraction (instructure, "pixel-aspect-ratio",
|
|
|
|
&par_num, &par_den)) {
|
|
|
|
gst_structure_set (outstructure,
|
|
|
|
"pixel-aspect-ratio", GST_TYPE_FRACTION,
|
|
|
|
par_num * scale->in_width / scale->out_width,
|
|
|
|
par_den * scale->in_height / scale->out_height, NULL);
|
|
|
|
}
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
ctx = avcodec_alloc_context ();
|
|
|
|
ctx->width = scale->in_width;
|
|
|
|
ctx->height = scale->in_height;
|
|
|
|
ctx->pix_fmt = PIX_FMT_NB;
|
|
|
|
gst_ffmpeg_caps_with_codectype (CODEC_TYPE_VIDEO, incaps, ctx);
|
|
|
|
if (ctx->pix_fmt == PIX_FMT_NB) {
|
|
|
|
av_free (ctx);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
scale->pixfmt = ctx->pix_fmt;
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
av_free (ctx);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
scale->res = img_resample_init (scale->out_width, scale->out_height,
|
|
|
|
scale->in_width, scale->in_height);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
return TRUE;
|
2005-05-13 15:46:42 +00:00
|
|
|
}
|
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_ffmpegscale_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|
|
|
GstBuffer * outbuf)
|
2005-05-13 15:46:42 +00:00
|
|
|
{
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
GstFFMpegScale *scale = GST_FFMPEGSCALE (trans);
|
|
|
|
AVPicture in_frame, out_frame;
|
2005-05-13 15:46:42 +00:00
|
|
|
|
2007-07-12 11:13:13 +00:00
|
|
|
gst_buffer_copy_metadata (outbuf, inbuf, GST_BUFFER_COPY_TIMESTAMPS);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
gst_ffmpeg_avpicture_fill (&in_frame,
|
|
|
|
GST_BUFFER_DATA (inbuf),
|
|
|
|
scale->pixfmt, scale->in_width, scale->in_height);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
gst_ffmpeg_avpicture_fill (&out_frame,
|
|
|
|
GST_BUFFER_DATA (outbuf),
|
|
|
|
scale->pixfmt, scale->out_width, scale->out_height);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
img_resample (scale->res, &out_frame, &in_frame);
|
2005-05-13 15:46:42 +00:00
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
return GST_FLOW_OK;
|
2005-05-13 15:46:42 +00:00
|
|
|
}
|
|
|
|
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
static gboolean
|
|
|
|
gst_ffmpegscale_handle_src_event (GstPad * pad, GstEvent * event)
|
2005-05-13 15:46:42 +00:00
|
|
|
{
|
2007-06-05 13:41:54 +00:00
|
|
|
GstFFMpegScale *scale;
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
gdouble pointer;
|
2007-06-05 13:41:54 +00:00
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
scale = GST_FFMPEGSCALE (gst_pad_get_parent (pad));
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_NAVIGATION:
|
|
|
|
event =
|
|
|
|
GST_EVENT (gst_mini_object_make_writable (GST_MINI_OBJECT (event)));
|
|
|
|
|
2006-03-31 22:26:12 +00:00
|
|
|
structure = (GstStructure *) gst_event_get_structure (event);
|
ext/ffmpeg/: Port of ffvideoscale to 0.10.
Original commit message from CVS:
Reviewed by : Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_base_init),
(gst_ffmpegscale_class_init), (gst_ffmpegscale_init),
(gst_ffmpegscale_finalize), (gst_ffmpegscale_transform_caps),
(gst_ffmpegscale_fixate_caps), (gst_ffmpegscale_get_unit_size),
(gst_ffmpegscale_set_caps), (gst_ffmpegscale_transform),
(gst_ffmpegscale_handle_src_event), (gst_ffmpegscale_register):
Port of ffvideoscale to 0.10.
Closes #332557
2006-03-01 15:08:08 +00:00
|
|
|
if (gst_structure_get_double (structure, "pointer_x", &pointer)) {
|
|
|
|
gst_structure_set (structure,
|
|
|
|
"pointer_x", G_TYPE_DOUBLE,
|
|
|
|
pointer * scale->in_width / scale->out_width, NULL);
|
|
|
|
}
|
|
|
|
if (gst_structure_get_double (structure, "pointer_y", &pointer)) {
|
|
|
|
gst_structure_set (structure,
|
|
|
|
"pointer_y", G_TYPE_DOUBLE,
|
|
|
|
pointer * scale->in_height / scale->out_height, NULL);
|
|
|
|
}
|
2005-05-13 15:46:42 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-06-05 13:41:54 +00:00
|
|
|
res = gst_pad_event_default (pad, event);
|
|
|
|
|
|
|
|
gst_object_unref (scale);
|
|
|
|
|
|
|
|
return res;
|
2005-05-13 15:46:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gst_ffmpegscale_register (GstPlugin * plugin)
|
|
|
|
{
|
|
|
|
return gst_element_register (plugin, "ffvideoscale",
|
|
|
|
GST_RANK_NONE, GST_TYPE_FFMPEGSCALE);
|
|
|
|
}
|