From 18aea785436660d615f83463614ebcbe4869e76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 3 Sep 2011 12:27:28 +0100 Subject: [PATCH 01/11] configure: back to development --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 655d383dd6..9b2684c991 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ(2.60) dnl initialize autoconf dnl when going to/from release please set the nano (fourth number) right ! dnl releases only do Wall, cvs and prerelease does Werror too -AC_INIT(GStreamer Libav, 0.10.12, +AC_INIT(GStreamer Libav, 0.10.12.1, http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer, gst-ffmpeg) From 9d6f797f7a79c48d23f7c31fe4b267a7a5e8e0f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 3 Sep 2011 12:30:26 +0100 Subject: [PATCH 02/11] Update internal libav snapshot to latest releases/0.7 tip for postproc fix https://bugzilla.gnome.org/show_bug.cgi?id=654634 --- gst-libs/ext/libav | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gst-libs/ext/libav b/gst-libs/ext/libav index 9459390f29..20ca827019 160000 --- a/gst-libs/ext/libav +++ b/gst-libs/ext/libav @@ -1 +1 @@ -Subproject commit 9459390f29ec6df63ff1878f13b7b4343811948a +Subproject commit 20ca827019a72bfacb38e73d0b8590e651818272 From 7b7928082b5d869f55f5d674930a610234aa8037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 18 Jul 2011 12:12:38 +0100 Subject: [PATCH 03/11] tests: add simple test for creating postproc elements https://bugzilla.gnome.org/show_bug.cgi?id=654634 --- tests/check/.gitignore | 1 + tests/check/Makefile.am | 3 ++- tests/check/elements/postproc.c | 46 +++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 tests/check/elements/postproc.c diff --git a/tests/check/.gitignore b/tests/check/.gitignore index b48eb4e646..03cf5bdba0 100644 --- a/tests/check/.gitignore +++ b/tests/check/.gitignore @@ -1,4 +1,5 @@ test-registry.* elements/ffdec_adpcm elements/ffdemux_ape +elements/postproc .dirstamp diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index d3e5978c58..a904a44b4c 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -20,7 +20,8 @@ check_PROGRAMS = \ generic/plugin-test \ generic/libavcodec-locking \ elements/ffdec_adpcm \ - elements/ffdemux_ape + elements/ffdemux_ape \ + elements/postproc VALGRIND_TO_FIX = \ generic/plugin-test \ diff --git a/tests/check/elements/postproc.c b/tests/check/elements/postproc.c new file mode 100644 index 0000000000..1dd20c224b --- /dev/null +++ b/tests/check/elements/postproc.c @@ -0,0 +1,46 @@ +/* GStreamer unit tests for postproc + * Copyright (C) 2011 Collabora Ltd. + * + * 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. + */ + +#include +#include + +GST_START_TEST (test_postproc_default) +{ + GstElement *pp; + + pp = gst_element_factory_make ("postproc_default", NULL); + fail_unless (pp != NULL, "Failed to create postproc_default!"); + gst_object_unref (pp); +} + +GST_END_TEST; + +static Suite * +postproc_suite (void) +{ + Suite *s = suite_create ("postproc"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_postproc_default); + + return s; +} + +GST_CHECK_MAIN (postproc) From eacf516f7f1f7a7332688364965b6a435e4e54b9 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 2 Sep 2011 16:25:16 -0400 Subject: [PATCH 04/11] ffdec: Blacklist non-working subtitle decoders This include decoder for ASS, SRT, PGS, DVD and DVB. Those are generated with bad capabilities and are not usable in GStreamer. Other elements exist to handle those subtitle formats. https://bugzilla.gnome.org/show_bug.cgi?id=658019 --- ext/ffmpeg/gstffmpegdec.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index 668ab08c07..0131ff08b5 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -2935,7 +2935,12 @@ gst_ffmpegdec_register (GstPlugin * plugin) !strcmp (in_plugin->name, "mp1") || !strcmp (in_plugin->name, "mp2") || !strcmp (in_plugin->name, "libfaad") || - !strcmp (in_plugin->name, "mpeg4aac")) { + !strcmp (in_plugin->name, "mpeg4aac") || + !strcmp (in_plugin->name, "ass") || + !strcmp (in_plugin->name, "srt") || + !strcmp (in_plugin->name, "pgssub") || + !strcmp (in_plugin->name, "dvdsub") || + !strcmp (in_plugin->name, "dvbsub")) { GST_LOG ("Ignoring decoder %s", in_plugin->name); goto next; } From 47bf93d84bc911e6ff7f2fb6d81175f91f1933e3 Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Tue, 6 Sep 2011 16:06:23 +0200 Subject: [PATCH 05/11] Automatic update of common submodule From 605cd9a to a39eb83 --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index 605cd9a65e..a39eb835fb 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 605cd9a65ed61505f24b840d3fe8e252be72b151 +Subproject commit a39eb835fb3be2a4c5a6a89b5ca5cc064e79b2e2 From 1ad6b4447e7c0b8f7ded469cf03a9c524a21164b Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Tue, 6 Sep 2011 21:52:50 +0200 Subject: [PATCH 06/11] Automatic update of common submodule From a39eb83 to 11f0cd5 --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index a39eb835fb..11f0cd5a3f 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit a39eb835fb3be2a4c5a6a89b5ca5cc064e79b2e2 +Subproject commit 11f0cd5a3fba36f85cf3e434150bfe66b1bf08d4 From 79e0c1f52de7d729dd806bd01311f1f6b5478423 Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Wed, 7 Sep 2011 16:10:02 +0200 Subject: [PATCH 07/11] docs: cleanup makefiles Remove commented out parts that we don't need. Remove "the wingo addition" - no so useful after all. Narrow down file-globs for plugin docs. --- docs/plugins/Makefile.am | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am index 51dea79007..b0ba1d8156 100644 --- a/docs/plugins/Makefile.am +++ b/docs/plugins/Makefile.am @@ -13,30 +13,10 @@ FORMATS=html html: html-build.stamp include $(srcdir)/../../common/upload-doc.mak -# generated basefiles -#basefiles = \ -## $(DOC_MODULE).types \ -# $(DOC_MODULE)-sections.txt \ -# $(DOC_MODULE)-docs.sgml - -# ugly hack to make -unused.sgml work -#unused-build.stamp: -# BUILDDIR=`pwd` && \ -# cd $(srcdir)/tmpl && \ -# ln -sf gstreamer-libs-unused.sgml \ -# $$BUILDDIR/tmpl/gstreamer-libs-@GST_MAJORMINOR@-unused.sgml -# touch unused-build.stamp - -# these rules are added to create parallel docs using GST_MAJORMINOR -#$(basefiles): gstreamer-libs-@GST_MAJORMINOR@%: gstreamer-libs% -# cp $< $@ - -#CLEANFILES = $(basefiles) - # The top-level SGML file. Change it if you want. DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml -# The directory containing the source code. Relative to $(top_srcdir). +# The directory containing the source code. # gtk-doc will search all .c & .h files beneath here for inline comments # documenting functions and macros. DOC_SOURCE_DIR = $(top_srcdir)/ext/ffmpeg @@ -52,14 +32,8 @@ MKDB_OPTIONS=--sgml-mode #FIXXREF_OPTIONS=--extra-dir=../gst/html # Used for dependencies. -HFILE_GLOB=$(DOC_SOURCE_DIR)/*.h -CFILE_GLOB=$(DOC_SOURCE_DIR)/*.c - -# this is a wingo addition -# thomasvs: another nice wingo addition would be an explanation on why -# this is useful ;) - -SCANOBJ_DEPS = +HFILE_GLOB=$(top_srcdir)/ext/ffmpeg/*.h +CFILE_GLOB=$(top_srcdir)/ext/ffmpeg/*.c # Header files to ignore when scanning. IGNORE_HFILES = @@ -87,7 +61,7 @@ extra_files = # CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib # contains GtkObjects/GObjects and you want to document signals and properties. GTKDOC_CFLAGS = $(GST_BASE_CFLAGS) -I$(top_builddir) -I$(top_builddir)/gst-libs -GTKDOC_LIBS = $(SCANOBJ_DEPS) $(GST_BASE_LIBS) +GTKDOC_LIBS = $(GST_BASE_LIBS) GTKDOC_CC=$(LIBTOOL) --tag=CC --mode=compile $(CC) GTKDOC_LD=$(LIBTOOL) --tag=CC --mode=link $(CC) From 42cb5bd386f7f4664a104cfaefc53f57e635b246 Mon Sep 17 00:00:00 2001 From: Tvrtko Ursulin Date: Fri, 12 Aug 2011 09:06:03 +0100 Subject: [PATCH 08/11] ffdeinterlace: add "mode" property including automatic mode Just like deinterlace. https://bugzilla.gnome.org/show_bug.cgi?id=656328 --- ext/ffmpeg/gstffmpegdeinterlace.c | 163 +++++++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 1 deletion(-) diff --git a/ext/ffmpeg/gstffmpegdeinterlace.c b/ext/ffmpeg/gstffmpegdeinterlace.c index cd049284d9..de953149fa 100644 --- a/ext/ffmpeg/gstffmpegdeinterlace.c +++ b/ext/ffmpeg/gstffmpegdeinterlace.c @@ -37,6 +37,47 @@ #include "gstffmpegcodecmap.h" #include "gstffmpegutils.h" + +/* Properties */ + +#define DEFAULT_MODE GST_FFMPEGDEINTERLACE_MODE_AUTO + +enum +{ + PROP_0, + PROP_MODE, + PROP_LAST +}; + +typedef enum +{ + GST_FFMPEGDEINTERLACE_MODE_AUTO, + GST_FFMPEGDEINTERLACE_MODE_INTERLACED, + GST_FFMPEGDEINTERLACE_MODE_DISABLED +} GstFFMpegDeinterlaceMode; + +#define GST_TYPE_FFMPEGDEINTERLACE_MODES (gst_ffmpegdeinterlace_modes_get_type ()) +static GType +gst_ffmpegdeinterlace_modes_get_type (void) +{ + static GType deinterlace_modes_type = 0; + + static const GEnumValue modes_types[] = { + {GST_FFMPEGDEINTERLACE_MODE_AUTO, "Auto detection", "auto"}, + {GST_FFMPEGDEINTERLACE_MODE_INTERLACED, "Force deinterlacing", + "interlaced"}, + {GST_FFMPEGDEINTERLACE_MODE_DISABLED, "Run in passthrough mode", + "disabled"}, + {0, NULL, NULL}, + }; + + if (!deinterlace_modes_type) { + deinterlace_modes_type = + g_enum_register_static ("GstFFMpegDeinterlaceModes", modes_types); + } + return deinterlace_modes_type; +} + typedef struct _GstFFMpegDeinterlace { GstElement element; @@ -46,6 +87,14 @@ typedef struct _GstFFMpegDeinterlace gint width, height; gint to_size; + GstFFMpegDeinterlaceMode mode; + + gboolean interlaced; /* is input interlaced? */ + gboolean passthrough; + + gboolean reconfigure; + GstFFMpegDeinterlaceMode new_mode; + enum PixelFormat pixfmt; AVPicture from_frame, to_frame; } GstFFMpegDeinterlace; @@ -68,6 +117,11 @@ typedef struct _GstFFMpegDeinterlaceClass GType gst_ffmpegdeinterlace_get_type (void); +static void gst_ffmpegdeinterlace_set_property (GObject * self, guint prop_id, + const GValue * value, GParamSpec * pspec); +static void gst_ffmpegdeinterlace_get_property (GObject * self, guint prop_id, + GValue * value, GParamSpec * pspec); + static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, @@ -103,6 +157,35 @@ gst_ffmpegdeinterlace_base_init (gpointer g_class) static void gst_ffmpegdeinterlace_class_init (GstFFMpegDeinterlaceClass * klass) { + GObjectClass *gobject_class = (GObjectClass *) klass; + + gobject_class->set_property = gst_ffmpegdeinterlace_set_property; + gobject_class->get_property = gst_ffmpegdeinterlace_get_property; + + /** + * GstFFMpegDeinterlace:mode + * + * This selects whether the deinterlacing methods should + * always be applied or if they should only be applied + * on content that has the "interlaced" flag on the caps. + * + * Since: 0.10.13 + */ + g_object_class_install_property (gobject_class, PROP_MODE, + g_param_spec_enum ("mode", "Mode", "Deinterlace Mode", + GST_TYPE_FFMPEGDEINTERLACE_MODES, + DEFAULT_MODE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) + ); +} + +static void +gst_ffmpegdeinterlace_update_passthrough (GstFFMpegDeinterlace * deinterlace) +{ + deinterlace->passthrough = + (deinterlace->mode == GST_FFMPEGDEINTERLACE_MODE_DISABLED + || (!deinterlace->interlaced + && deinterlace->mode != GST_FFMPEGDEINTERLACE_MODE_INTERLACED)); + GST_DEBUG_OBJECT (deinterlace, "Passthrough: %d", deinterlace->passthrough); } static gboolean @@ -120,6 +203,10 @@ gst_ffmpegdeinterlace_sink_setcaps (GstPad * pad, GstCaps * caps) if (!gst_structure_get_int (structure, "height", &deinterlace->height)) return FALSE; + deinterlace->interlaced = FALSE; + gst_structure_get_boolean (structure, "interlaced", &deinterlace->interlaced); + gst_ffmpegdeinterlace_update_passthrough (deinterlace); + ctx = avcodec_alloc_context (); ctx->width = deinterlace->width; ctx->height = deinterlace->height; @@ -139,7 +226,8 @@ gst_ffmpegdeinterlace_sink_setcaps (GstPad * pad, GstCaps * caps) deinterlace->height); src_caps = gst_caps_copy (caps); - gst_caps_set_simple (src_caps, "interlaced", G_TYPE_BOOLEAN, FALSE, NULL); + gst_caps_set_simple (src_caps, "interlaced", G_TYPE_BOOLEAN, + deinterlace->interlaced, NULL); ret = gst_pad_set_caps (deinterlace->srcpad, src_caps); gst_caps_unref (src_caps); @@ -162,6 +250,12 @@ gst_ffmpegdeinterlace_init (GstFFMpegDeinterlace * deinterlace, gst_element_add_pad (GST_ELEMENT (deinterlace), deinterlace->srcpad); deinterlace->pixfmt = PIX_FMT_NB; + + deinterlace->interlaced = FALSE; + deinterlace->passthrough = FALSE; + deinterlace->reconfigure = FALSE; + deinterlace->mode = DEFAULT_MODE; + deinterlace->new_mode = -1; } static GstFlowReturn @@ -172,6 +266,24 @@ gst_ffmpegdeinterlace_chain (GstPad * pad, GstBuffer * inbuf) GstBuffer *outbuf = NULL; GstFlowReturn result; + GST_OBJECT_LOCK (deinterlace); + if (deinterlace->reconfigure) { + if (deinterlace->new_mode != -1) + deinterlace->mode = deinterlace->new_mode; + deinterlace->new_mode = -1; + + deinterlace->reconfigure = FALSE; + GST_OBJECT_UNLOCK (deinterlace); + if (GST_PAD_CAPS (deinterlace->srcpad)) + gst_ffmpegdeinterlace_sink_setcaps (deinterlace->sinkpad, + GST_PAD_CAPS (deinterlace->sinkpad)); + } else { + GST_OBJECT_UNLOCK (deinterlace); + } + + if (deinterlace->passthrough) + return gst_pad_push (deinterlace->srcpad, inbuf); + result = gst_pad_alloc_buffer (deinterlace->srcpad, GST_BUFFER_OFFSET_NONE, deinterlace->to_size, GST_PAD_CAPS (deinterlace->srcpad), &outbuf); @@ -202,3 +314,52 @@ gst_ffmpegdeinterlace_register (GstPlugin * plugin) return gst_element_register (plugin, "ffdeinterlace", GST_RANK_NONE, GST_TYPE_FFMPEGDEINTERLACE); } + +static void +gst_ffmpegdeinterlace_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstFFMpegDeinterlace *self; + + g_return_if_fail (GST_IS_FFMPEGDEINTERLACE (object)); + self = GST_FFMPEGDEINTERLACE (object); + + switch (prop_id) { + case PROP_MODE:{ + gint new_mode; + + GST_OBJECT_LOCK (self); + new_mode = g_value_get_enum (value); + if (self->mode != new_mode && GST_PAD_CAPS (self->srcpad)) { + self->reconfigure = TRUE; + self->new_mode = new_mode; + } else { + self->mode = new_mode; + gst_ffmpegdeinterlace_update_passthrough (self); + } + GST_OBJECT_UNLOCK (self); + break; + } + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); + } + +} + +static void +gst_ffmpegdeinterlace_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec) +{ + GstFFMpegDeinterlace *self; + + g_return_if_fail (GST_IS_FFMPEGDEINTERLACE (object)); + self = GST_FFMPEGDEINTERLACE (object); + + switch (prop_id) { + case PROP_MODE: + g_value_set_enum (value, self->mode); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); + } +} From 902ee8a9059f55eff1fefeecf1f9b96d99781ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 26 Sep 2011 19:54:52 +0100 Subject: [PATCH 09/11] ffmpegcodecmap: don't create dummy codec data for FLAC decoder Since then it just errors out because it's too small, as it wants the flac headers as codec data if there is codec data. https://bugzilla.gnome.org/show_bug.cgi?id=589361 --- ext/ffmpeg/gstffmpegcodecmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/ffmpeg/gstffmpegcodecmap.c b/ext/ffmpeg/gstffmpegcodecmap.c index 42cad1a28e..89bda3db78 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.c +++ b/ext/ffmpeg/gstffmpegcodecmap.c @@ -2387,7 +2387,8 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id, } GST_DEBUG ("have codec data of size %d", size); - } else if (context->extradata == NULL && codec_id != CODEC_ID_AAC_LATM) { + } else if (context->extradata == NULL && codec_id != CODEC_ID_AAC_LATM && + codec_id != CODEC_ID_FLAC) { /* no extradata, alloc dummy with 0 sized, some codecs insist on reading * extradata anyway which makes then segfault. */ context->extradata = From 8a34abff64dcfac2025c8a923ea6fbf1797c89c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 26 Sep 2011 19:55:54 +0100 Subject: [PATCH 10/11] ffmpegdec: disable parser for already-parsed FLAC input Not needed to make anything work, just seems to make sense. https://bugzilla.gnome.org/show_bug.cgi?id=589361 --- ext/ffmpeg/gstffmpegdec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index 0131ff08b5..395937d235 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -852,6 +852,12 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps) } } + /* for FLAC, don't parse if it's already parsed */ + if (oclass->in_plugin->id == CODEC_ID_FLAC) { + if (gst_structure_has_field (structure, "streamheader")) + ffmpegdec->turnoff_parser = TRUE; + } + /* workaround encoder bugs */ ffmpegdec->context->workaround_bugs |= FF_BUG_AUTODETECT; ffmpegdec->context->error_recognition = 1; From 8bf3d5a2b77eff15e130bde36366457c26b7f66a Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Thu, 1 Sep 2011 16:46:47 +0100 Subject: [PATCH 11/11] ffmpegdec: post QoS messages when dropping a frame There seems to be a little bit of non obvious logic where the QoS logic can decide to not drop decoding a frame and pass it to ffmpeg, telling it to drop. In this case, the QoS logic does not drop the frame itself, but since the frame will end up being dropped, we still mark it as dropped and post a QoS message. https://bugzilla.gnome.org/show_bug.cgi?id=657950 --- ext/ffmpeg/gstffmpegdec.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index 395937d235..47cd96ce4a 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -126,6 +126,8 @@ struct _GstFFMpegDec /* QoS stuff *//* with LOCK */ gdouble proportion; GstClockTime earliest_time; + gint64 processed; + gint64 dropped; /* clipping segment */ GstSegment segment; @@ -539,6 +541,8 @@ static void gst_ffmpegdec_reset_qos (GstFFMpegDec * ffmpegdec) { gst_ffmpegdec_update_qos (ffmpegdec, 0.5, GST_CLOCK_TIME_NONE); + ffmpegdec->processed = 0; + ffmpegdec->dropped = 0; } static void @@ -1369,6 +1373,7 @@ gst_ffmpegdec_do_qos (GstFFMpegDec * ffmpegdec, GstClockTime timestamp, GstClockTimeDiff diff; gdouble proportion; GstClockTime qostime, earliest_time; + gboolean res = TRUE; *mode_switch = FALSE; @@ -1419,11 +1424,13 @@ gst_ffmpegdec_do_qos (GstFFMpegDec * ffmpegdec, GstClockTime timestamp, } no_qos: + ffmpegdec->processed++; return TRUE; skipping: { - return FALSE; + res = FALSE; + goto drop_qos; } normal_mode: { @@ -1432,6 +1439,7 @@ normal_mode: *mode_switch = TRUE; GST_DEBUG_OBJECT (ffmpegdec, "QOS: normal mode %g < 0.4", proportion); } + ffmpegdec->processed++; return TRUE; } skip_frame: @@ -1442,7 +1450,27 @@ skip_frame: GST_DEBUG_OBJECT (ffmpegdec, "QOS: hurry up, diff %" G_GINT64_FORMAT " >= 0", diff); } - return TRUE; + goto drop_qos; + } +drop_qos: + { + GstClockTime stream_time, jitter; + GstMessage *qos_msg; + + ffmpegdec->dropped++; + stream_time = + gst_segment_to_stream_time (&ffmpegdec->segment, GST_FORMAT_TIME, + timestamp); + jitter = GST_CLOCK_DIFF (qostime, earliest_time); + qos_msg = + gst_message_new_qos (GST_OBJECT_CAST (ffmpegdec), FALSE, qostime, + stream_time, timestamp, GST_CLOCK_TIME_NONE); + gst_message_set_qos_values (qos_msg, jitter, proportion, 1000000); + gst_message_set_qos_stats (qos_msg, GST_FORMAT_BUFFERS, + ffmpegdec->processed, ffmpegdec->dropped); + gst_element_post_message (GST_ELEMENT_CAST (ffmpegdec), qos_msg); + + return res; } }