Commit f6186655 authored by Edward Hervey's avatar Edward Hervey 🤘

Merging GST_FFMPEG_NO_MIRROR branch to trunk

Original commit message from CVS:
Merging GST_FFMPEG_NO_MIRROR branch to trunk
parent 22e3b86e
2007-12-17 Edward Hervey <edward.hervey@collabora.co.uk>
* configure.ac:
Minor typo in disabling cavs decoder. Now compiles AND works on x86 32
and 64 bits ! Time to merge :)
2007-12-17 Edward Hervey <edward.hervey@collabora.co.uk>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open):
Handle VC-1 properly , which is handled differently from WMV3.
2007-12-17 Edward Hervey <edward.hervey@collabora.co.uk>
* autogen.sh:
Fix call to ffmpegrev
* configure.ac:
Re-apply -fPIC extra-cflag for ffmpeg while removing support for the
flac encoder which is currently broken for x86/32bits with -fPIC.
* ffmpegrev:
Switch to latest upstream revision so we can have the split-up for
flac mmx optimizations.
2007-12-15 Sebastian Dröge <slomo@circular-chaos.org>
Based on a patch by:
Hans de Goede <j dot w dot r degoede at hhs dot nl>
* ext/ffmpeg/gstffmpegcfg.c: (gst_ffmpeg_pre_me_get_type),
(gst_ffmpeg_pred_method_get_type):
NULL-terminate the GEnumValue arrays, otherwise they will cause
crashes. Fixes #503733.
2007-12-09 Sebastian Dröge <slomo@circular-chaos.org>
* configure.ac:
Don't define GST_DISABLE_DEPRECATED for releases. Fixes #498181.
2007-11-28 Edward Hervey <bilboed@bilboed.com>
* configure.ac:
Temporarily remove fPIC option for building ffmpeg
* ffmpegrev:
Switch to latest ffmpeg checkout so people can enjoy all the niceties
that have just landed (mmx optimisations for vc1 and h263, bugfixes,..)
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_collected),
(gst_ffmpegmux_change_state):
Adjust code to ffmpeg API changes.
2007-11-22 Edward Hervey <bilboed@bilboed.com>
* ext/ffmpeg/gstffmpegaudioresample.c:
(gst_ffmpegaudioresample_get_unit_size),
(gst_ffmpegaudioresample_transform):
Correct the output size of the buffer.
2007-11-15 Edward Hervey <bilboed@bilboed.com>
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpeg.h:
* ext/ffmpeg/gstffmpegaudioresample.c:
(gst_ffmpegaudioresample_base_init),
(gst_ffmpegaudioresample_class_init),
(gst_ffmpegaudioresample_init), (gst_ffmpegaudioresample_finalize),
(gst_ffmpegaudioresample_transform_caps),
(gst_ffmpegaudioresample_transform_size),
(gst_ffmpegaudioresample_get_unit_size),
(gst_ffmpegaudioresample_set_caps),
(gst_ffmpegaudioresample_transform),
(gst_ffmpegaudioresample_register):
Added new ffaudioresample element using the ffmpeg resampling code.
It's (way) faster than audioresample, doesn't introduce latency, but
might cause a little bit of 'clicking'.
2007-11-15 Edward Hervey <bilboed@bilboed.com>
* Makefile.am:
* autogen.sh:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ffmpegrev:
* gst-libs/ext/Makefile.am:
Initial patch of the new mirror-less build-system for gst-ffmpeg using
specific revisions of ffmpeg svn instead.
Might still have some issues, we need people to try this.
Help by : Dejan Sakelšak <sakdean at gmail dot com>
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid),
(gst_ffmpeg_get_codecid_longname):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_base_init),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_audio_frame),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_register):
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_register):
Update code for new ffmpeg API.
2007-12-04 Edward Hervey <bilboed@bilboed.com>
* configure.ac:
......
......@@ -8,7 +8,7 @@ debug:
echo $(win32)
EXTRA_DIST = \
gst-ffmpeg.spec depcomp \
gst-ffmpeg.spec depcomp ffmpegrev \
AUTHORS COPYING NEWS README ChangeLog gst-ffmpeg.doap \
$(win32)
......
......@@ -5,6 +5,9 @@ DIE=0
package=gst-ffmpeg
srcfile=configure.ac
# FFMPEG specific properties
. ./ffmpegrev
# a quick cvs co if necessary to alleviate the pain - may remove this
# when developers get a clue ;)
if test ! -d common;
......@@ -13,11 +16,16 @@ then
cvs co common
fi
if test ! -f gst-libs/ext/ffmpeg/autogen.sh
then
rm -rf gst-libs/ext/ffmpeg
echo "+ getting ffmpeg from cvs"
cvs co mirror-ffmpeg
if test ! -f $FFMPEG_CO_DIR/configure
then
# checkout ffmpeg from its repository
rm -rf $FFMPEG_CO_DIR
echo "+ getting ffmpeg from svn"
svn -r $FFMPEG_REVISION co $FFMPEG_SVN $FFMPEG_CO_DIR
else
# update ffmpeg from its repository
echo "+ updating ffmpeg checkout"
svn -r $FFMPEG_REVISION up $FFMPEG_CO_DIR
fi
......@@ -30,7 +38,23 @@ then
fi
. common/gst-autogen.sh
CONFIGURE_DEF_OPT='--enable-maintainer-mode --enable-gtk-doc'
# Let's check if we can disable the building of the ffmpeg binary
can_disable=`$FFMPEG_CO_DIR/configure --help | grep 'disable-ffmpeg' | wc -l`
if [ $can_disable != "0" ]
then
CONFIGURE_DEF_OPT="--disable-ffmpeg"
fi
# Let's clear the 'exit 1' command when we post an Unknown option
echo "Patching ffmpeg ./configure"
sed -e '/Unknown option/ {
N
N
s/exit 1/#/
}' $FFMPEG_CO_DIR/configure > $FFMPEG_CO_DIR/configure.tmp
mv $FFMPEG_CO_DIR/configure.tmp $FFMPEG_CO_DIR/configure
chmod +x $FFMPEG_CO_DIR/configure
autogen_options $@
......@@ -88,17 +112,6 @@ if test -f disable; then
done
fi
# remove ffmpeg's configure, it's going to get created anyway and it probably
# conflicted before this too
rm -f gst-libs/ext/ffmpeg/configure
# now, run ffmpeg's autogen
echo "+ running autogen.sh in gst-libs/ext/ffmpeg"
cd gst-libs/ext/ffmpeg
chmod +x autogen.sh
./autogen.sh || exit 1
cd ../../..
test -n "$NOCONFIGURE" && {
echo "+ skipping configure stage for package $package, as requested."
echo "+ autogen.sh done."
......
common @ a00d4c19
Subproject commit 423e2ea96b5f79281f4dd20d734bd968b3d95e89
Subproject commit a00d4c1966aab517c2694c61d580489ebcbce448
......@@ -113,11 +113,14 @@ AM_CONDITIONAL(HAVE_GST_CHECK, test "x$HAVE_GST_CHECK" = "xyes")
AC_MSG_NOTICE(Using GStreamer Core Plugins in $GST_PLUGINS_DIR)
AC_MSG_NOTICE(Using GStreamer Base Plugins in $GSTPB_PLUGINS_DIR)
dnl liboil is required
dnl liboil is required for cpu detection for libpostproc
dnl FIXME : In theory we should be able to compile libpostproc with cpudetect
dnl capabilities, which would enable us to get rid of this
PKG_CHECK_MODULES(LIBOIL, liboil-$LIBOIL_MAJORMINOR >= $LIBOIL_REQ, HAVE_LIBOIL=yes, HAVE_LIBOIL=no)
if test "x$HAVE_LIBOIL" != "xyes"
then
AC_ERROR([liboil-$LIBOIL_REQ or later is required])
AC_MSG_ERROR([liboil-$LIBOIL_REQ or later is required])
AC_ERROR
fi
AC_SUBST(LIBOIL_CFLAGS)
......@@ -150,7 +153,11 @@ if test "x$USE_DEBUG" = xyes; then
fi
AC_SUBST(PROFILE_CFLAGS)
DEPRECATED_CFLAGS="-DGST_DISABLE_DEPRECATED"
if test "x$GST_CVS" = "xyes"; then
DEPRECATED_CFLAGS="-DGST_DISABLE_DEPRECATED"
else
DEPRECATED_CFLAGS=""
fi
AC_SUBST(DEPRECATED_CFLAGS)
dnl every flag in GST_OPTION_CFLAGS can be overridden at make time
......@@ -235,26 +242,48 @@ if test "x$with_system_ffmpeg" = "xyes"; then
dnl No, this is not too extreme, we want people to see and read the above
sleep 15
else
source ./ffmpegrev
AC_MSG_NOTICE([Using ffmpeg revision $FFMPEG_REVISION])
dnl libgstffmpeg.la: include dirs
FFMPEG_CFLAGS="-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavformat \
-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavutil \
-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavcodec"
FFMPEG_LIBS="\$(top_builddir)/gst-libs/ext/ffmpeg/libavformat/libavformat.la"
-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavcodec -Wno-deprecated-declarations"
dnl libgstffmpeg.la: libs to statically link to
FFMPEG_LIBS="\$(top_builddir)/gst-libs/ext/ffmpeg/libavformat/libavformat.a \
\$(top_builddir)/gst-libs/ext/ffmpeg/libavcodec/libavcodec.a \
\$(top_builddir)/gst-libs/ext/ffmpeg/libavutil/libavutil.a \
-lz"
dnl
POSTPROC_CFLAGS="-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libpostproc \
-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavformat \
-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavutil \
-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavcodec"
POSTPROC_LIBS="\$(top_builddir)/gst-libs/ext/ffmpeg/libavcodec/libavcodec.la"
dnl libgstpostproc.la: libs to statically link to
POSTPROC_LIBS="\$(top_builddir)/gst-libs/ext/ffmpeg/libpostproc/libpostproc.a \
\$(top_builddir)/gst-libs/ext/ffmpeg/libavutil/libavutil.a"
FFMPEG_SUBDIRS=gst-libs
AC_DEFINE(HAVE_AVI_H)
AC_DEFINE([FFMPEG_SOURCE], ["local snapshot"], [Describes where the FFmpeg libraries come from.])
ac_configure_args="$ac_configure_args --disable-v4l --disable-audio-oss --disable-dv1394 --disable-vhook --disable-ffmpeg --disable-ffserver --disable-ffplay --disable-sdltest --enable-pp"
ac_configure_args="$ac_configure_args --disable-vhook --disable-ffserver --disable-ffplay --enable-pp --enable-gpl --enable-static --disable-shared --disable-encoder=flac --disable-decoder=cavs --extra-cflags=-fPIC"
AC_SUBST(FFMPEG_CO_DIR)
AC_SUBST(FFMPEG_SVN)
AC_SUBST(FFMPEG_REVISION)
AC_CONFIG_SUBDIRS(gst-libs/ext/ffmpeg)
AC_MSG_NOTICE([Using included FFMpeg code])
fi
AC_SUBST(FFMPEG_CFLAGS)
AC_SUBST(FFMPEG_LIBS)
AC_SUBST(FFMPEG_SUBDIRS)
AC_SUBST(POSTPROC_CFLAGS)
AC_SUBST(POSTPROC_LIBS)
AC_DEFINE_UNQUOTED(HAVE_FFMPEG_UNINSTALLED, $HAVE_FFMPEG_UNINSTALLED,
[Defined if building against uninstalled FFmpeg source])
AM_CONDITIONAL(HAVE_FFMPEG_UNINSTALLED, test x$HAVE_FFMPEG_UNINSTALLED = x1)
......
......@@ -9,7 +9,9 @@ libgstffmpeg_la_SOURCES = gstffmpeg.c \
gstffmpegdemux.c \
gstffmpegmux.c \
gstffmpegdeinterlace.c \
gstffmpegscale.c
gstffmpegaudioresample.c
# \
# gstffmpegscale.c
libgstffmpeg_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
$(FFMPEG_CFLAGS)
......
......@@ -143,10 +143,13 @@ plugin_init (GstPlugin * plugin)
gst_ffmpegdemux_register (plugin);
gst_ffmpegmux_register (plugin);
gst_ffmpegdeinterlace_register (plugin);
#if 0
gst_ffmpegscale_register (plugin);
#endif
#if 0
gst_ffmpegcsp_register (plugin);
#endif
gst_ffmpegaudioresample_register (plugin);
register_protocol (&gstreamer_protocol);
......
......@@ -48,7 +48,10 @@ extern gboolean gst_ffmpegdec_register (GstPlugin * plugin);
extern gboolean gst_ffmpegenc_register (GstPlugin * plugin);
extern gboolean gst_ffmpegmux_register (GstPlugin * plugin);
extern gboolean gst_ffmpegcsp_register (GstPlugin * plugin);
#if 0
extern gboolean gst_ffmpegscale_register (GstPlugin * plugin);
#endif
extern gboolean gst_ffmpegaudioresample_register (GstPlugin * plugin);
extern gboolean gst_ffmpegdeinterlace_register (GstPlugin * plugin);
int gst_ffmpeg_avcodec_open (AVCodecContext *avctx, AVCodec *codec);
......
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* This file:
* Copyright (C) 2005 Luca Ognibene <luogni@tin.it>
* Copyright (C) 2006 Martin Zlomek <martin.zlomek@itonis.tv>
*
* 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
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
#include <gst/video/video.h>
#include "gstffmpeg.h"
#include "gstffmpegcodecmap.h"
typedef struct _GstFFMpegAudioResample
{
GstBaseTransform element;
GstPad *sinkpad, *srcpad;
gint in_rate, out_rate;
gint in_channels, out_channels;
ReSampleContext *res;
} GstFFMpegAudioResample;
typedef struct _GstFFMpegAudioResampleClass
{
GstBaseTransformClass parent_class;
} GstFFMpegAudioResampleClass;
#define GST_TYPE_FFMPEGAUDIORESAMPLE \
(gst_ffmpegaudioresample_get_type())
#define GST_FFMPEGAUDIORESAMPLE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGAUDIORESAMPLE,GstFFMpegAudioResample))
#define GST_FFMPEGAUDIORESAMPLE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGAUDIORESAMPLE,GstFFMpegAudioResampleClass))
#define GST_IS_FFMPEGAUDIORESAMPLE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGAUDIORESAMPLE))
#define GST_IS_FFMPEGAUDIORESAMPLE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGAUDIORESAMPLE))
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, endianness = (int) BYTE_ORDER, signed = (boolean) true, width = (int) 16, depth = (int) 16, channels = (int) { 1 , 2 }, rate = (int) [1, MAX ]")
);
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, endianness = (int) BYTE_ORDER, signed = (boolean) true, width = (int) 16, depth = (int) 16, channels = (int) [ 1 , 6 ], rate = (int) [1, MAX ]")
);
GST_BOILERPLATE (GstFFMpegAudioResample, gst_ffmpegaudioresample, GstBaseTransform,
GST_TYPE_BASE_TRANSFORM);
static void gst_ffmpegaudioresample_finalize (GObject * object);
static GstCaps *gst_ffmpegaudioresample_transform_caps (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps);
static gboolean gst_ffmpegaudioresample_transform_size (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, guint size, GstCaps *othercaps,
guint * othersize);
static gboolean gst_ffmpegaudioresample_get_unit_size (GstBaseTransform * trans,
GstCaps * caps, guint * size);
static gboolean gst_ffmpegaudioresample_set_caps (GstBaseTransform * trans,
GstCaps * incaps, GstCaps * outcaps);
static GstFlowReturn gst_ffmpegaudioresample_transform (GstBaseTransform * trans,
GstBuffer * inbuf, GstBuffer * outbuf);
static void
gst_ffmpegaudioresample_base_init (gpointer g_class)
{
static GstElementDetails plugin_details = {
"FFMPEG Audio resampling element",
"Filter/Converter/Audio",
"Converts audio from one samplerate to another",
"Edward Hervey <bilboed@bilboed.com>",
};
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
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));
gst_element_class_set_details (element_class, &plugin_details);
}
static void
gst_ffmpegaudioresample_class_init (GstFFMpegAudioResampleClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstBaseTransformClass *trans_class = GST_BASE_TRANSFORM_CLASS (klass);
gobject_class->finalize = gst_ffmpegaudioresample_finalize;
trans_class->transform_caps =
GST_DEBUG_FUNCPTR (gst_ffmpegaudioresample_transform_caps);
trans_class->get_unit_size =
GST_DEBUG_FUNCPTR (gst_ffmpegaudioresample_get_unit_size);
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_ffmpegaudioresample_set_caps);
trans_class->transform = GST_DEBUG_FUNCPTR (gst_ffmpegaudioresample_transform);
trans_class->transform_size = GST_DEBUG_FUNCPTR (gst_ffmpegaudioresample_transform_size);
trans_class->passthrough_on_same_caps = TRUE;
}
static void
gst_ffmpegaudioresample_init (GstFFMpegAudioResample * resample, GstFFMpegAudioResampleClass * klass)
{
GstBaseTransform *trans = GST_BASE_TRANSFORM (resample);
gst_pad_set_bufferalloc_function (trans->sinkpad, NULL);
resample->res = NULL;
}
static void
gst_ffmpegaudioresample_finalize (GObject * object)
{
GstFFMpegAudioResample *resample = GST_FFMPEGAUDIORESAMPLE (object);
if (resample->res != NULL)
audio_resample_close (resample->res);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static GstCaps *
gst_ffmpegaudioresample_transform_caps (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps)
{
GstCaps *retcaps;
GstStructure * struc;
retcaps = gst_caps_copy (caps);
struc = gst_caps_get_structure (retcaps, 0);
gst_structure_set (struc, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
GST_LOG_OBJECT (trans, "returning caps %" GST_PTR_FORMAT,
retcaps);
return retcaps;
}
static gboolean gst_ffmpegaudioresample_transform_size (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, guint size, GstCaps *othercaps,
guint * othersize)
{
gint inrate, outrate;
gint inchanns, outchanns;
GstStructure *ins, *outs;
gboolean ret;
guint64 conv;
ins = gst_caps_get_structure (caps, 0);
outs = gst_caps_get_structure (othercaps, 0);
/* Get input/output sample rate and channels */
ret = gst_structure_get_int (ins, "rate", &inrate);
ret &= gst_structure_get_int (ins, "channels", &inchanns);
ret &= gst_structure_get_int (outs, "rate", &outrate);
ret &= gst_structure_get_int (outs, "channels", &outchanns);
if (!ret)
return FALSE;
conv = gst_util_uint64_scale(size, outrate * outchanns,
inrate * inchanns);
*othersize = (guint) conv;
GST_DEBUG_OBJECT (trans, "Transformed size from %d to %d",
size, *othersize);
return TRUE;
}
static gboolean
gst_ffmpegaudioresample_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
guint * size)
{
gint channels;
GstStructure * structure;
gboolean ret;
g_assert (size);
structure = gst_caps_get_structure (caps, 0);
ret = gst_structure_get_int (structure, "channels", &channels);
g_return_val_if_fail (ret, FALSE);
*size = 2 * channels;
return TRUE;
}
static gboolean
gst_ffmpegaudioresample_set_caps (GstBaseTransform * trans, GstCaps * incaps,
GstCaps * outcaps)
{
GstFFMpegAudioResample *resample = GST_FFMPEGAUDIORESAMPLE (trans);
GstStructure *instructure = gst_caps_get_structure (incaps, 0);
GstStructure *outstructure = gst_caps_get_structure (outcaps, 0);
GST_LOG_OBJECT (resample, "incaps:%"GST_PTR_FORMAT,
incaps);
GST_LOG_OBJECT (resample, "outcaps:%"GST_PTR_FORMAT,
outcaps);
if (!gst_structure_get_int (instructure, "channels", &resample->in_channels))
return FALSE;
if (!gst_structure_get_int (instructure, "rate", &resample->in_rate))
return FALSE;
if (!gst_structure_get_int (outstructure, "channels", &resample->out_channels))
return FALSE;
if (!gst_structure_get_int (outstructure, "rate", &resample->out_rate))
return FALSE;
resample->res = audio_resample_init (resample->out_channels, resample->in_channels,
resample->out_rate, resample->in_rate);
if (resample->res == NULL)
return FALSE;
return TRUE;
}
static GstFlowReturn
gst_ffmpegaudioresample_transform (GstBaseTransform * trans, GstBuffer * inbuf,
GstBuffer * outbuf)
{
GstFFMpegAudioResample *resample = GST_FFMPEGAUDIORESAMPLE (trans);
gint nbsamples;
gint ret;
gst_buffer_copy_metadata (outbuf, inbuf, GST_BUFFER_COPY_TIMESTAMPS);
nbsamples = GST_BUFFER_SIZE (inbuf) / (2 * resample->in_channels);
GST_LOG_OBJECT (resample, "input buffer duration:%"GST_TIME_FORMAT,
GST_TIME_ARGS (GST_BUFFER_DURATION (inbuf)));
GST_DEBUG_OBJECT (resample, "audio_resample(ctx, output:%p [size:%d], input:%p [size:%d], nbsamples:%d",
GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf),
GST_BUFFER_DATA (inbuf), GST_BUFFER_SIZE (inbuf),
nbsamples);
ret = audio_resample (resample->res, (short *) GST_BUFFER_DATA(outbuf),
(short *) GST_BUFFER_DATA (inbuf), nbsamples);
GST_DEBUG_OBJECT (resample, "audio_resample returned %d", ret);
GST_BUFFER_DURATION(outbuf) = gst_util_uint64_scale (ret, GST_SECOND,
resample->out_rate);
GST_BUFFER_SIZE (outbuf) = ret * 2 * resample->out_channels;
GST_LOG_OBJECT (resample, "Output buffer duration:%"GST_TIME_FORMAT,
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)));
return GST_FLOW_OK;
}
gboolean
gst_ffmpegaudioresample_register (GstPlugin * plugin)
{
return gst_element_register (plugin, "ffaudioresample",
GST_RANK_NONE, GST_TYPE_FFMPEGAUDIORESAMPLE);
}
......@@ -87,7 +87,7 @@ gst_ffmpeg_mb_decision_get_type (void)
static const GEnumValue ffmpeg_mb_decisions[] = {
{FF_MB_DECISION_SIMPLE, "Use method set by mb-cmp", "simple"},
{FF_MB_DECISION_BITS,
"Chooses the one which needs the fewest bits aka vhq mode", "bits"},
"Chooses the one which needs the fewest bits aka vhq mode", "bits"},
{FF_MB_DECISION_RD, "Rate Distortion", "rd"},
{0, NULL, NULL},
};
......@@ -223,6 +223,7 @@ gst_ffmpeg_pre_me_get_type (void)
{0, "Disabled", "off"},
{1, "Only after I-frames", "key"},
{2, "Always", "all"},
{0, NULL, NULL}
};
ffmpeg_pre_me_type =
......@@ -243,6 +244,7 @@ gst_ffmpeg_pred_method_get_type (void)
{FF_PRED_LEFT, "Left", "left"},
{FF_PRED_PLANE, "Plane", "plane"},
{FF_PRED_MEDIAN, "Median", "median"},
{0, NULL, NULL}
};
ffmpeg_pred_method =
......@@ -265,22 +267,22 @@ gst_ffmpeg_flags_get_type (void)
{CODEC_FLAG_GMC, "GMC", "gmc"},
{CODEC_FLAG_MV0, "Always try a MB with MV (0,0)", "mv0"},
{CODEC_FLAG_PART,
"Store MV, DC and AC coefficients in seperate partitions", "part"},
"Store MV, DC and AC coefficients in seperate partitions", "part"},
{CODEC_FLAG_GRAY, "Only decode/encode grayscale", "gray"},
{CODEC_FLAG_NORMALIZE_AQP,
"Normalize Adaptive Quantization (masking, etc)", "aqp"},
"Normalize Adaptive Quantization (masking, etc)", "aqp"},
{CODEC_FLAG_TRELLIS_QUANT, "Trellis Quantization", "trellis"},
{CODEC_FLAG_GLOBAL_HEADER,
"Global headers in extradata instead of every keyframe",
"global-headers"},
"global-headers"},
{CODEC_FLAG_AC_PRED, "H263 Advanced Intra Coding / MPEG4 AC prediction",
"aic"},
"aic"},
{CODEC_FLAG_H263P_UMV, "Unlimited Motion Vector", "umv"},
{CODEC_FLAG_CBP_RD, "Rate Distoration Optimization for CBP", "cbp-rd"},
{CODEC_FLAG_QP_RD, "Rate Distoration Optimization for QP selection",
"qp-rd"},
"qp-rd"},
{CODEC_FLAG_SVCD_SCAN_OFFSET,
"Reserve space for SVCD scan offset user data", "scanoffset"},
"Reserve space for SVCD scan offset user data", "scanoffset"},
{CODEC_FLAG_CLOSED_GOP, "Closed GOP", "closedgop"},
{0, NULL, NULL},
};
......
......@@ -193,13 +193,10 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
switch (codec_id) {
case CODEC_ID_MPEG1VIDEO:
/* For decoding, CODEC_ID_MPEG2VIDEO is preferred... So omit here */
if (encode) {
/* FIXME: bitrate */
caps = gst_ff_vid_caps_new (context, codec_id, "video/mpeg",
"mpegversion", G_TYPE_INT, 1,
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
}
/* FIXME: bitrate */
caps = gst_ff_vid_caps_new (context, codec_id, "video/mpeg",
"mpegversion", G_TYPE_INT, 1,
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
break;
case CODEC_ID_MPEG2VIDEO:
......@@ -288,12 +285,9 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
break;
case CODEC_ID_MP2:
/* we use CODEC_ID_MP3 for decoding */
if (encode) {
/* FIXME: bitrate */
caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg",
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL);
}
/* FIXME: bitrate */
caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg",
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL);
break;
case CODEC_ID_MP3:
......@@ -310,26 +304,15 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
case CODEC_ID_VORBIS:
/* This one is disabled for several reasons:
* - GStreamer already has perfect Ogg and Vorbis support
* - The ffmpeg implementation depends on libvorbis/libogg,
* which are not included in the ffmpeg that GStreamer ships.
* - The ffmpeg implementation depends on shared objects between
* the ogg demuxer and vorbis decoder, which GStreamer doesn't.
*/
case CODEC_ID_AC3:
/* FIXME: bitrate */
caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-ac3", NULL);
break;
case CODEC_ID_AC3:
/* Decoding is disabled, because:
* - it depends on liba52, which we don't ship in ffmpeg.
* - we already have a liba52 plugin ourselves.
*/
if (encode) {
/* FIXME: bitrate */
caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-ac3", NULL);
}
case CODEC_ID_ATRAC3:
caps = gst_ff_aud_caps_new (context, codec_id, "audio/atrac3", NULL);
break;
case CODEC_ID_DTS:
caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-dts", NULL);
break;
......@@ -554,12 +537,15 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp6-flash", NULL);
break;
case CODEC_ID_VP6A:
caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp6-alpha", NULL);
break;
case CODEC_ID_THEORA:
caps = gst_ff_vid_caps_new (context, codec_id, "video/x-theora", NULL);
break;
case CODEC_ID_AAC:
case CODEC_ID_MPEG4AAC:
caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg",
"mpegversion", G_TYPE_INT, 4, NULL);
break;
......@@ -645,10 +631,14 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
break;
case CODEC_ID_WMV3:
case CODEC_ID_VC1:
caps = gst_ff_vid_caps_new (context, codec_id, "video/x-wmv",
"wmvversion", G_TYPE_INT, 3, NULL);
break;
case CODEC_ID_VC1: