2002-03-20 21:45:03 +00:00
|
|
|
/* GStreamer
|
2001-12-23 06:03:21 +00:00
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2003-06-29 19:46:09 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2001-12-23 06:03:21 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
|
|
|
#include "gstmpeg2dec.h"
|
|
|
|
|
2006-11-21 12:15:58 +00:00
|
|
|
/* 16byte-aligns a buffer for libmpeg2 */
|
2006-11-03 09:52:12 +00:00
|
|
|
#define ALIGN_16(p) ((void *)(((uintptr_t)(p) + 15) & ~((uintptr_t)15)))
|
|
|
|
|
2003-09-11 17:13:24 +00:00
|
|
|
/* mpeg2dec changed a struct name after 0.3.1, here's a workaround */
|
|
|
|
/* mpeg2dec also only defined MPEG2_RELEASE after 0.3.1
|
2005-07-19 20:51:16 +00:00
|
|
|
#if MPEG2_RELEASE < MPEG2_VERSION(0,3,2)
|
2003-09-11 17:13:24 +00:00
|
|
|
*/
|
|
|
|
#ifndef MPEG2_RELEASE
|
2004-01-03 23:45:32 +00:00
|
|
|
#define MPEG2_VERSION(a,b,c) ((((a)&0xff)<<16)|(((b)&0xff)<<8)|((c)&0xff))
|
|
|
|
#define MPEG2_RELEASE MPEG2_VERSION(0,3,1)
|
2003-09-11 17:13:24 +00:00
|
|
|
typedef picture_t mpeg2_picture_t;
|
2003-10-06 12:16:21 +00:00
|
|
|
typedef gint mpeg2_state_t;
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2003-10-07 10:08:30 +00:00
|
|
|
#define STATE_BUFFER 0
|
2003-09-11 17:13:24 +00:00
|
|
|
#endif
|
|
|
|
|
2012-04-02 13:21:36 +00:00
|
|
|
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
|
2004-04-01 11:48:27 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (mpeg2dec_debug);
|
|
|
|
#define GST_CAT_DEFAULT (mpeg2dec_debug)
|
2003-07-25 02:04:01 +00:00
|
|
|
|
2007-03-02 13:01:48 +00:00
|
|
|
/* Send a warning message about decoding errors after receiving this many
|
|
|
|
* STATE_INVALID return values from mpeg2_parse. -1 means never.
|
2006-02-27 14:49:05 +00:00
|
|
|
*/
|
2007-03-02 13:01:48 +00:00
|
|
|
#define WARN_THRESHOLD (5)
|
2006-02-27 14:49:05 +00:00
|
|
|
|
2008-11-25 03:44:06 +00:00
|
|
|
//#define enable_user_data
|
2004-03-13 00:19:26 +00:00
|
|
|
#ifdef enable_user_data
|
2003-12-22 01:47:08 +00:00
|
|
|
static GstStaticPadTemplate user_data_template_factory =
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("user_data",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
2004-03-13 00:19:26 +00:00
|
|
|
#endif
|
2002-12-19 07:45:11 +00:00
|
|
|
|
2003-12-22 01:47:08 +00:00
|
|
|
static GstStaticPadTemplate sink_template_factory =
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("video/mpeg, "
|
2004-03-15 19:32:25 +00:00
|
|
|
"mpegversion = (int) [ 1, 2 ], " "systemstream = (boolean) false")
|
2004-03-14 22:34:30 +00:00
|
|
|
);
|
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
static GstStaticPadTemplate src_template_factory =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2011-09-30 15:38:07 +00:00
|
|
|
GST_STATIC_CAPS ("video/x-raw, "
|
|
|
|
"format = (string) { I420, Y42B, Y444 }, "
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
"width = (int) [ 16, 4096 ], "
|
|
|
|
"height = (int) [ 16, 4096 ], "
|
2006-11-15 13:57:21 +00:00
|
|
|
"framerate = (fraction) [ 0/1, 2147483647/1 ]")
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static void gst_mpeg2dec_finalize (GObject * object);
|
2005-02-05 07:36:01 +00:00
|
|
|
static void gst_mpeg2dec_reset (GstMpeg2dec * mpeg2dec);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2011-11-17 14:25:58 +00:00
|
|
|
static gboolean gst_mpeg2dec_src_event (GstPad * pad, GstObject * parent,
|
|
|
|
GstEvent * event);
|
2005-09-02 15:43:54 +00:00
|
|
|
static GstStateChangeReturn gst_mpeg2dec_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2011-11-17 14:25:58 +00:00
|
|
|
static gboolean gst_mpeg2dec_sink_event (GstPad * pad, GstObject * parent,
|
|
|
|
GstEvent * event);
|
2008-10-14 12:51:41 +00:00
|
|
|
static gboolean gst_mpeg2dec_setcaps (GstPad * pad, GstCaps * caps);
|
2011-11-17 14:25:58 +00:00
|
|
|
static GstFlowReturn gst_mpeg2dec_chain (GstPad * pad, GstObject * parent,
|
|
|
|
GstBuffer * buf);
|
2005-07-19 20:51:16 +00:00
|
|
|
|
2006-06-07 17:05:48 +00:00
|
|
|
static void clear_buffers (GstMpeg2dec * mpeg2dec);
|
|
|
|
|
2011-11-16 16:28:56 +00:00
|
|
|
//static gboolean gst_mpeg2dec_sink_query (GstPad * pad, GstObject * parent, GstQuery * query);
|
2005-07-19 20:51:16 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
static const GstFormat *gst_mpeg2dec_get_formats (GstPad * pad);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
static const GstEventMask *gst_mpeg2dec_get_event_masks (GstPad * pad);
|
|
|
|
#endif
|
2001-12-23 06:03:21 +00:00
|
|
|
|
2012-04-02 13:21:36 +00:00
|
|
|
static gboolean gst_mpeg2dec_crop_buffer (GstMpeg2dec * dec, GstBuffer ** buf,
|
|
|
|
GstVideoFrame * frame);
|
2005-01-17 13:54:30 +00:00
|
|
|
|
2001-12-23 06:03:21 +00:00
|
|
|
/*static guint gst_mpeg2dec_signals[LAST_SIGNAL] = { 0 };*/
|
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
#define gst_mpeg2dec_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE (GstMpeg2dec, gst_mpeg2dec, GST_TYPE_ELEMENT);
|
2003-11-02 00:33:31 +00:00
|
|
|
|
2001-12-23 06:03:21 +00:00
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg2dec_class_init (GstMpeg2decClass * klass)
|
2001-12-23 06:03:21 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2001-12-23 06:03:21 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
gobject_class->finalize = gst_mpeg2dec_finalize;
|
2001-12-23 06:03:21 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&src_template_factory));
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&sink_template_factory));
|
|
|
|
#ifdef enable_user_data
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&user_data_template_factory));
|
|
|
|
#endif
|
|
|
|
gst_element_class_set_details_simple (gstelement_class,
|
|
|
|
"mpeg1 and mpeg2 video decoder", "Codec/Decoder/Video",
|
|
|
|
"Uses libmpeg2 to decode MPEG video streams",
|
|
|
|
"Wim Taymans <wim.taymans@gmail.com>");
|
|
|
|
|
2001-12-23 06:03:21 +00:00
|
|
|
gstelement_class->change_state = gst_mpeg2dec_change_state;
|
2011-09-30 15:38:07 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (mpeg2dec_debug, "mpeg2dec", 0,
|
|
|
|
"MPEG2 decoder element");
|
2001-12-23 06:03:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg2dec_init (GstMpeg2dec * mpeg2dec)
|
2001-12-23 06:03:21 +00:00
|
|
|
{
|
2002-12-05 00:29:11 +00:00
|
|
|
/* create the sink and src pads */
|
2004-03-14 22:34:30 +00:00
|
|
|
mpeg2dec->sinkpad =
|
2006-11-15 11:41:39 +00:00
|
|
|
gst_pad_new_from_static_template (&sink_template_factory, "sink");
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_pad_set_chain_function (mpeg2dec->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_mpeg2dec_chain));
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
#if 0
|
|
|
|
gst_pad_set_query_function (mpeg2dec->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_mpeg2dec_get_sink_query));
|
|
|
|
#endif
|
2005-07-19 20:51:16 +00:00
|
|
|
gst_pad_set_event_function (mpeg2dec->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_mpeg2dec_sink_event));
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (mpeg2dec), mpeg2dec->sinkpad);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
mpeg2dec->srcpad =
|
2006-11-15 11:41:39 +00:00
|
|
|
gst_pad_new_from_static_template (&src_template_factory, "src");
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_pad_set_event_function (mpeg2dec->srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_mpeg2dec_src_event));
|
2011-12-30 17:53:12 +00:00
|
|
|
#if 0
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_pad_set_query_function (mpeg2dec->srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_mpeg2dec_src_query));
|
2011-12-30 17:53:12 +00:00
|
|
|
#endif
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
gst_pad_use_fixed_caps (mpeg2dec->srcpad);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (mpeg2dec), mpeg2dec->srcpad);
|
2001-12-23 06:03:21 +00:00
|
|
|
|
2004-03-13 00:19:26 +00:00
|
|
|
#ifdef enable_user_data
|
2004-03-14 22:34:30 +00:00
|
|
|
mpeg2dec->userdatapad =
|
2006-11-15 11:41:39 +00:00
|
|
|
gst_pad_new_from_static_template (&user_data_template_factory,
|
|
|
|
"user_data");
|
2002-12-19 07:45:11 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (mpeg2dec), mpeg2dec->userdatapad);
|
2004-03-13 00:19:26 +00:00
|
|
|
#endif
|
2002-12-19 07:45:11 +00:00
|
|
|
|
2006-02-27 14:49:05 +00:00
|
|
|
mpeg2dec->error_count = 0;
|
2006-11-21 12:15:58 +00:00
|
|
|
mpeg2dec->can_allocate_aligned = TRUE;
|
2006-02-27 14:49:05 +00:00
|
|
|
|
2002-12-23 00:32:36 +00:00
|
|
|
/* initialize the mpeg2dec acceleration */
|
2002-12-26 22:46:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
gst_mpeg2dec_finalize (GObject * object)
|
2002-12-26 22:46:26 +00:00
|
|
|
{
|
|
|
|
GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (object);
|
|
|
|
|
2005-10-26 16:45:04 +00:00
|
|
|
if (mpeg2dec->decoder) {
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "closing decoder");
|
|
|
|
mpeg2_close (mpeg2dec->decoder);
|
|
|
|
mpeg2dec->decoder = NULL;
|
|
|
|
}
|
2006-06-07 17:05:48 +00:00
|
|
|
clear_buffers (mpeg2dec);
|
2006-11-03 09:52:12 +00:00
|
|
|
g_free (mpeg2dec->dummybuf[3]);
|
|
|
|
mpeg2dec->dummybuf[3] = NULL;
|
2001-12-23 06:03:21 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2001-12-23 06:03:21 +00:00
|
|
|
}
|
|
|
|
|
2005-02-05 07:36:01 +00:00
|
|
|
static void
|
|
|
|
gst_mpeg2dec_reset (GstMpeg2dec * mpeg2dec)
|
|
|
|
{
|
|
|
|
/* reset the initial video state */
|
2011-09-30 15:38:07 +00:00
|
|
|
gst_video_info_init (&mpeg2dec->vinfo);
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
gst_segment_init (&mpeg2dec->segment, GST_FORMAT_UNDEFINED);
|
2005-02-05 07:36:01 +00:00
|
|
|
mpeg2dec->discont_state = MPEG2DEC_DISC_NEW_PICTURE;
|
|
|
|
mpeg2dec->frame_period = 0;
|
|
|
|
mpeg2dec->need_sequence = TRUE;
|
2006-06-07 17:05:48 +00:00
|
|
|
mpeg2dec->next_time = -1;
|
2005-10-26 16:45:04 +00:00
|
|
|
mpeg2dec->offset = 0;
|
2006-02-27 14:49:05 +00:00
|
|
|
mpeg2dec->error_count = 0;
|
2006-11-21 12:15:58 +00:00
|
|
|
mpeg2dec->can_allocate_aligned = TRUE;
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
mpeg2_reset (mpeg2dec->decoder, 1);
|
2005-02-05 07:36:01 +00:00
|
|
|
}
|
2005-10-26 16:45:04 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
static void
|
|
|
|
gst_mpeg2dec_qos_reset (GstMpeg2dec * mpeg2dec)
|
|
|
|
{
|
|
|
|
GST_OBJECT_LOCK (mpeg2dec);
|
|
|
|
mpeg2dec->proportion = 1.0;
|
|
|
|
mpeg2dec->earliest_time = -1;
|
2011-09-05 10:11:52 +00:00
|
|
|
mpeg2dec->dropped = 0;
|
|
|
|
mpeg2dec->processed = 0;
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
GST_OBJECT_UNLOCK (mpeg2dec);
|
|
|
|
}
|
|
|
|
|
2010-12-29 22:17:50 +00:00
|
|
|
static GstFlowReturn
|
2012-04-02 13:21:36 +00:00
|
|
|
gst_mpeg2dec_crop_buffer (GstMpeg2dec * dec, GstBuffer ** buf,
|
|
|
|
GstVideoFrame * frame)
|
2005-01-17 13:54:30 +00:00
|
|
|
{
|
2012-04-02 13:21:36 +00:00
|
|
|
GstFlowReturn ret;
|
2009-04-19 12:03:19 +00:00
|
|
|
GstBuffer *outbuf;
|
2012-04-02 13:21:36 +00:00
|
|
|
GstVideoFrame outframe;
|
|
|
|
guint i, n_planes;
|
|
|
|
|
|
|
|
ret = gst_buffer_pool_acquire_buffer (dec->pool, &outbuf, NULL);
|
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK))
|
|
|
|
return ret;;
|
|
|
|
|
|
|
|
GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, dec,
|
|
|
|
"cropping input buffer to output buffer");
|
|
|
|
|
|
|
|
gst_video_frame_map (&outframe, &dec->cinfo, outbuf, GST_MAP_WRITE);
|
|
|
|
|
|
|
|
n_planes = GST_VIDEO_FRAME_N_PLANES (&outframe);
|
|
|
|
|
|
|
|
for (i = 0; i < n_planes; i++) {
|
|
|
|
guint w, h, j;
|
|
|
|
guint8 *sp, *dp;
|
|
|
|
gint ss, ds;
|
|
|
|
|
|
|
|
sp = GST_VIDEO_FRAME_PLANE_DATA (frame, i);
|
|
|
|
dp = GST_VIDEO_FRAME_PLANE_DATA (&outframe, i);
|
|
|
|
|
|
|
|
ss = GST_VIDEO_FRAME_PLANE_STRIDE (frame, i);
|
|
|
|
ds = GST_VIDEO_FRAME_PLANE_STRIDE (&outframe, i);
|
|
|
|
|
|
|
|
w = MIN (ABS (ss), ABS (ds));
|
|
|
|
h = GST_VIDEO_FRAME_COMP_HEIGHT (&outframe, i);
|
|
|
|
|
|
|
|
GST_CAT_DEBUG (GST_CAT_PERFORMANCE, "copy plane %u, w:%u h:%u ", i, w, h);
|
|
|
|
|
|
|
|
for (j = 0; j < h; j++) {
|
|
|
|
memcpy (dp, sp, w);
|
|
|
|
dp += ds;
|
|
|
|
sp += ss;
|
2005-01-17 13:54:30 +00:00
|
|
|
}
|
|
|
|
}
|
2012-04-02 13:21:36 +00:00
|
|
|
gst_video_frame_unmap (&outframe);
|
2005-01-17 13:54:30 +00:00
|
|
|
|
2012-04-02 13:21:36 +00:00
|
|
|
gst_buffer_copy_into (outbuf, *buf,
|
|
|
|
GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS, 0, -1);
|
2010-12-29 21:42:36 +00:00
|
|
|
|
|
|
|
gst_buffer_unref (*buf);
|
|
|
|
*buf = outbuf;
|
|
|
|
|
2010-12-29 22:17:50 +00:00
|
|
|
return GST_FLOW_OK;
|
2005-01-17 13:54:30 +00:00
|
|
|
}
|
|
|
|
|
2006-04-13 19:08:20 +00:00
|
|
|
static GstFlowReturn
|
2011-09-30 15:38:07 +00:00
|
|
|
gst_mpeg2dec_negotiate_pool (GstMpeg2dec * dec, GstCaps * caps,
|
2012-04-02 13:21:36 +00:00
|
|
|
GstVideoInfo * vinfo, GstVideoInfo * cinfo)
|
2002-12-05 00:29:11 +00:00
|
|
|
{
|
2011-09-30 15:38:07 +00:00
|
|
|
GstQuery *query;
|
2012-03-15 19:38:50 +00:00
|
|
|
GstBufferPool *pool;
|
|
|
|
guint size, min, max;
|
2011-09-30 15:38:07 +00:00
|
|
|
GstStructure *config;
|
2012-04-02 13:21:36 +00:00
|
|
|
GstCaps *pcaps;
|
2011-09-30 15:38:07 +00:00
|
|
|
|
|
|
|
/* find a pool for the negotiated caps now */
|
|
|
|
query = gst_query_new_allocation (caps, TRUE);
|
|
|
|
|
2012-04-02 13:21:36 +00:00
|
|
|
if (gst_pad_peer_query (dec->srcpad, query)) {
|
|
|
|
/* check if downstream supports cropping */
|
|
|
|
dec->has_cropping =
|
|
|
|
gst_query_has_allocation_meta (query, GST_VIDEO_CROP_META_API_TYPE);
|
|
|
|
} else {
|
2012-03-15 19:38:50 +00:00
|
|
|
/* use the query default then */
|
|
|
|
GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints");
|
2012-04-02 13:21:36 +00:00
|
|
|
dec->has_cropping = FALSE;
|
2012-03-15 19:38:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (gst_query_get_n_allocation_pools (query) > 0) {
|
2011-09-30 15:38:07 +00:00
|
|
|
/* we got configuration from our peer, parse them */
|
2012-03-15 19:38:50 +00:00
|
|
|
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
|
2005-10-26 16:45:04 +00:00
|
|
|
} else {
|
2012-03-15 19:38:50 +00:00
|
|
|
pool = NULL;
|
2012-04-02 13:21:36 +00:00
|
|
|
size = 0;
|
2011-09-30 15:38:07 +00:00
|
|
|
min = max = 0;
|
2004-03-31 06:31:47 +00:00
|
|
|
}
|
|
|
|
|
2011-11-04 09:45:47 +00:00
|
|
|
GST_DEBUG_OBJECT (dec,
|
2012-03-15 19:38:50 +00:00
|
|
|
"size:%d, min:%d, max:%d,pool:%p", size, min, max, pool);
|
2012-04-02 13:21:36 +00:00
|
|
|
GST_DEBUG_OBJECT (dec, "downstream cropping %d", dec->has_cropping);
|
2011-11-04 09:45:47 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
if (pool == NULL) {
|
|
|
|
/* we did not get a pool, make one ourselves then */
|
2012-03-15 19:38:50 +00:00
|
|
|
pool = gst_video_buffer_pool_new ();
|
2011-09-30 15:38:07 +00:00
|
|
|
}
|
2006-06-19 15:16:43 +00:00
|
|
|
|
2012-03-15 19:38:50 +00:00
|
|
|
if (dec->pool) {
|
|
|
|
gst_buffer_pool_set_active (dec->pool, FALSE);
|
2011-09-30 15:38:07 +00:00
|
|
|
gst_object_unref (dec->pool);
|
2012-03-15 19:38:50 +00:00
|
|
|
}
|
2011-09-30 15:38:07 +00:00
|
|
|
dec->pool = pool;
|
2006-06-19 15:16:43 +00:00
|
|
|
|
2012-04-02 13:21:36 +00:00
|
|
|
if (dec->need_cropping && dec->has_cropping) {
|
|
|
|
/* we can crop, configure the pool with buffers of caps and size of the
|
|
|
|
* decoded picture size and then crop them with metadata */
|
|
|
|
pcaps = gst_video_info_to_caps (vinfo);
|
|
|
|
size = MAX (size, GST_VIDEO_INFO_SIZE (vinfo));
|
|
|
|
} else {
|
|
|
|
/* no cropping, use cropped videoinfo */
|
|
|
|
pcaps = gst_caps_ref (caps);
|
|
|
|
size = MAX (size, GST_VIDEO_INFO_SIZE (cinfo));
|
|
|
|
}
|
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
config = gst_buffer_pool_get_config (pool);
|
2012-04-02 13:21:36 +00:00
|
|
|
gst_buffer_pool_config_set_params (config, pcaps, size, min, max);
|
|
|
|
gst_caps_unref (pcaps);
|
2012-03-15 19:38:50 +00:00
|
|
|
|
|
|
|
if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) {
|
|
|
|
/* just set the option, if the pool can support it we will transparently use
|
|
|
|
* it through the video info API. We could also see if the pool support this
|
|
|
|
* option and only activate it then. */
|
|
|
|
gst_buffer_pool_config_add_option (config,
|
|
|
|
GST_BUFFER_POOL_OPTION_VIDEO_META);
|
|
|
|
}
|
2006-06-19 15:16:43 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
gst_buffer_pool_set_config (pool, config);
|
|
|
|
/* and activate */
|
|
|
|
gst_buffer_pool_set_active (pool, TRUE);
|
2003-12-22 01:47:08 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
gst_query_unref (query);
|
2003-02-02 20:03:10 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
return GST_FLOW_OK;
|
2001-12-23 06:03:21 +00:00
|
|
|
}
|
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
static void
|
|
|
|
init_dummybuf (GstMpeg2dec * mpeg2dec)
|
|
|
|
{
|
2006-11-03 09:52:12 +00:00
|
|
|
g_free (mpeg2dec->dummybuf[3]);
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
|
2006-11-21 12:15:58 +00:00
|
|
|
/* libmpeg2 needs 16 byte aligned buffers... care for this here */
|
2006-11-03 09:52:12 +00:00
|
|
|
mpeg2dec->dummybuf[3] = g_malloc0 (mpeg2dec->size + 15);
|
|
|
|
mpeg2dec->dummybuf[0] = ALIGN_16 (mpeg2dec->dummybuf[3]);
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
mpeg2dec->dummybuf[1] = mpeg2dec->dummybuf[0] + mpeg2dec->u_offs;
|
2006-09-15 16:14:15 +00:00
|
|
|
mpeg2dec->dummybuf[2] = mpeg2dec->dummybuf[0] + mpeg2dec->v_offs;
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
}
|
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
static GstFlowReturn
|
2005-02-04 13:43:28 +00:00
|
|
|
handle_sequence (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
|
|
|
|
{
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2011-09-30 15:38:07 +00:00
|
|
|
const mpeg2_sequence_t *sequence;
|
|
|
|
gint par_n, par_d;
|
2012-04-02 13:21:36 +00:00
|
|
|
GstVideoInfo vinfo, cinfo;
|
2011-09-30 15:38:07 +00:00
|
|
|
GstVideoFormat format;
|
|
|
|
GstCaps *caps;
|
|
|
|
gint y_size, uv_size;
|
2005-02-04 13:43:28 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
sequence = info->sequence;
|
|
|
|
|
|
|
|
if (sequence->frame_period == 0)
|
|
|
|
goto invalid_frame_period;
|
|
|
|
|
|
|
|
/* mpeg2 video can only be from 16x16 to 4096x4096. Everything
|
|
|
|
* else is a corrupted file */
|
2012-04-02 13:21:36 +00:00
|
|
|
if (sequence->width > 4096 || sequence->width < 16 ||
|
|
|
|
sequence->height > 4096 || sequence->height < 16)
|
2011-09-30 15:38:07 +00:00
|
|
|
goto invalid_size;
|
|
|
|
|
2012-04-02 13:21:36 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec,
|
|
|
|
"widthxheight: %dx%d , decoded_widthxheight: %dx%d",
|
|
|
|
sequence->picture_width, sequence->picture_height, sequence->width,
|
|
|
|
sequence->height);
|
|
|
|
|
|
|
|
if (sequence->picture_width != sequence->width ||
|
|
|
|
sequence->picture_height != sequence->height) {
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "we need to crop");
|
|
|
|
mpeg2dec->need_cropping = TRUE;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "no cropping needed");
|
|
|
|
mpeg2dec->need_cropping = FALSE;
|
|
|
|
}
|
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
y_size = sequence->width * sequence->height;
|
|
|
|
/* get subsampling */
|
|
|
|
if (sequence->chroma_width < sequence->width) {
|
|
|
|
/* horizontally subsampled */
|
|
|
|
if (sequence->chroma_height < sequence->height) {
|
|
|
|
/* and vertically subsamples */
|
|
|
|
format = GST_VIDEO_FORMAT_I420;
|
|
|
|
uv_size = y_size >> 2;
|
|
|
|
} else {
|
|
|
|
format = GST_VIDEO_FORMAT_Y42B;
|
|
|
|
uv_size = y_size >> 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* not subsampled */
|
|
|
|
format = GST_VIDEO_FORMAT_Y444;
|
|
|
|
uv_size = y_size;
|
2008-02-04 14:27:32 +00:00
|
|
|
}
|
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
/* calculate size and offsets of the decoded frames */
|
|
|
|
mpeg2dec->size = y_size + 2 * (uv_size);
|
|
|
|
mpeg2dec->u_offs = y_size;
|
|
|
|
mpeg2dec->v_offs = y_size + uv_size;
|
|
|
|
|
2012-04-02 13:21:36 +00:00
|
|
|
/* we store the codec size before cropping */
|
2011-09-30 15:38:07 +00:00
|
|
|
gst_video_info_init (&vinfo);
|
2011-11-04 09:45:47 +00:00
|
|
|
gst_video_info_set_format (&vinfo, format, sequence->width, sequence->height);
|
2011-09-30 15:38:07 +00:00
|
|
|
|
|
|
|
/* sink caps par overrides sequence PAR */
|
|
|
|
if (mpeg2dec->have_par) {
|
|
|
|
par_n = mpeg2dec->in_par_n;
|
|
|
|
par_d = mpeg2dec->in_par_d;
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "using sink par %d:%d", par_n, par_d);
|
|
|
|
} else {
|
|
|
|
par_n = sequence->pixel_width;
|
|
|
|
par_d = sequence->pixel_height;
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "using encoded par %d:%d", par_n, par_d);
|
2008-10-14 12:51:41 +00:00
|
|
|
}
|
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
if (par_n == 0 || par_d == 0) {
|
2012-04-02 13:21:36 +00:00
|
|
|
if (!gst_util_fraction_multiply (4, 3, sequence->picture_height,
|
|
|
|
sequence->picture_width, &par_n, &par_d))
|
2011-09-30 15:38:07 +00:00
|
|
|
par_n = par_d = 1;
|
|
|
|
|
|
|
|
GST_WARNING_OBJECT (mpeg2dec, "Unknown par, assuming %d:%d", par_n, par_d);
|
2008-07-13 10:13:06 +00:00
|
|
|
}
|
2011-09-30 15:38:07 +00:00
|
|
|
vinfo.par_n = par_n;
|
|
|
|
vinfo.par_d = par_d;
|
2008-07-13 10:13:06 +00:00
|
|
|
|
2006-11-15 13:57:21 +00:00
|
|
|
/* set framerate */
|
2011-09-30 15:38:07 +00:00
|
|
|
vinfo.fps_n = 27000000;
|
|
|
|
vinfo.fps_d = sequence->frame_period;
|
|
|
|
mpeg2dec->frame_period = sequence->frame_period * GST_USECOND / 27;
|
|
|
|
|
|
|
|
if (!(sequence->flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE))
|
2011-12-19 17:20:56 +00:00
|
|
|
vinfo.interlace_mode = GST_VIDEO_INTERLACE_MODE_MIXED;
|
|
|
|
else
|
|
|
|
vinfo.interlace_mode = GST_VIDEO_INTERLACE_MODE_PROGRESSIVE;
|
2005-02-04 13:43:28 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
vinfo.chroma_site = GST_VIDEO_CHROMA_SITE_MPEG2;
|
|
|
|
vinfo.colorimetry.range = GST_VIDEO_COLOR_RANGE_16_235;
|
|
|
|
|
|
|
|
if (sequence->flags & SEQ_FLAG_COLOUR_DESCRIPTION) {
|
|
|
|
/* do color description */
|
|
|
|
switch (sequence->colour_primaries) {
|
|
|
|
case 1:
|
|
|
|
vinfo.colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_BT709;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
vinfo.colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_BT470M;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
vinfo.colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_BT470BG;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
vinfo.colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_SMPTE170M;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
vinfo.colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_SMPTE240M;
|
|
|
|
break;
|
|
|
|
/* 0 forbidden */
|
|
|
|
/* 2 unspecified */
|
|
|
|
/* 3 reserved */
|
|
|
|
/* 8-255 reseved */
|
|
|
|
default:
|
|
|
|
vinfo.colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_UNKNOWN;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* matrix coefficients */
|
|
|
|
switch (sequence->matrix_coefficients) {
|
|
|
|
case 1:
|
|
|
|
vinfo.colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_BT709;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
vinfo.colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_FCC;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
vinfo.colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_BT601;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
vinfo.colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_SMPTE240M;
|
|
|
|
break;
|
|
|
|
/* 0 forbidden */
|
|
|
|
/* 2 unspecified */
|
|
|
|
/* 3 reserved */
|
|
|
|
/* 8-255 reseved */
|
|
|
|
default:
|
|
|
|
vinfo.colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_UNKNOWN;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* transfer characteristics */
|
|
|
|
switch (sequence->transfer_characteristics) {
|
|
|
|
case 1:
|
|
|
|
vinfo.colorimetry.transfer = GST_VIDEO_TRANSFER_BT709;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
vinfo.colorimetry.transfer = GST_VIDEO_TRANSFER_GAMMA22;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
vinfo.colorimetry.transfer = GST_VIDEO_TRANSFER_GAMMA28;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
vinfo.colorimetry.transfer = GST_VIDEO_TRANSFER_BT709;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
vinfo.colorimetry.transfer = GST_VIDEO_TRANSFER_SMPTE240M;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
vinfo.colorimetry.transfer = GST_VIDEO_TRANSFER_GAMMA10;
|
|
|
|
break;
|
|
|
|
/* 0 forbidden */
|
|
|
|
/* 2 unspecified */
|
|
|
|
/* 3 reserved */
|
|
|
|
/* 9-255 reseved */
|
|
|
|
default:
|
|
|
|
vinfo.colorimetry.transfer = GST_VIDEO_TRANSFER_UNKNOWN;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-05-12 09:44:13 +00:00
|
|
|
|
2005-02-04 13:43:28 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec,
|
2005-11-23 00:12:24 +00:00
|
|
|
"sequence flags: %d, frame period: %d (%g), frame rate: %d/%d",
|
2011-09-30 15:38:07 +00:00
|
|
|
sequence->flags, sequence->frame_period,
|
|
|
|
(double) (mpeg2dec->frame_period) / GST_SECOND, vinfo.fps_n, vinfo.fps_d);
|
2005-02-04 13:43:28 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "profile: %02x, colour_primaries: %d",
|
2011-09-30 15:38:07 +00:00
|
|
|
sequence->profile_level_id, sequence->colour_primaries);
|
2005-02-04 13:43:28 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "transfer chars: %d, matrix coef: %d",
|
2011-09-30 15:38:07 +00:00
|
|
|
sequence->transfer_characteristics, sequence->matrix_coefficients);
|
2009-05-12 09:44:13 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec,
|
|
|
|
"FLAGS: CONSTRAINED_PARAMETERS:%d, PROGRESSIVE_SEQUENCE:%d",
|
2011-09-30 15:38:07 +00:00
|
|
|
sequence->flags & SEQ_FLAG_CONSTRAINED_PARAMETERS,
|
|
|
|
sequence->flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE);
|
2009-05-12 09:44:13 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "FLAGS: LOW_DELAY:%d, COLOUR_DESCRIPTION:%d",
|
2011-09-30 15:38:07 +00:00
|
|
|
sequence->flags & SEQ_FLAG_LOW_DELAY,
|
|
|
|
sequence->flags & SEQ_FLAG_COLOUR_DESCRIPTION);
|
2005-02-04 13:43:28 +00:00
|
|
|
|
2012-04-02 13:21:36 +00:00
|
|
|
/* for the output caps we always take the cropped dimensions */
|
|
|
|
cinfo = vinfo;
|
|
|
|
gst_video_info_set_format (&cinfo, GST_VIDEO_INFO_FORMAT (&vinfo),
|
|
|
|
sequence->picture_width, sequence->picture_height);
|
|
|
|
caps = gst_video_info_to_caps (&cinfo);
|
2011-09-30 15:38:07 +00:00
|
|
|
gst_pad_set_caps (mpeg2dec->srcpad, caps);
|
2005-10-26 16:45:04 +00:00
|
|
|
|
2012-04-02 13:21:36 +00:00
|
|
|
gst_mpeg2dec_negotiate_pool (mpeg2dec, caps, &vinfo, &cinfo);
|
2011-09-30 15:38:07 +00:00
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
2012-04-02 13:21:36 +00:00
|
|
|
mpeg2dec->vinfo = vinfo;
|
|
|
|
mpeg2dec->cinfo = cinfo;
|
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
mpeg2_custom_fbuf (mpeg2dec->decoder, 1);
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
init_dummybuf (mpeg2dec);
|
2005-02-04 13:43:28 +00:00
|
|
|
|
2011-02-17 16:06:51 +00:00
|
|
|
/* Pump in some null buffers, because otherwise libmpeg2 doesn't
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
* initialise the discard_fbuf->id */
|
|
|
|
mpeg2_set_buf (mpeg2dec->decoder, mpeg2dec->dummybuf, NULL);
|
|
|
|
mpeg2_set_buf (mpeg2dec->decoder, mpeg2dec->dummybuf, NULL);
|
|
|
|
mpeg2_set_buf (mpeg2dec->decoder, mpeg2dec->dummybuf, NULL);
|
2005-10-27 17:26:13 +00:00
|
|
|
|
2005-02-04 13:43:28 +00:00
|
|
|
mpeg2dec->need_sequence = FALSE;
|
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
done:
|
|
|
|
return ret;
|
2005-10-26 16:45:04 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
invalid_frame_period:
|
2005-10-26 16:45:04 +00:00
|
|
|
{
|
2011-09-30 15:38:07 +00:00
|
|
|
GST_WARNING_OBJECT (mpeg2dec, "Frame period is 0!");
|
|
|
|
ret = GST_FLOW_ERROR;
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
goto done;
|
2005-10-26 16:45:04 +00:00
|
|
|
}
|
2011-09-30 15:38:07 +00:00
|
|
|
invalid_size:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (mpeg2dec, "Invalid frame dimensions: %d x %d",
|
2012-04-02 13:21:36 +00:00
|
|
|
sequence->width, sequence->height);
|
2011-09-30 15:38:07 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2005-02-04 13:43:28 +00:00
|
|
|
}
|
|
|
|
|
2006-06-07 17:05:48 +00:00
|
|
|
static void
|
|
|
|
clear_buffers (GstMpeg2dec * mpeg2dec)
|
|
|
|
{
|
|
|
|
gint i;
|
2011-09-30 15:38:07 +00:00
|
|
|
GstVideoFrame *frame;
|
2006-06-07 17:05:48 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
2011-09-30 15:38:07 +00:00
|
|
|
frame = &mpeg2dec->ip_frame[i];
|
|
|
|
if (frame->buffer) {
|
|
|
|
gst_video_frame_unmap (frame);
|
|
|
|
gst_buffer_unref (frame->buffer);
|
|
|
|
frame->buffer = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
frame = &mpeg2dec->b_frame;
|
|
|
|
if (frame->buffer) {
|
|
|
|
gst_video_frame_unmap (frame);
|
|
|
|
gst_buffer_unref (frame->buffer);
|
|
|
|
frame->buffer = NULL;
|
2006-06-07 17:05:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-10 15:24:08 +00:00
|
|
|
static void
|
|
|
|
clear_queued (GstMpeg2dec * mpeg2dec)
|
|
|
|
{
|
|
|
|
g_list_foreach (mpeg2dec->queued, (GFunc) gst_mini_object_unref, NULL);
|
|
|
|
g_list_free (mpeg2dec->queued);
|
|
|
|
mpeg2dec->queued = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
flush_queued (GstMpeg2dec * mpeg2dec)
|
|
|
|
{
|
2008-01-14 11:41:32 +00:00
|
|
|
GstFlowReturn res = GST_FLOW_OK;
|
2008-01-10 15:24:08 +00:00
|
|
|
|
|
|
|
while (mpeg2dec->queued) {
|
|
|
|
GstBuffer *buf = GST_BUFFER_CAST (mpeg2dec->queued->data);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (mpeg2dec, "pushing buffer %p, timestamp %"
|
|
|
|
GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT, buf,
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
|
|
|
|
|
|
|
|
/* iterate ouput queue an push downstream */
|
|
|
|
res = gst_pad_push (mpeg2dec->srcpad, buf);
|
|
|
|
|
|
|
|
mpeg2dec->queued = g_list_delete_link (mpeg2dec->queued, mpeg2dec->queued);
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
static GstFlowReturn
|
2005-02-04 13:43:28 +00:00
|
|
|
handle_picture (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
|
|
|
|
{
|
|
|
|
gboolean key_frame = FALSE;
|
2011-09-30 15:38:07 +00:00
|
|
|
GstBuffer *outbuf;
|
|
|
|
GstVideoFrame *frame;
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
GstFlowReturn ret;
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
gint type;
|
2011-09-30 15:38:07 +00:00
|
|
|
guint8 *buf[3];
|
2005-02-04 13:43:28 +00:00
|
|
|
|
2012-04-02 13:21:36 +00:00
|
|
|
if (mpeg2dec->need_cropping && !mpeg2dec->has_cropping) {
|
|
|
|
GstAllocationParams params = { 0, };
|
|
|
|
|
|
|
|
/* we need to crop manually */
|
|
|
|
params.align = 15;
|
|
|
|
outbuf =
|
|
|
|
gst_buffer_new_allocate (NULL, GST_VIDEO_INFO_SIZE (&mpeg2dec->vinfo),
|
|
|
|
¶ms);
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
} else {
|
|
|
|
ret = gst_buffer_pool_acquire_buffer (mpeg2dec->pool, &outbuf, NULL);
|
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK))
|
|
|
|
goto no_buffer;
|
|
|
|
}
|
2005-10-26 16:45:04 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
/* we store the original byteoffset of this picture in the stream here
|
|
|
|
* because we need it for indexing */
|
|
|
|
GST_BUFFER_OFFSET (outbuf) = mpeg2dec->offset;
|
|
|
|
|
2005-02-04 13:43:28 +00:00
|
|
|
if (info->current_picture) {
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
type = info->current_picture->flags & PIC_MASK_CODING_TYPE;
|
|
|
|
} else {
|
|
|
|
type = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "handle picture type %d", type);
|
|
|
|
|
|
|
|
key_frame = type == PIC_FLAG_CODING_TYPE_I;
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case PIC_FLAG_CODING_TYPE_I:
|
|
|
|
mpeg2_skip (mpeg2dec->decoder, 0);
|
2008-01-10 15:24:08 +00:00
|
|
|
if (mpeg2dec->segment.rate < 0.0) {
|
|
|
|
/* negative rate, flush the queued pictures in reverse */
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "flushing queued buffers");
|
|
|
|
flush_queued (mpeg2dec);
|
|
|
|
}
|
2011-09-30 15:38:07 +00:00
|
|
|
/* fallthrough */
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
case PIC_FLAG_CODING_TYPE_P:
|
2011-09-30 15:38:07 +00:00
|
|
|
frame = &mpeg2dec->ip_frame[mpeg2dec->ip_framepos];
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "I/P unref %p, ref %p", frame, outbuf);
|
|
|
|
mpeg2dec->ip_framepos = (mpeg2dec->ip_framepos + 1) & 3;
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
break;
|
|
|
|
case PIC_FLAG_CODING_TYPE_B:
|
2011-09-30 15:38:07 +00:00
|
|
|
frame = &mpeg2dec->b_frame;
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "B unref %p, ref %p", frame, outbuf);
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-09-30 15:38:07 +00:00
|
|
|
goto unknown_frame;
|
2005-02-04 13:43:28 +00:00
|
|
|
}
|
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
if (frame->buffer) {
|
|
|
|
gst_video_frame_unmap (frame);
|
|
|
|
gst_buffer_unref (frame->buffer);
|
2012-04-02 13:21:36 +00:00
|
|
|
frame->buffer = NULL;
|
2011-09-30 15:38:07 +00:00
|
|
|
}
|
2012-04-01 18:19:36 +00:00
|
|
|
|
2012-04-02 13:21:36 +00:00
|
|
|
if (mpeg2dec->need_cropping && mpeg2dec->has_cropping) {
|
2012-04-01 18:19:36 +00:00
|
|
|
GstVideoCropMeta *crop;
|
|
|
|
|
|
|
|
crop = gst_buffer_add_video_crop_meta (outbuf);
|
|
|
|
/* we can do things slightly more efficient when we know that
|
|
|
|
* downstream understands clipping */
|
|
|
|
crop->x = 0;
|
|
|
|
crop->y = 0;
|
2012-04-02 13:21:36 +00:00
|
|
|
crop->width = info->sequence->picture_width;
|
|
|
|
crop->height = info->sequence->picture_height;
|
2012-04-01 18:19:36 +00:00
|
|
|
}
|
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
gst_video_frame_map (frame, &mpeg2dec->vinfo, outbuf, GST_MAP_WRITE);
|
|
|
|
|
|
|
|
buf[0] = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
|
|
|
|
buf[1] = GST_VIDEO_FRAME_PLANE_DATA (frame, 1);
|
|
|
|
buf[2] = GST_VIDEO_FRAME_PLANE_DATA (frame, 2);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "set_buf: %p %p %p, outbuf %p",
|
|
|
|
buf[0], buf[1], buf[2], outbuf);
|
|
|
|
|
|
|
|
mpeg2_set_buf (mpeg2dec->decoder, buf, frame);
|
|
|
|
|
2005-02-04 13:43:28 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "picture %s, outbuf %p, offset %"
|
|
|
|
G_GINT64_FORMAT,
|
|
|
|
key_frame ? ", kf," : " ", outbuf, GST_BUFFER_OFFSET (outbuf)
|
|
|
|
);
|
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
if (mpeg2dec->discont_state == MPEG2DEC_DISC_NEW_PICTURE && key_frame)
|
2005-02-04 13:43:28 +00:00
|
|
|
mpeg2dec->discont_state = MPEG2DEC_DISC_NEW_KEYFRAME;
|
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
return ret;
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
|
|
|
|
no_buffer:
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
2011-09-30 15:38:07 +00:00
|
|
|
unknown_frame:
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
2005-02-04 13:43:28 +00:00
|
|
|
}
|
|
|
|
|
2008-01-10 15:24:08 +00:00
|
|
|
/* try to clip the buffer to the segment boundaries */
|
|
|
|
static gboolean
|
|
|
|
clip_buffer (GstMpeg2dec * dec, GstBuffer * buf)
|
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
GstClockTime in_ts, in_dur, stop;
|
2011-09-30 15:38:07 +00:00
|
|
|
guint64 cstart, cstop;
|
2008-01-10 15:24:08 +00:00
|
|
|
|
|
|
|
in_ts = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
in_dur = GST_BUFFER_DURATION (buf);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (dec,
|
|
|
|
"timestamp:%" GST_TIME_FORMAT " , duration:%" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (in_ts), GST_TIME_ARGS (in_dur));
|
|
|
|
|
|
|
|
/* can't clip without TIME segment */
|
|
|
|
if (dec->segment.format != GST_FORMAT_TIME)
|
|
|
|
goto beach;
|
|
|
|
|
|
|
|
/* we need a start time */
|
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (in_ts))
|
|
|
|
goto beach;
|
|
|
|
|
|
|
|
/* generate valid stop, if duration unknown, we have unknown stop */
|
|
|
|
stop =
|
|
|
|
GST_CLOCK_TIME_IS_VALID (in_dur) ? (in_ts + in_dur) : GST_CLOCK_TIME_NONE;
|
|
|
|
|
|
|
|
/* now clip */
|
|
|
|
if (!(res = gst_segment_clip (&dec->segment, GST_FORMAT_TIME,
|
|
|
|
in_ts, stop, &cstart, &cstop)))
|
|
|
|
goto beach;
|
|
|
|
|
|
|
|
/* update timestamp and possibly duration if the clipped stop time is
|
|
|
|
* valid */
|
|
|
|
GST_BUFFER_TIMESTAMP (buf) = cstart;
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (cstop))
|
|
|
|
GST_BUFFER_DURATION (buf) = cstop - cstart;
|
|
|
|
|
|
|
|
beach:
|
|
|
|
GST_LOG_OBJECT (dec, "%sdropping", (res ? "not " : ""));
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
static GstFlowReturn
|
2005-02-04 13:43:28 +00:00
|
|
|
handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
|
|
|
|
{
|
|
|
|
GstBuffer *outbuf = NULL;
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
const mpeg2_picture_t *picture;
|
|
|
|
gboolean key_frame = FALSE;
|
|
|
|
GstClockTime time;
|
2011-09-30 15:38:07 +00:00
|
|
|
GstVideoFrame *frame;
|
2005-10-19 16:01:35 +00:00
|
|
|
|
2005-02-04 13:43:28 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "picture slice/end %p %p %p %p",
|
|
|
|
info->display_fbuf,
|
|
|
|
info->display_picture, info->current_picture,
|
|
|
|
(info->display_fbuf ? info->display_fbuf->id : NULL));
|
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
if (!info->display_fbuf || !info->display_fbuf->id)
|
|
|
|
goto no_display;
|
2005-02-04 13:43:28 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
frame = (GstVideoFrame *) (info->display_fbuf->id);
|
|
|
|
outbuf = frame->buffer;
|
2005-02-04 13:43:28 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
picture = info->display_picture;
|
2005-02-04 13:43:28 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
key_frame = (picture->flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I;
|
2005-10-27 17:26:13 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "picture flags: %d, type: %d, keyframe: %d",
|
|
|
|
picture->flags, picture->flags & PIC_MASK_CODING_TYPE, key_frame);
|
2005-02-04 13:43:28 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
if (key_frame) {
|
|
|
|
GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
|
|
|
|
mpeg2_skip (mpeg2dec->decoder, 0);
|
|
|
|
} else {
|
|
|
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
|
|
|
|
}
|
2005-10-27 17:26:13 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
if (mpeg2dec->discont_state == MPEG2DEC_DISC_NEW_KEYFRAME && key_frame)
|
|
|
|
mpeg2dec->discont_state = MPEG2DEC_DISC_NONE;
|
2005-02-04 13:43:28 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
time = GST_CLOCK_TIME_NONE;
|
2005-10-27 17:26:13 +00:00
|
|
|
|
2005-02-04 13:43:28 +00:00
|
|
|
#if MPEG2_RELEASE < MPEG2_VERSION(0,4,0)
|
2006-10-10 16:58:32 +00:00
|
|
|
if (picture->flags & PIC_FLAG_PTS) {
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
time = MPEG_TIME_TO_GST_TIME (picture->pts);
|
2006-10-10 16:58:32 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "picture pts %" G_GUINT64_FORMAT
|
|
|
|
", time %" GST_TIME_FORMAT, picture->pts, GST_TIME_ARGS (time));
|
|
|
|
}
|
2005-02-04 13:43:28 +00:00
|
|
|
#else
|
2006-10-10 16:58:32 +00:00
|
|
|
if (picture->flags & PIC_FLAG_TAGS) {
|
|
|
|
guint64 pts = (((guint64) picture->tag2) << 32) | picture->tag;
|
|
|
|
|
|
|
|
time = MPEG_TIME_TO_GST_TIME (pts);
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "picture tags %" G_GUINT64_FORMAT
|
|
|
|
", time %" GST_TIME_FORMAT, pts, GST_TIME_ARGS (time));
|
|
|
|
}
|
2005-02-04 13:43:28 +00:00
|
|
|
#endif
|
2005-10-27 17:26:13 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
if (time == GST_CLOCK_TIME_NONE) {
|
|
|
|
time = mpeg2dec->next_time;
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "picture didn't have pts");
|
|
|
|
} else {
|
2005-02-04 13:43:28 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec,
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
"picture had pts %" GST_TIME_FORMAT ", we had %"
|
|
|
|
GST_TIME_FORMAT, GST_TIME_ARGS (time),
|
|
|
|
GST_TIME_ARGS (mpeg2dec->next_time));
|
|
|
|
mpeg2dec->next_time = time;
|
|
|
|
}
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = time;
|
2005-02-04 13:43:28 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
/* TODO set correct offset here based on frame number */
|
|
|
|
if (info->display_picture_2nd) {
|
|
|
|
GST_BUFFER_DURATION (outbuf) = (picture->nb_fields +
|
|
|
|
info->display_picture_2nd->nb_fields) * mpeg2dec->frame_period / 2;
|
|
|
|
} else {
|
|
|
|
GST_BUFFER_DURATION (outbuf) =
|
|
|
|
picture->nb_fields * mpeg2dec->frame_period / 2;
|
|
|
|
}
|
|
|
|
mpeg2dec->next_time += GST_BUFFER_DURATION (outbuf);
|
2005-02-04 13:43:28 +00:00
|
|
|
|
2011-12-19 17:20:56 +00:00
|
|
|
if (!(picture->flags & PIC_FLAG_PROGRESSIVE_FRAME))
|
|
|
|
GST_BUFFER_FLAG_SET (outbuf, GST_VIDEO_BUFFER_FLAG_INTERLACED);
|
|
|
|
|
2009-05-12 09:44:13 +00:00
|
|
|
if (picture->flags & PIC_FLAG_TOP_FIELD_FIRST)
|
2011-09-30 15:38:07 +00:00
|
|
|
GST_BUFFER_FLAG_SET (outbuf, GST_VIDEO_BUFFER_FLAG_TFF);
|
2009-05-12 09:44:13 +00:00
|
|
|
|
2009-05-12 18:34:20 +00:00
|
|
|
#if MPEG2_RELEASE >= MPEG2_VERSION(0,5,0)
|
|
|
|
/* repeat field introduced in 0.5.0 */
|
2009-05-12 09:44:13 +00:00
|
|
|
if (picture->flags & PIC_FLAG_REPEAT_FIRST_FIELD)
|
2011-09-30 15:38:07 +00:00
|
|
|
GST_BUFFER_FLAG_SET (outbuf, GST_VIDEO_BUFFER_FLAG_RFF);
|
2009-05-12 18:34:20 +00:00
|
|
|
#endif
|
2009-05-12 09:44:13 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec,
|
2009-05-12 09:44:13 +00:00
|
|
|
"picture: %s %s %s %s %s fields:%d off:%" G_GINT64_FORMAT " ts:%"
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
GST_TIME_FORMAT,
|
|
|
|
(picture->flags & PIC_FLAG_PROGRESSIVE_FRAME ? "prog" : " "),
|
2009-05-12 09:44:13 +00:00
|
|
|
(picture->flags & PIC_FLAG_TOP_FIELD_FIRST ? "tff" : " "),
|
2009-05-12 18:34:20 +00:00
|
|
|
#if MPEG2_RELEASE >= MPEG2_VERSION(0,5,0)
|
2009-05-12 09:44:13 +00:00
|
|
|
(picture->flags & PIC_FLAG_REPEAT_FIRST_FIELD ? "rff" : " "),
|
2009-05-12 18:34:20 +00:00
|
|
|
#else
|
|
|
|
"unknown rff",
|
|
|
|
#endif
|
2009-05-12 09:44:13 +00:00
|
|
|
(picture->flags & PIC_FLAG_SKIP ? "skip" : " "),
|
|
|
|
(picture->flags & PIC_FLAG_COMPOSITE_DISPLAY ? "composite" : " "),
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
picture->nb_fields, GST_BUFFER_OFFSET (outbuf),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)));
|
|
|
|
|
|
|
|
if (picture->flags & PIC_FLAG_SKIP)
|
|
|
|
goto skip;
|
|
|
|
|
|
|
|
if (mpeg2dec->discont_state != MPEG2DEC_DISC_NONE)
|
|
|
|
goto drop;
|
|
|
|
|
2008-01-10 15:24:08 +00:00
|
|
|
/* check for clipping */
|
|
|
|
if (!clip_buffer (mpeg2dec, outbuf))
|
|
|
|
goto clipped;
|
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (time)) {
|
|
|
|
gboolean need_skip;
|
|
|
|
GstClockTime qostime;
|
|
|
|
|
|
|
|
/* qos needs to be done on running time */
|
|
|
|
qostime = gst_segment_to_running_time (&mpeg2dec->segment, GST_FORMAT_TIME,
|
|
|
|
time);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (mpeg2dec);
|
|
|
|
/* check for QoS, don't perform the last steps of getting and
|
|
|
|
* pushing the buffers that are known to be late. */
|
|
|
|
/* FIXME, we can also entirely skip decoding if the next valid buffer is
|
|
|
|
* known to be after a keyframe (using the granule_shift) */
|
|
|
|
need_skip = mpeg2dec->earliest_time != -1
|
|
|
|
&& qostime <= mpeg2dec->earliest_time;
|
|
|
|
GST_OBJECT_UNLOCK (mpeg2dec);
|
|
|
|
|
2011-09-05 10:11:52 +00:00
|
|
|
if (need_skip) {
|
|
|
|
GstMessage *qos_msg;
|
|
|
|
guint64 stream_time;
|
|
|
|
gint64 jitter;
|
|
|
|
|
|
|
|
mpeg2dec->dropped++;
|
|
|
|
|
|
|
|
stream_time =
|
|
|
|
gst_segment_to_stream_time (&mpeg2dec->segment, GST_FORMAT_TIME,
|
|
|
|
time);
|
|
|
|
jitter = GST_CLOCK_DIFF (qostime, mpeg2dec->earliest_time);
|
|
|
|
|
|
|
|
qos_msg =
|
|
|
|
gst_message_new_qos (GST_OBJECT_CAST (mpeg2dec), FALSE, qostime,
|
|
|
|
stream_time, time, GST_BUFFER_DURATION (outbuf));
|
|
|
|
gst_message_set_qos_values (qos_msg, jitter, mpeg2dec->proportion,
|
|
|
|
1000000);
|
|
|
|
gst_message_set_qos_stats (qos_msg, GST_FORMAT_BUFFERS,
|
|
|
|
mpeg2dec->processed, mpeg2dec->dropped);
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (mpeg2dec), qos_msg);
|
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
goto dropping_qos;
|
2011-09-05 10:11:52 +00:00
|
|
|
}
|
2005-02-04 13:43:28 +00:00
|
|
|
}
|
|
|
|
|
2011-09-05 10:11:52 +00:00
|
|
|
mpeg2dec->processed++;
|
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
/* ref before pushing it out, so we still have the ref in our
|
|
|
|
* array of buffers */
|
|
|
|
gst_buffer_ref (outbuf);
|
2006-07-10 11:52:58 +00:00
|
|
|
|
2010-12-29 21:42:36 +00:00
|
|
|
/* do cropping if the target region is smaller than the input one */
|
2012-04-02 13:21:36 +00:00
|
|
|
if (mpeg2dec->need_cropping && !mpeg2dec->has_cropping) {
|
2010-12-29 21:42:36 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "cropping buffer");
|
2012-04-02 13:21:36 +00:00
|
|
|
ret = gst_mpeg2dec_crop_buffer (mpeg2dec, &outbuf, frame);
|
2010-12-29 22:17:50 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto done;
|
2010-12-29 21:42:36 +00:00
|
|
|
}
|
2006-07-10 11:52:58 +00:00
|
|
|
|
2008-01-10 15:24:08 +00:00
|
|
|
if (mpeg2dec->segment.rate >= 0.0) {
|
|
|
|
/* forward: push right away */
|
|
|
|
GST_LOG_OBJECT (mpeg2dec, "pushing buffer %p, timestamp %"
|
|
|
|
GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT,
|
|
|
|
outbuf,
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)));
|
2009-05-12 09:44:13 +00:00
|
|
|
GST_LOG_OBJECT (mpeg2dec, "... with flags %x", GST_BUFFER_FLAGS (outbuf));
|
2008-01-10 15:24:08 +00:00
|
|
|
|
|
|
|
ret = gst_pad_push (mpeg2dec->srcpad, outbuf);
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "pushed with result %s",
|
|
|
|
gst_flow_get_name (ret));
|
|
|
|
} else {
|
|
|
|
/* reverse: queue, we'll push in reverse when we receive the next (previous)
|
|
|
|
* keyframe. */
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "queued frame");
|
|
|
|
mpeg2dec->queued = g_list_prepend (mpeg2dec->queued, outbuf);
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
}
|
2012-04-02 13:21:36 +00:00
|
|
|
done:
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
return ret;
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
|
|
|
|
/* special cases */
|
|
|
|
no_display:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "no picture to display");
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
skip:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "dropping buffer because of skip flag");
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
drop:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "dropping buffer, discont state %d",
|
|
|
|
mpeg2dec->discont_state);
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2008-01-10 15:24:08 +00:00
|
|
|
clipped:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "dropping buffer, clipped");
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
dropping_qos:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "dropping buffer because of QoS");
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2005-02-04 13:43:28 +00:00
|
|
|
}
|
|
|
|
|
2005-07-19 20:51:16 +00:00
|
|
|
static GstFlowReturn
|
2011-11-17 14:25:58 +00:00
|
|
|
gst_mpeg2dec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
2001-12-23 06:03:21 +00:00
|
|
|
{
|
2005-10-26 16:45:04 +00:00
|
|
|
GstMpeg2dec *mpeg2dec;
|
2012-01-25 06:24:59 +00:00
|
|
|
GstMapInfo map;
|
ext/a52dec/gsta52dec.c: Add some debug output. Check that a discont has a valid time associated.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_push),
(gst_a52dec_handle_event), (gst_a52dec_chain):
Add some debug output. Check that a discont has a valid
time associated.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event),
(gst_alsa_sink_loop):
Ignore TAG events. A little extra debug for broken timestamps.
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_init), (dvdnavsrc_loop),
(dvdnavsrc_change_state):
Ensure we send a discont to engage the link before we send any
other events.
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_init),
(dvdreadsrc_finalize), (_close), (_open), (_seek_title),
(_seek_chapter), (seek_sector), (dvdreadsrc_get),
(dvdreadsrc_uri_get_uri), (dvdreadsrc_uri_set_uri):
Handle URI of the form dvd://title[,chapter[,angle]]. Currently only
dvd://title works in totem because typefinding sends a seek that ends
up going back to chapter 1 regardless.
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/mpeg2dec/gstmpeg2dec.h:
Output correct timestamps and handle disconts.
* ext/ogg/gstoggdemux.c: (get_relative):
Small guard against a null dereference.
* ext/pango/gsttextoverlay.c: (gst_textoverlay_finalize),
(gst_textoverlay_set_property):
Free memory when done. Don't call gst_event_filler_get_duration on
EOS events. Use GST_LOG and GST_WARNING instead of g_message and
g_warning.
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init),
(draw_line), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain):
Draw solid lines, prettier colours.
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
Add a default palette that'll work for some movies.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_init),
(gst_dvd_demux_handle_dvd_event), (gst_dvd_demux_send_discont),
(gst_dvd_demux_send_subbuffer), (gst_dvd_demux_reset):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_parse_syshead), (gst_mpeg_demux_parse_pes):
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_init),
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_parse_packhead):
* gst/mpegstream/gstmpegparse.h:
Use PTM/NAV events when for timestamp adjustment when connected to
dvdnavsrc. Don't use many discont events where one suffices.
* gst/playback/gstplaybasebin.c: (group_destroy),
(gen_preroll_element), (gst_play_base_bin_add_element):
* gst/playback/gstplaybasebin.h:
Make sure we remove subtitles from the same bin we put them in.
* gst/subparse/gstsubparse.c: (convert_encoding), (parse_subrip),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_change_state):
Fix some memleaks and invalid accesses.
* gst/typefind/gsttypefindfunctions.c: (ogganx_type_find),
(oggskel_type_find), (cmml_type_find), (plugin_init):
Some typefind functions for Annodex v3.0 files
* gst/wavparse/gstwavparse.h:
GstRiffReadClass is the correct parent class.
2005-01-25 15:34:08 +00:00
|
|
|
GstClockTime pts;
|
2002-12-05 00:29:11 +00:00
|
|
|
const mpeg2_info_t *info;
|
2003-10-06 12:16:21 +00:00
|
|
|
mpeg2_state_t state;
|
2002-12-05 00:29:11 +00:00
|
|
|
gboolean done = FALSE;
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2001-12-23 06:03:21 +00:00
|
|
|
|
2011-11-17 14:25:58 +00:00
|
|
|
mpeg2dec = GST_MPEG2DEC (parent);
|
2001-12-23 06:03:21 +00:00
|
|
|
|
2012-01-25 06:24:59 +00:00
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
2001-12-23 06:03:21 +00:00
|
|
|
pts = GST_BUFFER_TIMESTAMP (buf);
|
2005-10-26 16:45:04 +00:00
|
|
|
|
2008-01-10 15:24:08 +00:00
|
|
|
if (GST_BUFFER_IS_DISCONT (buf)) {
|
|
|
|
GST_LOG_OBJECT (mpeg2dec, "DISCONT, reset decoder");
|
|
|
|
/* when we receive a discont, reset our state as to not create too much
|
|
|
|
* distortion in the picture due to missing packets */
|
|
|
|
mpeg2_reset (mpeg2dec->decoder, 0);
|
|
|
|
mpeg2_skip (mpeg2dec->decoder, 1);
|
|
|
|
mpeg2dec->discont_state = MPEG2DEC_DISC_NEW_PICTURE;
|
|
|
|
}
|
|
|
|
|
2004-07-07 16:49:49 +00:00
|
|
|
GST_LOG_OBJECT (mpeg2dec, "received buffer, timestamp %"
|
|
|
|
GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
|
2001-12-23 06:03:21 +00:00
|
|
|
|
2005-10-26 16:45:04 +00:00
|
|
|
info = mpeg2dec->info;
|
2002-12-05 00:29:11 +00:00
|
|
|
|
2005-02-04 13:43:28 +00:00
|
|
|
mpeg2dec->offset = GST_BUFFER_OFFSET (buf);
|
2005-10-26 16:45:04 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
if (pts != GST_CLOCK_TIME_NONE) {
|
|
|
|
gint64 mpeg_pts = GST_TIME_TO_MPEG_TIME (pts);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec,
|
|
|
|
"have pts: %" G_GINT64_FORMAT " (%" GST_TIME_FORMAT ")",
|
|
|
|
mpeg_pts, GST_TIME_ARGS (MPEG_TIME_TO_GST_TIME (mpeg_pts)));
|
|
|
|
|
|
|
|
#if MPEG2_RELEASE >= MPEG2_VERSION(0,4,0)
|
|
|
|
mpeg2_tag_picture (mpeg2dec->decoder, mpeg_pts & 0xffffffff,
|
|
|
|
mpeg_pts >> 32);
|
|
|
|
#else
|
|
|
|
mpeg2_pts (mpeg2dec->decoder, mpeg_pts);
|
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
GST_LOG ("no pts");
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (mpeg2dec, "calling mpeg2_buffer");
|
2012-01-25 06:24:59 +00:00
|
|
|
mpeg2_buffer (mpeg2dec->decoder, map.data, map.data + map.size);
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
GST_LOG_OBJECT (mpeg2dec, "calling mpeg2_buffer done");
|
|
|
|
|
2002-12-05 00:29:11 +00:00
|
|
|
while (!done) {
|
ext/a52dec/gsta52dec.c: Add some debug output. Check that a discont has a valid time associated.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_push),
(gst_a52dec_handle_event), (gst_a52dec_chain):
Add some debug output. Check that a discont has a valid
time associated.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event),
(gst_alsa_sink_loop):
Ignore TAG events. A little extra debug for broken timestamps.
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_init), (dvdnavsrc_loop),
(dvdnavsrc_change_state):
Ensure we send a discont to engage the link before we send any
other events.
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_init),
(dvdreadsrc_finalize), (_close), (_open), (_seek_title),
(_seek_chapter), (seek_sector), (dvdreadsrc_get),
(dvdreadsrc_uri_get_uri), (dvdreadsrc_uri_set_uri):
Handle URI of the form dvd://title[,chapter[,angle]]. Currently only
dvd://title works in totem because typefinding sends a seek that ends
up going back to chapter 1 regardless.
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/mpeg2dec/gstmpeg2dec.h:
Output correct timestamps and handle disconts.
* ext/ogg/gstoggdemux.c: (get_relative):
Small guard against a null dereference.
* ext/pango/gsttextoverlay.c: (gst_textoverlay_finalize),
(gst_textoverlay_set_property):
Free memory when done. Don't call gst_event_filler_get_duration on
EOS events. Use GST_LOG and GST_WARNING instead of g_message and
g_warning.
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init),
(draw_line), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain):
Draw solid lines, prettier colours.
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
Add a default palette that'll work for some movies.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_init),
(gst_dvd_demux_handle_dvd_event), (gst_dvd_demux_send_discont),
(gst_dvd_demux_send_subbuffer), (gst_dvd_demux_reset):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_parse_syshead), (gst_mpeg_demux_parse_pes):
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_init),
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_parse_packhead):
* gst/mpegstream/gstmpegparse.h:
Use PTM/NAV events when for timestamp adjustment when connected to
dvdnavsrc. Don't use many discont events where one suffices.
* gst/playback/gstplaybasebin.c: (group_destroy),
(gen_preroll_element), (gst_play_base_bin_add_element):
* gst/playback/gstplaybasebin.h:
Make sure we remove subtitles from the same bin we put them in.
* gst/subparse/gstsubparse.c: (convert_encoding), (parse_subrip),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_change_state):
Fix some memleaks and invalid accesses.
* gst/typefind/gsttypefindfunctions.c: (ogganx_type_find),
(oggskel_type_find), (cmml_type_find), (plugin_init):
Some typefind functions for Annodex v3.0 files
* gst/wavparse/gstwavparse.h:
GstRiffReadClass is the correct parent class.
2005-01-25 15:34:08 +00:00
|
|
|
GST_LOG_OBJECT (mpeg2dec, "calling parse");
|
2002-12-05 00:29:11 +00:00
|
|
|
state = mpeg2_parse (mpeg2dec->decoder);
|
2004-07-07 16:49:49 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "parse state %d", state);
|
2005-10-26 16:45:04 +00:00
|
|
|
|
2002-12-05 00:29:11 +00:00
|
|
|
switch (state) {
|
2008-11-24 09:51:39 +00:00
|
|
|
#if MPEG2_RELEASE >= MPEG2_VERSION (0, 5, 0)
|
|
|
|
case STATE_SEQUENCE_MODIFIED:
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "sequence modified");
|
|
|
|
/* fall through */
|
|
|
|
#endif
|
2002-12-05 00:29:11 +00:00
|
|
|
case STATE_SEQUENCE:
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
ret = handle_sequence (mpeg2dec, info);
|
2008-02-04 14:27:32 +00:00
|
|
|
/* if there is an error handling the sequence
|
|
|
|
* reset the decoder, maybe something more elegant
|
|
|
|
* could be done.
|
|
|
|
*/
|
|
|
|
if (ret == GST_FLOW_ERROR) {
|
|
|
|
mpeg2dec->error_count++;
|
|
|
|
GST_WARNING_OBJECT (mpeg2dec, "Decoding error #%d",
|
|
|
|
mpeg2dec->error_count);
|
|
|
|
if (mpeg2dec->error_count >= WARN_THRESHOLD && WARN_THRESHOLD > 0) {
|
|
|
|
GST_ELEMENT_WARNING (mpeg2dec, STREAM, DECODE,
|
|
|
|
("%d consecutive decoding errors", mpeg2dec->error_count),
|
|
|
|
(NULL));
|
|
|
|
}
|
|
|
|
mpeg2_reset (mpeg2dec->decoder, 0);
|
|
|
|
mpeg2_skip (mpeg2dec->decoder, 1);
|
|
|
|
mpeg2dec->discont_state = MPEG2DEC_DISC_NEW_PICTURE;
|
|
|
|
|
|
|
|
goto exit;
|
|
|
|
}
|
2004-03-15 19:32:25 +00:00
|
|
|
break;
|
2002-12-05 00:29:11 +00:00
|
|
|
case STATE_SEQUENCE_REPEATED:
|
2004-07-07 16:49:49 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "sequence repeated");
|
2005-10-26 16:45:04 +00:00
|
|
|
break;
|
2002-12-05 00:29:11 +00:00
|
|
|
case STATE_GOP:
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "gop");
|
2004-03-15 19:32:25 +00:00
|
|
|
break;
|
2002-12-05 00:29:11 +00:00
|
|
|
case STATE_PICTURE:
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
ret = handle_picture (mpeg2dec, info);
|
2004-03-15 19:32:25 +00:00
|
|
|
break;
|
2002-12-05 00:29:11 +00:00
|
|
|
case STATE_SLICE_1ST:
|
ext/a52dec/gsta52dec.c: Add some debug output. Check that a discont has a valid time associated.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_push),
(gst_a52dec_handle_event), (gst_a52dec_chain):
Add some debug output. Check that a discont has a valid
time associated.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event),
(gst_alsa_sink_loop):
Ignore TAG events. A little extra debug for broken timestamps.
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_init), (dvdnavsrc_loop),
(dvdnavsrc_change_state):
Ensure we send a discont to engage the link before we send any
other events.
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_init),
(dvdreadsrc_finalize), (_close), (_open), (_seek_title),
(_seek_chapter), (seek_sector), (dvdreadsrc_get),
(dvdreadsrc_uri_get_uri), (dvdreadsrc_uri_set_uri):
Handle URI of the form dvd://title[,chapter[,angle]]. Currently only
dvd://title works in totem because typefinding sends a seek that ends
up going back to chapter 1 regardless.
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/mpeg2dec/gstmpeg2dec.h:
Output correct timestamps and handle disconts.
* ext/ogg/gstoggdemux.c: (get_relative):
Small guard against a null dereference.
* ext/pango/gsttextoverlay.c: (gst_textoverlay_finalize),
(gst_textoverlay_set_property):
Free memory when done. Don't call gst_event_filler_get_duration on
EOS events. Use GST_LOG and GST_WARNING instead of g_message and
g_warning.
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init),
(draw_line), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain):
Draw solid lines, prettier colours.
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
Add a default palette that'll work for some movies.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_init),
(gst_dvd_demux_handle_dvd_event), (gst_dvd_demux_send_discont),
(gst_dvd_demux_send_subbuffer), (gst_dvd_demux_reset):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_parse_syshead), (gst_mpeg_demux_parse_pes):
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_init),
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_parse_packhead):
* gst/mpegstream/gstmpegparse.h:
Use PTM/NAV events when for timestamp adjustment when connected to
dvdnavsrc. Don't use many discont events where one suffices.
* gst/playback/gstplaybasebin.c: (group_destroy),
(gen_preroll_element), (gst_play_base_bin_add_element):
* gst/playback/gstplaybasebin.h:
Make sure we remove subtitles from the same bin we put them in.
* gst/subparse/gstsubparse.c: (convert_encoding), (parse_subrip),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_change_state):
Fix some memleaks and invalid accesses.
* gst/typefind/gsttypefindfunctions.c: (ogganx_type_find),
(oggskel_type_find), (cmml_type_find), (plugin_init):
Some typefind functions for Annodex v3.0 files
* gst/wavparse/gstwavparse.h:
GstRiffReadClass is the correct parent class.
2005-01-25 15:34:08 +00:00
|
|
|
GST_LOG_OBJECT (mpeg2dec, "1st slice of frame encountered");
|
2004-03-15 19:32:25 +00:00
|
|
|
break;
|
2002-12-05 00:29:11 +00:00
|
|
|
case STATE_PICTURE_2ND:
|
ext/a52dec/gsta52dec.c: Add some debug output. Check that a discont has a valid time associated.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_push),
(gst_a52dec_handle_event), (gst_a52dec_chain):
Add some debug output. Check that a discont has a valid
time associated.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event),
(gst_alsa_sink_loop):
Ignore TAG events. A little extra debug for broken timestamps.
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_init), (dvdnavsrc_loop),
(dvdnavsrc_change_state):
Ensure we send a discont to engage the link before we send any
other events.
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_init),
(dvdreadsrc_finalize), (_close), (_open), (_seek_title),
(_seek_chapter), (seek_sector), (dvdreadsrc_get),
(dvdreadsrc_uri_get_uri), (dvdreadsrc_uri_set_uri):
Handle URI of the form dvd://title[,chapter[,angle]]. Currently only
dvd://title works in totem because typefinding sends a seek that ends
up going back to chapter 1 regardless.
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/mpeg2dec/gstmpeg2dec.h:
Output correct timestamps and handle disconts.
* ext/ogg/gstoggdemux.c: (get_relative):
Small guard against a null dereference.
* ext/pango/gsttextoverlay.c: (gst_textoverlay_finalize),
(gst_textoverlay_set_property):
Free memory when done. Don't call gst_event_filler_get_duration on
EOS events. Use GST_LOG and GST_WARNING instead of g_message and
g_warning.
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init),
(draw_line), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain):
Draw solid lines, prettier colours.
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
Add a default palette that'll work for some movies.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_init),
(gst_dvd_demux_handle_dvd_event), (gst_dvd_demux_send_discont),
(gst_dvd_demux_send_subbuffer), (gst_dvd_demux_reset):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_parse_syshead), (gst_mpeg_demux_parse_pes):
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_init),
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_parse_packhead):
* gst/mpegstream/gstmpegparse.h:
Use PTM/NAV events when for timestamp adjustment when connected to
dvdnavsrc. Don't use many discont events where one suffices.
* gst/playback/gstplaybasebin.c: (group_destroy),
(gen_preroll_element), (gst_play_base_bin_add_element):
* gst/playback/gstplaybasebin.h:
Make sure we remove subtitles from the same bin we put them in.
* gst/subparse/gstsubparse.c: (convert_encoding), (parse_subrip),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_change_state):
Fix some memleaks and invalid accesses.
* gst/typefind/gsttypefindfunctions.c: (ogganx_type_find),
(oggskel_type_find), (cmml_type_find), (plugin_init):
Some typefind functions for Annodex v3.0 files
* gst/wavparse/gstwavparse.h:
GstRiffReadClass is the correct parent class.
2005-01-25 15:34:08 +00:00
|
|
|
GST_LOG_OBJECT (mpeg2dec,
|
|
|
|
"Second picture header encountered. Decoding 2nd field");
|
2004-03-15 19:32:25 +00:00
|
|
|
break;
|
2004-01-14 06:41:52 +00:00
|
|
|
#if MPEG2_RELEASE >= MPEG2_VERSION (0, 4, 0)
|
|
|
|
case STATE_INVALID_END:
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "invalid end");
|
2004-01-14 06:41:52 +00:00
|
|
|
#endif
|
2002-12-05 00:29:11 +00:00
|
|
|
case STATE_END:
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "end");
|
2005-02-04 13:43:28 +00:00
|
|
|
mpeg2dec->need_sequence = TRUE;
|
|
|
|
case STATE_SLICE:
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
ret = handle_slice (mpeg2dec, info);
|
2004-03-15 19:32:25 +00:00
|
|
|
break;
|
2003-10-06 12:16:21 +00:00
|
|
|
case STATE_BUFFER:
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
done = TRUE;
|
2004-03-15 19:32:25 +00:00
|
|
|
break;
|
|
|
|
/* error */
|
2002-12-05 00:29:11 +00:00
|
|
|
case STATE_INVALID:
|
2007-03-02 13:01:48 +00:00
|
|
|
/* FIXME: at some point we should probably send newsegment events to
|
|
|
|
* let downstream know that parts of the stream are missing */
|
2006-02-27 14:49:05 +00:00
|
|
|
mpeg2dec->error_count++;
|
|
|
|
GST_WARNING_OBJECT (mpeg2dec, "Decoding error #%d",
|
|
|
|
mpeg2dec->error_count);
|
2007-03-02 13:01:48 +00:00
|
|
|
if (mpeg2dec->error_count >= WARN_THRESHOLD && WARN_THRESHOLD > 0) {
|
|
|
|
GST_ELEMENT_WARNING (mpeg2dec, STREAM, DECODE,
|
|
|
|
("%d consecutive decoding errors", mpeg2dec->error_count),
|
|
|
|
(NULL));
|
2006-02-27 14:49:05 +00:00
|
|
|
}
|
2011-08-22 16:49:14 +00:00
|
|
|
continue;
|
2002-12-05 00:29:11 +00:00
|
|
|
default:
|
ext/a52dec/gsta52dec.c: Add some debug output. Check that a discont has a valid time associated.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_push),
(gst_a52dec_handle_event), (gst_a52dec_chain):
Add some debug output. Check that a discont has a valid
time associated.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event),
(gst_alsa_sink_loop):
Ignore TAG events. A little extra debug for broken timestamps.
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_init), (dvdnavsrc_loop),
(dvdnavsrc_change_state):
Ensure we send a discont to engage the link before we send any
other events.
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_init),
(dvdreadsrc_finalize), (_close), (_open), (_seek_title),
(_seek_chapter), (seek_sector), (dvdreadsrc_get),
(dvdreadsrc_uri_get_uri), (dvdreadsrc_uri_set_uri):
Handle URI of the form dvd://title[,chapter[,angle]]. Currently only
dvd://title works in totem because typefinding sends a seek that ends
up going back to chapter 1 regardless.
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/mpeg2dec/gstmpeg2dec.h:
Output correct timestamps and handle disconts.
* ext/ogg/gstoggdemux.c: (get_relative):
Small guard against a null dereference.
* ext/pango/gsttextoverlay.c: (gst_textoverlay_finalize),
(gst_textoverlay_set_property):
Free memory when done. Don't call gst_event_filler_get_duration on
EOS events. Use GST_LOG and GST_WARNING instead of g_message and
g_warning.
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init),
(draw_line), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain):
Draw solid lines, prettier colours.
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
Add a default palette that'll work for some movies.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_init),
(gst_dvd_demux_handle_dvd_event), (gst_dvd_demux_send_discont),
(gst_dvd_demux_send_subbuffer), (gst_dvd_demux_reset):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_parse_syshead), (gst_mpeg_demux_parse_pes):
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_init),
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_parse_packhead):
* gst/mpegstream/gstmpegparse.h:
Use PTM/NAV events when for timestamp adjustment when connected to
dvdnavsrc. Don't use many discont events where one suffices.
* gst/playback/gstplaybasebin.c: (group_destroy),
(gen_preroll_element), (gst_play_base_bin_add_element):
* gst/playback/gstplaybasebin.h:
Make sure we remove subtitles from the same bin we put them in.
* gst/subparse/gstsubparse.c: (convert_encoding), (parse_subrip),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_change_state):
Fix some memleaks and invalid accesses.
* gst/typefind/gsttypefindfunctions.c: (ogganx_type_find),
(oggskel_type_find), (cmml_type_find), (plugin_init):
Some typefind functions for Annodex v3.0 files
* gst/wavparse/gstwavparse.h:
GstRiffReadClass is the correct parent class.
2005-01-25 15:34:08 +00:00
|
|
|
GST_ERROR_OBJECT (mpeg2dec, "Unknown libmpeg2 state %d, FIXME", state);
|
2006-02-27 14:49:05 +00:00
|
|
|
goto exit;
|
2002-12-05 00:29:11 +00:00
|
|
|
}
|
2002-12-19 07:45:11 +00:00
|
|
|
|
2006-02-27 14:49:05 +00:00
|
|
|
mpeg2dec->error_count = 0;
|
|
|
|
|
2002-12-19 21:05:57 +00:00
|
|
|
/*
|
2002-12-19 07:45:11 +00:00
|
|
|
* FIXME: should pass more information such as state the user data is from
|
|
|
|
*/
|
2004-03-13 00:19:26 +00:00
|
|
|
#ifdef enable_user_data
|
2002-12-19 21:05:57 +00:00
|
|
|
if (info->user_data_len > 0) {
|
2012-03-15 12:38:16 +00:00
|
|
|
GstBuffer *udbuf =
|
|
|
|
gst_buffer_new_allocate (NULL, info->user_data_len, NULL);
|
2002-12-19 21:05:57 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
gst_buffer_fill (udbuf, 0, info->user_data, info->user_data_len);
|
2002-12-19 21:05:57 +00:00
|
|
|
|
2005-10-26 16:45:04 +00:00
|
|
|
gst_pad_push (mpeg2dec->userdatapad, udbuf);
|
2002-12-19 21:05:57 +00:00
|
|
|
}
|
2004-03-13 00:19:26 +00:00
|
|
|
#endif
|
2005-07-19 20:51:16 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
if (ret != GST_FLOW_OK) {
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "exit loop, reason %s",
|
|
|
|
gst_flow_get_name (ret));
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-12-05 00:29:11 +00:00
|
|
|
}
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
done:
|
2012-01-25 06:24:59 +00:00
|
|
|
gst_buffer_unmap (buf, &map);
|
2005-02-05 07:36:01 +00:00
|
|
|
gst_buffer_unref (buf);
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
return ret;
|
2005-02-05 07:36:01 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
/* errors */
|
2002-12-27 04:04:04 +00:00
|
|
|
exit:
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
{
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
goto done;
|
|
|
|
}
|
2005-07-19 20:51:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-11-17 14:25:58 +00:00
|
|
|
gst_mpeg2dec_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
2005-07-19 20:51:16 +00:00
|
|
|
{
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
GstMpeg2dec *mpeg2dec;
|
2005-07-19 20:51:16 +00:00
|
|
|
gboolean ret = TRUE;
|
|
|
|
|
2011-11-17 14:25:58 +00:00
|
|
|
mpeg2dec = GST_MPEG2DEC (parent);
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.c: Set DELTA_UNIT flag on outgoing buffers if this is NOT a keyframe; nice-ify debug message...
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (handle_slice),
(gst_mpeg2dec_sink_event):
Set DELTA_UNIT flag on outgoing buffers if this is NOT a keyframe;
nice-ify debug message in event handler; add CHECKME.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_process_event),
(gst_dvd_demux_send_event), (gst_dvd_demux_process_private),
(gst_dvd_demux_send_subbuffer), (gst_dvd_demux_reset),
(gst_dvd_demux_sync_stream_to_time):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_class_init),
(gst_mpeg_demux_process_event), (gst_mpeg_demux_send_event),
(gst_mpeg_demux_handle_discont), (gst_mpeg_demux_new_output_pad),
(gst_mpeg_demux_parse_packet), (gst_mpeg_demux_parse_pes),
(gst_mpeg_demux_send_subbuffer), (gst_mpeg_demux_process_private),
(gst_mpeg_demux_sync_stream_to_time),
(gst_mpeg_demux_handle_src_event), (gst_mpeg_demux_reset):
* gst/mpegstream/gstmpegdemux.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_init),
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_send_buffer),
(gst_mpeg_parse_process_event), (gst_mpeg_parse_send_discont),
(gst_mpeg_parse_send_event), (gst_mpeg_parse_event),
(gst_mpeg_parse_chain):
* gst/mpegstream/gstmpegparse.h:
Get rid of GST_PAD_IS_USABLE and fix GstFlowReturn vs. gboolean
return value confusion (gst_pad_push vs. gst_pad_send_event and
gst_pad_push_event); pass flow return values to caller;
miscellaneous fixes and clean-ups.
2005-11-15 14:19:38 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "Got %s event on sink pad",
|
|
|
|
GST_EVENT_TYPE_NAME (event));
|
|
|
|
|
2005-07-19 20:51:16 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2011-09-30 15:38:07 +00:00
|
|
|
case GST_EVENT_CAPS:
|
2005-07-19 20:51:16 +00:00
|
|
|
{
|
2011-09-30 15:38:07 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
gst_event_parse_caps (event, &caps);
|
|
|
|
ret = gst_mpeg2dec_setcaps (pad, caps);
|
|
|
|
gst_event_unref (event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_EVENT_SEGMENT:
|
|
|
|
{
|
|
|
|
GstSegment seg;
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
gst_event_copy_segment (event, &seg);
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
/* we need TIME */
|
|
|
|
if (seg.format != GST_FORMAT_TIME)
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
goto newseg_wrong_format;
|
|
|
|
|
|
|
|
/* now configure the values */
|
2011-09-30 15:38:07 +00:00
|
|
|
mpeg2dec->segment = seg;
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "Pushing seg %" GST_SEGMENT_FORMAT, &seg);
|
2008-01-10 15:24:08 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
ret = gst_pad_push_event (mpeg2dec->srcpad, event);
|
2005-07-19 20:51:16 +00:00
|
|
|
break;
|
|
|
|
}
|
Various event updates and cleanups.
Original commit message from CVS:
* ext/amrnb/amrnbparse.c: (gst_amrnbparse_event),
(gst_amrnbparse_loop):
* ext/dv/gstdvdec.c: (gst_dvdec_handle_sink_event),
(gst_dvdec_handle_src_event), (gst_dvdec_decode_frame):
* ext/mad/gstid3tag.c: (gst_id3_tag_src_event),
(gst_id3_tag_sink_event), (gst_id3_tag_chain):
* ext/mad/gstmad.c: (gst_mad_src_query), (index_seek),
(normal_seek), (gst_mad_sink_event), (gst_mad_chain):
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/shout2/gstshout2.c: (gst_shout2send_event):
* ext/sidplay/gstsiddec.cc:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_event),
(gst_avi_demux_send_event), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry):
* gst/goom/gstgoom.c: (gst_goom_event):
* gst/realmedia/rmdemux.c: (gst_rmdemux_sink_event),
(gst_rmdemux_chain), (gst_rmdemux_send_event),
(gst_rmdemux_add_stream):
* gst/wavparse/gstwavparse.c: (gst_wavparse_handle_seek),
(gst_wavparse_stream_headers), (gst_wavparse_stream_data),
(gst_wavparse_loop), (gst_wavparse_srcpad_event):
Various event updates and cleanups.
2005-07-27 18:37:25 +00:00
|
|
|
case GST_EVENT_FLUSH_START:
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
ret = gst_pad_push_event (mpeg2dec->srcpad, event);
|
Various event updates and cleanups.
Original commit message from CVS:
* ext/amrnb/amrnbparse.c: (gst_amrnbparse_event),
(gst_amrnbparse_loop):
* ext/dv/gstdvdec.c: (gst_dvdec_handle_sink_event),
(gst_dvdec_handle_src_event), (gst_dvdec_decode_frame):
* ext/mad/gstid3tag.c: (gst_id3_tag_src_event),
(gst_id3_tag_sink_event), (gst_id3_tag_chain):
* ext/mad/gstmad.c: (gst_mad_src_query), (index_seek),
(normal_seek), (gst_mad_sink_event), (gst_mad_chain):
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/shout2/gstshout2.c: (gst_shout2send_event):
* ext/sidplay/gstsiddec.cc:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_event),
(gst_avi_demux_send_event), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry):
* gst/goom/gstgoom.c: (gst_goom_event):
* gst/realmedia/rmdemux.c: (gst_rmdemux_sink_event),
(gst_rmdemux_chain), (gst_rmdemux_send_event),
(gst_rmdemux_add_stream):
* gst/wavparse/gstwavparse.c: (gst_wavparse_handle_seek),
(gst_wavparse_stream_headers), (gst_wavparse_stream_data),
(gst_wavparse_loop), (gst_wavparse_srcpad_event):
Various event updates and cleanups.
2005-07-27 18:37:25 +00:00
|
|
|
break;
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
{
|
2005-07-19 20:51:16 +00:00
|
|
|
mpeg2dec->discont_state = MPEG2DEC_DISC_NEW_PICTURE;
|
2005-10-26 16:45:04 +00:00
|
|
|
mpeg2dec->next_time = -1;;
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
gst_mpeg2dec_qos_reset (mpeg2dec);
|
2005-10-26 16:45:04 +00:00
|
|
|
mpeg2_reset (mpeg2dec->decoder, 0);
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
mpeg2_skip (mpeg2dec->decoder, 1);
|
2008-01-10 15:24:08 +00:00
|
|
|
clear_queued (mpeg2dec);
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
ret = gst_pad_push_event (mpeg2dec->srcpad, event);
|
2005-07-19 20:51:16 +00:00
|
|
|
break;
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
}
|
2005-07-19 20:51:16 +00:00
|
|
|
case GST_EVENT_EOS:
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
ret = gst_pad_push_event (mpeg2dec->srcpad, event);
|
2005-07-19 20:51:16 +00:00
|
|
|
break;
|
|
|
|
default:
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
ret = gst_pad_push_event (mpeg2dec->srcpad, event);
|
2005-07-19 20:51:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
done:
|
2005-07-19 20:51:16 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
return ret;
|
2005-07-19 20:51:16 +00:00
|
|
|
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
/* ERRORS */
|
|
|
|
newseg_wrong_format:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "received non TIME newsegment");
|
|
|
|
gst_event_unref (event);
|
|
|
|
goto done;
|
|
|
|
}
|
2002-12-05 00:29:11 +00:00
|
|
|
}
|
|
|
|
|
2008-10-14 12:51:41 +00:00
|
|
|
static gboolean
|
|
|
|
gst_mpeg2dec_setcaps (GstPad * pad, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstMpeg2dec *mpeg2dec;
|
|
|
|
GstStructure *s;
|
|
|
|
|
|
|
|
mpeg2dec = GST_MPEG2DEC (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
s = gst_caps_get_structure (caps, 0);
|
|
|
|
|
|
|
|
/* parse the par, this overrides the encoded par */
|
|
|
|
mpeg2dec->have_par = gst_structure_get_fraction (s, "pixel-aspect-ratio",
|
2011-09-30 15:38:07 +00:00
|
|
|
&mpeg2dec->in_par_n, &mpeg2dec->in_par_d);
|
2008-10-14 12:51:41 +00:00
|
|
|
|
|
|
|
gst_object_unref (mpeg2dec);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static gboolean
|
2011-11-17 14:25:58 +00:00
|
|
|
gst_mpeg2dec_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
2002-12-26 22:46:26 +00:00
|
|
|
{
|
2005-10-26 16:45:04 +00:00
|
|
|
gboolean res;
|
2002-12-26 22:46:26 +00:00
|
|
|
GstMpeg2dec *mpeg2dec;
|
|
|
|
|
2011-11-17 14:25:58 +00:00
|
|
|
mpeg2dec = GST_MPEG2DEC (parent);
|
2002-12-26 22:46:26 +00:00
|
|
|
|
|
|
|
if (mpeg2dec->decoder == NULL)
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
goto no_decoder;
|
2002-12-26 22:46:26 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
case GST_EVENT_QOS:
|
|
|
|
{
|
2011-09-30 15:38:07 +00:00
|
|
|
GstQOSType type;
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
gdouble proportion;
|
|
|
|
GstClockTimeDiff diff;
|
|
|
|
GstClockTime timestamp;
|
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
gst_event_parse_qos (event, &type, &proportion, &diff, ×tamp);
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
|
|
|
|
GST_OBJECT_LOCK (mpeg2dec);
|
|
|
|
mpeg2dec->proportion = proportion;
|
|
|
|
mpeg2dec->earliest_time = timestamp + diff;
|
|
|
|
GST_OBJECT_UNLOCK (mpeg2dec);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec,
|
|
|
|
"got QoS %" GST_TIME_FORMAT ", %" G_GINT64_FORMAT,
|
|
|
|
GST_TIME_ARGS (timestamp), diff);
|
|
|
|
|
|
|
|
res = gst_pad_push_event (mpeg2dec->sinkpad, event);
|
|
|
|
break;
|
|
|
|
}
|
2011-12-30 17:53:12 +00:00
|
|
|
case GST_EVENT_SEEK:
|
2004-01-06 16:42:10 +00:00
|
|
|
case GST_EVENT_NAVIGATION:
|
2011-12-30 17:53:12 +00:00
|
|
|
/* Forward unchanged */
|
2002-05-26 21:59:22 +00:00
|
|
|
default:
|
2005-10-26 16:45:04 +00:00
|
|
|
res = gst_pad_push_event (mpeg2dec->sinkpad, event);
|
2002-05-26 21:59:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
ext/mpeg2dec/gstmpeg2dec.c: Forward GstFlowReturn about everywhere.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_reset),
(gst_mpeg2dec_alloc_buffer), (gst_mpeg2dec_negotiate_format),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_src_query), (normal_seek),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
Forward GstFlowReturn about everywhere.
Handle seeking correctly.
2005-10-27 21:50:11 +00:00
|
|
|
|
|
|
|
no_decoder:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "no decoder, cannot handle event");
|
|
|
|
gst_event_unref (event);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-05-26 21:59:22 +00:00
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:54 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_mpeg2dec_change_state (GstElement * element, GstStateChange transition)
|
2001-12-23 06:03:21 +00:00
|
|
|
{
|
2005-09-02 15:43:54 +00:00
|
|
|
GstStateChangeReturn ret;
|
2001-12-23 06:03:21 +00:00
|
|
|
GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (element);
|
|
|
|
|
2005-09-02 15:43:54 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
2005-10-26 16:45:04 +00:00
|
|
|
mpeg2_accel (MPEG2_ACCEL_DETECT);
|
|
|
|
if ((mpeg2dec->decoder = mpeg2_init ()) == NULL)
|
|
|
|
goto init_failed;
|
|
|
|
mpeg2dec->info = mpeg2_info (mpeg2dec->decoder);
|
2001-12-23 06:03:21 +00:00
|
|
|
break;
|
2005-09-02 15:43:54 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2005-02-05 07:36:01 +00:00
|
|
|
gst_mpeg2dec_reset (mpeg2dec);
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
gst_mpeg2dec_qos_reset (mpeg2dec);
|
2001-12-23 06:03:21 +00:00
|
|
|
break;
|
2005-09-02 15:43:54 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
Various event updates and cleanups.
Original commit message from CVS:
* ext/amrnb/amrnbparse.c: (gst_amrnbparse_event),
(gst_amrnbparse_loop):
* ext/dv/gstdvdec.c: (gst_dvdec_handle_sink_event),
(gst_dvdec_handle_src_event), (gst_dvdec_decode_frame):
* ext/mad/gstid3tag.c: (gst_id3_tag_src_event),
(gst_id3_tag_sink_event), (gst_id3_tag_chain):
* ext/mad/gstmad.c: (gst_mad_src_query), (index_seek),
(normal_seek), (gst_mad_sink_event), (gst_mad_chain):
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/shout2/gstshout2.c: (gst_shout2send_event):
* ext/sidplay/gstsiddec.cc:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_event),
(gst_avi_demux_send_event), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry):
* gst/goom/gstgoom.c: (gst_goom_event):
* gst/realmedia/rmdemux.c: (gst_rmdemux_sink_event),
(gst_rmdemux_chain), (gst_rmdemux_send_event),
(gst_rmdemux_add_stream):
* gst/wavparse/gstwavparse.c: (gst_wavparse_handle_seek),
(gst_wavparse_stream_headers), (gst_wavparse_stream_data),
(gst_wavparse_loop), (gst_wavparse_srcpad_event):
Various event updates and cleanups.
2005-07-27 18:37:25 +00:00
|
|
|
default:
|
2001-12-23 06:03:21 +00:00
|
|
|
break;
|
Various event updates and cleanups.
Original commit message from CVS:
* ext/amrnb/amrnbparse.c: (gst_amrnbparse_event),
(gst_amrnbparse_loop):
* ext/dv/gstdvdec.c: (gst_dvdec_handle_sink_event),
(gst_dvdec_handle_src_event), (gst_dvdec_decode_frame):
* ext/mad/gstid3tag.c: (gst_id3_tag_src_event),
(gst_id3_tag_sink_event), (gst_id3_tag_chain):
* ext/mad/gstmad.c: (gst_mad_src_query), (index_seek),
(normal_seek), (gst_mad_sink_event), (gst_mad_chain):
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/shout2/gstshout2.c: (gst_shout2send_event):
* ext/sidplay/gstsiddec.cc:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_event),
(gst_avi_demux_send_event), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry):
* gst/goom/gstgoom.c: (gst_goom_event):
* gst/realmedia/rmdemux.c: (gst_rmdemux_sink_event),
(gst_rmdemux_chain), (gst_rmdemux_send_event),
(gst_rmdemux_add_stream):
* gst/wavparse/gstwavparse.c: (gst_wavparse_handle_seek),
(gst_wavparse_stream_headers), (gst_wavparse_stream_data),
(gst_wavparse_loop), (gst_wavparse_srcpad_event):
Various event updates and cleanups.
2005-07-27 18:37:25 +00:00
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:54 +00:00
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
Various event updates and cleanups.
Original commit message from CVS:
* ext/amrnb/amrnbparse.c: (gst_amrnbparse_event),
(gst_amrnbparse_loop):
* ext/dv/gstdvdec.c: (gst_dvdec_handle_sink_event),
(gst_dvdec_handle_src_event), (gst_dvdec_decode_frame):
* ext/mad/gstid3tag.c: (gst_id3_tag_src_event),
(gst_id3_tag_sink_event), (gst_id3_tag_chain):
* ext/mad/gstmad.c: (gst_mad_src_query), (index_seek),
(normal_seek), (gst_mad_sink_event), (gst_mad_chain):
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/shout2/gstshout2.c: (gst_shout2send_event):
* ext/sidplay/gstsiddec.cc:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_event),
(gst_avi_demux_send_event), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry):
* gst/goom/gstgoom.c: (gst_goom_event):
* gst/realmedia/rmdemux.c: (gst_rmdemux_sink_event),
(gst_rmdemux_chain), (gst_rmdemux_send_event),
(gst_rmdemux_add_stream):
* gst/wavparse/gstwavparse.c: (gst_wavparse_handle_seek),
(gst_wavparse_stream_headers), (gst_wavparse_stream_data),
(gst_wavparse_loop), (gst_wavparse_srcpad_event):
Various event updates and cleanups.
2005-07-27 18:37:25 +00:00
|
|
|
|
2005-09-02 15:43:54 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
2001-12-23 06:03:21 +00:00
|
|
|
break;
|
2005-09-02 15:43:54 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
ext/mpeg2dec/gstmpeg2dec.*: Fix padtemplate as we can now do fractional framerates.
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_base_init),
(gst_mpeg2dec_class_init), (gst_mpeg2dec_init),
(gst_mpeg2dec_finalize), (gst_mpeg2dec_reset),
(gst_mpeg2dec_qos_reset), (gst_mpeg2dec_alloc_buffer),
(gst_mpeg2dec_negotiate_format), (init_dummybuf),
(handle_sequence), (handle_picture), (handle_slice),
(gst_mpeg2dec_chain), (gst_mpeg2dec_sink_event),
(gst_mpeg2dec_src_event), (gst_mpeg2dec_change_state):
* ext/mpeg2dec/gstmpeg2dec.h:
Fix padtemplate as we can now do fractional framerates.
Small cleanups.
Use GstSegment.
Add simple frame dropping QoS.
Precalc buffer output sizes and UV offsets.
Always give libmpeg2 a valid fbuf when it wants one.
don't trust libmpeg to discard our buffers but manage it
ourselves.
Fixes #343627, #327350, #335288
2006-06-07 16:15:42 +00:00
|
|
|
gst_mpeg2dec_qos_reset (mpeg2dec);
|
2008-01-10 15:24:08 +00:00
|
|
|
clear_queued (mpeg2dec);
|
2011-09-30 15:38:07 +00:00
|
|
|
if (mpeg2dec->pool) {
|
|
|
|
gst_buffer_pool_set_active (mpeg2dec->pool, FALSE);
|
|
|
|
gst_object_unref (mpeg2dec->pool);
|
|
|
|
mpeg2dec->pool = NULL;
|
|
|
|
}
|
2001-12-23 06:03:21 +00:00
|
|
|
break;
|
2005-09-02 15:43:54 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
2005-10-26 16:45:04 +00:00
|
|
|
if (mpeg2dec->decoder) {
|
|
|
|
mpeg2_close (mpeg2dec->decoder);
|
|
|
|
mpeg2dec->decoder = NULL;
|
|
|
|
mpeg2dec->info = NULL;
|
|
|
|
}
|
2006-06-07 17:05:48 +00:00
|
|
|
clear_buffers (mpeg2dec);
|
2001-12-23 06:03:21 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
Various event updates and cleanups.
Original commit message from CVS:
* ext/amrnb/amrnbparse.c: (gst_amrnbparse_event),
(gst_amrnbparse_loop):
* ext/dv/gstdvdec.c: (gst_dvdec_handle_sink_event),
(gst_dvdec_handle_src_event), (gst_dvdec_decode_frame):
* ext/mad/gstid3tag.c: (gst_id3_tag_src_event),
(gst_id3_tag_sink_event), (gst_id3_tag_chain):
* ext/mad/gstmad.c: (gst_mad_src_query), (index_seek),
(normal_seek), (gst_mad_sink_event), (gst_mad_chain):
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/shout2/gstshout2.c: (gst_shout2send_event):
* ext/sidplay/gstsiddec.cc:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_event),
(gst_avi_demux_send_event), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry):
* gst/goom/gstgoom.c: (gst_goom_event):
* gst/realmedia/rmdemux.c: (gst_rmdemux_sink_event),
(gst_rmdemux_chain), (gst_rmdemux_send_event),
(gst_rmdemux_add_stream):
* gst/wavparse/gstwavparse.c: (gst_wavparse_handle_seek),
(gst_wavparse_stream_headers), (gst_wavparse_stream_data),
(gst_wavparse_loop), (gst_wavparse_srcpad_event):
Various event updates and cleanups.
2005-07-27 18:37:25 +00:00
|
|
|
return ret;
|
2005-10-26 16:45:04 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
init_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (mpeg2dec, LIBRARY, INIT,
|
|
|
|
(NULL), ("Failed to initialize libmpeg2 library"));
|
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
|
|
|
}
|
2001-12-23 06:03:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2001-12-23 06:03:21 +00:00
|
|
|
{
|
2009-05-13 17:32:16 +00:00
|
|
|
if (!gst_element_register (plugin, "mpeg2dec", GST_RANK_PRIMARY,
|
2004-03-15 19:32:25 +00:00
|
|
|
GST_TYPE_MPEG2DEC))
|
2003-11-02 00:33:31 +00:00
|
|
|
return FALSE;
|
2001-12-23 06:03:21 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"mpeg2dec",
|
2006-04-01 09:54:39 +00:00
|
|
|
"LibMpeg2 decoder", plugin_init, VERSION, "GPL", GST_PACKAGE_NAME,
|
|
|
|
GST_PACKAGE_ORIGIN);
|