2003-04-21 21:54:27 +00:00
|
|
|
/* GStreamer xvid encoder plugin
|
|
|
|
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
|
|
|
#include <string.h>
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
|
2003-04-21 21:54:27 +00:00
|
|
|
#include <xvid.h>
|
|
|
|
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
#include <gst/video/video.h>
|
|
|
|
#include "gstxvidenc.h"
|
|
|
|
|
2003-04-21 21:54:27 +00:00
|
|
|
/* elementfactory information */
|
2006-04-25 21:56:38 +00:00
|
|
|
static const GstElementDetails gst_xvidenc_details =
|
2006-04-06 11:35:26 +00:00
|
|
|
GST_ELEMENT_DETAILS ("XviD video encoder",
|
|
|
|
"Codec/Encoder/Video",
|
|
|
|
"XviD encoder based on xvidcore",
|
|
|
|
"Ronald Bultje <rbultje@ronald.bitfreak.net>");
|
2003-04-21 21:54:27 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, YVYU, UYVY }")
|
2004-03-15 19:32:27 +00:00
|
|
|
"; " RGB_24_32_STATIC_CAPS (32, 0x00ff0000, 0x0000ff00,
|
|
|
|
0x000000ff) "; " RGB_24_32_STATIC_CAPS (32, 0xff000000, 0x00ff0000,
|
|
|
|
0x0000ff00) "; " RGB_24_32_STATIC_CAPS (32, 0x0000ff00, 0x00ff0000,
|
|
|
|
0xff000000) "; " RGB_24_32_STATIC_CAPS (32, 0x000000ff, 0x0000ff00,
|
|
|
|
0x00ff0000) "; " RGB_24_32_STATIC_CAPS (24, 0x0000ff, 0x00ff00,
|
|
|
|
0xff0000) "; " GST_VIDEO_CAPS_RGB_15 "; " GST_VIDEO_CAPS_RGB_16)
|
2004-03-14 22:34:33 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("video/x-xvid, "
|
2004-03-15 19:32:27 +00:00
|
|
|
"width = (int) [ 0, MAX ], "
|
2005-12-14 22:41:47 +00:00
|
|
|
"height = (int) [ 0, MAX ], " "framerate = (fraction) [0/1, MAX]")
|
2004-03-14 22:34:33 +00:00
|
|
|
);
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* XvidEnc signals and args */
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-04-21 21:54:27 +00:00
|
|
|
FRAME_ENCODED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-04-21 21:54:27 +00:00
|
|
|
ARG_0,
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
ARG_PROFILE,
|
2003-04-21 21:54:27 +00:00
|
|
|
ARG_BITRATE,
|
|
|
|
ARG_MAXKEYINTERVAL,
|
|
|
|
ARG_BUFSIZE
|
2004-03-14 22:34:33 +00:00
|
|
|
/* FILL ME:
|
|
|
|
* - ME
|
|
|
|
* - VOP
|
|
|
|
* - VOL
|
|
|
|
* - PAR
|
|
|
|
* - max b frames
|
|
|
|
*/
|
2003-04-21 21:54:27 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_xvidenc_base_init (gpointer g_class);
|
|
|
|
static void gst_xvidenc_class_init (GstXvidEncClass * klass);
|
|
|
|
static void gst_xvidenc_init (GstXvidEnc * xvidenc);
|
2005-12-14 22:41:47 +00:00
|
|
|
static GstFlowReturn gst_xvidenc_chain (GstPad * pad, GstBuffer * buf);
|
|
|
|
static gboolean gst_xvidenc_setcaps (GstPad * pad, GstCaps * caps);
|
|
|
|
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
/* properties */
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_xvidenc_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_xvidenc_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
2005-09-05 17:20:29 +00:00
|
|
|
static GstStateChangeReturn gst_xvidenc_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
static guint gst_xvidenc_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
#define GST_TYPE_XVIDENC_PROFILE (gst_xvidenc_profile_get_type ())
|
|
|
|
|
|
|
|
static GType
|
|
|
|
gst_xvidenc_profile_get_type (void)
|
|
|
|
{
|
|
|
|
static GType xvidenc_profile_type = 0;
|
|
|
|
|
|
|
|
if (!xvidenc_profile_type) {
|
|
|
|
static const GEnumValue xvidenc_profiles[] = {
|
2004-03-14 22:34:33 +00:00
|
|
|
{XVID_PROFILE_S_L0, "S_L0", "Simple profile, L0"},
|
|
|
|
{XVID_PROFILE_S_L1, "S_L1", "Simple profile, L1"},
|
|
|
|
{XVID_PROFILE_S_L2, "S_L2", "Simple profile, L2"},
|
|
|
|
{XVID_PROFILE_S_L3, "S_L3", "Simple profile, L3"},
|
|
|
|
{XVID_PROFILE_ARTS_L1, "ARTS_L1",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Advanced real-time simple profile, L1"},
|
2004-03-14 22:34:33 +00:00
|
|
|
{XVID_PROFILE_ARTS_L2, "ARTS_L2",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Advanced real-time simple profile, L2"},
|
2004-03-14 22:34:33 +00:00
|
|
|
{XVID_PROFILE_ARTS_L3, "ARTS_L3",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Advanced real-time simple profile, L3"},
|
2004-03-14 22:34:33 +00:00
|
|
|
{XVID_PROFILE_ARTS_L4, "ARTS_L4",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Advanced real-time simple profile, L4"},
|
2004-03-14 22:34:33 +00:00
|
|
|
{XVID_PROFILE_AS_L0, "AS_L0", "Advanced simple profile, L0"},
|
|
|
|
{XVID_PROFILE_AS_L1, "AS_L1", "Advanced simple profile, L1"},
|
|
|
|
{XVID_PROFILE_AS_L2, "AS_L2", "Advanced simple profile, L2"},
|
|
|
|
{XVID_PROFILE_AS_L3, "AS_L3", "Advanced simple profile, L3"},
|
|
|
|
{XVID_PROFILE_AS_L4, "AS_L4", "Advanced simple profile, L4"},
|
|
|
|
{0, NULL, NULL},
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
xvidenc_profile_type =
|
2004-03-15 19:32:27 +00:00
|
|
|
g_enum_register_static ("GstXvidEncProfiles", xvidenc_profiles);
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return xvidenc_profile_type;
|
|
|
|
}
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
GType
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_xvidenc_get_type (void)
|
2003-04-21 21:54:27 +00:00
|
|
|
{
|
|
|
|
static GType xvidenc_type = 0;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if (!xvidenc_type) {
|
2003-04-21 21:54:27 +00:00
|
|
|
static const GTypeInfo xvidenc_info = {
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstXvidEncClass),
|
2003-11-02 02:31:04 +00:00
|
|
|
gst_xvidenc_base_init,
|
2003-04-21 21:54:27 +00:00
|
|
|
NULL,
|
|
|
|
(GClassInitFunc) gst_xvidenc_class_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstXvidEnc),
|
2003-04-21 21:54:27 +00:00
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gst_xvidenc_init,
|
|
|
|
};
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
xvidenc_type = g_type_register_static (GST_TYPE_ELEMENT,
|
2004-03-15 19:32:27 +00:00
|
|
|
"GstXvidEnc", &xvidenc_info, 0);
|
2003-04-21 21:54:27 +00:00
|
|
|
}
|
|
|
|
return xvidenc_type;
|
|
|
|
}
|
|
|
|
|
2003-11-02 02:31:04 +00:00
|
|
|
static void
|
|
|
|
gst_xvidenc_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_static_pad_template_get (&sink_template));
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_static_pad_template_get (&src_template));
|
2003-11-02 02:31:04 +00:00
|
|
|
gst_element_class_set_details (element_class, &gst_xvidenc_details);
|
|
|
|
}
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_xvidenc_class_init (GstXvidEncClass * klass)
|
2003-04-21 21:54:27 +00:00
|
|
|
{
|
2005-12-14 22:41:47 +00:00
|
|
|
GstElementClass *gstelement_class = (GstElementClass *) klass;
|
|
|
|
GObjectClass *gobject_class = (GObjectClass *) klass;
|
2003-07-29 11:59:09 +00:00
|
|
|
|
2005-12-14 22:41:47 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2003-04-21 21:54:27 +00:00
|
|
|
|
2005-12-14 22:41:47 +00:00
|
|
|
gobject_class->set_property = gst_xvidenc_set_property;
|
|
|
|
gobject_class->get_property = gst_xvidenc_get_property;
|
2003-04-21 21:54:27 +00:00
|
|
|
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
/* encoding profile */
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_PROFILE,
|
|
|
|
g_param_spec_enum ("profile", "Profile", "XviD/MPEG-4 encoding profile",
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_TYPE_XVIDENC_PROFILE, XVID_PROFILE_S_L0, G_PARAM_READWRITE));
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
|
|
|
|
/* bitrate */
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_BITRATE,
|
|
|
|
g_param_spec_int ("bitrate", "Bitrate",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Target video bitrate (kbps)", 0, G_MAXINT, 512, G_PARAM_READWRITE));
|
2003-04-21 21:54:27 +00:00
|
|
|
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
/* keyframe interval */
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_MAXKEYINTERVAL,
|
|
|
|
g_param_spec_int ("max_key_interval", "Max. Key Interval",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Maximum number of frames between two keyframes",
|
2004-05-03 17:27:19 +00:00
|
|
|
-1, G_MAXINT, -1, G_PARAM_READWRITE));
|
2003-04-21 21:54:27 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_BUFSIZE,
|
|
|
|
g_param_spec_ulong ("buffer_size", "Buffer Size",
|
2004-03-15 19:32:27 +00:00
|
|
|
"Size of the video buffers", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
|
2003-04-21 21:54:27 +00:00
|
|
|
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
gstelement_class->change_state = gst_xvidenc_change_state;
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
gst_xvidenc_signals[FRAME_ENCODED] =
|
2004-03-14 22:34:33 +00:00
|
|
|
g_signal_new ("frame-encoded", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GstXvidEncClass, frame_encoded),
|
|
|
|
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
2003-04-21 21:54:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_xvidenc_init (GstXvidEnc * xvidenc)
|
2003-04-21 21:54:27 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_xvid_init ();
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
|
2003-04-21 21:54:27 +00:00
|
|
|
/* create the sink pad */
|
2004-03-14 22:34:33 +00:00
|
|
|
xvidenc->sinkpad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&sink_template),
|
|
|
|
"sink");
|
|
|
|
gst_pad_set_chain_function (xvidenc->sinkpad, gst_xvidenc_chain);
|
2005-12-14 22:41:47 +00:00
|
|
|
gst_pad_set_setcaps_function (xvidenc->sinkpad, gst_xvidenc_setcaps);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (xvidenc), xvidenc->sinkpad);
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
/* create the src pad */
|
2004-03-14 22:34:33 +00:00
|
|
|
xvidenc->srcpad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&src_template),
|
|
|
|
"src");
|
|
|
|
gst_element_add_pad (GST_ELEMENT (xvidenc), xvidenc->srcpad);
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
/* bitrate, etc. */
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
xvidenc->width = xvidenc->height = xvidenc->csp = xvidenc->stride = -1;
|
|
|
|
xvidenc->profile = XVID_PROFILE_S_L0;
|
|
|
|
xvidenc->bitrate = 512;
|
2006-03-23 09:15:09 +00:00
|
|
|
xvidenc->max_b_frames = 0;
|
2004-03-15 19:32:27 +00:00
|
|
|
xvidenc->max_key_interval = -1; /* default - 2*fps */
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
xvidenc->buffer_size = 512;
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
/* set xvid handle to NULL */
|
|
|
|
xvidenc->handle = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_xvidenc_setup (GstXvidEnc * xvidenc)
|
2003-04-21 21:54:27 +00:00
|
|
|
{
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
xvid_enc_create_t xenc;
|
|
|
|
xvid_enc_plugin_t xplugin;
|
|
|
|
xvid_plugin_single_t xsingle;
|
|
|
|
gint ret;
|
|
|
|
|
|
|
|
/* see xvid.h for the meaning of all this. */
|
|
|
|
gst_xvid_init_struct (xenc);
|
|
|
|
xenc.profile = xvidenc->profile;
|
2003-04-21 21:54:27 +00:00
|
|
|
xenc.width = xvidenc->width;
|
|
|
|
xenc.height = xvidenc->height;
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
xenc.max_bframes = xvidenc->max_b_frames;
|
|
|
|
xenc.global = XVID_GLOBAL_PACKED;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2006-03-23 09:15:09 +00:00
|
|
|
/* frame duration = fincr/fbase, is inverse of framerate */
|
|
|
|
xenc.fincr = xvidenc->fps_d;
|
|
|
|
xenc.fbase = xvidenc->fps_n;
|
2003-04-21 21:54:27 +00:00
|
|
|
xenc.max_key_interval = (xvidenc->max_key_interval == -1) ?
|
2004-03-14 22:34:33 +00:00
|
|
|
(2 * xenc.fbase / xenc.fincr) : xvidenc->max_key_interval;
|
2003-04-21 21:54:27 +00:00
|
|
|
xenc.handle = NULL;
|
|
|
|
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
/* CBR bitrate/quant for now */
|
|
|
|
gst_xvid_init_struct (xsingle);
|
|
|
|
xsingle.bitrate = xvidenc->bitrate << 10;
|
|
|
|
xsingle.reaction_delay_factor = -1;
|
|
|
|
xsingle.averaging_period = -1;
|
|
|
|
xsingle.buffer = -1;
|
|
|
|
|
|
|
|
/* set CBR plugin */
|
|
|
|
xenc.num_plugins = 1;
|
|
|
|
xenc.plugins = &xplugin;
|
|
|
|
xenc.plugins[0].func = xvid_plugin_single;
|
|
|
|
xenc.plugins[0].param = &xsingle;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if ((ret = xvid_encore (NULL, XVID_ENC_CREATE, &xenc, NULL)) < 0) {
|
2004-02-02 17:23:33 +00:00
|
|
|
GST_ELEMENT_ERROR (xvidenc, LIBRARY, INIT, (NULL),
|
2004-03-15 19:32:27 +00:00
|
|
|
("Error setting up xvid encoder: %s (%d)", gst_xvid_error (ret), ret));
|
2003-04-21 21:54:27 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
xvidenc->handle = xenc.handle;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-12-14 22:41:47 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_xvidenc_chain (GstPad * pad, GstBuffer * buf)
|
2003-04-21 21:54:27 +00:00
|
|
|
{
|
2005-12-14 22:41:47 +00:00
|
|
|
GstXvidEnc *xvidenc = GST_XVIDENC (gst_pad_get_parent (pad));
|
2003-04-21 21:54:27 +00:00
|
|
|
GstBuffer *outbuf;
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
xvid_enc_frame_t xframe;
|
|
|
|
xvid_enc_stats_t xstats;
|
2005-12-15 14:39:00 +00:00
|
|
|
gint res;
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2003-04-21 21:54:27 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
outbuf = gst_buffer_new_and_alloc (xvidenc->buffer_size << 10);
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
/* encode and so ... */
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
gst_xvid_init_struct (xframe);
|
2004-03-14 22:34:33 +00:00
|
|
|
xframe.vol_flags = XVID_VOL_MPEGQUANT | XVID_VOL_GMC;
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
xframe.par = XVID_PAR_11_VGA;
|
|
|
|
xframe.vop_flags = XVID_VOP_TRELLISQUANT;
|
|
|
|
xframe.motion = 0;
|
|
|
|
xframe.input.csp = xvidenc->csp;
|
|
|
|
if (xvidenc->width == xvidenc->stride) {
|
2004-03-14 22:34:33 +00:00
|
|
|
xframe.input.plane[0] = GST_BUFFER_DATA (buf);
|
|
|
|
xframe.input.plane[1] =
|
2004-03-15 19:32:27 +00:00
|
|
|
xframe.input.plane[0] + (xvidenc->width * xvidenc->height);
|
2004-03-14 22:34:33 +00:00
|
|
|
xframe.input.plane[2] =
|
2004-03-15 19:32:27 +00:00
|
|
|
xframe.input.plane[1] + (xvidenc->width * xvidenc->height / 4);
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
xframe.input.stride[0] = xvidenc->width;
|
|
|
|
xframe.input.stride[1] = xvidenc->width / 2;
|
|
|
|
xframe.input.stride[2] = xvidenc->width / 2;
|
|
|
|
} else {
|
2004-03-14 22:34:33 +00:00
|
|
|
xframe.input.plane[0] = GST_BUFFER_DATA (buf);
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
xframe.input.stride[0] = xvidenc->stride;
|
|
|
|
}
|
|
|
|
xframe.type = XVID_TYPE_AUTO;
|
2004-03-14 22:34:33 +00:00
|
|
|
xframe.bitstream = (void *) GST_BUFFER_DATA (outbuf);
|
2005-12-14 22:41:47 +00:00
|
|
|
xframe.length = GST_BUFFER_SIZE (outbuf); /* GST_BUFFER_MAXSIZE */
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
gst_xvid_init_struct (xstats);
|
2003-04-21 21:54:27 +00:00
|
|
|
|
2005-12-15 14:39:00 +00:00
|
|
|
if ((res = xvid_encore (xvidenc->handle, XVID_ENC_ENCODE,
|
2004-03-15 19:32:27 +00:00
|
|
|
&xframe, &xstats)) < 0) {
|
2004-02-02 17:23:33 +00:00
|
|
|
GST_ELEMENT_ERROR (xvidenc, LIBRARY, ENCODE, (NULL),
|
2005-12-15 14:39:00 +00:00
|
|
|
("Error encoding xvid frame: %s (%d)", gst_xvid_error (res), res));
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_buffer_unref (outbuf);
|
2005-12-15 14:39:00 +00:00
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto cleanup;
|
2003-04-21 21:54:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_BUFFER_SIZE (outbuf) = xstats.length;
|
2003-04-21 21:54:27 +00:00
|
|
|
|
2006-03-23 09:15:09 +00:00
|
|
|
/* mark whether key-frame = !delta-unit or not */
|
|
|
|
if (!(xframe.out_flags & XVID_KEYFRAME))
|
|
|
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
|
|
|
|
|
2003-04-21 21:54:27 +00:00
|
|
|
/* go out, multiply! */
|
2005-12-14 22:41:47 +00:00
|
|
|
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (xvidenc->srcpad));
|
2005-12-15 14:39:00 +00:00
|
|
|
ret = gst_pad_push (xvidenc->srcpad, outbuf);
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
/* proclaim destiny */
|
2004-03-14 22:34:33 +00:00
|
|
|
g_signal_emit (G_OBJECT (xvidenc), gst_xvidenc_signals[FRAME_ENCODED], 0);
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
/* until the final judgement */
|
2005-12-15 14:39:00 +00:00
|
|
|
|
|
|
|
cleanup:
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_buffer_unref (buf);
|
2005-12-15 14:39:00 +00:00
|
|
|
gst_object_unref (xvidenc);
|
|
|
|
return ret;
|
2003-04-21 21:54:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-12-14 22:41:47 +00:00
|
|
|
static gboolean
|
|
|
|
gst_xvidenc_setcaps (GstPad * pad, GstCaps * caps)
|
2003-04-21 21:54:27 +00:00
|
|
|
{
|
2005-12-15 14:39:00 +00:00
|
|
|
GstCaps *new_caps = NULL;
|
2003-04-21 21:54:27 +00:00
|
|
|
GstXvidEnc *xvidenc;
|
2005-12-14 22:41:47 +00:00
|
|
|
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
const gchar *mime;
|
|
|
|
gint w, h;
|
2005-12-14 22:41:47 +00:00
|
|
|
const GValue *fps;
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
gint xvid_cs = -1, stride = -1;
|
2005-12-15 14:39:00 +00:00
|
|
|
gboolean ret = FALSE;
|
2003-04-21 21:54:27 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
xvidenc = GST_XVIDENC (gst_pad_get_parent (pad));
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
/* if there's something old around, remove it */
|
|
|
|
if (xvidenc->handle) {
|
2004-03-14 22:34:33 +00:00
|
|
|
xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL);
|
2003-04-21 21:54:27 +00:00
|
|
|
xvidenc->handle = NULL;
|
|
|
|
}
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_structure_get_int (structure, "width", &w);
|
|
|
|
gst_structure_get_int (structure, "height", &h);
|
2003-04-21 21:54:27 +00:00
|
|
|
|
2005-12-14 22:41:47 +00:00
|
|
|
fps = gst_structure_get_value (structure, "framerate");
|
2005-12-15 14:39:00 +00:00
|
|
|
if (fps != NULL) {
|
2005-12-14 22:41:47 +00:00
|
|
|
xvidenc->fps_n = gst_value_get_fraction_numerator (fps);
|
|
|
|
xvidenc->fps_d = gst_value_get_fraction_denominator (fps);
|
|
|
|
} else {
|
|
|
|
xvidenc->fps_n = -1;
|
|
|
|
}
|
2003-07-06 20:49:52 +00:00
|
|
|
|
2005-12-14 22:41:47 +00:00
|
|
|
mime = gst_structure_get_name (structure);
|
|
|
|
xvid_cs = gst_xvid_structure_to_csp (structure, w, &stride, NULL);
|
2003-12-22 01:47:09 +00:00
|
|
|
xvidenc->csp = xvid_cs;
|
|
|
|
xvidenc->width = w;
|
|
|
|
xvidenc->height = h;
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
xvidenc->stride = stride;
|
2003-07-06 20:49:52 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if (gst_xvidenc_setup (xvidenc)) {
|
2003-07-06 20:49:52 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
new_caps = gst_caps_new_simple ("video/x-xvid",
|
2004-03-15 19:32:27 +00:00
|
|
|
"width", G_TYPE_INT, w,
|
2005-12-14 22:41:47 +00:00
|
|
|
"height", G_TYPE_INT, h,
|
|
|
|
"framerate", GST_TYPE_FRACTION, xvidenc->fps_n, xvidenc->fps_d, NULL);
|
2005-12-15 14:39:00 +00:00
|
|
|
|
|
|
|
if (new_caps) {
|
|
|
|
|
|
|
|
if (!gst_pad_set_caps (xvidenc->srcpad, new_caps)) {
|
|
|
|
if (xvidenc->handle) {
|
|
|
|
xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL);
|
|
|
|
xvidenc->handle = NULL;
|
|
|
|
}
|
|
|
|
ret = FALSE;
|
|
|
|
goto cleanup;
|
2003-12-22 01:47:09 +00:00
|
|
|
}
|
2005-12-15 14:39:00 +00:00
|
|
|
ret = TRUE;
|
|
|
|
goto cleanup;
|
|
|
|
|
2003-07-06 20:49:52 +00:00
|
|
|
}
|
2005-12-15 14:39:00 +00:00
|
|
|
|
2003-04-21 21:54:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* if we got here - it's not good */
|
2005-12-15 14:39:00 +00:00
|
|
|
ret = FALSE;
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
|
|
|
|
if (new_caps) {
|
|
|
|
gst_caps_unref (new_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (xvidenc);
|
|
|
|
return ret;
|
|
|
|
|
2003-04-21 21:54:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_xvidenc_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
2003-04-21 21:54:27 +00:00
|
|
|
{
|
2005-12-14 22:41:47 +00:00
|
|
|
GstXvidEnc *xvidenc = GST_XVIDENC (object);
|
2003-04-21 21:54:27 +00:00
|
|
|
|
2005-12-14 22:41:47 +00:00
|
|
|
GST_OBJECT_LOCK (xvidenc);
|
2003-04-21 21:54:27 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
switch (prop_id) {
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
case ARG_PROFILE:
|
2004-03-14 22:34:33 +00:00
|
|
|
xvidenc->profile = g_value_get_enum (value);
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
break;
|
2003-04-21 21:54:27 +00:00
|
|
|
case ARG_BITRATE:
|
2004-03-14 22:34:33 +00:00
|
|
|
xvidenc->bitrate = g_value_get_int (value);
|
2003-04-21 21:54:27 +00:00
|
|
|
break;
|
|
|
|
case ARG_BUFSIZE:
|
2004-03-25 02:32:33 +00:00
|
|
|
xvidenc->buffer_size = g_value_get_ulong (value);
|
2003-04-21 21:54:27 +00:00
|
|
|
break;
|
|
|
|
case ARG_MAXKEYINTERVAL:
|
2004-03-14 22:34:33 +00:00
|
|
|
xvidenc->max_key_interval = g_value_get_int (value);
|
2003-04-21 21:54:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-12-14 22:41:47 +00:00
|
|
|
GST_OBJECT_UNLOCK (xvidenc);
|
|
|
|
|
|
|
|
}
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_xvidenc_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
2003-04-21 21:54:27 +00:00
|
|
|
{
|
2005-12-14 22:41:47 +00:00
|
|
|
GstXvidEnc *xvidenc = GST_XVIDENC (object);
|
2003-04-21 21:54:27 +00:00
|
|
|
|
2005-12-14 22:41:47 +00:00
|
|
|
GST_OBJECT_LOCK (xvidenc);
|
2003-04-21 21:54:27 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
case ARG_PROFILE:
|
2004-03-14 22:34:33 +00:00
|
|
|
g_value_set_enum (value, xvidenc->profile);
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
break;
|
2003-04-21 21:54:27 +00:00
|
|
|
case ARG_BITRATE:
|
2004-03-14 22:34:33 +00:00
|
|
|
g_value_set_int (value, xvidenc->bitrate);
|
2003-04-21 21:54:27 +00:00
|
|
|
break;
|
|
|
|
case ARG_BUFSIZE:
|
2004-03-25 02:32:33 +00:00
|
|
|
g_value_set_ulong (value, xvidenc->buffer_size);
|
2003-04-21 21:54:27 +00:00
|
|
|
break;
|
|
|
|
case ARG_MAXKEYINTERVAL:
|
2004-03-14 22:34:33 +00:00
|
|
|
g_value_set_int (value, xvidenc->max_key_interval);
|
2003-04-21 21:54:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2005-12-14 22:41:47 +00:00
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (xvidenc);
|
2003-04-21 21:54:27 +00:00
|
|
|
}
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_xvidenc_change_state (GstElement * element, GstStateChange transition)
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
{
|
|
|
|
GstXvidEnc *xvidenc = GST_XVIDENC (element);
|
2005-12-14 22:41:47 +00:00
|
|
|
GstStateChangeReturn ret;
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
|
2005-12-14 22:41:47 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = parent_class->change_state (element, transition);
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
|
|
|
break;
|
2005-09-05 17:20:29 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
if (xvidenc->handle) {
|
2004-03-15 19:32:27 +00:00
|
|
|
xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL);
|
|
|
|
xvidenc->handle = NULL;
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
}
|
|
|
|
break;
|
2005-12-14 22:41:47 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
|
|
|
break;
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-12-14 22:41:47 +00:00
|
|
|
return ret;
|
Update xvid plugin to latest xvid (1.0.0-beta3) API.
Original commit message from CVS:
2004-01-03 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/xvid/gstxvid.c: (gst_xvid_init), (gst_xvid_error),
(gst_xvid_structure_to_csp), (gst_xvid_csp_to_caps):
* ext/xvid/gstxvid.h:
* ext/xvid/gstxviddec.c: (gst_xviddec_class_init),
(gst_xviddec_init), (gst_xviddec_setup), (gst_xviddec_chain),
(gst_xviddec_src_link), (gst_xviddec_sink_link),
(gst_xviddec_change_state):
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.c: (gst_xvidenc_profile_get_type),
(gst_xvidenc_base_init), (gst_xvidenc_class_init),
(gst_xvidenc_init), (gst_xvidenc_setup), (gst_xvidenc_chain),
(gst_xvidenc_link), (gst_xvidenc_set_property),
(gst_xvidenc_get_property), (gst_xvidenc_change_state):
* ext/xvid/gstxvidenc.h:
Update xvid plugin to latest xvid (1.0.0-beta3) API.
2004-01-03 19:38:40 +00:00
|
|
|
}
|