Merge branch 'master' into 0.11

Conflicts:
	configure.ac
	ext/ffmpeg/gstffmpegdec.c
This commit is contained in:
Wim Taymans 2011-04-29 18:40:36 +02:00
commit c71a2ec502
20 changed files with 228 additions and 226 deletions

3
.gitmodules vendored
View file

@ -1,3 +1,6 @@
[submodule "common"] [submodule "common"]
path = common path = common
url = git://anongit.freedesktop.org/gstreamer/common url = git://anongit.freedesktop.org/gstreamer/common
[submodule "gst-libs/ext/libav"]
path = gst-libs/ext/libav
url = git://git.libav.org/libav.git

View file

@ -8,7 +8,7 @@ DIST_SUBDIRS = $(COMMON_SUBDIRS) gst-libs
include $(top_srcdir)/common/win32.mak include $(top_srcdir)/common/win32.mak
EXTRA_DIST = \ EXTRA_DIST = \
gst-ffmpeg.spec depcomp ffmpegrev autogen.sh \ gst-ffmpeg.spec depcomp autogen.sh \
AUTHORS COPYING NEWS README ChangeLog gst-ffmpeg.doap \ AUTHORS COPYING NEWS README ChangeLog gst-ffmpeg.doap \
$(win32) $(win32)

View file

@ -4,50 +4,15 @@
DIE=0 DIE=0
package=gst-ffmpeg package=gst-ffmpeg
srcfile=configure.ac srcfile=configure.ac
have_svn=`which svn`
# FFMPEG specific properties
. ./ffmpegrev
# make sure we have common # make sure we have common
if test ! -f common/gst-autogen.sh; if test ! -f common/gst-autogen.sh -o ! -f gst-libs/ext/libav/configure ;
then then
echo "+ Setting up common submodule" echo "+ Setting up common submodule"
git submodule init git submodule init
fi fi
git submodule update git submodule update
if test -x $have_svn && [ $have_svn ];
then
co_ffmpeg=no
if test ! -f $FFMPEG_CO_DIR/configure; then
co_ffmpeg=yes
else
if ! svn info gst-libs/ext/ffmpeg | grep "URL: $FFMPEG_SVN" > /dev/null; then
echo "FFmpeg checkout is on the wrong branch. Re-fetching."
co_ffmpeg=yes
fi
fi
if [ "$co_ffmpeg" = "yes" ]; 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
if [ "x$FFMPEG_EXTERNALS_REVISION" != "x" ]; then
echo "+ updating externals"
svn update -r $FFMPEG_EXTERNALS_REVISION $FFMPEG_CO_DIR/libswscale
fi
else
echo "Subversion needed for ffmpeg checkout, please install and/or add to \$PATH"
exit 0
fi
# source helper functions # source helper functions
if test ! -f common/gst-autogen.sh; if test ! -f common/gst-autogen.sh;
then then

2
common

@ -1 +1 @@
Subproject commit c3cafe123f3a363d337a29ad32fdd6d3631f52c0 Subproject commit 46dfcea233cf6df83e3771d8a8066e87d614f893

View file

