Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
/* GStreamer
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
* Copyright (C) <2008> Mindfruit B.V.
|
|
|
|
* @author Sjoerd Simons <sjoerd@luon.net>
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
* Copyright (C) <2007> Julien Moutte <julien@fluendo.com>
|
2011-05-12 10:07:39 +00:00
|
|
|
* Copyright (C) <2011> Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
|
|
|
|
* Copyright (C) <2011> Nokia Corporation
|
2011-09-26 19:58:58 +00:00
|
|
|
* Copyright (C) <2011> Intel
|
|
|
|
* Copyright (C) <2011> Collabora Ltd.
|
|
|
|
* Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:38:00 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
#include <string.h>
|
2013-12-16 09:21:00 +00:00
|
|
|
#include <gst/base/base.h>
|
|
|
|
#include <gst/pbutils/pbutils.h>
|
2011-12-18 17:37:08 +00:00
|
|
|
#include <gst/video/video.h>
|
2011-09-29 17:37:59 +00:00
|
|
|
|
2011-09-26 13:39:31 +00:00
|
|
|
#include "gstmpeg4videoparse.h"
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
GST_DEBUG_CATEGORY (mpeg4v_parse_debug);
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
#define GST_CAT_DEFAULT mpeg4v_parse_debug
|
|
|
|
|
|
|
|
static GstStaticPadTemplate src_template =
|
2012-12-17 14:04:44 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC,
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("video/mpeg, "
|
|
|
|
"mpegversion = (int) 4, "
|
2012-11-15 13:14:34 +00:00
|
|
|
"width = (int)[ 0, max ], "
|
|
|
|
"height = (int)[ 0, max ], "
|
2012-11-15 14:37:12 +00:00
|
|
|
"framerate = (fraction)[ 0, max ] ,"
|
2012-12-13 10:43:09 +00:00
|
|
|
"parsed = (boolean) true, " "systemstream = (boolean) false; "
|
|
|
|
"video/x-divx, " "divxversion = (int) [ 4, 5 ]")
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate sink_template =
|
2012-12-17 14:04:44 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK,
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("video/mpeg, "
|
2012-12-13 10:43:09 +00:00
|
|
|
"mpegversion = (int) 4, " "systemstream = (boolean) false; "
|
|
|
|
"video/x-divx, " "divxversion = (int) [ 4, 5 ]")
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
);
|
|
|
|
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
/* Properties */
|
2011-09-26 19:58:58 +00:00
|
|
|
#define DEFAULT_PROP_DROP TRUE
|
2010-06-15 09:16:34 +00:00
|
|
|
#define DEFAULT_CONFIG_INTERVAL (0)
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_DROP,
|
2015-04-24 15:48:23 +00:00
|
|
|
PROP_CONFIG_INTERVAL
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
};
|
|
|
|
|
2011-10-06 12:03:29 +00:00
|
|
|
#define gst_mpeg4vparse_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE (GstMpeg4VParse, gst_mpeg4vparse, GST_TYPE_BASE_PARSE);
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
static gboolean gst_mpeg4vparse_start (GstBaseParse * parse);
|
|
|
|
static gboolean gst_mpeg4vparse_stop (GstBaseParse * parse);
|
2012-02-13 17:44:01 +00:00
|
|
|
static GstFlowReturn gst_mpeg4vparse_handle_frame (GstBaseParse * parse,
|
|
|
|
GstBaseParseFrame * frame, gint * skipsize);
|
2011-05-12 10:07:39 +00:00
|
|
|
static GstFlowReturn gst_mpeg4vparse_parse_frame (GstBaseParse * parse,
|
|
|
|
GstBaseParseFrame * frame);
|
|
|
|
static GstFlowReturn gst_mpeg4vparse_pre_push_frame (GstBaseParse * parse,
|
|
|
|
GstBaseParseFrame * frame);
|
|
|
|
static gboolean gst_mpeg4vparse_set_caps (GstBaseParse * parse, GstCaps * caps);
|
2011-11-25 11:48:58 +00:00
|
|
|
static GstCaps *gst_mpeg4vparse_get_caps (GstBaseParse * parse,
|
|
|
|
GstCaps * filter);
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
static void gst_mpeg4vparse_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_mpeg4vparse_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2011-12-18 17:37:08 +00:00
|
|
|
static gboolean gst_mpeg4vparse_event (GstBaseParse * parse, GstEvent * event);
|
|
|
|
static gboolean gst_mpeg4vparse_src_event (GstBaseParse * parse,
|
|
|
|
GstEvent * event);
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
static void
|
|
|
|
gst_mpeg4vparse_set_property (GObject * object, guint property_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2011-09-26 13:39:31 +00:00
|
|
|
GstMpeg4VParse *parse = GST_MPEG4VIDEO_PARSE (object);
|
2010-11-18 08:09:23 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
switch (property_id) {
|
|
|
|
case PROP_DROP:
|
|
|
|
parse->drop = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case PROP_CONFIG_INTERVAL:
|
|
|
|
parse->interval = g_value_get_uint (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
2010-11-18 08:09:23 +00:00
|
|
|
}
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
}
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
static void
|
|
|
|
gst_mpeg4vparse_get_property (GObject * object, guint property_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
{
|
2011-09-26 13:39:31 +00:00
|
|
|
GstMpeg4VParse *parse = GST_MPEG4VIDEO_PARSE (object);
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
switch (property_id) {
|
|
|
|
case PROP_DROP:
|
|
|
|
g_value_set_boolean (value, parse->drop);
|
|
|
|
break;
|
|
|
|
case PROP_CONFIG_INTERVAL:
|
|
|
|
g_value_set_uint (value, parse->interval);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
static void
|
|
|
|
gst_mpeg4vparse_class_init (GstMpeg4VParseClass * klass)
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
{
|
2011-05-12 10:07:39 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
GstBaseParseClass *parse_class = GST_BASE_PARSE_CLASS (klass);
|
2011-12-30 10:41:17 +00:00
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
gobject_class->set_property = gst_mpeg4vparse_set_property;
|
|
|
|
gobject_class->get_property = gst_mpeg4vparse_get_property;
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_DROP,
|
|
|
|
g_param_spec_boolean ("drop", "drop",
|
|
|
|
"Drop data untill valid configuration data is received either "
|
|
|
|
"in the stream or through caps", DEFAULT_PROP_DROP,
|
|
|
|
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_CONFIG_INTERVAL,
|
|
|
|
g_param_spec_uint ("config-interval",
|
|
|
|
"Configuration Send Interval",
|
|
|
|
"Send Configuration Insertion Interval in seconds (configuration headers "
|
|
|
|
"will be multiplexed in the data stream when detected.) (0 = disabled)",
|
|
|
|
0, 3600, DEFAULT_CONFIG_INTERVAL,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-12-30 10:41:17 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2011-10-06 12:03:29 +00:00
|
|
|
gst_static_pad_template_get (&src_template));
|
2011-12-30 10:41:17 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2011-10-06 12:03:29 +00:00
|
|
|
gst_static_pad_template_get (&sink_template));
|
|
|
|
|
2012-10-17 16:34:26 +00:00
|
|
|
gst_element_class_set_static_metadata (element_class,
|
2011-10-06 12:03:29 +00:00
|
|
|
"MPEG 4 video elementary stream parser", "Codec/Parser/Video",
|
|
|
|
"Parses MPEG-4 Part 2 elementary video streams",
|
|
|
|
"Julien Moutte <julien@fluendo.com>");
|
|
|
|
|
2011-12-30 10:41:17 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (mpeg4v_parse_debug, "mpeg4videoparse", 0,
|
|
|
|
"MPEG-4 video parser");
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* Override BaseParse vfuncs */
|
|
|
|
parse_class->start = GST_DEBUG_FUNCPTR (gst_mpeg4vparse_start);
|
|
|
|
parse_class->stop = GST_DEBUG_FUNCPTR (gst_mpeg4vparse_stop);
|
2012-02-13 17:44:01 +00:00
|
|
|
parse_class->handle_frame = GST_DEBUG_FUNCPTR (gst_mpeg4vparse_handle_frame);
|
2011-05-12 10:07:39 +00:00
|
|
|
parse_class->pre_push_frame =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_mpeg4vparse_pre_push_frame);
|
|
|
|
parse_class->set_sink_caps = GST_DEBUG_FUNCPTR (gst_mpeg4vparse_set_caps);
|
2011-11-24 09:04:30 +00:00
|
|
|
parse_class->get_sink_caps = GST_DEBUG_FUNCPTR (gst_mpeg4vparse_get_caps);
|
2012-03-30 10:02:16 +00:00
|
|
|
parse_class->sink_event = GST_DEBUG_FUNCPTR (gst_mpeg4vparse_event);
|
2011-12-18 17:37:08 +00:00
|
|
|
parse_class->src_event = GST_DEBUG_FUNCPTR (gst_mpeg4vparse_src_event);
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
}
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
static void
|
2011-10-06 12:03:29 +00:00
|
|
|
gst_mpeg4vparse_init (GstMpeg4VParse * parse)
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
{
|
2011-05-12 10:07:39 +00:00
|
|
|
parse->interval = DEFAULT_CONFIG_INTERVAL;
|
|
|
|
parse->last_report = GST_CLOCK_TIME_NONE;
|
2012-09-13 05:58:04 +00:00
|
|
|
|
|
|
|
gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (parse), FALSE);
|
2013-12-04 08:13:31 +00:00
|
|
|
GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (parse));
|
2015-08-14 14:43:18 +00:00
|
|
|
GST_PAD_SET_ACCEPT_TEMPLATE (GST_BASE_PARSE_SINK_PAD (parse));
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
}
|
|
|
|
|
2010-04-20 13:37:03 +00:00
|
|
|
static void
|
2011-05-12 10:07:39 +00:00
|
|
|
gst_mpeg4vparse_reset_frame (GstMpeg4VParse * mp4vparse)
|
2010-04-20 13:37:03 +00:00
|
|
|
{
|
2011-05-12 10:07:39 +00:00
|
|
|
/* done parsing; reset state */
|
|
|
|
mp4vparse->last_sc = -1;
|
|
|
|
mp4vparse->vop_offset = -1;
|
2011-09-26 19:58:58 +00:00
|
|
|
mp4vparse->vo_found = FALSE;
|
2012-10-09 11:53:19 +00:00
|
|
|
mp4vparse->config_found = FALSE;
|
2011-09-26 19:58:58 +00:00
|
|
|
mp4vparse->vol_offset = -1;
|
2012-09-02 18:17:14 +00:00
|
|
|
mp4vparse->vo_offset = -1;
|
2011-05-12 10:07:39 +00:00
|
|
|
}
|
2010-04-20 13:37:03 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
static void
|
|
|
|
gst_mpeg4vparse_reset (GstMpeg4VParse * mp4vparse)
|
|
|
|
{
|
|
|
|
gst_mpeg4vparse_reset_frame (mp4vparse);
|
|
|
|
mp4vparse->update_caps = TRUE;
|
2011-09-29 17:37:59 +00:00
|
|
|
mp4vparse->profile = NULL;
|
|
|
|
mp4vparse->level = NULL;
|
2011-12-18 17:37:08 +00:00
|
|
|
mp4vparse->pending_key_unit_ts = GST_CLOCK_TIME_NONE;
|
|
|
|
mp4vparse->force_key_unit_event = NULL;
|
2014-01-08 19:33:05 +00:00
|
|
|
mp4vparse->discont = FALSE;
|
2010-04-20 13:37:03 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
gst_buffer_replace (&mp4vparse->config, NULL);
|
2011-09-26 19:58:58 +00:00
|
|
|
memset (&mp4vparse->vol, 0, sizeof (mp4vparse->vol));
|
2010-04-20 13:37:03 +00:00
|
|
|
}
|
|
|
|
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
static gboolean
|
2011-05-12 10:07:39 +00:00
|
|
|
gst_mpeg4vparse_start (GstBaseParse * parse)
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
{
|
2011-09-26 13:39:31 +00:00
|
|
|
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEO_PARSE (parse);
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
GST_DEBUG_OBJECT (parse, "start");
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
gst_mpeg4vparse_reset (mp4vparse);
|
2011-05-17 20:39:19 +00:00
|
|
|
/* at least this much for a valid frame */
|
|
|
|
gst_base_parse_set_min_frame_size (parse, 6);
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
return TRUE;
|
2009-02-26 14:40:26 +00:00
|
|
|
}
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
static gboolean
|
|
|
|
gst_mpeg4vparse_stop (GstBaseParse * parse)
|
2009-09-07 14:20:23 +00:00
|
|
|
{
|
2011-09-26 13:39:31 +00:00
|
|
|
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEO_PARSE (parse);
|
2009-09-07 14:20:23 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
GST_DEBUG_OBJECT (parse, "stop");
|
2009-09-07 14:20:23 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
gst_mpeg4vparse_reset (mp4vparse);
|
2009-09-07 14:20:23 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
return TRUE;
|
2009-09-07 14:20:23 +00:00
|
|
|
}
|
|
|
|
|
2009-02-26 14:40:26 +00:00
|
|
|
static gboolean
|
2011-09-26 19:58:58 +00:00
|
|
|
gst_mpeg4vparse_process_config (GstMpeg4VParse * mp4vparse,
|
|
|
|
const guint8 * data, guint offset, gsize size)
|
2009-02-26 14:40:26 +00:00
|
|
|
{
|
2012-09-02 18:17:14 +00:00
|
|
|
GstMpeg4VisualObject *vo;
|
2013-08-16 19:41:48 +00:00
|
|
|
GstMpeg4VideoObjectLayer vol = { 0 };
|
2012-09-02 18:17:14 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* only do stuff if something new */
|
2012-01-09 13:28:14 +00:00
|
|
|
if (mp4vparse->config
|
2013-08-16 19:41:48 +00:00
|
|
|
&& gst_buffer_get_size (mp4vparse->config) == size
|
2012-01-09 13:28:14 +00:00
|
|
|
&& !gst_buffer_memcmp (mp4vparse->config, offset, data, size))
|
2009-02-26 14:40:26 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2011-09-26 19:58:58 +00:00
|
|
|
if (mp4vparse->vol_offset < 0) {
|
|
|
|
GST_WARNING ("No video object Layer parsed in this frame, cannot accept "
|
|
|
|
"config");
|
2011-05-12 10:07:39 +00:00
|
|
|
return FALSE;
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
}
|
|
|
|
|
2012-09-02 18:17:14 +00:00
|
|
|
vo = mp4vparse->vo_found ? &mp4vparse->vo : NULL;
|
|
|
|
|
2011-09-26 19:58:58 +00:00
|
|
|
/* If the parsing fail, we accept the config only if we don't have
|
|
|
|
* any config yet. */
|
2013-08-16 19:41:48 +00:00
|
|
|
if (gst_mpeg4_parse_video_object_layer (&vol,
|
2012-09-02 18:17:14 +00:00
|
|
|
vo, data + mp4vparse->vol_offset,
|
2011-09-26 19:58:58 +00:00
|
|
|
size - mp4vparse->vol_offset) != GST_MPEG4_PARSER_OK &&
|
|
|
|
mp4vparse->config)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-08-16 19:41:48 +00:00
|
|
|
/* ignore update if nothing meaningful changed */
|
|
|
|
if (vol.height == mp4vparse->vol.height &&
|
|
|
|
vol.width == mp4vparse->vol.width &&
|
|
|
|
vol.vop_time_increment_resolution ==
|
|
|
|
mp4vparse->vol.vop_time_increment_resolution &&
|
|
|
|
vol.fixed_vop_time_increment == mp4vparse->vol.fixed_vop_time_increment &&
|
|
|
|
vol.par_width == mp4vparse->vol.par_width &&
|
|
|
|
vol.par_height == mp4vparse->vol.par_height &&
|
|
|
|
vol.sprite_enable == mp4vparse->vol.sprite_enable &&
|
|
|
|
vol.no_of_sprite_warping_points ==
|
|
|
|
mp4vparse->vol.no_of_sprite_warping_points)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
mp4vparse->vol = vol;
|
|
|
|
|
2011-09-26 19:58:58 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse, "Width/Height: %u/%u, "
|
|
|
|
"time increment resolution: %u fixed time increment: %u",
|
2011-12-06 19:27:25 +00:00
|
|
|
mp4vparse->vol.width, mp4vparse->vol.height,
|
2011-09-26 19:58:58 +00:00
|
|
|
mp4vparse->vol.vop_time_increment_resolution,
|
|
|
|
mp4vparse->vol.fixed_vop_time_increment);
|
|
|
|
|
|
|
|
|
2013-03-03 11:30:21 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse, "accepting parsed config size %" G_GSIZE_FORMAT,
|
2011-05-29 11:03:38 +00:00
|
|
|
size);
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
if (mp4vparse->config != NULL)
|
|
|
|
gst_buffer_unref (mp4vparse->config);
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-12-30 10:41:17 +00:00
|
|
|
mp4vparse->config = gst_buffer_new_wrapped (g_memdup (data, size), size);
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* trigger src caps update */
|
|
|
|
mp4vparse->update_caps = TRUE;
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
return TRUE;
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
}
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* caller guarantees at least start code in @buf at @off */
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
static gboolean
|
2011-09-26 19:58:58 +00:00
|
|
|
gst_mpeg4vparse_process_sc (GstMpeg4VParse * mp4vparse, GstMpeg4Packet * packet,
|
|
|
|
gsize size)
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
{
|
|
|
|
|
2011-09-26 19:58:58 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse, "process startcode %x", packet->type);
|
2010-01-16 21:17:08 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* if we found a VOP, next start code ends it,
|
|
|
|
* except for final VOS end sequence code included in last VOP-frame */
|
2011-09-26 19:58:58 +00:00
|
|
|
if (mp4vparse->vop_offset >= 0 &&
|
|
|
|
packet->type != GST_MPEG4_VISUAL_OBJ_SEQ_END) {
|
|
|
|
if (G_LIKELY (size > mp4vparse->vop_offset + 1)) {
|
2011-05-12 10:07:39 +00:00
|
|
|
mp4vparse->intra_frame =
|
2011-09-26 19:58:58 +00:00
|
|
|
((packet->data[mp4vparse->vop_offset + 1] >> 6 & 0x3) == 0);
|
2010-01-16 21:17:08 +00:00
|
|
|
} else {
|
2011-05-12 10:07:39 +00:00
|
|
|
GST_WARNING_OBJECT (mp4vparse, "no data following VOP startcode");
|
|
|
|
mp4vparse->intra_frame = FALSE;
|
2010-01-16 21:17:08 +00:00
|
|
|
}
|
2013-02-14 09:40:08 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse, "ending frame of size %d, is intra %d",
|
|
|
|
packet->offset - 3, mp4vparse->intra_frame);
|
2011-05-12 10:07:39 +00:00
|
|
|
return TRUE;
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
}
|
|
|
|
|
2012-09-02 18:17:14 +00:00
|
|
|
if (mp4vparse->vo_offset >= 0) {
|
|
|
|
gst_mpeg4_parse_visual_object (&mp4vparse->vo, NULL,
|
|
|
|
packet->data + mp4vparse->vo_offset,
|
|
|
|
packet->offset - 3 - mp4vparse->vo_offset);
|
|
|
|
mp4vparse->vo_offset = -1;
|
|
|
|
mp4vparse->vo_found = TRUE;
|
|
|
|
}
|
|
|
|
|
2011-09-26 19:58:58 +00:00
|
|
|
switch (packet->type) {
|
|
|
|
case GST_MPEG4_VIDEO_OBJ_PLANE:
|
|
|
|
case GST_MPEG4_GROUP_OF_VOP:
|
2012-09-02 16:21:16 +00:00
|
|
|
case GST_MPEG4_USER_DATA:
|
2011-05-12 10:07:39 +00:00
|
|
|
{
|
2011-09-26 19:58:58 +00:00
|
|
|
if (packet->type == GST_MPEG4_VIDEO_OBJ_PLANE) {
|
2011-05-12 10:07:39 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse, "startcode is VOP");
|
2011-09-26 19:58:58 +00:00
|
|
|
mp4vparse->vop_offset = packet->offset;
|
2012-09-02 16:21:16 +00:00
|
|
|
} else if (packet->type == GST_MPEG4_GROUP_OF_VOP) {
|
2011-05-12 10:07:39 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse, "startcode is GOP");
|
2012-09-02 16:21:16 +00:00
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (mp4vparse, "startcode is User Data");
|
2010-11-18 08:09:23 +00:00
|
|
|
}
|
2011-05-12 10:07:39 +00:00
|
|
|
/* parse config data ending here if proper startcodes found earlier;
|
2012-09-02 18:17:14 +00:00
|
|
|
* we should have received a visual object before. */
|
2012-10-09 11:53:19 +00:00
|
|
|
if (mp4vparse->config_found) {
|
2011-09-26 19:58:58 +00:00
|
|
|
/*Do not take care startcode into account */
|
|
|
|
gst_mpeg4vparse_process_config (mp4vparse,
|
|
|
|
packet->data, packet->offset, packet->offset - 3);
|
|
|
|
mp4vparse->vo_found = FALSE;
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
}
|
2010-11-18 08:09:23 +00:00
|
|
|
break;
|
2011-05-12 10:07:39 +00:00
|
|
|
}
|
2011-09-26 19:58:58 +00:00
|
|
|
case GST_MPEG4_VISUAL_OBJ_SEQ_START:
|
|
|
|
GST_LOG_OBJECT (mp4vparse, "Visual Sequence Start");
|
2012-10-09 11:53:19 +00:00
|
|
|
mp4vparse->config_found = TRUE;
|
2011-09-29 17:37:59 +00:00
|
|
|
mp4vparse->profile = gst_codec_utils_mpeg4video_get_profile (packet->data
|
|
|
|
+ packet->offset + 1, packet->offset);
|
|
|
|
mp4vparse->level = gst_codec_utils_mpeg4video_get_level (packet->data
|
|
|
|
+ packet->offset + 1, packet->offset);
|
2010-11-18 08:09:23 +00:00
|
|
|
break;
|
2011-09-26 19:58:58 +00:00
|
|
|
case GST_MPEG4_VISUAL_OBJ:
|
|
|
|
GST_LOG_OBJECT (mp4vparse, "Visual Object");
|
2012-09-02 18:17:14 +00:00
|
|
|
mp4vparse->vo_offset = packet->offset;
|
2012-09-02 16:21:16 +00:00
|
|
|
break;
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
default:
|
2011-09-26 19:58:58 +00:00
|
|
|
if (packet->type >= GST_MPEG4_VIDEO_LAYER_FIRST &&
|
|
|
|
packet->type <= GST_MPEG4_VIDEO_LAYER_LAST) {
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (mp4vparse, "Video Object Layer");
|
|
|
|
|
2013-11-23 10:23:35 +00:00
|
|
|
/* we keep track of the offset to parse later on */
|
2011-09-26 19:58:58 +00:00
|
|
|
if (mp4vparse->vol_offset < 0)
|
|
|
|
mp4vparse->vol_offset = packet->offset;
|
|
|
|
|
2013-11-23 10:23:35 +00:00
|
|
|
/* Video Object below is merely a start code,
|
|
|
|
* if that is considered as config, then certainly Video Object Layer
|
|
|
|
* which really contains some needed data */
|
|
|
|
mp4vparse->config_found = TRUE;
|
|
|
|
|
2011-09-26 19:58:58 +00:00
|
|
|
/* VO (video object) cases */
|
|
|
|
} else if (packet->type <= GST_MPEG4_VIDEO_OBJ_LAST) {
|
|
|
|
GST_LOG_OBJECT (mp4vparse, "Video object");
|
2012-10-09 11:53:19 +00:00
|
|
|
mp4vparse->config_found = TRUE;
|
2011-05-12 10:07:39 +00:00
|
|
|
}
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* at least need to have a VOP in a frame */
|
|
|
|
return FALSE;
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
}
|
|
|
|
|
2012-02-13 17:44:01 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_mpeg4vparse_handle_frame (GstBaseParse * parse,
|
|
|
|
GstBaseParseFrame * frame, gint * skipsize)
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
{
|
2011-09-26 13:39:31 +00:00
|
|
|
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEO_PARSE (parse);
|
2011-09-26 19:58:58 +00:00
|
|
|
GstMpeg4Packet packet;
|
2012-01-25 15:20:41 +00:00
|
|
|
GstMapInfo map;
|
2011-12-30 10:41:17 +00:00
|
|
|
guint8 *data = NULL;
|
|
|
|
gsize size;
|
2011-05-12 10:07:39 +00:00
|
|
|
gint off = 0;
|
2011-10-06 12:03:29 +00:00
|
|
|
gboolean ret = FALSE;
|
2013-03-30 08:52:45 +00:00
|
|
|
guint framesize = 0;
|
2011-10-06 12:03:29 +00:00
|
|
|
|
2014-01-08 19:33:05 +00:00
|
|
|
if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (frame->buffer,
|
|
|
|
GST_BUFFER_FLAG_DISCONT))) {
|
|
|
|
mp4vparse->discont = TRUE;
|
|
|
|
}
|
|
|
|
|
2012-01-25 15:20:41 +00:00
|
|
|
gst_buffer_map (frame->buffer, &map, GST_MAP_READ);
|
|
|
|
data = map.data;
|
|
|
|
size = map.size;
|
2011-05-12 10:07:39 +00:00
|
|
|
|
|
|
|
retry:
|
|
|
|
/* at least start code and subsequent byte */
|
2012-02-13 17:44:01 +00:00
|
|
|
if (G_UNLIKELY (size - off < 5)) {
|
|
|
|
*skipsize = 1;
|
2011-12-30 10:41:17 +00:00
|
|
|
goto out;
|
2012-02-13 17:44:01 +00:00
|
|
|
}
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-17 20:18:51 +00:00
|
|
|
/* avoid stale cached parsing state */
|
2012-02-15 10:59:37 +00:00
|
|
|
if (frame->flags & GST_BASE_PARSE_FRAME_FLAG_NEW_FRAME) {
|
2011-05-17 20:18:51 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse, "parsing new frame");
|
|
|
|
gst_mpeg4vparse_reset_frame (mp4vparse);
|
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (mp4vparse, "resuming frame parsing");
|
|
|
|
}
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* if already found a previous start code, e.g. start of frame, go for next */
|
|
|
|
if (mp4vparse->last_sc >= 0) {
|
|
|
|
off = mp4vparse->last_sc;
|
|
|
|
goto next;
|
|
|
|
}
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* didn't find anything that looks like a sync word, skip */
|
2012-09-02 16:21:16 +00:00
|
|
|
switch (gst_mpeg4_parse (&packet, FALSE, NULL, data, off, size)) {
|
2011-09-26 19:58:58 +00:00
|
|
|
case (GST_MPEG4_PARSER_NO_PACKET):
|
|
|
|
case (GST_MPEG4_PARSER_ERROR):
|
|
|
|
*skipsize = size - 3;
|
2011-12-30 10:41:17 +00:00
|
|
|
goto out;
|
2011-09-26 19:58:58 +00:00
|
|
|
default:
|
|
|
|
break;
|
2011-05-12 10:07:39 +00:00
|
|
|
}
|
2011-09-26 19:58:58 +00:00
|
|
|
off = packet.offset;
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* possible frame header, but not at offset 0? skip bytes before sync */
|
2011-12-06 19:27:25 +00:00
|
|
|
if (G_UNLIKELY (off > 3)) {
|
|
|
|
*skipsize = off - 3;
|
2011-12-30 10:41:17 +00:00
|
|
|
goto out;
|
2011-05-12 10:07:39 +00:00
|
|
|
}
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-09-26 19:58:58 +00:00
|
|
|
switch (packet.type) {
|
|
|
|
case GST_MPEG4_GROUP_OF_VOP:
|
|
|
|
case GST_MPEG4_VISUAL_OBJ_SEQ_START:
|
|
|
|
case GST_MPEG4_VIDEO_OBJ_PLANE:
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-09-26 19:58:58 +00:00
|
|
|
if (packet.type <= GST_MPEG4_VIDEO_OBJ_LAST)
|
2011-05-12 10:07:39 +00:00
|
|
|
break;
|
2013-11-23 10:23:35 +00:00
|
|
|
if (packet.type >= GST_MPEG4_VIDEO_LAYER_FIRST &&
|
|
|
|
packet.type <= GST_MPEG4_VIDEO_LAYER_LAST)
|
|
|
|
break;
|
2011-05-12 10:07:39 +00:00
|
|
|
/* undesirable sc */
|
2013-11-23 10:23:35 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse, "start code is no VOS, VO, VOL, VOP or GOP");
|
2011-05-12 10:07:39 +00:00
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* found sc */
|
|
|
|
mp4vparse->last_sc = 0;
|
|
|
|
|
|
|
|
/* examine start code, which should not end frame at present */
|
2011-09-26 19:58:58 +00:00
|
|
|
gst_mpeg4vparse_process_sc (mp4vparse, &packet, size);
|
2011-05-12 10:07:39 +00:00
|
|
|
|
|
|
|
next:
|
2011-09-26 19:58:58 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse, "Looking for frame end");
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* start is fine as of now */
|
|
|
|
*skipsize = 0;
|
|
|
|
/* position a bit further than last sc */
|
|
|
|
off++;
|
2011-09-26 19:58:58 +00:00
|
|
|
|
|
|
|
/* so now we have start code at start of data; locate next packet */
|
2012-09-02 16:21:16 +00:00
|
|
|
switch (gst_mpeg4_parse (&packet, FALSE, NULL, data, off, size)) {
|
2011-09-26 19:58:58 +00:00
|
|
|
case (GST_MPEG4_PARSER_NO_PACKET_END):
|
|
|
|
ret = gst_mpeg4vparse_process_sc (mp4vparse, &packet, size);
|
|
|
|
if (ret)
|
|
|
|
break;
|
|
|
|
case (GST_MPEG4_PARSER_NO_PACKET):
|
|
|
|
case (GST_MPEG4_PARSER_ERROR):
|
|
|
|
/* if draining, take all */
|
|
|
|
if (GST_BASE_PARSE_DRAINING (parse)) {
|
2012-02-13 17:44:01 +00:00
|
|
|
framesize = size;
|
2011-12-30 10:41:17 +00:00
|
|
|
ret = TRUE;
|
2011-09-26 19:58:58 +00:00
|
|
|
} else {
|
|
|
|
/* resume scan where we left it */
|
|
|
|
mp4vparse->last_sc = size - 3;
|
|
|
|
}
|
2011-12-30 10:41:17 +00:00
|
|
|
goto out;
|
2011-09-26 19:58:58 +00:00
|
|
|
default:
|
|
|
|
/* decide whether this startcode ends a frame */
|
|
|
|
ret = gst_mpeg4vparse_process_sc (mp4vparse, &packet, size);
|
|
|
|
break;
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
}
|
|
|
|
|
2011-09-26 19:58:58 +00:00
|
|
|
off = packet.offset;
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
if (ret) {
|
2012-02-13 17:44:01 +00:00
|
|
|
framesize = off - 3;
|
2011-05-12 10:07:39 +00:00
|
|
|
} else {
|
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
|
2011-12-30 10:41:17 +00:00
|
|
|
out:
|
2012-01-25 15:20:41 +00:00
|
|
|
gst_buffer_unmap (frame->buffer, &map);
|
2012-02-13 17:44:01 +00:00
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
GstFlowReturn res;
|
|
|
|
|
|
|
|
g_assert (framesize <= map.size);
|
|
|
|
res = gst_mpeg4vparse_parse_frame (parse, frame);
|
|
|
|
if (res == GST_BASE_PARSE_FLOW_DROPPED)
|
|
|
|
frame->flags |= GST_BASE_PARSE_FRAME_FLAG_DROP;
|
2014-01-08 19:33:05 +00:00
|
|
|
if (G_UNLIKELY (mp4vparse->discont)) {
|
|
|
|
GST_BUFFER_FLAG_SET (frame->buffer, GST_BUFFER_FLAG_DISCONT);
|
|
|
|
mp4vparse->discont = FALSE;
|
|
|
|
}
|
2012-02-13 17:44:01 +00:00
|
|
|
return gst_base_parse_finish_frame (parse, frame, framesize);
|
|
|
|
}
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
}
|
|
|
|
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
static void
|
2011-05-12 10:07:39 +00:00
|
|
|
gst_mpeg4vparse_update_src_caps (GstMpeg4VParse * mp4vparse)
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
{
|
2011-05-12 10:07:39 +00:00
|
|
|
GstCaps *caps = NULL;
|
2012-09-08 15:03:33 +00:00
|
|
|
GstStructure *s = NULL;
|
2010-11-18 08:09:23 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* only update if no src caps yet or explicitly triggered */
|
2011-10-06 12:03:29 +00:00
|
|
|
if (G_LIKELY (gst_pad_has_current_caps (GST_BASE_PARSE_SRC_PAD (mp4vparse)) &&
|
2011-05-12 10:07:39 +00:00
|
|
|
!mp4vparse->update_caps))
|
|
|
|
return;
|
2010-11-18 08:09:23 +00:00
|
|
|
|
2013-08-16 19:41:48 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse, "Updating caps");
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* carry over input caps as much as possible; override with our own stuff */
|
2011-10-06 12:03:29 +00:00
|
|
|
caps = gst_pad_get_current_caps (GST_BASE_PARSE_SINK_PAD (mp4vparse));
|
2011-05-12 10:07:39 +00:00
|
|
|
if (caps) {
|
2011-12-30 10:41:17 +00:00
|
|
|
GstCaps *tmp = gst_caps_copy (caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
caps = tmp;
|
2012-09-08 15:03:33 +00:00
|
|
|
s = gst_caps_get_structure (caps, 0);
|
2011-05-12 10:07:39 +00:00
|
|
|
} else {
|
|
|
|
caps = gst_caps_new_simple ("video/mpeg",
|
2012-12-13 10:43:09 +00:00
|
|
|
"mpegversion", G_TYPE_INT, 4,
|
|
|
|
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
|
2011-05-12 10:07:39 +00:00
|
|
|
}
|
2010-11-18 08:09:23 +00:00
|
|
|
|
2012-12-13 10:43:09 +00:00
|
|
|
gst_caps_set_simple (caps, "parsed", G_TYPE_BOOLEAN, TRUE, NULL);
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-09-29 17:37:59 +00:00
|
|
|
if (mp4vparse->profile && mp4vparse->level) {
|
|
|
|
gst_caps_set_simple (caps, "profile", G_TYPE_STRING, mp4vparse->profile,
|
|
|
|
"level", G_TYPE_STRING, mp4vparse->level, NULL);
|
2011-05-12 10:07:39 +00:00
|
|
|
}
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
if (mp4vparse->config != NULL) {
|
|
|
|
gst_caps_set_simple (caps, "codec_data",
|
|
|
|
GST_TYPE_BUFFER, mp4vparse->config, NULL);
|
|
|
|
}
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-09-26 19:58:58 +00:00
|
|
|
if (mp4vparse->vol.width > 0 && mp4vparse->vol.height > 0) {
|
|
|
|
gst_caps_set_simple (caps, "width", G_TYPE_INT, mp4vparse->vol.width,
|
|
|
|
"height", G_TYPE_INT, mp4vparse->vol.height, NULL);
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
}
|
|
|
|
|
2012-09-08 15:03:33 +00:00
|
|
|
/* perhaps we have a framerate */
|
2012-10-25 15:50:52 +00:00
|
|
|
{
|
2011-09-26 19:58:58 +00:00
|
|
|
gint fps_num = mp4vparse->vol.vop_time_increment_resolution;
|
|
|
|
gint fps_den = mp4vparse->vol.fixed_vop_time_increment;
|
2012-10-25 15:50:52 +00:00
|
|
|
GstClockTime latency;
|
|
|
|
|
|
|
|
/* upstream overrides */
|
|
|
|
if (s && gst_structure_has_field (s, "framerate"))
|
|
|
|
gst_structure_get_fraction (s, "framerate", &fps_num, &fps_den);
|
|
|
|
|
|
|
|
if (fps_den > 0 && fps_num > 0) {
|
|
|
|
gst_caps_set_simple (caps, "framerate",
|
|
|
|
GST_TYPE_FRACTION, fps_num, fps_den, NULL);
|
|
|
|
gst_base_parse_set_frame_rate (GST_BASE_PARSE (mp4vparse),
|
|
|
|
fps_num, fps_den, 0, 0);
|
|
|
|
latency = gst_util_uint64_scale (GST_SECOND, fps_den, fps_num);
|
|
|
|
gst_base_parse_set_latency (GST_BASE_PARSE (mp4vparse), latency, latency);
|
|
|
|
}
|
2011-05-12 10:07:39 +00:00
|
|
|
}
|
2010-12-07 14:44:00 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* or pixel-aspect-ratio */
|
2012-09-08 15:03:33 +00:00
|
|
|
if (mp4vparse->vol.par_width > 0 && mp4vparse->vol.par_height > 0 &&
|
|
|
|
(!s || !gst_structure_has_field (s, "pixel-aspect-ratio"))) {
|
2011-05-12 10:07:39 +00:00
|
|
|
gst_caps_set_simple (caps, "pixel-aspect-ratio",
|
2011-09-26 19:58:58 +00:00
|
|
|
GST_TYPE_FRACTION, mp4vparse->vol.par_width,
|
|
|
|
mp4vparse->vol.par_height, NULL);
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
}
|
2010-11-18 08:09:23 +00:00
|
|
|
|
2012-12-13 10:47:57 +00:00
|
|
|
if (mp4vparse->vol.sprite_enable != GST_MPEG4_SPRITE_UNUSED)
|
|
|
|
gst_caps_set_simple (caps, "sprite-warping-points", G_TYPE_INT,
|
|
|
|
mp4vparse->vol.no_of_sprite_warping_points, NULL);
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (mp4vparse), caps);
|
|
|
|
gst_caps_unref (caps);
|
2012-01-09 13:39:43 +00:00
|
|
|
|
|
|
|
mp4vparse->update_caps = FALSE;
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
}
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_mpeg4vparse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
{
|
2011-09-26 13:39:31 +00:00
|
|
|
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEO_PARSE (parse);
|
2011-05-12 10:07:39 +00:00
|
|
|
GstBuffer *buffer = frame->buffer;
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
gst_mpeg4vparse_update_src_caps (mp4vparse);
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
if (mp4vparse->intra_frame)
|
|
|
|
GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
|
|
|
|
else
|
|
|
|
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (mp4vparse->drop && !mp4vparse->config)) {
|
2011-09-26 19:58:58 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse, "dropping frame as no config yet");
|
2011-05-12 10:07:39 +00:00
|
|
|
return GST_BASE_PARSE_FLOW_DROPPED;
|
|
|
|
} else
|
|
|
|
return GST_FLOW_OK;
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
}
|
|
|
|
|
2011-12-18 17:37:08 +00:00
|
|
|
static GstEvent *
|
|
|
|
check_pending_key_unit_event (GstEvent * pending_event, GstSegment * segment,
|
|
|
|
GstClockTime timestamp, guint flags, GstClockTime pending_key_unit_ts)
|
2011-10-06 12:03:29 +00:00
|
|
|
{
|
2011-12-18 17:37:08 +00:00
|
|
|
GstClockTime running_time, stream_time;
|
|
|
|
gboolean all_headers;
|
|
|
|
guint count;
|
|
|
|
GstEvent *event = NULL;
|
2011-10-06 12:03:29 +00:00
|
|
|
|
2011-12-18 17:37:08 +00:00
|
|
|
g_return_val_if_fail (segment != NULL, NULL);
|
2011-10-06 12:03:29 +00:00
|
|
|
|
2011-12-18 17:37:08 +00:00
|
|
|
if (pending_event == NULL)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (pending_key_unit_ts) &&
|
|
|
|
timestamp == GST_CLOCK_TIME_NONE)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
running_time = gst_segment_to_running_time (segment,
|
|
|
|
GST_FORMAT_TIME, timestamp);
|
|
|
|
|
|
|
|
GST_INFO ("now %" GST_TIME_FORMAT " wanted %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (running_time), GST_TIME_ARGS (pending_key_unit_ts));
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (pending_key_unit_ts) &&
|
|
|
|
running_time < pending_key_unit_ts)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
if (flags & GST_BUFFER_FLAG_DELTA_UNIT) {
|
|
|
|
GST_DEBUG ("pending force key unit, waiting for keyframe");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
stream_time = gst_segment_to_stream_time (segment,
|
|
|
|
GST_FORMAT_TIME, timestamp);
|
|
|
|
|
|
|
|
gst_video_event_parse_upstream_force_key_unit (pending_event,
|
|
|
|
NULL, &all_headers, &count);
|
|
|
|
|
|
|
|
event =
|
|
|
|
gst_video_event_new_downstream_force_key_unit (timestamp, stream_time,
|
|
|
|
running_time, all_headers, count);
|
|
|
|
gst_event_set_seqnum (event, gst_event_get_seqnum (pending_event));
|
|
|
|
|
|
|
|
out:
|
|
|
|
return event;
|
2011-10-06 12:03:29 +00:00
|
|
|
}
|
|
|
|
|
2011-12-18 17:37:08 +00:00
|
|
|
static void
|
|
|
|
gst_mpeg4vparse_prepare_key_unit (GstMpeg4VParse * parse, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstClockTime running_time;
|
|
|
|
guint count;
|
|
|
|
|
|
|
|
parse->pending_key_unit_ts = GST_CLOCK_TIME_NONE;
|
|
|
|
gst_event_replace (&parse->force_key_unit_event, NULL);
|
|
|
|
|
|
|
|
gst_video_event_parse_downstream_force_key_unit (event,
|
|
|
|
NULL, NULL, &running_time, NULL, &count);
|
|
|
|
|
|
|
|
GST_INFO_OBJECT (parse, "pushing downstream force-key-unit event %d "
|
|
|
|
"%" GST_TIME_FORMAT " count %d", gst_event_get_seqnum (event),
|
|
|
|
GST_TIME_ARGS (running_time), count);
|
|
|
|
gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (parse), event);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_mpeg4vparse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
{
|
2011-09-26 13:39:31 +00:00
|
|
|
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEO_PARSE (parse);
|
2011-05-12 10:07:39 +00:00
|
|
|
GstBuffer *buffer = frame->buffer;
|
2011-12-18 17:37:08 +00:00
|
|
|
gboolean push_codec = FALSE;
|
|
|
|
GstEvent *event = NULL;
|
|
|
|
|
2013-12-16 09:21:00 +00:00
|
|
|
if (!mp4vparse->sent_codec_tag) {
|
|
|
|
GstTagList *taglist;
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
/* codec tag */
|
|
|
|
caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse));
|
2015-12-15 17:10:00 +00:00
|
|
|
if (G_UNLIKELY (caps == NULL)) {
|
|
|
|
if (GST_PAD_IS_FLUSHING (GST_BASE_PARSE_SRC_PAD (parse))) {
|
|
|
|
GST_INFO_OBJECT (parse, "Src pad is flushing");
|
|
|
|
return GST_FLOW_FLUSHING;
|
|
|
|
} else {
|
|
|
|
GST_INFO_OBJECT (parse, "Src pad is not negotiated!");
|
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
taglist = gst_tag_list_new_empty ();
|
2013-12-16 09:21:00 +00:00
|
|
|
gst_pb_utils_add_codec_description_to_tag_list (taglist,
|
|
|
|
GST_TAG_VIDEO_CODEC, caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
2015-03-17 21:55:26 +00:00
|
|
|
gst_base_parse_merge_tags (parse, taglist, GST_TAG_MERGE_REPLACE);
|
|
|
|
gst_tag_list_unref (taglist);
|
2013-12-16 09:21:00 +00:00
|
|
|
|
|
|
|
/* also signals the end of first-frame processing */
|
|
|
|
mp4vparse->sent_codec_tag = TRUE;
|
|
|
|
}
|
|
|
|
|
2011-12-18 17:37:08 +00:00
|
|
|
if ((event = check_pending_key_unit_event (mp4vparse->force_key_unit_event,
|
|
|
|
&parse->segment, GST_BUFFER_TIMESTAMP (buffer),
|
|
|
|
GST_BUFFER_FLAGS (buffer), mp4vparse->pending_key_unit_ts))) {
|
|
|
|
gst_mpeg4vparse_prepare_key_unit (mp4vparse, event);
|
|
|
|
push_codec = TRUE;
|
|
|
|
}
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-09-26 19:58:58 +00:00
|
|
|
/* periodic config sending */
|
2011-12-18 17:37:08 +00:00
|
|
|
if (mp4vparse->interval > 0 || push_codec) {
|
2011-05-12 10:07:39 +00:00
|
|
|
GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
guint64 diff;
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* init */
|
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (mp4vparse->last_report)) {
|
|
|
|
mp4vparse->last_report = timestamp;
|
|
|
|
}
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT)) {
|
|
|
|
if (timestamp > mp4vparse->last_report)
|
|
|
|
diff = timestamp - mp4vparse->last_report;
|
|
|
|
else
|
|
|
|
diff = 0;
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse,
|
|
|
|
"now %" GST_TIME_FORMAT ", last config %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (timestamp), GST_TIME_ARGS (mp4vparse->last_report));
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse,
|
|
|
|
"interval since last config %" GST_TIME_FORMAT, GST_TIME_ARGS (diff));
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-12-18 17:37:08 +00:00
|
|
|
if (GST_TIME_AS_SECONDS (diff) >= mp4vparse->interval || push_codec) {
|
2012-01-25 15:20:41 +00:00
|
|
|
GstMapInfo cmap;
|
2011-12-30 10:41:17 +00:00
|
|
|
gsize csize;
|
|
|
|
gboolean diffconf;
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* we need to send config now first */
|
2011-12-18 17:37:08 +00:00
|
|
|
GST_INFO_OBJECT (parse, "inserting config in stream");
|
2012-01-25 15:20:41 +00:00
|
|
|
gst_buffer_map (mp4vparse->config, &cmap, GST_MAP_READ);
|
|
|
|
diffconf = (gst_buffer_get_size (buffer) < cmap.size)
|
|
|
|
|| gst_buffer_memcmp (buffer, 0, cmap.data, cmap.size);
|
|
|
|
csize = cmap.size;
|
|
|
|
gst_buffer_unmap (mp4vparse->config, &cmap);
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* avoid inserting duplicate config */
|
2011-12-30 10:41:17 +00:00
|
|
|
if (diffconf) {
|
2011-05-12 10:07:39 +00:00
|
|
|
GstBuffer *superbuf;
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* insert header */
|
2012-03-28 10:49:54 +00:00
|
|
|
superbuf =
|
|
|
|
gst_buffer_append (gst_buffer_ref (mp4vparse->config),
|
|
|
|
gst_buffer_ref (buffer));
|
2011-12-30 10:41:17 +00:00
|
|
|
gst_buffer_copy_into (superbuf, buffer, GST_BUFFER_COPY_METADATA, 0,
|
|
|
|
csize);
|
2012-02-13 17:44:01 +00:00
|
|
|
gst_buffer_replace (&frame->out_buffer, superbuf);
|
2011-05-12 10:07:39 +00:00
|
|
|
gst_buffer_unref (superbuf);
|
|
|
|
} else {
|
2011-12-18 17:37:08 +00:00
|
|
|
GST_INFO_OBJECT (parse, "... but avoiding duplication");
|
2011-05-12 10:07:39 +00:00
|
|
|
}
|
gst/mpeg4videoparse/mpeg4videoparse.*: Parse the config data (either outbound or in the stream) to set width/height, ...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_set_new_caps), (gst_mpeg4vparse_align),
(get_bits), (next_start_code), (gst_mpeg4vparse_handle_vos),
(gst_mpeg4vparse_push), (gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_src_query),
(gst_mpeg4vparse_set_property), (gst_mpeg4vparse_get_property),
(gst_mpeg4vparse_class_init), (gst_mpeg4vparse_init):
* gst/mpeg4videoparse/mpeg4videoparse.h:
Parse the config data (either outbound or in the stream) to set
width/height, apect ration, framerate in the caps if applicable.
Mark frames as GST_BUFFER_FLAG_DELTA_UNIT when they are not
intra frames
Set the timestamps of outgoing buffers to the buffer in
which the VOP header was found.
Drop incoming data untill configuration is found (by default,
configurable using a property).
Report a 1 frame latency. Fixes #532723.
2008-05-13 17:21:07 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
if (G_UNLIKELY (timestamp != -1)) {
|
|
|
|
mp4vparse->last_report = timestamp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-06-15 09:16:34 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
return GST_FLOW_OK;
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
}
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
static gboolean
|
|
|
|
gst_mpeg4vparse_set_caps (GstBaseParse * parse, GstCaps * caps)
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
{
|
2011-09-26 13:39:31 +00:00
|
|
|
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEO_PARSE (parse);
|
2011-05-12 10:07:39 +00:00
|
|
|
GstStructure *s;
|
|
|
|
const GValue *value;
|
|
|
|
GstBuffer *buf;
|
2012-01-25 15:20:41 +00:00
|
|
|
GstMapInfo map;
|
2011-09-26 19:58:58 +00:00
|
|
|
guint8 *data;
|
|
|
|
gsize size;
|
|
|
|
|
|
|
|
GstMpeg4Packet packet;
|
|
|
|
GstMpeg4ParseResult res;
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
GST_DEBUG_OBJECT (parse, "setcaps called with %" GST_PTR_FORMAT, caps);
|
2010-06-15 09:16:34 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
s = gst_caps_get_structure (caps, 0);
|
|
|
|
|
|
|
|
if ((value = gst_structure_get_value (s, "codec_data")) != NULL
|
|
|
|
&& (buf = gst_value_get_buffer (value))) {
|
|
|
|
/* best possible parse attempt,
|
|
|
|
* src caps are based on sink caps so it will end up in there
|
|
|
|
* whether sucessful or not */
|
2012-01-25 15:20:41 +00:00
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
data = map.data;
|
|
|
|
size = map.size;
|
2012-09-02 16:21:16 +00:00
|
|
|
res = gst_mpeg4_parse (&packet, FALSE, NULL, data, 0, size);
|
2011-09-26 19:58:58 +00:00
|
|
|
|
|
|
|
while (res == GST_MPEG4_PARSER_OK || res == GST_MPEG4_PARSER_NO_PACKET_END) {
|
|
|
|
|
|
|
|
if (packet.type >= GST_MPEG4_VIDEO_LAYER_FIRST &&
|
|
|
|
packet.type <= GST_MPEG4_VIDEO_LAYER_LAST)
|
|
|
|
mp4vparse->vol_offset = packet.offset;
|
|
|
|
|
2012-09-02 18:17:14 +00:00
|
|
|
else if (packet.type == GST_MPEG4_VISUAL_OBJ) {
|
|
|
|
gst_mpeg4_parse_visual_object (&mp4vparse->vo, NULL,
|
|
|
|
data + packet.offset, MIN (packet.size, size));
|
|
|
|
mp4vparse->vo_found = TRUE;
|
|
|
|
}
|
|
|
|
|
2012-09-02 16:21:16 +00:00
|
|
|
res = gst_mpeg4_parse (&packet, FALSE, NULL, data, packet.offset, size);
|
2011-09-26 19:58:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* And take it as config */
|
2011-12-30 10:41:17 +00:00
|
|
|
gst_mpeg4vparse_process_config (mp4vparse, data, 3, size);
|
2012-01-25 15:20:41 +00:00
|
|
|
gst_buffer_unmap (buf, &map);
|
2012-10-10 07:58:39 +00:00
|
|
|
gst_mpeg4vparse_reset_frame (mp4vparse);
|
2011-05-12 10:07:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* let's not interfere and accept regardless of config parsing success */
|
|
|
|
return TRUE;
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
}
|
|
|
|
|
2013-12-04 08:00:43 +00:00
|
|
|
static void
|
|
|
|
remove_fields (GstCaps * caps)
|
|
|
|
{
|
|
|
|
guint i, n;
|
|
|
|
|
|
|
|
n = gst_caps_get_size (caps);
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
GstStructure *s = gst_caps_get_structure (caps, i);
|
|
|
|
|
|
|
|
gst_structure_remove_field (s, "parsed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-26 13:39:31 +00:00
|
|
|
|
2011-11-24 09:04:30 +00:00
|
|
|
static GstCaps *
|
2011-11-25 11:48:58 +00:00
|
|
|
gst_mpeg4vparse_get_caps (GstBaseParse * parse, GstCaps * filter)
|
2011-11-24 09:04:30 +00:00
|
|
|
{
|
2012-06-05 07:30:00 +00:00
|
|
|
GstCaps *peercaps, *templ;
|
2011-11-24 09:04:30 +00:00
|
|
|
GstCaps *res;
|
|
|
|
|
2012-06-05 07:30:00 +00:00
|
|
|
templ = gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD (parse));
|
2013-12-04 08:03:45 +00:00
|
|
|
if (filter) {
|
|
|
|
GstCaps *fcopy = gst_caps_copy (filter);
|
|
|
|
/* Remove the fields we convert */
|
|
|
|
remove_fields (fcopy);
|
|
|
|
peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), fcopy);
|
|
|
|
gst_caps_unref (fcopy);
|
|
|
|
} else
|
|
|
|
peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), NULL);
|
2012-06-05 07:30:00 +00:00
|
|
|
|
2011-11-24 09:04:30 +00:00
|
|
|
if (peercaps) {
|
|
|
|
/* Remove the parsed field */
|
|
|
|
peercaps = gst_caps_make_writable (peercaps);
|
2013-12-04 08:00:43 +00:00
|
|
|
remove_fields (peercaps);
|
2011-11-24 09:04:30 +00:00
|
|
|
|
2012-06-05 07:30:00 +00:00
|
|
|
res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
|
2011-11-24 09:04:30 +00:00
|
|
|
gst_caps_unref (peercaps);
|
2013-12-04 08:13:31 +00:00
|
|
|
gst_caps_unref (templ);
|
2011-11-24 09:04:30 +00:00
|
|
|
} else {
|
2012-06-05 07:30:00 +00:00
|
|
|
res = templ;
|
2011-11-24 09:04:30 +00:00
|
|
|
}
|
|
|
|
|
2011-12-30 10:41:17 +00:00
|
|
|
if (filter) {
|
|
|
|
GstCaps *tmp = gst_caps_intersect_full (res, filter,
|
|
|
|
GST_CAPS_INTERSECT_FIRST);
|
|
|
|
gst_caps_unref (res);
|
|
|
|
res = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-24 09:04:30 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
static gboolean
|
2011-12-18 17:37:08 +00:00
|
|
|
gst_mpeg4vparse_event (GstBaseParse * parse, GstEvent * event)
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
{
|
2012-02-15 11:56:55 +00:00
|
|
|
gboolean res;
|
2011-12-18 17:37:08 +00:00
|
|
|
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEO_PARSE (parse);
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2011-12-18 17:37:08 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_CUSTOM_DOWNSTREAM:
|
|
|
|
{
|
|
|
|
GstClockTime timestamp, stream_time, running_time;
|
|
|
|
gboolean all_headers;
|
|
|
|
guint count;
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
|
2012-02-15 11:56:55 +00:00
|
|
|
if (gst_video_event_is_force_key_unit (event)) {
|
|
|
|
gst_video_event_parse_downstream_force_key_unit (event,
|
|
|
|
×tamp, &stream_time, &running_time, &all_headers, &count);
|
2011-12-18 17:37:08 +00:00
|
|
|
|
2012-02-15 11:56:55 +00:00
|
|
|
GST_INFO_OBJECT (mp4vparse, "received downstream force key unit event, "
|
|
|
|
"seqnum %d running_time %" GST_TIME_FORMAT
|
|
|
|
" all_headers %d count %d", gst_event_get_seqnum (event),
|
|
|
|
GST_TIME_ARGS (running_time), all_headers, count);
|
2011-12-18 17:37:08 +00:00
|
|
|
|
2012-02-15 11:56:55 +00:00
|
|
|
if (mp4vparse->force_key_unit_event) {
|
|
|
|
GST_INFO_OBJECT (mp4vparse, "ignoring force key unit event "
|
|
|
|
"as one is already queued");
|
|
|
|
} else {
|
|
|
|
mp4vparse->pending_key_unit_ts = running_time;
|
|
|
|
gst_event_replace (&mp4vparse->force_key_unit_event, event);
|
|
|
|
}
|
2012-02-15 12:02:06 +00:00
|
|
|
gst_event_unref (event);
|
2012-02-15 11:56:55 +00:00
|
|
|
res = TRUE;
|
|
|
|
} else {
|
2012-03-30 10:02:16 +00:00
|
|
|
res = GST_BASE_PARSE_CLASS (parent_class)->sink_event (parse, event);
|
2011-12-18 17:37:08 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2012-03-30 10:02:16 +00:00
|
|
|
res = GST_BASE_PARSE_CLASS (parent_class)->sink_event (parse, event);
|
2011-12-18 17:37:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-02-15 11:56:55 +00:00
|
|
|
return res;
|
Add a simple MPEG4 ES parser.
Original commit message from CVS:
2007-10-26 Julien MOUTTE <julien@moutte.net>
* configure.ac:
* gst/mpeg4videoparse/Makefile.am:
* gst/mpeg4videoparse/mpeg4videoparse.c:
(gst_mpeg4vparse_drain),
(gst_mpeg4vparse_chain), (gst_mpeg4vparse_sink_setcaps),
(gst_mpeg4vparse_sink_event), (gst_mpeg4vparse_cleanup),
(gst_mpeg4vparse_change_state), (gst_mpeg4vparse_dispose),
(gst_mpeg4vparse_base_init), (gst_mpeg4vparse_class_init),
(gst_mpeg4vparse_init), (plugin_init):
* gst/mpeg4videoparse/mpeg4videoparse.h: Add a simple MPEG4 ES
parser.
2007-10-26 16:08:04 +00:00
|
|
|
}
|
|
|
|
|
2011-12-18 17:37:08 +00:00
|
|
|
static gboolean
|
|
|
|
gst_mpeg4vparse_src_event (GstBaseParse * parse, GstEvent * event)
|
|
|
|
{
|
2012-02-15 11:56:55 +00:00
|
|
|
gboolean res;
|
2011-12-18 17:37:08 +00:00
|
|
|
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEO_PARSE (parse);
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_CUSTOM_UPSTREAM:
|
|
|
|
{
|
|
|
|
GstClockTime running_time;
|
|
|
|
gboolean all_headers;
|
|
|
|
guint count;
|
|
|
|
|
2012-02-15 11:56:55 +00:00
|
|
|
if (gst_video_event_is_force_key_unit (event)) {
|
|
|
|
gst_video_event_parse_upstream_force_key_unit (event,
|
|
|
|
&running_time, &all_headers, &count);
|
2011-12-18 17:37:08 +00:00
|
|
|
|
2012-02-15 11:56:55 +00:00
|
|
|
GST_INFO_OBJECT (mp4vparse, "received upstream force-key-unit event, "
|
|
|
|
"seqnum %d running_time %" GST_TIME_FORMAT
|
|
|
|
" all_headers %d count %d", gst_event_get_seqnum (event),
|
|
|
|
GST_TIME_ARGS (running_time), all_headers, count);
|
2011-12-18 17:37:08 +00:00
|
|
|
|
2012-02-15 11:56:55 +00:00
|
|
|
if (all_headers) {
|
|
|
|
mp4vparse->pending_key_unit_ts = running_time;
|
|
|
|
gst_event_replace (&mp4vparse->force_key_unit_event, event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
res = GST_BASE_PARSE_CLASS (parent_class)->src_event (parse, event);
|
2011-12-18 17:37:08 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2012-02-15 11:56:55 +00:00
|
|
|
res = GST_BASE_PARSE_CLASS (parent_class)->src_event (parse, event);
|
2011-12-18 17:37:08 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-02-15 11:56:55 +00:00
|
|
|
return res;
|
2011-12-18 17:37:08 +00:00
|
|
|
}
|