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> Collabora Multimedia
|
|
|
|
* Copyright (C) <2011> Nokia Corporation
|
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
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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>
|
2011-05-12 10:07:39 +00:00
|
|
|
#include <gst/base/gstbytereader.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
|
|
|
#include "mpeg4videoparse.h"
|
|
|
|
|
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 =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("video/mpeg, "
|
|
|
|
"mpegversion = (int) 4, "
|
|
|
|
"parsed = (boolean) true, " "systemstream = (boolean) false")
|
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate sink_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("video/mpeg, "
|
2011-11-16 18:45:52 +00:00
|
|
|
"mpegversion = (int) 4, " "systemstream = (boolean) 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
|
|
|
);
|
|
|
|
|
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 */
|
|
|
|
#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,
|
2010-06-15 09:16:34 +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
|
|
|
PROP_LAST
|
|
|
|
};
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
GST_BOILERPLATE (GstMpeg4VParse, gst_mpeg4vparse, GstBaseParse,
|
|
|
|
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);
|
|
|
|
static gboolean gst_mpeg4vparse_check_valid_frame (GstBaseParse * parse,
|
|
|
|
GstBaseParseFrame * frame, guint * framesize, gint * skipsize);
|
|
|
|
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);
|
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);
|
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_base_init (gpointer klass)
|
|
|
|
{
|
|
|
|
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
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&src_template));
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&sink_template));
|
2010-11-18 08:09:23 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
gst_element_class_set_details_simple (element_class,
|
|
|
|
"MPEG 4 video elementary stream parser", "Codec/Parser/Video",
|
|
|
|
"Parses MPEG-4 Part 2 elementary video streams",
|
|
|
|
"Julien Moutte <julien@fluendo.com>");
|
|
|
|
}
|
2010-11-18 08:09:23 +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)
|
|
|
|
{
|
|
|
|
GstMpeg4VParse *parse = GST_MPEG4VIDEOPARSE (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-05-12 10:07:39 +00:00
|
|
|
GstMpeg4VParse *parse = GST_MPEG4VIDEOPARSE (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);
|
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-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);
|
|
|
|
parse_class->check_valid_frame =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_mpeg4vparse_check_valid_frame);
|
|
|
|
parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_mpeg4vparse_parse_frame);
|
|
|
|
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);
|
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_init (GstMpeg4VParse * parse, GstMpeg4VParseClass * g_class)
|
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;
|
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;
|
|
|
|
mp4vparse->vos_offset = -1;
|
|
|
|
mp4vparse->vo_offset = -1;
|
|
|
|
}
|
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->profile = 0;
|
|
|
|
mp4vparse->update_caps = TRUE;
|
2010-04-20 13:37:03 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
gst_buffer_replace (&mp4vparse->config, NULL);
|
|
|
|
memset (&mp4vparse->params, 0, sizeof (mp4vparse->params));
|
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-05-12 10:07:39 +00:00
|
|
|
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEOPARSE (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-05-12 10:07:39 +00:00
|
|
|
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEOPARSE (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-05-12 10:07:39 +00:00
|
|
|
gst_mpeg4vparse_process_config (GstMpeg4VParse * mp4vparse, const guint8 * data,
|
2009-02-26 14:40:26 +00:00
|
|
|
gsize size)
|
|
|
|
{
|
2011-05-12 10:07:39 +00:00
|
|
|
/* only do stuff if something new */
|
|
|
|
if (mp4vparse->config && size == GST_BUFFER_SIZE (mp4vparse->config) &&
|
|
|
|
memcmp (GST_BUFFER_DATA (mp4vparse->config), data, size) == 0)
|
2009-02-26 14:40:26 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
if (!gst_mpeg4_params_parse_config (&mp4vparse->params, data, size)) {
|
2011-05-29 11:03:38 +00:00
|
|
|
GST_DEBUG_OBJECT (mp4vparse, "failed to parse config data (size %"
|
|
|
|
G_GSSIZE_FORMAT ")", size);
|
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
|
|
|
}
|
|
|
|
|
2011-05-29 11:03:38 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse, "accepting parsed config size %" G_GSSIZE_FORMAT,
|
|
|
|
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
|
|
|
/* parsing ok, so accept it as new config */
|
|
|
|
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-05-12 10:07:39 +00:00
|
|
|
mp4vparse->config = gst_buffer_new_and_alloc (size);
|
|
|
|
memcpy (GST_BUFFER_DATA (mp4vparse->config), data, 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-05-12 10:07:39 +00:00
|
|
|
gst_mpeg4vparse_process_sc (GstMpeg4VParse * mp4vparse, GstBuffer * buf,
|
|
|
|
gint 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
|
|
|
{
|
2011-05-12 10:07:39 +00:00
|
|
|
guint8 *data;
|
|
|
|
guint code;
|
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
|
|
|
g_return_val_if_fail (buf && GST_BUFFER_SIZE (buf) >= off + 4, 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
|
|
|
data = GST_BUFFER_DATA (buf);
|
|
|
|
code = data[off + 3];
|
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, "process startcode %x", code);
|
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 */
|
|
|
|
if (mp4vparse->vop_offset >= 0 && code != MPEG4_VOS_ENDCODE) {
|
|
|
|
if (G_LIKELY (GST_BUFFER_SIZE (buf) > mp4vparse->vop_offset + 4)) {
|
|
|
|
mp4vparse->intra_frame =
|
|
|
|
((data[mp4vparse->vop_offset + 4] >> 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
|
|
|
}
|
2011-05-12 10:07:39 +00:00
|
|
|
GST_LOG_OBJECT (mp4vparse, "ending frame of size %d, is intra %d", off,
|
|
|
|
mp4vparse->intra_frame);
|
|
|
|
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
|
|
|
switch (code) {
|
|
|
|
case MPEG4_VOP_STARTCODE:
|
|
|
|
case MPEG4_GOP_STARTCODE:
|
|
|
|
{
|
|
|
|
gint offset;
|
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 (code == MPEG4_VOP_STARTCODE) {
|
|
|
|
GST_LOG_OBJECT (mp4vparse, "startcode is VOP");
|
|
|
|
mp4vparse->vop_offset = off;
|
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (mp4vparse, "startcode is GOP");
|
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;
|
|
|
|
* preferably start at VOS (visual object sequence),
|
|
|
|
* otherwise at VO (video object) */
|
|
|
|
offset = mp4vparse->vos_offset >= 0 ?
|
|
|
|
mp4vparse->vos_offset : mp4vparse->vo_offset;
|
|
|
|
if (offset >= 0) {
|
|
|
|
gst_mpeg4vparse_process_config (mp4vparse, GST_BUFFER_DATA (buf), off);
|
|
|
|
/* avoid accepting again for a VOP sc following a GOP sc */
|
|
|
|
mp4vparse->vos_offset = -1;
|
|
|
|
mp4vparse->vo_offset = -1;
|
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
|
|
|
}
|
|
|
|
case MPEG4_VOS_STARTCODE:
|
|
|
|
GST_LOG_OBJECT (mp4vparse, "startcode is VOS");
|
|
|
|
mp4vparse->vos_offset = off;
|
2010-11-18 08:09:23 +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-05-12 10:07:39 +00:00
|
|
|
/* VO (video object) cases */
|
|
|
|
if (code <= 0x1f) {
|
|
|
|
GST_LOG_OBJECT (mp4vparse, "startcode is VO");
|
|
|
|
mp4vparse->vo_offset = 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
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-05-17 20:18:51 +00:00
|
|
|
/* FIXME move into baseparse, or anything equivalent;
|
|
|
|
* see https://bugzilla.gnome.org/show_bug.cgi?id=650093 */
|
|
|
|
#define GST_BASE_PARSE_FRAME_FLAG_PARSING 0x10000
|
|
|
|
|
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_check_valid_frame (GstBaseParse * parse,
|
|
|
|
GstBaseParseFrame * frame, guint * framesize, 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-05-12 10:07:39 +00:00
|
|
|
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEOPARSE (parse);
|
|
|
|
GstBuffer *buf = frame->buffer;
|
|
|
|
GstByteReader reader = GST_BYTE_READER_INIT_FROM_BUFFER (buf);
|
|
|
|
gint off = 0;
|
|
|
|
gboolean ret;
|
|
|
|
guint code;
|
|
|
|
|
|
|
|
retry:
|
|
|
|
/* at least start code and subsequent byte */
|
|
|
|
if (G_UNLIKELY (GST_BUFFER_SIZE (buf) - off < 5))
|
|
|
|
return 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
|
|
|
|
2011-05-17 20:18:51 +00:00
|
|
|
/* avoid stale cached parsing state */
|
|
|
|
if (!(frame->flags & GST_BASE_PARSE_FRAME_FLAG_PARSING)) {
|
|
|
|
GST_LOG_OBJECT (mp4vparse, "parsing new frame");
|
|
|
|
gst_mpeg4vparse_reset_frame (mp4vparse);
|
|
|
|
frame->flags |= GST_BASE_PARSE_FRAME_FLAG_PARSING;
|
|
|
|
} 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
|
|
|
off = gst_byte_reader_masked_scan_uint32 (&reader, 0xffffff00, 0x00000100,
|
|
|
|
off, GST_BUFFER_SIZE (buf) - off);
|
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, "possible sync at buffer offset %d", off);
|
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 */
|
|
|
|
if (G_UNLIKELY (off < 0)) {
|
|
|
|
*skipsize = GST_BUFFER_SIZE (buf) - 3;
|
|
|
|
return 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
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* possible frame header, but not at offset 0? skip bytes before sync */
|
|
|
|
if (G_UNLIKELY (off > 0)) {
|
|
|
|
*skipsize = off;
|
|
|
|
return 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
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* ensure start code looks like a real starting start code */
|
|
|
|
code = GST_BUFFER_DATA (buf)[3];
|
|
|
|
switch (code) {
|
|
|
|
case MPEG4_VOP_STARTCODE:
|
|
|
|
case MPEG4_VOS_STARTCODE:
|
|
|
|
case MPEG4_GOP_STARTCODE:
|
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-05-12 10:07:39 +00:00
|
|
|
if (code <= 0x1f)
|
|
|
|
break;
|
|
|
|
/* undesirable sc */
|
|
|
|
GST_LOG_OBJECT (mp4vparse, "start code is no VOS, VO, VOP or GOP");
|
|
|
|
off++;
|
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* found sc */
|
|
|
|
mp4vparse->last_sc = 0;
|
|
|
|
|
|
|
|
/* examine start code, which should not end frame at present */
|
|
|
|
gst_mpeg4vparse_process_sc (mp4vparse, buf, 0);
|
|
|
|
|
|
|
|
next:
|
|
|
|
/* start is fine as of now */
|
|
|
|
*skipsize = 0;
|
|
|
|
/* position a bit further than last sc */
|
|
|
|
off++;
|
|
|
|
/* so now we have start code at start of data; locate next start code */
|
|
|
|
off = gst_byte_reader_masked_scan_uint32 (&reader, 0xffffff00, 0x00000100,
|
|
|
|
off, GST_BUFFER_SIZE (buf) - off);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (mp4vparse, "next start code at %d", off);
|
|
|
|
if (off < 0) {
|
|
|
|
/* if draining, take all */
|
|
|
|
if (GST_BASE_PARSE_DRAINING (parse)) {
|
|
|
|
off = GST_BUFFER_SIZE (buf);
|
|
|
|
ret = TRUE;
|
|
|
|
} else {
|
|
|
|
/* resume scan where we left it */
|
|
|
|
mp4vparse->last_sc = GST_BUFFER_SIZE (buf) - 4;
|
2011-05-17 20:39:19 +00:00
|
|
|
/* request best next available */
|
|
|
|
*framesize = G_MAXUINT;
|
2011-05-12 10:07:39 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* decide whether this startcode ends a frame */
|
|
|
|
ret = gst_mpeg4vparse_process_sc (mp4vparse, buf, off);
|
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 (ret) {
|
|
|
|
*framesize = off;
|
|
|
|
} else {
|
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
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;
|
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 */
|
|
|
|
if (G_LIKELY (GST_PAD_CAPS (GST_BASE_PARSE_SRC_PAD (mp4vparse)) &&
|
|
|
|
!mp4vparse->update_caps))
|
|
|
|
return;
|
2010-11-18 08:09:23 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* carry over input caps as much as possible; override with our own stuff */
|
|
|
|
caps = GST_PAD_CAPS (GST_BASE_PARSE_SINK_PAD (mp4vparse));
|
|
|
|
if (caps) {
|
|
|
|
caps = gst_caps_copy (caps);
|
|
|
|
} else {
|
|
|
|
caps = gst_caps_new_simple ("video/mpeg",
|
|
|
|
"mpegversion", G_TYPE_INT, 4, NULL);
|
|
|
|
}
|
2010-11-18 08:09:23 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
gst_caps_set_simple (caps, "systemstream", G_TYPE_BOOLEAN, FALSE,
|
|
|
|
"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-05-12 10:07:39 +00:00
|
|
|
if (mp4vparse->profile != 0) {
|
|
|
|
gchar *profile = NULL;
|
2008-06-02 07:37:31 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* FIXME does it make sense to expose the profile in the caps ? */
|
|
|
|
profile = g_strdup_printf ("%d", mp4vparse->profile);
|
|
|
|
gst_caps_set_simple (caps, "profile-level-id",
|
|
|
|
G_TYPE_STRING, profile, NULL);
|
|
|
|
g_free (profile);
|
|
|
|
}
|
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-05-12 10:07:39 +00:00
|
|
|
if (mp4vparse->params.width > 0 && mp4vparse->params.height > 0) {
|
|
|
|
gst_caps_set_simple (caps, "width", G_TYPE_INT, mp4vparse->params.width,
|
|
|
|
"height", G_TYPE_INT, mp4vparse->params.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
|
|
|
}
|
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* perhaps we have a framerate */
|
|
|
|
if (mp4vparse->params.fixed_time_increment != 0) {
|
|
|
|
gint fps_num = mp4vparse->params.time_increment_resolution;
|
|
|
|
gint fps_den = mp4vparse->params.fixed_time_increment;
|
|
|
|
GstClockTime latency = gst_util_uint64_scale (GST_SECOND, fps_den, fps_num);
|
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_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);
|
|
|
|
gst_base_parse_set_latency (GST_BASE_PARSE (mp4vparse), latency, latency);
|
|
|
|
}
|
2010-12-07 14:44:00 +00:00
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
/* or pixel-aspect-ratio */
|
|
|
|
if (mp4vparse->params.aspect_ratio_width > 0 &&
|
|
|
|
mp4vparse->params.aspect_ratio_height > 0) {
|
|
|
|
gst_caps_set_simple (caps, "pixel-aspect-ratio",
|
|
|
|
GST_TYPE_FRACTION, mp4vparse->params.aspect_ratio_width,
|
|
|
|
mp4vparse->params.aspect_ratio_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
|
|
|
|
2011-05-12 10:07:39 +00:00
|
|
|
gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (mp4vparse), caps);
|
|
|
|
gst_caps_unref (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-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-05-12 10:07:39 +00:00
|
|
|
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEOPARSE (parse);
|
|
|
|
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)) {
|
|
|
|
GST_DEBUG_OBJECT (mp4vparse, "dropping frame as no config yet");
|
|
|
|
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-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-05-12 10:07:39 +00:00
|
|
|
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEOPARSE (parse);
|
|
|
|
GstBuffer *buffer = frame->buffer;
|
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
|
|
|
/* periodic SPS/PPS sending */
|
|
|
|
if (mp4vparse->interval > 0) {
|
|
|
|
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-05-12 10:07:39 +00:00
|
|
|
if (GST_TIME_AS_SECONDS (diff) >= mp4vparse->interval) {
|
|
|
|
/* we need to send config now first */
|
|
|
|
GST_LOG_OBJECT (parse, "inserting config in stream");
|
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 */
|
|
|
|
if ((GST_BUFFER_SIZE (buffer) < GST_BUFFER_SIZE (mp4vparse->config)) ||
|
|
|
|
memcmp (GST_BUFFER_DATA (buffer),
|
|
|
|
GST_BUFFER_DATA (mp4vparse->config),
|
|
|
|
GST_BUFFER_SIZE (mp4vparse->config))) {
|
|
|
|
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 */
|
|
|
|
superbuf = gst_buffer_merge (mp4vparse->config, buffer);
|
|
|
|
gst_buffer_copy_metadata (superbuf, buffer, GST_BUFFER_COPY_ALL);
|
|
|
|
gst_buffer_replace (&frame->buffer, superbuf);
|
|
|
|
gst_buffer_unref (superbuf);
|
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (parse, "... but avoiding duplication");
|
|
|
|
}
|
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-05-12 10:07:39 +00:00
|
|
|
GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEOPARSE (parse);
|
|
|
|
GstStructure *s;
|
|
|
|
const GValue *value;
|
|
|
|
GstBuffer *buf;
|
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 */
|
|
|
|
gst_mpeg4vparse_process_config (mp4vparse, GST_BUFFER_DATA (buf),
|
|
|
|
GST_BUFFER_SIZE (buf));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
plugin_init (GstPlugin * plugin)
|
|
|
|
{
|
|
|
|
GST_DEBUG_CATEGORY_INIT (mpeg4v_parse_debug, "mpeg4videoparse", 0,
|
|
|
|
"MPEG-4 video parser");
|
|
|
|
|
2011-11-16 18:57:55 +00:00
|
|
|
if (!gst_element_register (plugin, "mpeg4videoparse", GST_RANK_PRIMARY + 1,
|
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_mpeg4vparse_get_type ()))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"mpeg4videoparse",
|
|
|
|
"MPEG-4 video parser",
|
|
|
|
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|