@ -209,7 +209,7 @@ dnl *** configure external libs ***
HAVE_FFMPEG_UNINSTALLED=1 HAVE_FFMPEG_UNINSTALLED=1
AC_ARG_WITH(system-ffmpeg, AC_ARG_WITH(system-ffmpeg,
[AC_HELP_STRING([--with-system-ffmpeg], [use system FFmpeg libraries])]) [AC_HELP_STRING([--with-system-ffmpeg], [use system Libav libraries])])
if test "x$with_system_ffmpeg" = "xyes"; then if test "x$with_system_ffmpeg" = "xyes"; then
PKG_CHECK_MODULES(FFMPEG, libavformat libavcodec libavutil) PKG_CHECK_MODULES(FFMPEG, libavformat libavcodec libavutil)
@ -219,34 +219,34 @@ if test "x$with_system_ffmpeg" = "xyes"; then
CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS" CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS"
AC_CHECK_HEADERS([avi.h]) AC_CHECK_HEADERS([avi.h])
CPPFLAGS="$saved_CPPFLAGS" CPPFLAGS="$saved_CPPFLAGS"
AC_DEFINE([FFMPEG_SOURCE], ["system install"], [Describes where the FFmpeg libraries come from.]) AC_DEFINE([FFMPEG_SOURCE], ["system install"], [Describes where the Libav libraries come from.])
HAVE_FFMPEG_UNINSTALLED=0 HAVE_FFMPEG_UNINSTALLED=0
AC_MSG_NOTICE([Using system-installed FFMpeg code]) AC_MSG_NOTICE([Using system-installed FFMpeg code])
AC_MSG_WARN([ AC_MSG_WARN([
====================================================================== ======================================================================
WARNING: you have chosen to build gst-ffmpeg against a random WARNING: you have chosen to build gst-ffmpeg against a random
external version of ffmpeg instead of building it against the tested external version of Libav instead of building it against the tested
internal ffmpeg snapshot that is included with gst-ffmpeg. internal Libav snapshot that is included with gst-ffmpeg.
This is a very bad idea. So bad in fact that words cannot express This is a very bad idea. So bad in fact that words cannot express
just how bad it is. Suffice to say that it is BAD. just how bad it is. Suffice to say that it is BAD.
The GStreamer developers cannot and will not support a gst-ffmpeg The GStreamer developers cannot and will not support a gst-ffmpeg
built this way. Any bug reports that indicate there is an external built this way. Any bug reports that indicate there is an external
version of ffmpeg involved will be closed immediately without further version of Libav involved will be closed immediately without further
investigation. investigation.
The reason such a setup can't be supported is that the ffmpeg API The reason such a setup can't be supported is that the Libav API
and ABI is in constant flux, yet there aren't any official releases and ABI is in constant flux, yet there aren't any official releases
of the ffmpeg library to develop against. This makes it impossible of the Libav library to develop against. This makes it impossible
to guarantee that gst-ffmpeg will work reliably, or even compile, to guarantee that gst-ffmpeg will work reliably, or even compile,
with a randomly picked version ffmpeg. Even if gst-ffmpeg compiles with a randomly picked version Libav. Even if gst-ffmpeg compiles
and superficially appears to work fine against your chosen external and superficially appears to work fine against your chosen external
ffmpeg version, that might just not be the case on other systems, or Libav version, that might just not be the case on other systems, or
even the same system at a later time, or when using decoders, even the same system at a later time, or when using decoders,
encoders, demuxers or muxers that have not been tested. encoders, demuxers or muxers that have not been tested.
Please do not create or distribute binary packages of gst-ffmpeg Please do not create or distribute binary packages of gst-Libav
that link against an external ffmpeg. Thank you! that link against an external ffmpeg. Thank you!
====================================================================== ======================================================================
]) ])
@ -255,50 +255,46 @@ if test "x$with_system_ffmpeg" = "xyes"; then
sleep 15 sleep 15
else else
. "$srcdir/ffmpegrev" AC_MSG_NOTICE([Using local Libav snapshot])
AC_MSG_NOTICE([Using ffmpeg revision $FFMPEG_REVISION])
dnl libgstffmpeg.la: include dirs dnl libgstffmpeg.la: include dirs
FFMPEG_CFLAGS="-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavutil \ FFMPEG_CFLAGS="-I \$(top_srcdir)/gst-libs/ext/libav/libavutil \
-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavcore \ -I \$(top_srcdir)/gst-libs/ext/libav/libavformat \
-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavformat \ -I \$(top_srcdir)/gst-libs/ext/libav/libavcodec \
-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavcodec \ -I \$(top_srcdir)/gst-libs/ext/libav \
-I \$(top_srcdir)/gst-libs/ext/ffmpeg \ -I \$(top_builddir)/gst-libs/ext/libav \
-I \$(top_builddir)/gst-libs/ext/ffmpeg \
-Wno-deprecated-declarations" -Wno-deprecated-declarations"
dnl libgstffmpeg.la: libs to statically link to dnl libgstffmpeg.la: libs to statically link to
FFMPEG_LIBS="\$(top_builddir)/gst-libs/ext/ffmpeg/libavformat/libavformat.a \ FFMPEG_LIBS="\$(top_builddir)/gst-libs/ext/libav/libavformat/libavformat.a \
\$(top_builddir)/gst-libs/ext/ffmpeg/libavcodec/libavcodec.a \ \$(top_builddir)/gst-libs/ext/libav/libavcodec/libavcodec.a \
\$(top_builddir)/gst-libs/ext/ffmpeg/libavutil/libavutil.a \ \$(top_builddir)/gst-libs/ext/libav/libavutil/libavutil.a"
\$(top_builddir)/gst-libs/ext/ffmpeg/libavcore/libavcore.a"
dnl dnl
POSTPROC_CFLAGS="-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libpostproc \ POSTPROC_CFLAGS="-I \$(top_srcdir)/gst-libs/ext/libav/libpostproc \
-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavutil \ -I \$(top_srcdir)/gst-libs/ext/libav/libavutil \
-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavcodec \ -I \$(top_srcdir)/gst-libs/ext/libav/libavcodec \
-I \$(top_srcdir)/gst-libs/ext/ffmpeg \ -I \$(top_srcdir)/gst-libs/ext/libav \
-I \$(top_builddir)/gst-libs/ext/ffmpeg \ -I \$(top_builddir)/gst-libs/ext/libav \
-Wno-deprecated-declarations" -Wno-deprecated-declarations"
dnl libgstpostproc.la: libs to statically link to dnl libgstpostproc.la: libs to statically link to
POSTPROC_LIBS="\$(top_builddir)/gst-libs/ext/ffmpeg/libpostproc/libpostproc.a \ POSTPROC_LIBS="\$(top_builddir)/gst-libs/ext/libav/libpostproc/libpostproc.a \
\$(top_builddir)/gst-libs/ext/ffmpeg/libavutil/libavutil.a" \$(top_builddir)/gst-libs/ext/libav/libavutil/libavutil.a"
dnl dnl
SWSCALE_CFLAGS="-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libswscale \ SWSCALE_CFLAGS="-I \$(top_srcdir)/gst-libs/ext/libav/libswscale \
-I \$(top_srcdir)/gst-libs/ext/ffmpeg/libavutil \ -I \$(top_srcdir)/gst-libs/ext/libav/libavutil \
-I \$(top_srcdir)/gst-libs/ext/ffmpeg \ -I \$(top_srcdir)/gst-libs/ext/libav \
-I \$(top_builddir)/gst-libs/ext/ffmpeg \ -I \$(top_builddir)/gst-libs/ext/libav \
-Wno-deprecated-declarations" -Wno-deprecated-declarations"
dnl libgstswscale.la: libs to statically link to dnl libgstswscale.la: libs to statically link to
SWSCALE_LIBS="\$(top_builddir)/gst-libs/ext/ffmpeg/libswscale/libswscale.a \ SWSCALE_LIBS="\$(top_builddir)/gst-libs/ext/libav/libswscale/libswscale.a \
\$(top_builddir)/gst-libs/ext/ffmpeg/libavutil/libavutil.a" \$(top_builddir)/gst-libs/ext/libav/libavutil/libavutil.a"
FFMPEG_SUBDIRS=gst-libs FFMPEG_SUBDIRS=gst-libs
AC_DEFINE(HAVE_AVI_H) AC_DEFINE(HAVE_AVI_H)
AC_DEFINE([FFMPEG_SOURCE], ["local snapshot"], [Describes where the FFmpeg libraries come from.]) AC_DEFINE([FFMPEG_SOURCE], ["local snapshot"], [Describes where the Libav libraries come from.])
AC_ARG_WITH(ffmpeg-extra-configure, AC_ARG_WITH(ffmpeg-extra-configure,
AC_HELP_STRING([--with-ffmpeg-extra-configure="xxx"], AC_HELP_STRING([--with-ffmpeg-extra-configure="xxx"],
@ -339,7 +335,7 @@ else
esac esac
dnl checks for extra enable/disable flags dnl checks for extra enable/disable flags
FFMPEG_OPTS="(cd $srcdir/gst-libs/ext/ffmpeg && ./configure --help)" FFMPEG_OPTS="(cd $srcdir/gst-libs/ext/libav && ./configure --help)"
# Let's check if we can disable the building of the ffmpeg binary # Let's check if we can disable the building of the ffmpeg binary
can_disable=`echo "$FFMPEG_OPTS" | grep 'disable-ffmpeg'` can_disable=`echo "$FFMPEG_OPTS" | grep 'disable-ffmpeg'`
if test "$can_disable" != ""; then if test "$can_disable" != ""; then
@ -361,24 +357,24 @@ else
AC_SUBST(FFMPEG_REVISION) AC_SUBST(FFMPEG_REVISION)
AC_SUBST(FFMPEG_EXTERNALS_REVISION) AC_SUBST(FFMPEG_EXTERNALS_REVISION)
AC_CONFIG_COMMANDS([configure-embedded-ffmpeg], AC_CONFIG_COMMANDS([configure-embedded-ffmpeg],
[echo "Configuring included FFmpeg instance with args $embffmpeg_configure_args" [echo "Configuring included Libav instance with args $embffmpeg_configure_args"
origdir=`pwd` origdir=`pwd`
dnl Don't put path on the configure call when not needed, as FFmpeg's configure relies on it dnl Don't put path on the configure call when not needed, as FFmpeg's configure relies on it
dnl to detect out-of-tree builds dnl to detect out-of-tree builds
if test -z "$srcdir" -o "$srcdir" = .; then if test -z "$srcdir" -o "$srcdir" = .; then
confcmd=./configure confcmd=./configure
else else
confcmd="$origdir"/"$ac_top_srcdir"/gst-libs/ext/ffmpeg/configure confcmd="$origdir"/"$ac_top_srcdir"/gst-libs/ext/libav/configure
fi fi
AS_MKDIR_P(["$ac_top_build_prefix"gst-libs/ext/ffmpeg]) AS_MKDIR_P(["$ac_top_build_prefix"gst-libs/ext/libav])
cd "$ac_top_build_prefix"gst-libs/ext/ffmpeg && cd "$ac_top_build_prefix"gst-libs/ext/libav &&
$confcmd $embffmpeg_configure_args || $confcmd $embffmpeg_configure_args ||
AC_MSG_ERROR([Failed to configure embedded FFmpeg tree]) AC_MSG_ERROR([Failed to configure embedded Libav tree])
cd "$origdir" cd "$origdir"
], ],
[embffmpeg_configure_args="$embffmpeg_configure_args"]) [embffmpeg_configure_args="$embffmpeg_configure_args"])
AC_MSG_NOTICE([Using included FFMpeg code]) AC_MSG_NOTICE([Using included Libav code])
fi fi
AC_SUBST(FFMPEG_CFLAGS) AC_SUBST(FFMPEG_CFLAGS)
@ -391,7 +387,7 @@ AC_SUBST(SWSCALE_LIBS)
AC_SUBST(WIN32_LIBS) AC_SUBST(WIN32_LIBS)
if test x$HAVE_FFMPEG_UNINSTALLED = x1; then if test x$HAVE_FFMPEG_UNINSTALLED = x1; then
AC_DEFINE(HAVE_FFMPEG_UNINSTALLED, [], [Defined if building against uninstalled FFmpeg source]) AC_DEFINE(HAVE_FFMPEG_UNINSTALLED, [], [Defined if building against uninstalled Libav source])
fi fi
AM_CONDITIONAL(HAVE_FFMPEG_UNINSTALLED, test x$HAVE_FFMPEG_UNINSTALLED = x1) AM_CONDITIONAL(HAVE_FFMPEG_UNINSTALLED, test x$HAVE_FFMPEG_UNINSTALLED = x1)

View file

@ -151,8 +151,8 @@ plugin_init (GstPlugin * plugin)
gst_ffmpegaudioresample_register (plugin); gst_ffmpegaudioresample_register (plugin);
#endif #endif
register_protocol (&gstreamer_protocol); av_register_protocol2 (&gstreamer_protocol, sizeof (URLProtocol));
register_protocol (&gstpipe_protocol); av_register_protocol2 (&gstpipe_protocol, sizeof (URLProtocol));
/* Now we can return the pointer to the newly created Plugin object. */ /* Now we can return the pointer to the newly created Plugin object. */
return TRUE; return TRUE;

View file

@ -247,9 +247,12 @@ gst_ffmpegaudioresample_set_caps (GstBaseTransform * trans, GstCaps * incaps,
if (!gst_structure_get_int (outstructure, "rate", &resample->out_rate)) if (!gst_structure_get_int (outstructure, "rate", &resample->out_rate))
return FALSE; return FALSE;
/* FIXME : Allow configuring the various resampling properties */
#define TAPS 16
resample->res = resample->res =
audio_resample_init (resample->out_channels, resample->in_channels, av_audio_resample_init (resample->out_channels, resample->in_channels,
resample->out_rate, resample->in_rate); resample->out_rate, resample->in_rate,
AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16, TAPS, 10, 0, 0.8);
if (resample->res == NULL) if (resample->res == NULL)
return FALSE; return FALSE;

View file

@ -488,15 +488,15 @@ gst_ffmpeg_cfg_init (void)
1, 31, 3, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); 1, 31, 3, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
gst_ffmpeg_add_pspec (pspec, config.max_qdiff, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.max_qdiff, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("mb-qmin", "Minimum MB Quantizer", pspec = g_param_spec_int ("mb-qmin", "Minimum MB Quantizer (DEPRECATED)",
"Minimum MB Quantizer", 0, 31, 2, "Minimum MB Quantizer (DEPRECATED, use qmin instead)", 0, 31, 2,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
gst_ffmpeg_add_pspec (pspec, config.mb_qmin, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.qmin, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("mb-qmax", "Maximum MB Quantizer", pspec = g_param_spec_int ("mb-qmax", "Maximum MB Quantizer (DEPRECATED)",
"Maximum MB Quantizer", 0, 31, 31, "Maximum MB Quantizer (DEPRECATED, use qmax instead)", 0, 31, 31,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
gst_ffmpeg_add_pspec (pspec, config.mb_qmax, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.qmax, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("lmin", "Minimum Lagrange Multiplier", pspec = g_param_spec_int ("lmin", "Minimum Lagrange Multiplier",
"Minimum Lagrange Multiplier", 1, 31, 2, "Minimum Lagrange Multiplier", 1, 31, 2,

View file

@ -757,7 +757,8 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
break; break;
case CODEC_ID_RAWVIDEO: case CODEC_ID_RAWVIDEO:
caps = gst_ffmpeg_codectype_to_caps (CODEC_TYPE_VIDEO, context, codec_id, caps =
gst_ffmpeg_codectype_to_caps (AVMEDIA_TYPE_VIDEO, context, codec_id,
encode); encode);
break; break;
@ -1214,7 +1215,6 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
case CODEC_ID_SNOW: case CODEC_ID_SNOW:
case CODEC_ID_VIXL: case CODEC_ID_VIXL:
case CODEC_ID_QPEG: case CODEC_ID_QPEG:
case CODEC_ID_XVID:
case CODEC_ID_PGMYUV: case CODEC_ID_PGMYUV:
case CODEC_ID_FFVHUFF: case CODEC_ID_FFVHUFF:
case CODEC_ID_WNV1: case CODEC_ID_WNV1:
@ -1600,12 +1600,12 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
GST_LOG ("Could not create stream format caps for %s", codec->name); GST_LOG ("Could not create stream format caps for %s", codec->name);
switch (codec->type) { switch (codec->type) {
case CODEC_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
mime = g_strdup_printf ("video/x-gst_ff-%s", codec->name); mime = g_strdup_printf ("video/x-gst_ff-%s", codec->name);
caps = gst_ff_vid_caps_new (context, codec_id, mime, NULL); caps = gst_ff_vid_caps_new (context, codec_id, mime, NULL);
g_free (mime); g_free (mime);
break; break;
case CODEC_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
mime = g_strdup_printf ("audio/x-gst_ff-%s", codec->name); mime = g_strdup_printf ("audio/x-gst_ff-%s", codec->name);
caps = gst_ff_aud_caps_new (context, codec_id, mime, NULL); caps = gst_ff_aud_caps_new (context, codec_id, mime, NULL);
if (context) if (context)
@ -1931,21 +1931,21 @@ gst_ffmpeg_codectype_to_video_caps (AVCodecContext * context,
* to a GstCaps. If the context is ommitted, no fixed values * to a GstCaps. If the context is ommitted, no fixed values
* for video/audio size will be included in the GstCaps * for video/audio size will be included in the GstCaps
* *
* CodecType is primarily meant for uncompressed data GstCaps! * AVMediaType is primarily meant for uncompressed data GstCaps!
*/ */
GstCaps * GstCaps *
gst_ffmpeg_codectype_to_caps (enum CodecType codec_type, gst_ffmpeg_codectype_to_caps (enum AVMediaType codec_type,
AVCodecContext * context, enum CodecID codec_id, gboolean encode) AVCodecContext * context, enum CodecID codec_id, gboolean encode)
{ {
GstCaps *caps; GstCaps *caps;
switch (codec_type) { switch (codec_type) {
case CODEC_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
caps = caps =
gst_ffmpeg_codectype_to_video_caps (context, codec_id, encode, NULL); gst_ffmpeg_codectype_to_video_caps (context, codec_id, encode, NULL);
break; break;
case CODEC_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
caps = caps =
gst_ffmpeg_codectype_to_audio_caps (context, codec_id, encode, NULL); gst_ffmpeg_codectype_to_audio_caps (context, codec_id, encode, NULL);
break; break;
@ -2154,22 +2154,22 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
* AVCodecContext. If the context is ommitted, no fixed values * AVCodecContext. If the context is ommitted, no fixed values
* for video/audio size will be included in the context * for video/audio size will be included in the context
* *
* CodecType is primarily meant for uncompressed data GstCaps! * AVMediaType is primarily meant for uncompressed data GstCaps!
*/ */
void void
gst_ffmpeg_caps_with_codectype (enum CodecType type, gst_ffmpeg_caps_with_codectype (enum AVMediaType type,
const GstCaps * caps, AVCodecContext * context) const GstCaps * caps, AVCodecContext * context)
{ {
if (context == NULL) if (context == NULL)
return; return;
switch (type) { switch (type) {
case CODEC_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
gst_ffmpeg_caps_to_pixfmt (caps, context, TRUE); gst_ffmpeg_caps_to_pixfmt (caps, context, TRUE);
break; break;
case CODEC_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
gst_ffmpeg_caps_to_smpfmt (caps, context, TRUE); gst_ffmpeg_caps_to_smpfmt (caps, context, TRUE);
break; break;
@ -2276,7 +2276,7 @@ full_copy:
void void
gst_ffmpeg_caps_with_codecid (enum CodecID codec_id, gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
enum CodecType codec_type, const GstCaps * caps, AVCodecContext * context) enum AVMediaType codec_type, const GstCaps * caps, AVCodecContext * context)
{ {
GstStructure *str; GstStructure *str;
const GValue *value; const GValue *value;
@ -2516,11 +2516,11 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
/* common properties (width, height, fps) */ /* common properties (width, height, fps) */
switch (codec_type) { switch (codec_type) {
case CODEC_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
gst_ffmpeg_caps_to_pixfmt (caps, context, codec_id == CODEC_ID_RAWVIDEO); gst_ffmpeg_caps_to_pixfmt (caps, context, codec_id == CODEC_ID_RAWVIDEO);
gst_ffmpeg_get_palette (caps, context); gst_ffmpeg_get_palette (caps, context);
break; break;
case CODEC_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
gst_ffmpeg_caps_to_smpfmt (caps, context, FALSE); gst_ffmpeg_caps_to_smpfmt (caps, context, FALSE);
break; break;
default: default:
@ -3369,11 +3369,11 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if (context != NULL) { if (context != NULL) {
if (video == TRUE) { if (video == TRUE) {
context->codec_type = CODEC_TYPE_VIDEO; context->codec_type = AVMEDIA_TYPE_VIDEO;
} else if (audio == TRUE) { } else if (audio == TRUE) {
context->codec_type = CODEC_TYPE_AUDIO; context->codec_type = AVMEDIA_TYPE_AUDIO;
} else { } else {
context->codec_type = CODEC_TYPE_UNKNOWN; context->codec_type = AVMEDIA_TYPE_UNKNOWN;
} }
context->codec_id = id; context->codec_id = id;
gst_ffmpeg_caps_with_codecid (id, context->codec_type, caps, context); gst_ffmpeg_caps_with_codecid (id, context->codec_type, caps, context);

View file

@ -41,11 +41,11 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
/* /*
* _codectype_to_caps () gets the GstCaps that belongs to * _codectype_to_caps () gets the GstCaps that belongs to
* a certain CodecType for a pad with uncompressed data. * a certain AVMediaType for a pad with uncompressed data.
*/ */
GstCaps * GstCaps *
gst_ffmpeg_codectype_to_caps (enum CodecType codec_type, gst_ffmpeg_codectype_to_caps (enum AVMediaType codec_type,
AVCodecContext *context, AVCodecContext *context,
enum CodecID codec_id, enum CodecID codec_id,
gboolean encode); gboolean encode);
@ -77,7 +77,7 @@ gst_ffmpeg_caps_to_codecid (const GstCaps *caps,
void void
gst_ffmpeg_caps_with_codecid (enum CodecID codec_id, gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
enum CodecType codec_type, enum AVMediaType codec_type,
const GstCaps *caps, const GstCaps *caps,
AVCodecContext *context); AVCodecContext *context);
@ -87,7 +87,7 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
*/ */
void void
gst_ffmpeg_caps_with_codectype (enum CodecType type, gst_ffmpeg_caps_with_codectype (enum AVMediaType type,
const GstCaps *caps, const GstCaps *caps,
AVCodecContext *context); AVCodecContext *context);

View file

@ -116,7 +116,7 @@ struct _GstFFMpegDec
gboolean extra_ref; /* keep extra ref around in get/release */ gboolean extra_ref; /* keep extra ref around in get/release */
/* some properties */ /* some properties */
gint hurry_up; enum AVDiscard skip_frame;
gint lowres; gint lowres;
gboolean direct_rendering; gboolean direct_rendering;
gboolean do_padding; gboolean do_padding;
@ -301,7 +301,7 @@ gst_ffmpegdec_base_init (GstFFMpegDecClass * klass)
/* construct the element details struct */ /* construct the element details struct */
longname = g_strdup_printf ("FFmpeg %s decoder", in_plugin->long_name); longname = g_strdup_printf ("FFmpeg %s decoder", in_plugin->long_name);
classification = g_strdup_printf ("Codec/Decoder/%s", classification = g_strdup_printf ("Codec/Decoder/%s",
(in_plugin->type == CODEC_TYPE_VIDEO) ? "Video" : "Audio"); (in_plugin->type == AVMEDIA_TYPE_VIDEO) ? "Video" : "Audio");
description = g_strdup_printf ("FFmpeg %s decoder", in_plugin->name); description = g_strdup_printf ("FFmpeg %s decoder", in_plugin->name);
gst_element_class_set_details_simple (element_class, longname, classification, gst_element_class_set_details_simple (element_class, longname, classification,
description, description,
@ -318,7 +318,7 @@ gst_ffmpegdec_base_init (GstFFMpegDecClass * klass)
GST_DEBUG ("Couldn't get sink caps for decoder '%s'", in_plugin->name); GST_DEBUG ("Couldn't get sink caps for decoder '%s'", in_plugin->name);
sinkcaps = gst_caps_from_string ("unknown/unknown"); sinkcaps = gst_caps_from_string ("unknown/unknown");
} }
if (in_plugin->type == CODEC_TYPE_VIDEO) { if (in_plugin->type == AVMEDIA_TYPE_VIDEO) {
srccaps = gst_caps_from_string ("video/x-raw-rgb; video/x-raw-yuv"); srccaps = gst_caps_from_string ("video/x-raw-rgb; video/x-raw-yuv");
} else { } else {
srccaps = gst_ffmpeg_codectype_to_audio_caps (NULL, srccaps = gst_ffmpeg_codectype_to_audio_caps (NULL,
@ -355,7 +355,7 @@ gst_ffmpegdec_class_init (GstFFMpegDecClass * klass)
gobject_class->set_property = gst_ffmpegdec_set_property; gobject_class->set_property = gst_ffmpegdec_set_property;
gobject_class->get_property = gst_ffmpegdec_get_property; gobject_class->get_property = gst_ffmpegdec_get_property;
if (klass->in_plugin->type == CODEC_TYPE_VIDEO) { if (klass->in_plugin->type == AVMEDIA_TYPE_VIDEO) {
g_object_class_install_property (gobject_class, PROP_SKIPFRAME, g_object_class_install_property (gobject_class, PROP_SKIPFRAME,
g_param_spec_enum ("skip-frame", "Skip frames", g_param_spec_enum ("skip-frame", "Skip frames",
"Which types of frames to skip during decoding", "Which types of frames to skip during decoding",
@ -421,7 +421,7 @@ gst_ffmpegdec_init (GstFFMpegDec * ffmpegdec)
ffmpegdec->par = NULL; ffmpegdec->par = NULL;
ffmpegdec->opened = FALSE; ffmpegdec->opened = FALSE;
ffmpegdec->waiting_for_key = TRUE; ffmpegdec->waiting_for_key = TRUE;
ffmpegdec->hurry_up = ffmpegdec->lowres = 0; ffmpegdec->skip_frame = ffmpegdec->lowres = 0;
ffmpegdec->direct_rendering = DEFAULT_DIRECT_RENDERING; ffmpegdec->direct_rendering = DEFAULT_DIRECT_RENDERING;
ffmpegdec->do_padding = DEFAULT_DO_PADDING; ffmpegdec->do_padding = DEFAULT_DO_PADDING;
ffmpegdec->debug_mv = DEFAULT_DEBUG_MV; ffmpegdec->debug_mv = DEFAULT_DEBUG_MV;
@ -665,7 +665,7 @@ gst_ffmpegdec_open (GstFFMpegDec * ffmpegdec)
} }
switch (oclass->in_plugin->type) { switch (oclass->in_plugin->type) {
case CODEC_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
ffmpegdec->format.video.width = 0; ffmpegdec->format.video.width = 0;
ffmpegdec->format.video.height = 0; ffmpegdec->format.video.height = 0;
ffmpegdec->format.video.clip_width = -1; ffmpegdec->format.video.clip_width = -1;
@ -673,7 +673,7 @@ gst_ffmpegdec_open (GstFFMpegDec * ffmpegdec)
ffmpegdec->format.video.pix_fmt = PIX_FMT_NB; ffmpegdec->format.video.pix_fmt = PIX_FMT_NB;
ffmpegdec->format.video.interlaced = FALSE; ffmpegdec->format.video.interlaced = FALSE;
break; break;
case CODEC_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
ffmpegdec->format.audio.samplerate = 0; ffmpegdec->format.audio.samplerate = 0;
ffmpegdec->format.audio.channels = 0; ffmpegdec->format.audio.channels = 0;
ffmpegdec->format.audio.depth = 0; ffmpegdec->format.audio.depth = 0;
@ -836,7 +836,7 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps)
/* for slow cpus */ /* for slow cpus */
ffmpegdec->context->lowres = ffmpegdec->lowres; ffmpegdec->context->lowres = ffmpegdec->lowres;
ffmpegdec->context->hurry_up = ffmpegdec->hurry_up; ffmpegdec->context->skip_frame = ffmpegdec->skip_frame;
/* ffmpeg can draw motion vectors on top of the image (not every decoder /* ffmpeg can draw motion vectors on top of the image (not every decoder
* supports it) */ * supports it) */
@ -984,9 +984,9 @@ gst_ffmpegdec_get_buffer (AVCodecContext * context, AVFrame * picture)
} }
switch (context->codec_type) { switch (context->codec_type) {
case CODEC_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
/* some ffmpeg video plugins don't see the point in setting codec_type ... */ /* some ffmpeg video plugins don't see the point in setting codec_type ... */
case CODEC_TYPE_UNKNOWN: case AVMEDIA_TYPE_UNKNOWN:
{ {
GstFlowReturn ret; GstFlowReturn ret;
gint clip_width, clip_height; gint clip_width, clip_height;
@ -1029,7 +1029,7 @@ gst_ffmpegdec_get_buffer (AVCodecContext * context, AVFrame * picture)
data, context->pix_fmt, width, height); data, context->pix_fmt, width, height);
break; break;
} }
case CODEC_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
default: default:
GST_ERROR_OBJECT (ffmpegdec, GST_ERROR_OBJECT (ffmpegdec,
"_get_buffer() should never get called for non-video buffers !"); "_get_buffer() should never get called for non-video buffers !");
@ -1222,7 +1222,7 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec, gboolean force)
oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec)); oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
switch (oclass->in_plugin->type) { switch (oclass->in_plugin->type) {
case CODEC_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
if (!force && ffmpegdec->format.video.width == ffmpegdec->context->width if (!force && ffmpegdec->format.video.width == ffmpegdec->context->width
&& ffmpegdec->format.video.height == ffmpegdec->context->height && ffmpegdec->format.video.height == ffmpegdec->context->height
&& ffmpegdec->format.video.fps_n == ffmpegdec->format.video.old_fps_n && ffmpegdec->format.video.fps_n == ffmpegdec->format.video.old_fps_n
@ -1252,7 +1252,7 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec, gboolean force)
ffmpegdec->format.video.par_d = ffmpegdec->format.video.par_d =
ffmpegdec->context->sample_aspect_ratio.den; ffmpegdec->context->sample_aspect_ratio.den;
break; break;
case CODEC_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
{ {
gint depth = av_smp_format_depth (ffmpegdec->context->sample_fmt); gint depth = av_smp_format_depth (ffmpegdec->context->sample_fmt);
if (!force && ffmpegdec->format.audio.samplerate == if (!force && ffmpegdec->format.audio.samplerate ==
@ -1281,7 +1281,7 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec, gboolean force)
goto no_caps; goto no_caps;
switch (oclass->in_plugin->type) { switch (oclass->in_plugin->type) {
case CODEC_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
{ {
gint width, height; gint width, height;
gboolean interlaced; gboolean interlaced;
@ -1311,7 +1311,7 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec, gboolean force)
gst_caps_get_structure (caps, 0)); gst_caps_get_structure (caps, 0));
break; break;
} }
case CODEC_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
{ {
break; break;
} }
@ -1373,7 +1373,7 @@ no_bufferpool:
/* perform qos calculations before decoding the next frame. /* perform qos calculations before decoding the next frame.
* *
* Sets the hurry_up flag and if things are really bad, skips to the next * Sets the skip_frame flag and if things are really bad, skips to the next
* keyframe. * keyframe.
* *
* Returns TRUE if the frame should be decoded, FALSE if the frame can be dropped * Returns TRUE if the frame should be decoded, FALSE if the frame can be dropped
@ -1398,8 +1398,8 @@ gst_ffmpegdec_do_qos (GstFFMpegDec * ffmpegdec, GstClockTime timestamp,
/* skip qos if we have no observation (yet) */ /* skip qos if we have no observation (yet) */
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (earliest_time))) { if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (earliest_time))) {
/* no hurry_up initialy */ /* no skip_frame initialy */
ffmpegdec->context->hurry_up = 0; ffmpegdec->context->skip_frame = AVDISCARD_DEFAULT;
goto no_qos; goto no_qos;
} }
@ -1437,8 +1437,8 @@ gst_ffmpegdec_do_qos (GstFFMpegDec * ffmpegdec, GstClockTime timestamp,
/* we were waiting for a keyframe, that's ok */ /* we were waiting for a keyframe, that's ok */
goto skipping; goto skipping;
} }
/* switch to hurry_up mode */ /* switch to skip_frame mode */
goto hurry_up; goto skip_frame;
} }
} }
@ -1451,8 +1451,8 @@ skipping:
} }
normal_mode: normal_mode:
{ {
if (ffmpegdec->context->hurry_up != 0) { if (ffmpegdec->context->skip_frame != AVDISCARD_DEFAULT) {
ffmpegdec->context->hurry_up = 0; ffmpegdec->context->skip_frame = AVDISCARD_DEFAULT;
*mode_switch = TRUE; *mode_switch = TRUE;
GST_DEBUG_OBJECT (ffmpegdec, "QOS: normal mode %g < 0.4", proportion); GST_DEBUG_OBJECT (ffmpegdec, "QOS: normal mode %g < 0.4", proportion);
} }
@ -1460,7 +1460,7 @@ normal_mode:
} }
skip_to_keyframe: skip_to_keyframe:
{ {
ffmpegdec->context->hurry_up = 1; ffmpegdec->context->skip_frame = AVDISCARD_NONKEY;
ffmpegdec->waiting_for_key = TRUE; ffmpegdec->waiting_for_key = TRUE;
*mode_switch = TRUE; *mode_switch = TRUE;
GST_DEBUG_OBJECT (ffmpegdec, GST_DEBUG_OBJECT (ffmpegdec,
@ -1468,10 +1468,10 @@ skip_to_keyframe:
/* we can skip the current frame */ /* we can skip the current frame */
return FALSE; return FALSE;
} }
hurry_up: skip_frame:
{ {
if (ffmpegdec->context->hurry_up != 1) { if (ffmpegdec->context->skip_frame != AVDISCARD_NONREF) {
ffmpegdec->context->hurry_up = 1; ffmpegdec->context->skip_frame = AVDISCARD_NONREF;
*mode_switch = TRUE; *mode_switch = TRUE;
GST_DEBUG_OBJECT (ffmpegdec, GST_DEBUG_OBJECT (ffmpegdec,
"QOS: hurry up, diff %" G_GINT64_FORMAT " >= 0", diff); "QOS: hurry up, diff %" G_GINT64_FORMAT " >= 0", diff);
@ -1677,6 +1677,18 @@ flush_queued (GstFFMpegDec * ffmpegdec)
return res; return res;
} }
static AVPacket *
gst_avpacket_new (guint8 * data, guint size)
{
AVPacket *res;
res = g_malloc0 (sizeof (AVPacket));
res->data = data;
res->size = size;
return res;
}
/* gst_ffmpegdec_[video|audio]_frame: /* gst_ffmpegdec_[video|audio]_frame:
* ffmpegdec: * ffmpegdec:
* data: pointer to the data to decode * data: pointer to the data to decode
@ -1700,10 +1712,11 @@ gst_ffmpegdec_video_frame (GstFFMpegDec * ffmpegdec,
gboolean iskeyframe; gboolean iskeyframe;
gboolean mode_switch; gboolean mode_switch;
gboolean decode; gboolean decode;
gint hurry_up = 0; gint skip_frame = AVDISCARD_DEFAULT;
GstClockTime out_timestamp, out_duration, out_pts; GstClockTime out_timestamp, out_duration, out_pts;
gint64 out_offset; gint64 out_offset;
const GstTSInfo *out_info; const GstTSInfo *out_info;
AVPacket *packet;
*ret = GST_FLOW_OK; *ret = GST_FLOW_OK;
*outbuf = NULL; *outbuf = NULL;
@ -1736,10 +1749,10 @@ gst_ffmpegdec_video_frame (GstFFMpegDec * ffmpegdec,
} }
if (!decode) { if (!decode) {
/* no decoding needed, save previous hurry_up value and brutely skip /* no decoding needed, save previous skip_frame value and brutely skip
* decoding everything */ * decoding everything */
hurry_up = ffmpegdec->context->hurry_up; skip_frame = ffmpegdec->context->skip_frame;
ffmpegdec->context->hurry_up = 2; ffmpegdec->context->skip_frame = AVDISCARD_NONREF;
} }
/* save reference to the timing info */ /* save reference to the timing info */
@ -1749,23 +1762,24 @@ gst_ffmpegdec_video_frame (GstFFMpegDec * ffmpegdec,
GST_DEBUG_OBJECT (ffmpegdec, "stored opaque values idx %d", dec_info->idx); GST_DEBUG_OBJECT (ffmpegdec, "stored opaque values idx %d", dec_info->idx);
/* now decode the frame */ /* now decode the frame */
len = avcodec_decode_video (ffmpegdec->context, packet = gst_avpacket_new (data, size);
ffmpegdec->picture, &have_data, data, size); len = avcodec_decode_video2 (ffmpegdec->context,
ffmpegdec->picture, &have_data, packet);
/* restore previous state */ /* restore previous state */
if (!decode) if (!decode)
ffmpegdec->context->hurry_up = hurry_up; ffmpegdec->context->skip_frame = skip_frame;
GST_DEBUG_OBJECT (ffmpegdec, "after decode: len %d, have_data %d", GST_DEBUG_OBJECT (ffmpegdec, "after decode: len %d, have_data %d",
len, have_data); len, have_data);
/* when we are in hurry_up mode, don't complain when ffmpeg returned /* when we are in skip_frame mode, don't complain when ffmpeg returned
* no data because we told it to skip stuff. */ * no data because we told it to skip stuff. */
if (len < 0 && (mode_switch || ffmpegdec->context->hurry_up)) if (len < 0 && (mode_switch || ffmpegdec->context->skip_frame))
len = 0; len = 0;
if (len > 0 && have_data <= 0 && (mode_switch if (len > 0 && have_data <= 0 && (mode_switch
|| ffmpegdec->context->hurry_up)) { || ffmpegdec->context->skip_frame)) {
/* we consumed some bytes but nothing decoded and we are skipping frames, /* we consumed some bytes but nothing decoded and we are skipping frames,
* disable the interpollation of DTS timestamps */ * disable the interpollation of DTS timestamps */
ffmpegdec->last_out = -1; ffmpegdec->last_out = -1;
@ -2111,6 +2125,7 @@ gst_ffmpegdec_audio_frame (GstFFMpegDec * ffmpegdec,
GstClockTime out_timestamp, out_duration; GstClockTime out_timestamp, out_duration;
gint64 out_offset; gint64 out_offset;
int16_t *odata; int16_t *odata;
AVPacket *packet;
GST_DEBUG_OBJECT (ffmpegdec, GST_DEBUG_OBJECT (ffmpegdec,
"size:%d, offset:%" G_GINT64_FORMAT ", ts:%" GST_TIME_FORMAT ", dur:%" "size:%d, offset:%" G_GINT64_FORMAT ", ts:%" GST_TIME_FORMAT ", dur:%"
@ -2123,8 +2138,10 @@ gst_ffmpegdec_audio_frame (GstFFMpegDec * ffmpegdec,
GST_PAD_CAPS (ffmpegdec->srcpad)); GST_PAD_CAPS (ffmpegdec->srcpad));
odata = gst_buffer_map (*outbuf, NULL, NULL, GST_MAP_WRITE); odata = gst_buffer_map (*outbuf, NULL, NULL, GST_MAP_WRITE);
len = avcodec_decode_audio2 (ffmpegdec->context, odata, &have_data,
data, size); packet = gst_avpacket_new (data, size);
len = avcodec_decode_audio3 (ffmpegdec->context, odata, &have_data, packet);
GST_DEBUG_OBJECT (ffmpegdec, GST_DEBUG_OBJECT (ffmpegdec,
"Decode audio: len=%d, have_data=%d", len, have_data); "Decode audio: len=%d, have_data=%d", len, have_data);
@ -2176,6 +2193,7 @@ gst_ffmpegdec_audio_frame (GstFFMpegDec * ffmpegdec,
GST_BUFFER_TIMESTAMP (*outbuf) = out_timestamp; GST_BUFFER_TIMESTAMP (*outbuf) = out_timestamp;
GST_BUFFER_DURATION (*outbuf) = out_duration; GST_BUFFER_DURATION (*outbuf) = out_duration;
GST_BUFFER_OFFSET (*outbuf) = out_offset; GST_BUFFER_OFFSET (*outbuf) = out_offset;
gst_buffer_set_caps (*outbuf, GST_PAD_CAPS (ffmpegdec->srcpad));
/* the next timestamp we'll use when interpolating */ /* the next timestamp we'll use when interpolating */
ffmpegdec->next_out = out_timestamp + out_duration; ffmpegdec->next_out = out_timestamp + out_duration;
@ -2249,12 +2267,12 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec)); oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
switch (oclass->in_plugin->type) { switch (oclass->in_plugin->type) {
case CODEC_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
len = len =
gst_ffmpegdec_video_frame (ffmpegdec, data, size, dec_info, &outbuf, gst_ffmpegdec_video_frame (ffmpegdec, data, size, dec_info, &outbuf,
ret); ret);
break; break;
case CODEC_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
len = len =
gst_ffmpegdec_audio_frame (ffmpegdec, oclass->in_plugin, data, size, gst_ffmpegdec_audio_frame (ffmpegdec, oclass->in_plugin, data, size,
dec_info, &outbuf, ret); dec_info, &outbuf, ret);
@ -2369,8 +2387,8 @@ gst_ffmpegdec_flush_pcache (GstFFMpegDec * ffmpegdec)
/* parse some dummy data to work around some ffmpeg weirdness where it keeps /* parse some dummy data to work around some ffmpeg weirdness where it keeps
* the previous pts around */ * the previous pts around */
av_parser_parse (ffmpegdec->pctx, ffmpegdec->context, av_parser_parse2 (ffmpegdec->pctx, ffmpegdec->context,
&data, &size, bdata, bsize, -1, -1); &data, &size, bdata, bsize, -1, -1, -1);
ffmpegdec->pctx->pts = -1; ffmpegdec->pctx->pts = -1;
ffmpegdec->pctx->dts = -1; ffmpegdec->pctx->dts = -1;
} }
@ -2551,7 +2569,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf)
if (G_UNLIKELY (ffmpegdec->waiting_for_key)) { if (G_UNLIKELY (ffmpegdec->waiting_for_key)) {
GST_DEBUG_OBJECT (ffmpegdec, "waiting for keyframe"); GST_DEBUG_OBJECT (ffmpegdec, "waiting for keyframe");
if (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_DELTA_UNIT) && if (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_DELTA_UNIT) &&
oclass->in_plugin->type != CODEC_TYPE_AUDIO) oclass->in_plugin->type != AVMEDIA_TYPE_AUDIO)
goto skip_keyframe; goto skip_keyframe;
GST_DEBUG_OBJECT (ffmpegdec, "got keyframe"); GST_DEBUG_OBJECT (ffmpegdec, "got keyframe");
@ -2641,14 +2659,14 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf)
gint res; gint res;
GST_LOG_OBJECT (ffmpegdec, GST_LOG_OBJECT (ffmpegdec,
"Calling av_parser_parse with offset %" G_GINT64_FORMAT ", ts:%" "Calling av_parser_parse2 with offset %" G_GINT64_FORMAT ", ts:%"
GST_TIME_FORMAT " size %d", in_offset, GST_TIME_ARGS (in_timestamp), GST_TIME_FORMAT " size %d", in_offset, GST_TIME_ARGS (in_timestamp),
bsize); bsize);
/* feed the parser. We pass the timestamp info so that we can recover all /* feed the parser. We pass the timestamp info so that we can recover all
* info again later */ * info again later */
res = av_parser_parse (ffmpegdec->pctx, ffmpegdec->context, res = av_parser_parse2 (ffmpegdec->pctx, ffmpegdec->context,
&data, &size, bdata, bsize, in_info->idx, in_info->idx); &data, &size, bdata, bsize, in_info->idx, in_info->idx, in_offset);
GST_LOG_OBJECT (ffmpegdec, GST_LOG_OBJECT (ffmpegdec,
"parser returned res %d and size %d, id %" G_GINT64_FORMAT, res, size, "parser returned res %d and size %d, id %" G_GINT64_FORMAT, res, size,
@ -2844,7 +2862,7 @@ gst_ffmpegdec_set_property (GObject * object,
ffmpegdec->lowres = ffmpegdec->context->lowres = g_value_get_enum (value); ffmpegdec->lowres = ffmpegdec->context->lowres = g_value_get_enum (value);
break; break;
case PROP_SKIPFRAME: case PROP_SKIPFRAME:
ffmpegdec->hurry_up = ffmpegdec->context->hurry_up = ffmpegdec->skip_frame = ffmpegdec->context->skip_frame =
g_value_get_enum (value); g_value_get_enum (value);
break; break;
case PROP_DIRECT_RENDERING: case PROP_DIRECT_RENDERING:
@ -2877,7 +2895,7 @@ gst_ffmpegdec_get_property (GObject * object,
g_value_set_enum (value, ffmpegdec->context->lowres); g_value_set_enum (value, ffmpegdec->context->lowres);
break; break;
case PROP_SKIPFRAME: case PROP_SKIPFRAME:
g_value_set_enum (value, ffmpegdec->context->hurry_up); g_value_set_enum (value, ffmpegdec->context->skip_frame);
break; break;
case PROP_DIRECT_RENDERING: case PROP_DIRECT_RENDERING:
g_value_set_boolean (value, ffmpegdec->direct_rendering); g_value_set_boolean (value, ffmpegdec->direct_rendering);

View file

@ -120,7 +120,7 @@ gst_ffmpegdeinterlace_sink_setcaps (GstPad * pad, GstCaps * caps)
ctx->width = deinterlace->width; ctx->width = deinterlace->width;
ctx->height = deinterlace->height; ctx->height = deinterlace->height;
ctx->pix_fmt = PIX_FMT_NB; ctx->pix_fmt = PIX_FMT_NB;
gst_ffmpeg_caps_with_codectype (CODEC_TYPE_VIDEO, caps, ctx); gst_ffmpeg_caps_with_codectype (AVMEDIA_TYPE_VIDEO, caps, ctx);
if (ctx->pix_fmt == PIX_FMT_NB) { if (ctx->pix_fmt == PIX_FMT_NB) {
av_free (ctx); av_free (ctx);
return FALSE; return FALSE;

View file

@ -42,6 +42,8 @@
#include "gstffmpegutils.h" #include "gstffmpegutils.h"
#include "gstffmpegpipe.h" #include "gstffmpegpipe.h"
#define MAX_STREAMS 20
typedef struct _GstFFMpegDemux GstFFMpegDemux; typedef struct _GstFFMpegDemux GstFFMpegDemux;
typedef struct _GstFFStream GstFFStream; typedef struct _GstFFStream GstFFStream;
@ -150,22 +152,22 @@ gst_ffmpegdemux_averror (gint av_errno)
const gchar *message = NULL; const gchar *message = NULL;
switch (av_errno) { switch (av_errno) {
case AVERROR_UNKNOWN: case AVERROR (EINVAL):
message = "Unknown error"; message = "Unknown error";
break; break;
case AVERROR_IO: case AVERROR (EIO):
message = "Input/output error"; message = "Input/output error";
break; break;
case AVERROR_NUMEXPECTED: case AVERROR (EDOM):
message = "Number syntax expected in filename"; message = "Number syntax expected in filename";
break; break;
case AVERROR_NOMEM: case AVERROR (ENOMEM):
message = "Not enough memory"; message = "Not enough memory";
break; break;
case AVERROR_NOFMT: case AVERROR (EILSEQ):
message = "Unknown format"; message = "Unknown format";
break; break;
case AVERROR_NOTSUPP: case AVERROR (ENOSYS):
message = "Operation not supported"; message = "Operation not supported";
break; break;
default: default:
@ -458,7 +460,7 @@ gst_ffmpegdemux_do_seek (GstFFMpegDemux * demux, GstSegment * segment)
/* if we need to land on a keyframe, try to do so, we don't try to do a /* if we need to land on a keyframe, try to do so, we don't try to do a
* keyframe seek if we are not absolutely sure we have an index.*/ * keyframe seek if we are not absolutely sure we have an index.*/
if (segment->flags & GST_SEEK_FLAG_KEY_UNIT && demux->context->index_built) { if (segment->flags & GST_SEEK_FLAG_KEY_UNIT) {
gint keyframeidx; gint keyframeidx;
GST_LOG_OBJECT (demux, "looking for keyframe in ffmpeg for time %" GST_LOG_OBJECT (demux, "looking for keyframe in ffmpeg for time %"
@ -867,7 +869,7 @@ gst_ffmpegdemux_src_convert (GstPad * pad,
return FALSE; return FALSE;
avstream = stream->avstream; avstream = stream->avstream;
if (avstream->codec->codec_type != CODEC_TYPE_VIDEO) if (avstream->codec->codec_type != AVMEDIA_TYPE_VIDEO)
return FALSE; return FALSE;
switch (src_fmt) { switch (src_fmt) {
@ -977,11 +979,11 @@ gst_ffmpegdemux_get_stream (GstFFMpegDemux * demux, AVStream * avstream)
stream->tags = NULL; stream->tags = NULL;
switch (ctx->codec_type) { switch (ctx->codec_type) {
case CODEC_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
templ = oclass->videosrctempl; templ = oclass->videosrctempl;
num = demux->videopads++; num = demux->videopads++;
break; break;
case CODEC_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
templ = oclass->audiosrctempl; templ = oclass->audiosrctempl;
num = demux->audiopads++; num = demux->audiopads++;
break; break;
@ -1041,7 +1043,7 @@ gst_ffmpegdemux_get_stream (GstFFMpegDemux * demux, AVStream * avstream)
stream->tags = gst_tag_list_new (); stream->tags = gst_tag_list_new ();
gst_tag_list_add (stream->tags, GST_TAG_MERGE_REPLACE, gst_tag_list_add (stream->tags, GST_TAG_MERGE_REPLACE,
(ctx->codec_type == CODEC_TYPE_VIDEO) ? (ctx->codec_type == AVMEDIA_TYPE_VIDEO) ?
GST_TAG_VIDEO_CODEC : GST_TAG_AUDIO_CODEC, codec, NULL); GST_TAG_VIDEO_CODEC : GST_TAG_AUDIO_CODEC, codec, NULL);
} }
@ -1065,6 +1067,10 @@ unknown_caps:
} }
} }
#if 0
/* Re-enable once converted to new AVMetaData API
* See #566605
*/
static gchar * static gchar *
my_safe_copy (gchar * input) my_safe_copy (gchar * input)
{ {
@ -1135,6 +1141,7 @@ gst_ffmpegdemux_read_tags (GstFFMpegDemux * demux)
} }
return tlist; return tlist;
} }
#endif
static gboolean static gboolean
gst_ffmpegdemux_open (GstFFMpegDemux * demux) gst_ffmpegdemux_open (GstFFMpegDemux * demux)
@ -1143,7 +1150,12 @@ gst_ffmpegdemux_open (GstFFMpegDemux * demux)
(GstFFMpegDemuxClass *) G_OBJECT_GET_CLASS (demux); (GstFFMpegDemuxClass *) G_OBJECT_GET_CLASS (demux);
gchar *location; gchar *location;
gint res, n_streams, i; gint res, n_streams, i;
#if 0
/* Re-enable once converted to new AVMetaData API
* See #566605
*/
GstTagList *tags; GstTagList *tags;
#endif
GstEvent *event; GstEvent *event;
GList *cached_events; GList *cached_events;
@ -1224,12 +1236,17 @@ gst_ffmpegdemux_open (GstFFMpegDemux * demux)
cached_events = g_list_delete_link (cached_events, cached_events); cached_events = g_list_delete_link (cached_events, cached_events);
} }
#if 0
/* Re-enable once converted to new AVMetaData API
* See #566605
*/
/* grab the global tags */ /* grab the global tags */
tags = gst_ffmpegdemux_read_tags (demux); tags = gst_ffmpegdemux_read_tags (demux);
if (tags) { if (tags) {
GST_INFO_OBJECT (demux, "global tags: %" GST_PTR_FORMAT, tags); GST_INFO_OBJECT (demux, "global tags: %" GST_PTR_FORMAT, tags);
gst_element_found_tags (GST_ELEMENT (demux), tags); gst_element_found_tags (GST_ELEMENT (demux), tags);
} }
#endif
/* now handle the stream tags */ /* now handle the stream tags */
for (i = 0; i < n_streams; i++) { for (i = 0; i < n_streams; i++) {
@ -1389,7 +1406,7 @@ gst_ffmpegdemux_loop (GstFFMpegDemux * demux)
/* prepare to push packet to peer */ /* prepare to push packet to peer */
srcpad = stream->pad; srcpad = stream->pad;
rawvideo = (avstream->codec->codec_type == CODEC_TYPE_VIDEO && rawvideo = (avstream->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
avstream->codec->codec_id == CODEC_ID_RAWVIDEO); avstream->codec->codec_id == CODEC_ID_RAWVIDEO);
if (rawvideo) if (rawvideo)
@ -1441,7 +1458,7 @@ gst_ffmpegdemux_loop (GstFFMpegDemux * demux)
GST_BUFFER_DURATION (outbuf) = duration; GST_BUFFER_DURATION (outbuf) = duration;
/* mark keyframes */ /* mark keyframes */
if (!(pkt.flags & PKT_FLAG_KEY)) { if (!(pkt.flags & AV_PKT_FLAG_KEY)) {
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT); GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
} }

View file

@ -136,7 +136,7 @@ gst_ffmpegenc_base_init (GstFFMpegEncClass * klass)
/* construct the element details struct */ /* construct the element details struct */
longname = g_strdup_printf ("FFmpeg %s encoder", in_plugin->long_name); longname = g_strdup_printf ("FFmpeg %s encoder", in_plugin->long_name);
classification = g_strdup_printf ("Codec/Encoder/%s", classification = g_strdup_printf ("Codec/Encoder/%s",
(in_plugin->type == CODEC_TYPE_VIDEO) ? "Video" : "Audio"); (in_plugin->type == AVMEDIA_TYPE_VIDEO) ? "Video" : "Audio");
description = g_strdup_printf ("FFmpeg %s encoder", in_plugin->name); description = g_strdup_printf ("FFmpeg %s encoder", in_plugin->name);
gst_element_class_set_details_simple (element_class, longname, classification, gst_element_class_set_details_simple (element_class, longname, classification,
description, description,
@ -151,7 +151,7 @@ gst_ffmpegenc_base_init (GstFFMpegEncClass * klass)
srccaps = gst_caps_new_simple ("unknown/unknown", NULL); srccaps = gst_caps_new_simple ("unknown/unknown", NULL);
} }
if (in_plugin->type == CODEC_TYPE_VIDEO) { if (in_plugin->type == AVMEDIA_TYPE_VIDEO) {
sinkcaps = gst_caps_from_string sinkcaps = gst_caps_from_string
("video/x-raw-rgb; video/x-raw-yuv; video/x-raw-gray"); ("video/x-raw-rgb; video/x-raw-yuv; video/x-raw-gray");
} else { } else {
@ -193,7 +193,7 @@ gst_ffmpegenc_class_init (GstFFMpegEncClass * klass)
gobject_class->set_property = gst_ffmpegenc_set_property; gobject_class->set_property = gst_ffmpegenc_set_property;
gobject_class->get_property = gst_ffmpegenc_get_property; gobject_class->get_property = gst_ffmpegenc_get_property;
if (klass->in_plugin->type == CODEC_TYPE_VIDEO) { if (klass->in_plugin->type == AVMEDIA_TYPE_VIDEO) {
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE, g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE,
g_param_spec_ulong ("bitrate", "Bit Rate", g_param_spec_ulong ("bitrate", "Bit Rate",
"Target Video Bitrate", 0, G_MAXULONG, DEFAULT_VIDEO_BITRATE, "Target Video Bitrate", 0, G_MAXULONG, DEFAULT_VIDEO_BITRATE,
@ -222,7 +222,7 @@ gst_ffmpegenc_class_init (GstFFMpegEncClass * klass)
/* register additional properties, possibly dependent on the exact CODEC */ /* register additional properties, possibly dependent on the exact CODEC */
gst_ffmpeg_cfg_install_property (klass, ARG_CFG_BASE); gst_ffmpeg_cfg_install_property (klass, ARG_CFG_BASE);
} else if (klass->in_plugin->type == CODEC_TYPE_AUDIO) { } else if (klass->in_plugin->type == AVMEDIA_TYPE_AUDIO) {
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE, g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE,
g_param_spec_ulong ("bitrate", "Bit Rate", g_param_spec_ulong ("bitrate", "Bit Rate",
"Target Audio Bitrate", 0, G_MAXULONG, DEFAULT_AUDIO_BITRATE, "Target Audio Bitrate", 0, G_MAXULONG, DEFAULT_AUDIO_BITRATE,
@ -255,7 +255,7 @@ gst_ffmpegenc_init (GstFFMpegEnc * ffmpegenc)
ffmpegenc->file = NULL; ffmpegenc->file = NULL;
ffmpegenc->delay = g_queue_new (); ffmpegenc->delay = g_queue_new ();
if (oclass->in_plugin->type == CODEC_TYPE_VIDEO) { if (oclass->in_plugin->type == AVMEDIA_TYPE_VIDEO) {
gst_pad_set_chain_function (ffmpegenc->sinkpad, gst_ffmpegenc_chain_video); gst_pad_set_chain_function (ffmpegenc->sinkpad, gst_ffmpegenc_chain_video);
/* so we know when to flush the buffers on EOS */ /* so we know when to flush the buffers on EOS */
gst_pad_set_event_function (ffmpegenc->sinkpad, gst_ffmpegenc_event_video); gst_pad_set_event_function (ffmpegenc->sinkpad, gst_ffmpegenc_event_video);
@ -272,7 +272,7 @@ gst_ffmpegenc_init (GstFFMpegEnc * ffmpegenc)
ffmpegenc->max_key_interval = 0; ffmpegenc->max_key_interval = 0;
gst_ffmpeg_cfg_set_defaults (ffmpegenc); gst_ffmpeg_cfg_set_defaults (ffmpegenc);
} else if (oclass->in_plugin->type == CODEC_TYPE_AUDIO) { } else if (oclass->in_plugin->type == AVMEDIA_TYPE_AUDIO) {
gst_pad_set_chain_function (ffmpegenc->sinkpad, gst_ffmpegenc_chain_audio); gst_pad_set_chain_function (ffmpegenc->sinkpad, gst_ffmpegenc_chain_audio);
ffmpegenc->bitrate = DEFAULT_AUDIO_BITRATE; ffmpegenc->bitrate = DEFAULT_AUDIO_BITRATE;
@ -385,7 +385,7 @@ gst_ffmpegenc_getcaps (GstPad * pad)
GST_DEBUG_OBJECT (ffmpegenc, "getting caps"); GST_DEBUG_OBJECT (ffmpegenc, "getting caps");
/* audio needs no special care */ /* audio needs no special care */
if (oclass->in_plugin->type == CODEC_TYPE_AUDIO) { if (oclass->in_plugin->type == AVMEDIA_TYPE_AUDIO) {
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
GST_DEBUG_OBJECT (ffmpegenc, "audio caps, return template %" GST_PTR_FORMAT, GST_DEBUG_OBJECT (ffmpegenc, "audio caps, return template %" GST_PTR_FORMAT,
@ -672,7 +672,7 @@ gst_ffmpegenc_setcaps (GstPad * pad, GstCaps * caps)
/* we may have failed mapping caps to a pixfmt, /* we may have failed mapping caps to a pixfmt,
* and quite some codecs do not make up their own mind about that * and quite some codecs do not make up their own mind about that
* in any case, _NONE can never work out later on */ * in any case, _NONE can never work out later on */
if (oclass->in_plugin->type == CODEC_TYPE_VIDEO && pix_fmt == PIX_FMT_NONE) { if (oclass->in_plugin->type == AVMEDIA_TYPE_VIDEO && pix_fmt == PIX_FMT_NONE) {
GST_DEBUG_OBJECT (ffmpegenc, "ffenc_%s: Failed to determine input format", GST_DEBUG_OBJECT (ffmpegenc, "ffenc_%s: Failed to determine input format",
oclass->in_plugin->name); oclass->in_plugin->name);
return FALSE; return FALSE;
@ -1320,8 +1320,8 @@ gst_ffmpegenc_register (GstPlugin * plugin)
gchar *type_name; gchar *type_name;
/* Skip non-AV codecs */ /* Skip non-AV codecs */
if (in_plugin->type != CODEC_TYPE_AUDIO && if (in_plugin->type != AVMEDIA_TYPE_AUDIO &&
in_plugin->type != CODEC_TYPE_VIDEO) in_plugin->type != AVMEDIA_TYPE_VIDEO)
goto next; goto next;
/* no quasi codecs, please */ /* no quasi codecs, please */

View file

@ -412,7 +412,7 @@ gst_ffmpegmux_request_new_pad (GstElement * element,
gchar *padname; gchar *padname;
GstPad *pad; GstPad *pad;
AVStream *st; AVStream *st;
enum CodecType type; enum AVMediaType type;
gint bitrate = 0, framesize = 0; gint bitrate = 0, framesize = 0;
g_return_val_if_fail (templ != NULL, NULL); g_return_val_if_fail (templ != NULL, NULL);
@ -422,12 +422,12 @@ gst_ffmpegmux_request_new_pad (GstElement * element,
/* figure out a name that *we* like */ /* figure out a name that *we* like */
if (templ == gst_element_class_get_pad_template (klass, "video_%d")) { if (templ == gst_element_class_get_pad_template (klass, "video_%d")) {
padname = g_strdup_printf ("video_%d", ffmpegmux->videopads++); padname = g_strdup_printf ("video_%d", ffmpegmux->videopads++);
type = CODEC_TYPE_VIDEO; type = AVMEDIA_TYPE_VIDEO;
bitrate = 64 * 1024; bitrate = 64 * 1024;
framesize = 1152; framesize = 1152;
} else if (templ == gst_element_class_get_pad_template (klass, "audio_%d")) { } else if (templ == gst_element_class_get_pad_template (klass, "audio_%d")) {
padname = g_strdup_printf ("audio_%d", ffmpegmux->audiopads++); padname = g_strdup_printf ("audio_%d", ffmpegmux->audiopads++);
type = CODEC_TYPE_AUDIO; type = AVMEDIA_TYPE_AUDIO;
bitrate = 285 * 1024; bitrate = 285 * 1024;
} else { } else {
g_warning ("ffmux: unknown pad template!"); g_warning ("ffmux: unknown pad template!");
@ -543,7 +543,12 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
GSList *collected; GSList *collected;
GstFFMpegMuxPad *best_pad; GstFFMpegMuxPad *best_pad;
GstClockTime best_time; GstClockTime best_time;
#if 0
/* Re-enable once converted to new AVMetaData API
* See #566605
*/
const GstTagList *tags; const GstTagList *tags;
#endif
/* open "file" (gstreamer protocol to next element) */ /* open "file" (gstreamer protocol to next element) */
if (!ffmpegmux->opened) { if (!ffmpegmux->opened) {
@ -560,12 +565,12 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
if (st->codec->codec_id == CODEC_ID_NONE) { if (st->codec->codec_id == CODEC_ID_NONE) {
GST_ELEMENT_ERROR (ffmpegmux, CORE, NEGOTIATION, (NULL), GST_ELEMENT_ERROR (ffmpegmux, CORE, NEGOTIATION, (NULL),
("no caps set on stream %d (%s)", collect_pad->padnum, ("no caps set on stream %d (%s)", collect_pad->padnum,
(st->codec->codec_type == CODEC_TYPE_VIDEO) ? (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) ?
"video" : "audio")); "video" : "audio"));
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
/* set framerate for audio */ /* set framerate for audio */
if (st->codec->codec_type == CODEC_TYPE_AUDIO) { if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
switch (st->codec->codec_id) { switch (st->codec->codec_id) {
case CODEC_ID_PCM_S16LE: case CODEC_ID_PCM_S16LE:
case CODEC_ID_PCM_S16BE: case CODEC_ID_PCM_S16BE:
@ -594,6 +599,11 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
} }
} }
#if 0
/* Re-enable once converted to new AVMetaData API
* See #566605
*/
/* tags */ /* tags */
tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (ffmpegmux)); tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (ffmpegmux));
if (tags) { if (tags) {
@ -629,6 +639,7 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
ffmpegmux->context->track = i; ffmpegmux->context->track = i;
} }
} }
#endif
/* set the streamheader flag for gstffmpegprotocol if codec supports it */ /* set the streamheader flag for gstffmpegprotocol if codec supports it */
if (!strcmp (ffmpegmux->context->oformat->name, "flv")) { if (!strcmp (ffmpegmux->context->oformat->name, "flv")) {
@ -747,7 +758,7 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
pkt.flags = 0; pkt.flags = 0;
if (!GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT)) if (!GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT))
pkt.flags |= PKT_FLAG_KEY; pkt.flags |= AV_PKT_FLAG_KEY;
if (GST_BUFFER_DURATION_IS_VALID (buf)) if (GST_BUFFER_DURATION_IS_VALID (buf))
pkt.duration = pkt.duration =

View file

@ -101,7 +101,7 @@ gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size)
GstFlowReturn ret; GstFlowReturn ret;
int total = 0; int total = 0;
g_return_val_if_fail (h->flags == URL_RDONLY, AVERROR_IO); g_return_val_if_fail (h->flags == URL_RDONLY, AVERROR (EIO));
info = (GstProtocolInfo *) h->priv_data; info = (GstProtocolInfo *) h->priv_data;
GST_DEBUG ("Pulling %d bytes at position %" G_GUINT64_FORMAT, size, GST_DEBUG ("Pulling %d bytes at position %" G_GUINT64_FORMAT, size,

View file

@ -81,8 +81,8 @@ struct _GstPostProc
gint ystride, ustride, vstride; gint ystride, ustride, vstride;
gint ysize, usize, vsize; gint ysize, usize, vsize;
pp_mode_t *mode; pp_mode *mode;
pp_context_t *context; pp_context *context;
/* props of various filters */ /* props of various filters */
gboolean autoq; gboolean autoq;

View file

@ -1,9 +0,0 @@
FFMPEG_REVISION=26402
FFMPEG_CO_DIR=gst-libs/ext/ffmpeg
FFMPEG_SVN=svn://svn.ffmpeg.org/ffmpeg/trunk/
# Because ffmpeg trunk checks out libswscale via an svn:externals, checking
# out an old ffmpeg does not check out a corresponding libswscale.
# Keep the swscale checkout manually synchronized, then. Update this
# when you update FFMPEG_REVISION. Set it to empty if there's no
# external to update (as on ffmpeg 0.5 branch)
FFMPEG_EXTERNALS_REVISION=

View file

@ -1,5 +1,5 @@
# we have to put in a little hack here for integration to work well # we have to put in a little hack here for integration to work well
# ffmpeg can't be in SUBDIRS, because then automake will try to descend in it # libav can't be in SUBDIRS, because then automake will try to descend in it
# and find conditionals it doesn't know. # and find conditionals it doesn't know.
# so, # so,
@ -9,24 +9,24 @@
# this also satisfies make distcheck # this also satisfies make distcheck
SUBDIRS = SUBDIRS =
DIST_SUBDIRS = ffmpeg DIST_SUBDIRS = libav
TMP_DIST_DIR=ffmpeg-dist TMP_DIST_DIR=libav-dist
DIST_DIR=$(TMP_DIST_DIR)/.ffmpeg DIST_DIR=$(TMP_DIST_DIR)/.libav
EXTRA_DIST=Makefile.am EXTRA_DIST=Makefile.am
MAINTAINERCLEANDIRS = $(DIST_SUBDIRS) MAINTAINERCLEANDIRS = $(DIST_SUBDIRS)
all-local: all-local:
cd ffmpeg && $(MAKE) cd libav && $(MAKE)
clean-local: clean-local:
cd ffmpeg && $(MAKE) clean cd libav && $(MAKE) clean
dist-clean: dist-clean:
cd ffmpeg && $(MAKE) distclean cd libav && $(MAKE) distclean
rm -rf $(TMP_DIST_DIR) rm -rf $(TMP_DIST_DIR)
rm -f Makefile rm -f Makefile
rm -f ffmpeg/.version rm -f libav/.version
rm -f ffmpeg/.config rm -f libav/.config
distclean: dist-clean distclean: dist-clean
@ -36,22 +36,19 @@ maintainer-clean: distclean
maintainerclean: maintainer-clean maintainerclean: maintainer-clean
dist-local: dist-local:
svn -r $(FFMPEG_REVISION) export $(FFMPEG_SVN) $(TMP_DIST_DIR)/ffmpeg/ GIT_DIR=libav/.git git checkout-index --prefix=$(TMP_DIST_DIR)/libav/ -a
@if [ "x$(FFMPEG_EXTERNALS_REVISION)" != x ]; then \ touch $(TMP_DIST_DIR)/libav/config.mak
svn update -r $(FFMPEG_EXTERNALS_REVISION) $(TMP_DIST_DIR)/ffmpeg/libswscale; \ echo "Patching libav ./configure"
fi sed -e '/Unknown option/ {N;N;s/exit 1//; }' $(TMP_DIST_DIR)/libav/configure > $(TMP_DIST_DIR)/libav/configure.tmp
touch $(TMP_DIST_DIR)/ffmpeg/config.mak mv $(TMP_DIST_DIR)/libav/configure.tmp $(TMP_DIST_DIR)/libav/configure
echo "Patching ffmpeg ./configure" chmod +x $(TMP_DIST_DIR)/libav/configure
sed -e '/Unknown option/ {N;N;s/exit 1//; }' $(TMP_DIST_DIR)/ffmpeg/configure > $(TMP_DIST_DIR)/ffmpeg/configure.tmp
mv $(TMP_DIST_DIR)/ffmpeg/configure.tmp $(TMP_DIST_DIR)/ffmpeg/configure
chmod +x $(TMP_DIST_DIR)/ffmpeg/configure
distdir: dist-local distdir: dist-local
cp -r $(TMP_DIST_DIR)/ffmpeg ${distdir} cp -r $(TMP_DIST_DIR)/libav ${distdir}
cp -f $(top_srcdir)/gst-libs/ext/Makefile.am $(top_srcdir)/gst-libs/ext/Makefile.in ${distdir} cp -f $(top_srcdir)/gst-libs/ext/Makefile.am $(top_srcdir)/gst-libs/ext/Makefile.in ${distdir}
rm -rf $(TMP_DIST_DIR) rm -rf $(TMP_DIST_DIR)
dist: dist-local dist: dist-local
cd $(TMP_DIST_DIR) && tar -czf ffmpeg.tar.gz ffmpeg cd $(TMP_DIST_DIR) && tar -czf libav.tar.gz libav
mv $(TMP_DIST_DIR)/ffmpeg.tar.gz ./ mv $(TMP_DIST_DIR)/libav.tar.gz ./
rm -rf $(TMP_DIST_DIR) rm -rf $(TMP_DIST_DIR)

1
gst-libs/ext/libav Submodule

@ -0,0 +1 @@
Subproject commit 151cd4f98225c0c5cab8fb29e1dbc0719f7f67e3