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
|
2012-11-03 20:40:37 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2001-12-23 06:03:21 +00:00
|
|
|
*/
|
|
|
|
|
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"
|
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
#include <gst/video/gstvideometa.h>
|
|
|
|
#include <gst/video/gstvideopool.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
|
|
|
|
|
2004-04-01 11:48:27 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (mpeg2dec_debug);
|
|
|
|
#define GST_CAT_DEFAULT (mpeg2dec_debug)
|
2012-06-20 08:06:37 +00:00
|
|
|
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
|
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
|
|
|
|
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,
|
2012-06-20 08:06:37 +00:00
|
|
|
GST_STATIC_CAPS ("video/x-raw, "
|
|
|
|
"format = (string) { YV12, 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
|
|
|
);
|
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
#define gst_mpeg2dec_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE (GstMpeg2dec, gst_mpeg2dec, GST_TYPE_VIDEO_DECODER);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2012-04-13 23:06:52 +00:00
|
|
|
static void gst_mpeg2dec_finalize (GObject * object);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2012-04-13 23:06:52 +00:00
|
|
|
/* GstVideoDecoder base class method */
|
|
|
|
static gboolean gst_mpeg2dec_open (GstVideoDecoder * decoder);
|
|
|
|
static gboolean gst_mpeg2dec_close (GstVideoDecoder * decoder);
|
2013-08-15 13:27:48 +00:00
|
|
|
static gboolean gst_mpeg2dec_start (GstVideoDecoder * decoder);
|
|
|
|
static gboolean gst_mpeg2dec_stop (GstVideoDecoder * decoder);
|
2012-04-13 23:06:52 +00:00
|
|
|
static gboolean gst_mpeg2dec_set_format (GstVideoDecoder * decoder,
|
|
|
|
GstVideoCodecState * state);
|
2013-08-15 13:27:48 +00:00
|
|
|
static gboolean gst_mpeg2dec_flush (GstVideoDecoder * decoder);
|
2012-04-13 23:06:52 +00:00
|
|
|
static GstFlowReturn gst_mpeg2dec_finish (GstVideoDecoder * decoder);
|
|
|
|
static GstFlowReturn gst_mpeg2dec_handle_frame (GstVideoDecoder * decoder,
|
|
|
|
GstVideoCodecFrame * frame);
|
2012-06-20 08:06:37 +00:00
|
|
|
static gboolean gst_mpeg2dec_decide_allocation (GstVideoDecoder * decoder,
|
|
|
|
GstQuery * query);
|
2005-07-19 20:51:16 +00:00
|
|
|
|
2012-05-01 18:49:03 +00:00
|
|
|
static void gst_mpeg2dec_clear_buffers (GstMpeg2dec * mpeg2dec);
|
2012-06-20 08:06:37 +00:00
|
|
|
static gboolean gst_mpeg2dec_crop_buffer (GstMpeg2dec * dec,
|
|
|
|
GstVideoCodecFrame * in_frame, GstVideoFrame * in_vframe);
|
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
|
|
|
{
|
2012-04-13 23:06:52 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
GstVideoDecoderClass *video_decoder_class = GST_VIDEO_DECODER_CLASS (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
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&src_template_factory));
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&sink_template_factory));
|
|
|
|
gst_element_class_set_static_metadata (element_class,
|
|
|
|
"mpeg1 and mpeg2 video decoder", "Codec/Decoder/Video",
|
|
|
|
"Uses libmpeg2 to decode MPEG video streams",
|
|
|
|
"Wim Taymans <wim.taymans@chello.be>");
|
|
|
|
|
2012-04-13 23:06:52 +00:00
|
|
|
video_decoder_class->open = GST_DEBUG_FUNCPTR (gst_mpeg2dec_open);
|
|
|
|
video_decoder_class->close = GST_DEBUG_FUNCPTR (gst_mpeg2dec_close);
|
2013-08-15 13:27:48 +00:00
|
|
|
video_decoder_class->start = GST_DEBUG_FUNCPTR (gst_mpeg2dec_start);
|
|
|
|
video_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_mpeg2dec_stop);
|
|
|
|
video_decoder_class->flush = GST_DEBUG_FUNCPTR (gst_mpeg2dec_flush);
|
2012-04-13 23:06:52 +00:00
|
|
|
video_decoder_class->set_format = GST_DEBUG_FUNCPTR (gst_mpeg2dec_set_format);
|
|
|
|
video_decoder_class->handle_frame =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_mpeg2dec_handle_frame);
|
|
|
|
video_decoder_class->finish = GST_DEBUG_FUNCPTR (gst_mpeg2dec_finish);
|
2012-06-20 08:06:37 +00:00
|
|
|
video_decoder_class->decide_allocation =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_mpeg2dec_decide_allocation);
|
2011-09-30 15:38:07 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (mpeg2dec_debug, "mpeg2dec", 0,
|
2012-04-13 23:06:52 +00:00
|
|
|
"MPEG-2 Video Decoder");
|
2001-12-23 06:03:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-06-20 08:06:37 +00:00
|
|
|
gst_mpeg2dec_init (GstMpeg2dec * mpeg2dec)
|
2001-12-23 06:03:21 +00:00
|
|
|
{
|
2012-04-13 23:06:52 +00:00
|
|
|
gst_video_decoder_set_packetized (GST_VIDEO_DECODER (mpeg2dec), 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;
|
|
|
|
}
|
2012-04-13 23:06:52 +00:00
|
|
|
|
2012-05-01 18:49:03 +00:00
|
|
|
gst_mpeg2dec_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
|
|
|
}
|
|
|
|
|
2012-04-13 23:06:52 +00:00
|
|
|
static gboolean
|
|
|
|
gst_mpeg2dec_open (GstVideoDecoder * decoder)
|
|
|
|
{
|
|
|
|
GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (decoder);
|
|
|
|
|
|
|
|
mpeg2_accel (MPEG2_ACCEL_DETECT);
|
|
|
|
if ((mpeg2dec->decoder = mpeg2_init ()) == NULL)
|
|
|
|
return FALSE;
|
|
|
|
mpeg2dec->info = mpeg2_info (mpeg2dec->decoder);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_mpeg2dec_close (GstVideoDecoder * decoder)
|
|
|
|
{
|
|
|
|
GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (decoder);
|
|
|
|
|
|
|
|
if (mpeg2dec->decoder) {
|
|
|
|
mpeg2_close (mpeg2dec->decoder);
|
|
|
|
mpeg2dec->decoder = NULL;
|
|
|
|
mpeg2dec->info = NULL;
|
|
|
|
}
|
2012-05-01 18:49:03 +00:00
|
|
|
gst_mpeg2dec_clear_buffers (mpeg2dec);
|
2012-04-13 23:06:52 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_mpeg2dec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state)
|
|
|
|
{
|
|
|
|
GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (decoder);
|
|
|
|
|
|
|
|
/* Save input state to be used as reference for output state */
|
|
|
|
if (mpeg2dec->input_state)
|
|
|
|
gst_video_codec_state_unref (mpeg2dec->input_state);
|
|
|
|
mpeg2dec->input_state = gst_video_codec_state_ref (state);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2013-08-15 13:27:48 +00:00
|
|
|
gst_mpeg2dec_start (GstVideoDecoder * decoder)
|
2005-02-05 07:36:01 +00:00
|
|
|
{
|
2012-04-13 23:06:52 +00:00
|
|
|
GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (decoder);
|
|
|
|
|
2013-08-15 13:27:48 +00:00
|
|
|
mpeg2dec->discont_state = MPEG2DEC_DISC_NEW_PICTURE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_mpeg2dec_stop (GstVideoDecoder * decoder)
|
|
|
|
{
|
|
|
|
GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (decoder);
|
|
|
|
|
2013-08-15 13:30:31 +00:00
|
|
|
mpeg2_reset (mpeg2dec->decoder, 0);
|
2013-08-15 13:27:48 +00:00
|
|
|
mpeg2_skip (mpeg2dec->decoder, 1);
|
|
|
|
|
|
|
|
gst_mpeg2dec_clear_buffers (mpeg2dec);
|
|
|
|
|
|
|
|
if (mpeg2dec->input_state)
|
|
|
|
gst_video_codec_state_unref (mpeg2dec->input_state);
|
|
|
|
mpeg2dec->input_state = NULL;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_mpeg2dec_flush (GstVideoDecoder * decoder)
|
|
|
|
{
|
|
|
|
GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (decoder);
|
2012-04-13 23:06:52 +00:00
|
|
|
|
2005-02-05 07:36:01 +00:00
|
|
|
/* reset the initial video state */
|
|
|
|
mpeg2dec->discont_state = MPEG2DEC_DISC_NEW_PICTURE;
|
2013-08-15 13:30:31 +00:00
|
|
|
mpeg2_reset (mpeg2dec->decoder, 1);
|
2012-04-13 23:06:52 +00:00
|
|
|
mpeg2_skip (mpeg2dec->decoder, 1);
|
|
|
|
|
2012-05-01 18:49:03 +00:00
|
|
|
gst_mpeg2dec_clear_buffers (mpeg2dec);
|
2012-04-13 23:06:52 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_mpeg2dec_finish (GstVideoDecoder * decoder)
|
|
|
|
{
|
|
|
|
return GST_FLOW_OK;
|
2005-02-05 07:36:01 +00:00
|
|
|
}
|
2005-10-26 16:45:04 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
static gboolean
|
|
|
|
gst_mpeg2dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
|
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
|
|
|
{
|
2012-06-20 08:06:37 +00:00
|
|
|
GstMpeg2dec *dec = GST_MPEG2DEC (decoder);
|
|
|
|
GstVideoCodecState *state;
|
|
|
|
GstBufferPool *pool;
|
|
|
|
guint size, min, max;
|
|
|
|
GstStructure *config;
|
2012-06-25 07:34:53 +00:00
|
|
|
GstAllocator *allocator;
|
|
|
|
GstAllocationParams params;
|
|
|
|
gboolean update_allocator;
|
|
|
|
|
|
|
|
/* Set allocation parameters to guarantee 16-byte aligned output buffers */
|
|
|
|
if (gst_query_get_n_allocation_params (query) > 0) {
|
|
|
|
gst_query_parse_nth_allocation_param (query, 0, &allocator, ¶ms);
|
|
|
|
update_allocator = TRUE;
|
|
|
|
} else {
|
|
|
|
allocator = NULL;
|
|
|
|
gst_allocation_params_init (¶ms);
|
|
|
|
update_allocator = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
params.align = MAX (params.align, 15);
|
|
|
|
|
|
|
|
if (update_allocator)
|
|
|
|
gst_query_set_nth_allocation_param (query, 0, allocator, ¶ms);
|
|
|
|
else
|
|
|
|
gst_query_add_allocation_param (query, allocator, ¶ms);
|
|
|
|
if (allocator)
|
2012-07-09 14:27:25 +00:00
|
|
|
gst_object_unref (allocator);
|
2012-06-20 08:06:37 +00:00
|
|
|
|
2012-06-25 07:43:53 +00:00
|
|
|
/* Now chain up to the parent class to guarantee that we can
|
|
|
|
* get a buffer pool from the query */
|
2012-06-20 08:06:37 +00:00
|
|
|
if (!GST_VIDEO_DECODER_CLASS (parent_class)->decide_allocation (decoder,
|
|
|
|
query))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
state = gst_video_decoder_get_output_state (decoder);
|
|
|
|
|
|
|
|
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
|
|
|
|
|
|
|
|
dec->has_cropping = FALSE;
|
|
|
|
config = gst_buffer_pool_get_config (pool);
|
2012-07-06 09:27:27 +00:00
|
|
|
if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL)) {
|
2012-06-20 08:06:37 +00:00
|
|
|
gst_buffer_pool_config_add_option (config,
|
|
|
|
GST_BUFFER_POOL_OPTION_VIDEO_META);
|
|
|
|
dec->has_cropping =
|
2012-07-06 09:27:27 +00:00
|
|
|
gst_query_find_allocation_meta (query, GST_VIDEO_CROP_META_API_TYPE,
|
|
|
|
NULL);
|
2012-04-13 23:06:52 +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
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
if (dec->has_cropping) {
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
/* Calculate uncropped size */
|
|
|
|
size = MAX (size, dec->decoded_info.size);
|
|
|
|
caps = gst_video_info_to_caps (&dec->decoded_info);
|
|
|
|
gst_buffer_pool_config_set_params (config, caps, size, min, max);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_buffer_pool_set_config (pool, config);
|
|
|
|
|
|
|
|
gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
|
2012-04-02 13:21:36 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
gst_object_unref (pool);
|
|
|
|
gst_video_codec_state_unref (state);
|
|
|
|
|
|
|
|
return TRUE;
|
2012-04-13 23:06:52 +00:00
|
|
|
}
|
2012-04-02 13:21:36 +00:00
|
|
|
|
2012-04-13 23:06:52 +00:00
|
|
|
static GstFlowReturn
|
2012-06-20 08:06:37 +00:00
|
|
|
gst_mpeg2dec_crop_buffer (GstMpeg2dec * dec, GstVideoCodecFrame * in_frame,
|
|
|
|
GstVideoFrame * input_vframe)
|
2012-04-13 23:06:52 +00:00
|
|
|
{
|
2012-06-20 08:06:37 +00:00
|
|
|
GstVideoCodecState *state;
|
2012-04-13 23:06:52 +00:00
|
|
|
GstVideoInfo *info;
|
2012-06-20 08:06:37 +00:00
|
|
|
GstVideoInfo *dinfo;
|
|
|
|
guint c, n_planes;
|
|
|
|
GstVideoFrame output_frame;
|
|
|
|
GstFlowReturn ret;
|
|
|
|
|
|
|
|
state = gst_video_decoder_get_output_state (GST_VIDEO_DECODER (dec));
|
|
|
|
info = &state->info;
|
|
|
|
dinfo = &dec->decoded_info;
|
|
|
|
|
|
|
|
GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, dec,
|
2012-12-19 16:16:53 +00:00
|
|
|
"Copying input buffer %ux%u (%" G_GSIZE_FORMAT ") to output buffer "
|
|
|
|
"%ux%u (%" G_GSIZE_FORMAT ")", dinfo->width, dinfo->height,
|
2012-06-20 08:06:37 +00:00
|
|
|
dinfo->size, info->width, info->height, info->size);
|
|
|
|
|
|
|
|
ret =
|
2012-07-23 08:33:33 +00:00
|
|
|
gst_video_decoder_allocate_output_frame (GST_VIDEO_DECODER (dec),
|
|
|
|
in_frame);
|
2012-07-19 07:58:50 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto beach;
|
2012-06-20 08:06:37 +00:00
|
|
|
|
|
|
|
if (!gst_video_frame_map (&output_frame, info, in_frame->output_buffer,
|
2012-07-19 07:58:50 +00:00
|
|
|
GST_MAP_WRITE))
|
|
|
|
goto map_fail;
|
2012-06-20 08:06:37 +00:00
|
|
|
|
|
|
|
n_planes = GST_VIDEO_FRAME_N_PLANES (&output_frame);
|
|
|
|
for (c = 0; c < n_planes; c++) {
|
|
|
|
guint w, h, j;
|
|
|
|
guint8 *sp, *dp;
|
|
|
|
gint ss, ds;
|
|
|
|
|
|
|
|
sp = GST_VIDEO_FRAME_PLANE_DATA (input_vframe, c);
|
|
|
|
dp = GST_VIDEO_FRAME_PLANE_DATA (&output_frame, c);
|
|
|
|
|
|
|
|
ss = GST_VIDEO_FRAME_PLANE_STRIDE (input_vframe, c);
|
|
|
|
ds = GST_VIDEO_FRAME_PLANE_STRIDE (&output_frame, c);
|
|
|
|
|
|
|
|
w = MIN (ABS (ss), ABS (ds));
|
|
|
|
h = GST_VIDEO_FRAME_COMP_HEIGHT (&output_frame, c);
|
|
|
|
|
|
|
|
GST_CAT_DEBUG (GST_CAT_PERFORMANCE, "copy plane %u, w:%u h:%u ", c, w, h);
|
|
|
|
|
|
|
|
for (j = 0; j < h; j++) {
|
|
|
|
memcpy (dp, sp, w);
|
|
|
|
dp += ds;
|
|
|
|
sp += ss;
|
2012-04-13 23:06:52 +00:00
|
|
|
}
|
|
|
|
}
|
2012-04-02 13:21:36 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
gst_video_frame_unmap (&output_frame);
|
|
|
|
|
2012-07-23 11:32:26 +00:00
|
|
|
GST_BUFFER_FLAGS (in_frame->output_buffer) =
|
|
|
|
GST_BUFFER_FLAGS (input_vframe->buffer);
|
|
|
|
|
2012-07-19 07:58:50 +00:00
|
|
|
beach:
|
2012-06-20 08:06:37 +00:00
|
|
|
gst_video_codec_state_unref (state);
|
2012-04-02 13:21:36 +00:00
|
|
|
|
2012-07-19 07:58:50 +00:00
|
|
|
return ret;
|
|
|
|
|
|
|
|
map_fail:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (dec, "Failed to map output frame");
|
|
|
|
gst_video_codec_state_unref (state);
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2012-04-13 23:06:52 +00:00
|
|
|
}
|
2012-04-02 13:21:36 +00:00
|
|
|
|
2012-07-19 07:56:17 +00:00
|
|
|
static void
|
|
|
|
frame_user_data_destroy_notify (GstBuffer * buf)
|
|
|
|
{
|
|
|
|
GST_DEBUG ("Releasing buffer %p", buf);
|
|
|
|
if (buf)
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
static GstFlowReturn
|
2012-04-13 23:06:52 +00:00
|
|
|
gst_mpeg2dec_alloc_sized_buf (GstMpeg2dec * mpeg2dec, guint size,
|
2012-07-19 07:56:17 +00:00
|
|
|
GstVideoCodecFrame * frame, GstBuffer ** buffer)
|
2012-04-13 23:06:52 +00:00
|
|
|
{
|
2012-06-20 08:06:37 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
GstVideoCodecState *state;
|
|
|
|
|
|
|
|
state = gst_video_decoder_get_output_state (GST_VIDEO_DECODER (mpeg2dec));
|
|
|
|
|
|
|
|
if (!mpeg2dec->need_cropping || mpeg2dec->has_cropping) {
|
|
|
|
ret =
|
2012-07-23 08:33:33 +00:00
|
|
|
gst_video_decoder_allocate_output_frame (GST_VIDEO_DECODER (mpeg2dec),
|
2012-06-20 08:06:37 +00:00
|
|
|
frame);
|
2012-07-19 07:56:17 +00:00
|
|
|
*buffer = frame->output_buffer;
|
2012-06-20 08:06:37 +00:00
|
|
|
} else {
|
|
|
|
GstAllocationParams params = { 0, 15, 0, 0 };
|
2012-04-02 13:21:36 +00:00
|
|
|
|
2012-07-19 07:56:17 +00:00
|
|
|
*buffer = gst_buffer_new_allocate (NULL, size, ¶ms);
|
|
|
|
gst_video_codec_frame_set_user_data (frame, *buffer,
|
|
|
|
(GDestroyNotify) frame_user_data_destroy_notify);
|
2012-04-13 23:06:52 +00:00
|
|
|
}
|
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
gst_video_codec_state_unref (state);
|
|
|
|
|
|
|
|
return ret;
|
2012-04-13 23:06:52 +00:00
|
|
|
}
|
2012-04-02 13:21:36 +00:00
|
|
|
|
2012-05-01 18:49:03 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gint id;
|
2012-06-20 08:06:37 +00:00
|
|
|
GstVideoFrame frame;
|
2012-05-01 18:49:03 +00:00
|
|
|
} GstMpeg2DecBuffer;
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_mpeg2dec_clear_buffers (GstMpeg2dec * mpeg2dec)
|
|
|
|
{
|
|
|
|
GList *l;
|
|
|
|
while ((l = g_list_first (mpeg2dec->buffers))) {
|
|
|
|
GstMpeg2DecBuffer *mbuf = l->data;
|
2012-06-20 08:06:37 +00:00
|
|
|
gst_video_frame_unmap (&mbuf->frame);
|
2012-05-01 18:49:03 +00:00
|
|
|
g_slice_free (GstMpeg2DecBuffer, mbuf);
|
|
|
|
mpeg2dec->buffers = g_list_delete_link (mpeg2dec->buffers, l);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-06-20 08:06:37 +00:00
|
|
|
gst_mpeg2dec_save_buffer (GstMpeg2dec * mpeg2dec, gint id,
|
|
|
|
GstVideoFrame * frame)
|
2012-05-01 18:49:03 +00:00
|
|
|
{
|
|
|
|
GstMpeg2DecBuffer *mbuf;
|
|
|
|
|
2012-07-27 09:35:52 +00:00
|
|
|
GST_LOG_OBJECT (mpeg2dec, "Saving local info for frame %d", id);
|
|
|
|
|
2012-05-01 18:49:03 +00:00
|
|
|
mbuf = g_slice_new0 (GstMpeg2DecBuffer);
|
|
|
|
mbuf->id = id;
|
2012-06-20 08:06:37 +00:00
|
|
|
mbuf->frame = *frame;
|
2012-05-01 18:49:03 +00:00
|
|
|
|
|
|
|
mpeg2dec->buffers = g_list_prepend (mpeg2dec->buffers, mbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gst_mpeg2dec_buffer_compare (GstMpeg2DecBuffer * mbuf, gconstpointer id)
|
|
|
|
{
|
|
|
|
if (mbuf->id == GPOINTER_TO_INT (id))
|
|
|
|
return 0;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_mpeg2dec_discard_buffer (GstMpeg2dec * mpeg2dec, gint id)
|
|
|
|
{
|
|
|
|
GList *l = g_list_find_custom (mpeg2dec->buffers, GINT_TO_POINTER (id),
|
|
|
|
(GCompareFunc) gst_mpeg2dec_buffer_compare);
|
|
|
|
|
|
|
|
if (l) {
|
|
|
|
GstMpeg2DecBuffer *mbuf = l->data;
|
2012-06-20 08:06:37 +00:00
|
|
|
gst_video_frame_unmap (&mbuf->frame);
|
2012-05-01 18:49:03 +00:00
|
|
|
g_slice_free (GstMpeg2DecBuffer, mbuf);
|
|
|
|
mpeg2dec->buffers = g_list_delete_link (mpeg2dec->buffers, l);
|
2012-07-27 09:35:52 +00:00
|
|
|
GST_LOG_OBJECT (mpeg2dec, "Discarded local info for frame %d", id);
|
2012-05-01 18:49:03 +00:00
|
|
|
} else {
|
2012-06-20 11:23:51 +00:00
|
|
|
GST_WARNING ("Could not find buffer %d, will be leaked until next reset",
|
|
|
|
id);
|
2012-05-01 18:49:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
static GstVideoFrame *
|
|
|
|
gst_mpeg2dec_get_buffer (GstMpeg2dec * mpeg2dec, gint id)
|
2012-04-13 23:06:52 +00:00
|
|
|
{
|
2012-06-20 08:06:37 +00:00
|
|
|
GList *l = g_list_find_custom (mpeg2dec->buffers, GINT_TO_POINTER (id),
|
|
|
|
(GCompareFunc) gst_mpeg2dec_buffer_compare);
|
2005-01-17 13:54:30 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
if (l) {
|
|
|
|
GstMpeg2DecBuffer *mbuf = l->data;
|
|
|
|
return &mbuf->frame;
|
|
|
|
}
|
2010-12-29 21:42:36 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
return NULL;
|
2005-01-17 13:54:30 +00:00
|
|
|
}
|
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
static GstFlowReturn
|
2012-07-19 07:56:17 +00:00
|
|
|
gst_mpeg2dec_alloc_buffer (GstMpeg2dec * mpeg2dec, GstVideoCodecFrame * frame,
|
|
|
|
GstBuffer ** buffer)
|
2002-12-05 00:29:11 +00:00
|
|
|
{
|
2012-07-19 07:56:17 +00:00
|
|
|
GstFlowReturn ret;
|
2012-06-20 08:06:37 +00:00
|
|
|
GstVideoFrame vframe;
|
|
|
|
guint8 *buf[3];
|
2004-03-31 06:31:47 +00:00
|
|
|
|
2012-07-19 07:56:17 +00:00
|
|
|
ret =
|
|
|
|
gst_mpeg2dec_alloc_sized_buf (mpeg2dec, mpeg2dec->decoded_info.size,
|
|
|
|
frame, buffer);
|
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK))
|
|
|
|
goto beach;
|
2011-11-04 09:45:47 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
if (mpeg2dec->need_cropping && mpeg2dec->has_cropping) {
|
|
|
|
GstVideoCropMeta *crop;
|
|
|
|
GstVideoCodecState *state;
|
|
|
|
GstVideoInfo *vinfo;
|
2012-05-30 10:50:13 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
state = gst_video_decoder_get_output_state (GST_VIDEO_DECODER (mpeg2dec));
|
|
|
|
vinfo = &state->info;
|
2006-06-19 15:16:43 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
crop = gst_buffer_add_video_crop_meta (frame->output_buffer);
|
|
|
|
/* we can do things slightly more efficient when we know that
|
|
|
|
* downstream understands clipping */
|
|
|
|
crop->x = 0;
|
|
|
|
crop->y = 0;
|
|
|
|
crop->width = vinfo->width;
|
|
|
|
crop->height = vinfo->height;
|
2006-06-19 15:16:43 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
gst_video_codec_state_unref (state);
|
2012-04-13 23:06:52 +00:00
|
|
|
}
|
|
|
|
|
2012-07-19 07:56:17 +00:00
|
|
|
if (!gst_video_frame_map (&vframe, &mpeg2dec->decoded_info, *buffer,
|
|
|
|
GST_MAP_READ | GST_MAP_WRITE))
|
|
|
|
goto map_fail;
|
2012-04-13 23:06:52 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
buf[0] = GST_VIDEO_FRAME_PLANE_DATA (&vframe, 0);
|
|
|
|
buf[1] = GST_VIDEO_FRAME_PLANE_DATA (&vframe, 1);
|
|
|
|
buf[2] = GST_VIDEO_FRAME_PLANE_DATA (&vframe, 2);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "set_buf: %p %p %p, frame %i",
|
|
|
|
buf[0], buf[1], buf[2], frame->system_frame_number);
|
|
|
|
|
2012-12-19 16:16:53 +00:00
|
|
|
/* Note: We use a non-null 'id' value to make the distinction
|
2012-07-27 09:35:52 +00:00
|
|
|
* between the dummy buffers (which have an id of NULL) and the
|
|
|
|
* ones we did */
|
2012-06-20 08:06:37 +00:00
|
|
|
mpeg2_set_buf (mpeg2dec->decoder, buf,
|
2012-07-27 09:35:52 +00:00
|
|
|
GINT_TO_POINTER (frame->system_frame_number + 1));
|
2012-06-20 08:06:37 +00:00
|
|
|
gst_mpeg2dec_save_buffer (mpeg2dec, frame->system_frame_number, &vframe);
|
|
|
|
|
2012-07-19 07:56:17 +00:00
|
|
|
beach:
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
map_fail:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (mpeg2dec, "Failed to map frame");
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
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 */
|
2012-06-20 08:06:37 +00:00
|
|
|
mpeg2dec->dummybuf[3] = g_malloc0 (mpeg2dec->decoded_info.size + 15);
|
2006-11-03 09:52:12 +00:00
|
|
|
mpeg2dec->dummybuf[0] = ALIGN_16 (mpeg2dec->dummybuf[3]);
|
2012-06-20 08:06:37 +00:00
|
|
|
mpeg2dec->dummybuf[1] =
|
|
|
|
mpeg2dec->dummybuf[0] +
|
|
|
|
GST_VIDEO_INFO_PLANE_OFFSET (&mpeg2dec->decoded_info, 1);
|
|
|
|
mpeg2dec->dummybuf[2] =
|
|
|
|
mpeg2dec->dummybuf[0] +
|
|
|
|
GST_VIDEO_INFO_PLANE_OFFSET (&mpeg2dec->decoded_info, 2);
|
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;
|
2012-04-13 23:06:52 +00:00
|
|
|
GstClockTime latency;
|
2012-06-20 08:06:37 +00:00
|
|
|
const mpeg2_sequence_t *sequence;
|
|
|
|
GstVideoCodecState *state;
|
|
|
|
GstVideoInfo *dinfo = &mpeg2dec->decoded_info;
|
|
|
|
GstVideoInfo *vinfo;
|
|
|
|
GstVideoFormat format;
|
2005-02-04 13:43:28 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
sequence = info->sequence;
|
2011-09-30 15:38:07 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
if (sequence->frame_period == 0)
|
|
|
|
goto invalid_frame_period;
|
2008-10-14 12:51:41 +00:00
|
|
|
|
2012-04-13 23:06:52 +00:00
|
|
|
/* mpeg2 video can only be from 16x16 to 4096x4096. Everything
|
2012-06-20 08:06:37 +00:00
|
|
|
* else is a corrupted file */
|
|
|
|
if (sequence->width > 4096 || sequence->width < 16 ||
|
|
|
|
sequence->height > 4096 || sequence->height < 16)
|
|
|
|
goto invalid_size;
|
|
|
|
|
|
|
|
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;
|
2008-07-13 10:13:06 +00:00
|
|
|
}
|
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
/* get subsampling */
|
|
|
|
if (sequence->chroma_width < sequence->width) {
|
|
|
|
/* horizontally subsampled */
|
|
|
|
if (sequence->chroma_height < sequence->height) {
|
|
|
|
/* and vertically subsamples */
|
|
|
|
format = GST_VIDEO_FORMAT_I420;
|
|
|
|
} else {
|
|
|
|
format = GST_VIDEO_FORMAT_Y42B;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* not subsampled */
|
|
|
|
format = GST_VIDEO_FORMAT_Y444;
|
|
|
|
}
|
2012-04-13 23:06:52 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
state = gst_video_decoder_set_output_state (GST_VIDEO_DECODER (mpeg2dec),
|
|
|
|
format, sequence->picture_width, sequence->picture_height,
|
|
|
|
mpeg2dec->input_state);
|
|
|
|
vinfo = &state->info;
|
2012-04-13 23:06:52 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
/* If we don't have a valid upstream PAR override it */
|
|
|
|
if (GST_VIDEO_INFO_PAR_N (vinfo) == 1 &&
|
|
|
|
GST_VIDEO_INFO_PAR_D (vinfo) == 1 &&
|
|
|
|
sequence->pixel_width != 0 && sequence->pixel_height != 0) {
|
2013-06-04 13:12:27 +00:00
|
|
|
#if MPEG2_RELEASE >= MPEG2_VERSION(0,5,0)
|
|
|
|
guint pixel_width, pixel_height;
|
|
|
|
if (mpeg2_guess_aspect (sequence, &pixel_width, &pixel_height)) {
|
|
|
|
vinfo->par_n = pixel_width;
|
|
|
|
vinfo->par_d = pixel_height;
|
|
|
|
}
|
|
|
|
#else
|
2012-06-20 08:06:37 +00:00
|
|
|
vinfo->par_n = sequence->pixel_width;
|
|
|
|
vinfo->par_d = sequence->pixel_height;
|
2013-06-04 13:12:27 +00:00
|
|
|
#endif
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "Setting PAR %d x %d",
|
|
|
|
vinfo->par_n, vinfo->par_d);
|
2012-06-20 08:06:37 +00:00
|
|
|
}
|
|
|
|
vinfo->fps_n = 27000000;
|
|
|
|
vinfo->fps_d = sequence->frame_period;
|
|
|
|
|
|
|
|
if (!(sequence->flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE))
|
|
|
|
vinfo->interlace_mode = GST_VIDEO_INTERLACE_MODE_MIXED;
|
|
|
|
else
|
|
|
|
vinfo->interlace_mode = GST_VIDEO_INTERLACE_MODE_PROGRESSIVE;
|
|
|
|
|
|
|
|
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,
|
2012-06-20 08:06:37 +00:00
|
|
|
"sequence flags: %d, frame period: %d, frame rate: %d/%d",
|
|
|
|
sequence->flags, sequence->frame_period, vinfo->fps_n, vinfo->fps_d);
|
2005-02-04 13:43:28 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "profile: %02x, colour_primaries: %d",
|
2012-06-20 08:06:37 +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",
|
2012-06-20 08:06:37 +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",
|
2012-06-20 08:06:37 +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",
|
2012-06-20 08:06:37 +00:00
|
|
|
sequence->flags & SEQ_FLAG_LOW_DELAY,
|
|
|
|
sequence->flags & SEQ_FLAG_COLOUR_DESCRIPTION);
|
|
|
|
|
|
|
|
/* we store the codec size before cropping */
|
|
|
|
*dinfo = *vinfo;
|
|
|
|
gst_video_info_set_format (dinfo, format, sequence->width, sequence->height);
|
2005-10-26 16:45:04 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
/* Mpeg2dec has 2 frame latency to produce a picture and 1 frame latency in
|
|
|
|
* it's parser */
|
|
|
|
latency = gst_util_uint64_scale (3, vinfo->fps_d, vinfo->fps_n);
|
|
|
|
gst_video_decoder_set_latency (GST_VIDEO_DECODER (mpeg2dec), latency,
|
|
|
|
latency);
|
|
|
|
|
2012-07-18 16:32:54 +00:00
|
|
|
if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (mpeg2dec)))
|
|
|
|
goto negotiation_fail;
|
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
gst_video_codec_state_unref (state);
|
2012-04-02 13:21:36 +00:00
|
|
|
|
2011-09-30 15:38:07 +00:00
|
|
|
mpeg2_custom_fbuf (mpeg2dec->decoder, 1);
|
2012-04-13 23:06:52 +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
|
|
|
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);
|
2012-05-01 18:49:03 +00:00
|
|
|
gst_mpeg2dec_clear_buffers (mpeg2dec);
|
2005-10-27 17:26:13 +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
|
|
|
return ret;
|
2005-10-26 16:45:04 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
invalid_frame_period:
|
2005-10-26 16:45:04 +00:00
|
|
|
{
|
2012-06-20 08:06:37 +00:00
|
|
|
GST_WARNING_OBJECT (mpeg2dec, "Frame period is 0!");
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
invalid_size:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (mpeg2dec, "Invalid frame dimensions: %d x %d",
|
|
|
|
sequence->width, sequence->height);
|
|
|
|
return GST_FLOW_ERROR;
|
2005-10-26 16:45:04 +00:00
|
|
|
}
|
2012-07-18 16:32:54 +00:00
|
|
|
|
|
|
|
negotiation_fail:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (mpeg2dec, "Failed to negotiate with downstream");
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2005-02-04 13:43:28 +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
|
2012-04-13 23:06:52 +00:00
|
|
|
handle_picture (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info,
|
|
|
|
GstVideoCodecFrame * frame)
|
2005-02-04 13:43:28 +00:00
|
|
|
{
|
2012-07-19 07:56:17 +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;
|
2012-04-13 23:06:52 +00:00
|
|
|
const gchar *type_str = NULL;
|
|
|
|
gboolean key_frame = FALSE;
|
|
|
|
const mpeg2_picture_t *picture = info->current_picture;
|
2012-07-19 07:56:17 +00:00
|
|
|
GstBuffer *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
|
|
|
|
2012-07-19 07:56:17 +00:00
|
|
|
ret = gst_mpeg2dec_alloc_buffer (mpeg2dec, frame, &buffer);
|
2012-06-20 08:06:37 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
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
|
|
|
|
2012-04-13 23:06:52 +00:00
|
|
|
type = picture->flags & PIC_MASK_CODING_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
|
|
|
switch (type) {
|
|
|
|
case PIC_FLAG_CODING_TYPE_I:
|
2012-04-13 23:06:52 +00:00
|
|
|
key_frame = TRUE;
|
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, 0);
|
2012-04-13 23:06:52 +00:00
|
|
|
type_str = "I";
|
|
|
|
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
|
|
|
case PIC_FLAG_CODING_TYPE_P:
|
2012-04-13 23:06:52 +00:00
|
|
|
type_str = "P";
|
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:
|
2012-04-13 23:06:52 +00:00
|
|
|
type_str = "B";
|
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:
|
2012-05-01 18:46:31 +00:00
|
|
|
gst_video_codec_frame_ref (frame);
|
2012-07-19 07:58:50 +00:00
|
|
|
ret = gst_video_decoder_drop_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
|
2012-04-13 23:06:52 +00:00
|
|
|
GST_VIDEO_DECODER_ERROR (mpeg2dec, 1, STREAM, DECODE,
|
|
|
|
("decoding error"), ("Invalid picture type"), ret);
|
|
|
|
return ret;
|
2005-02-04 13:43:28 +00:00
|
|
|
}
|
|
|
|
|
2012-04-13 23:06:52 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "handle picture type %s", type_str);
|
2012-06-20 08:06:37 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "picture %s, frame %i",
|
|
|
|
key_frame ? ", kf," : " ", frame->system_frame_number);
|
2012-04-01 18:19:36 +00:00
|
|
|
|
2012-07-23 09:25:34 +00:00
|
|
|
if (GST_VIDEO_INFO_IS_INTERLACED (&mpeg2dec->decoded_info)) {
|
|
|
|
/* This implies SEQ_FLAG_PROGRESSIVE_SEQUENCE is not set */
|
2012-07-23 09:13:05 +00:00
|
|
|
if (picture->flags & PIC_FLAG_TOP_FIELD_FIRST) {
|
|
|
|
GST_BUFFER_FLAG_SET (buffer, GST_VIDEO_BUFFER_FLAG_TFF);
|
|
|
|
}
|
|
|
|
if (!(picture->flags & PIC_FLAG_PROGRESSIVE_FRAME)) {
|
|
|
|
GST_BUFFER_FLAG_SET (buffer, GST_VIDEO_BUFFER_FLAG_INTERLACED);
|
|
|
|
}
|
2012-04-13 23:06:52 +00:00
|
|
|
#if MPEG2_RELEASE >= MPEG2_VERSION(0,5,0)
|
2012-07-23 09:13:05 +00:00
|
|
|
/* repeat field introduced in 0.5.0 */
|
|
|
|
if (picture->flags & PIC_FLAG_REPEAT_FIRST_FIELD) {
|
|
|
|
GST_BUFFER_FLAG_SET (buffer, GST_VIDEO_BUFFER_FLAG_RFF);
|
|
|
|
}
|
2012-04-13 23:06:52 +00:00
|
|
|
#endif
|
2012-07-23 09:13:05 +00:00
|
|
|
}
|
2012-04-01 18:19:36 +00:00
|
|
|
|
2012-04-13 23:06:52 +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.*: 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-02-04 13:43:28 +00:00
|
|
|
|
2012-04-13 23:06:52 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec,
|
2012-06-20 08:06:37 +00:00
|
|
|
"picture: %s %s %s %s %s fields:%d ts:%"
|
2012-04-13 23:06:52 +00:00
|
|
|
GST_TIME_FORMAT,
|
|
|
|
(picture->flags & PIC_FLAG_PROGRESSIVE_FRAME ? "prog" : " "),
|
|
|
|
(picture->flags & PIC_FLAG_TOP_FIELD_FIRST ? "tff" : " "),
|
|
|
|
#if MPEG2_RELEASE >= MPEG2_VERSION(0,5,0)
|
|
|
|
(picture->flags & PIC_FLAG_REPEAT_FIRST_FIELD ? "rff" : " "),
|
|
|
|
#else
|
|
|
|
"unknown rff",
|
|
|
|
#endif
|
|
|
|
(picture->flags & PIC_FLAG_SKIP ? "skip" : " "),
|
|
|
|
(picture->flags & PIC_FLAG_COMPOSITE_DISPLAY ? "composite" : " "),
|
2012-06-20 08:06:37 +00:00
|
|
|
picture->nb_fields, GST_TIME_ARGS (frame->pts));
|
2012-04-13 23:06:52 +00:00
|
|
|
|
2012-07-19 07:56:17 +00:00
|
|
|
return ret;
|
2008-01-10 15:24:08 +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_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
|
|
|
|
{
|
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;
|
2012-04-13 23:06:52 +00:00
|
|
|
GstVideoCodecFrame *frame;
|
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;
|
2012-06-20 08:06:37 +00:00
|
|
|
GstVideoCodecState *state;
|
2005-10-19 16:01:35 +00:00
|
|
|
|
2012-07-26 16:30:04 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec,
|
|
|
|
"fbuf:%p display_picture:%p current_picture:%p fbuf->id:%d",
|
2012-04-13 23:06:52 +00:00
|
|
|
info->display_fbuf, info->display_picture, info->current_picture,
|
2012-07-27 09:35:52 +00:00
|
|
|
GPOINTER_TO_INT (info->display_fbuf->id) - 1);
|
2005-02-04 13:43:28 +00:00
|
|
|
|
2012-07-27 09:35:52 +00:00
|
|
|
/* Note, the fbuf-id is shifted by 1 to make the difference between
|
|
|
|
* NULL values (used by dummy buffers) and 'real' values */
|
2012-04-13 23:06:52 +00:00
|
|
|
frame = gst_video_decoder_get_frame (GST_VIDEO_DECODER (mpeg2dec),
|
2012-07-27 09:35:52 +00:00
|
|
|
GPOINTER_TO_INT (info->display_fbuf->id) - 1);
|
|
|
|
if (!frame)
|
|
|
|
goto no_frame;
|
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;
|
|
|
|
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) {
|
|
|
|
mpeg2_skip (mpeg2dec->decoder, 0);
|
|
|
|
}
|
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
|
|
|
|
2012-04-13 23:06:52 +00:00
|
|
|
if (picture->flags & PIC_FLAG_SKIP) {
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "dropping buffer because of skip flag");
|
2012-07-19 07:58:50 +00:00
|
|
|
ret = gst_video_decoder_drop_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
|
2012-04-13 23:06:52 +00:00
|
|
|
mpeg2_skip (mpeg2dec->decoder, 1);
|
2012-07-19 07:58:50 +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
|
|
|
}
|
2005-02-04 13:43:28 +00:00
|
|
|
|
2012-04-13 23:06:52 +00:00
|
|
|
if (mpeg2dec->discont_state != MPEG2DEC_DISC_NONE) {
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "dropping buffer, discont state %d",
|
|
|
|
mpeg2dec->discont_state);
|
2012-07-19 07:58:50 +00:00
|
|
|
ret = gst_video_decoder_drop_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
|
|
|
|
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
|
|
|
}
|
2009-05-12 09:44:13 +00:00
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
state = gst_video_decoder_get_output_state (GST_VIDEO_DECODER (mpeg2dec));
|
|
|
|
|
2012-04-13 23:06:52 +00:00
|
|
|
/* do cropping if the target region is smaller than the input one */
|
2012-06-20 08:06:37 +00:00
|
|
|
if (mpeg2dec->need_cropping && !mpeg2dec->has_cropping) {
|
|
|
|
GstVideoFrame *vframe;
|
|
|
|
|
2012-04-13 23:06:52 +00:00
|
|
|
if (gst_video_decoder_get_max_decode_time (GST_VIDEO_DECODER (mpeg2dec),
|
|
|
|
frame) < 0) {
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "dropping buffer crop, too late");
|
2012-07-19 07:58:50 +00:00
|
|
|
ret = gst_video_decoder_drop_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
|
|
|
|
goto beach;
|
2011-09-05 10:11:52 +00:00
|
|
|
}
|
|
|
|
|
2012-06-20 08:06:37 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "cropping buffer");
|
|
|
|
vframe = gst_mpeg2dec_get_buffer (mpeg2dec, frame->system_frame_number);
|
|
|
|
g_assert (vframe != NULL);
|
|
|
|
ret = gst_mpeg2dec_crop_buffer (mpeg2dec, frame, vframe);
|
2010-12-29 21:42:36 +00:00
|
|
|
}
|
2006-07-10 11:52:58 +00:00
|
|
|
|
2012-07-19 07:58:50 +00:00
|
|
|
ret = gst_video_decoder_finish_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
|
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
|
|
|
|
2012-07-19 07:58:50 +00:00
|
|
|
beach:
|
|
|
|
gst_video_codec_state_unref (state);
|
2012-04-13 23:06:52 +00:00
|
|
|
return ret;
|
2012-07-27 09:35:52 +00:00
|
|
|
|
|
|
|
no_frame:
|
|
|
|
{
|
2012-09-30 14:01:09 +00:00
|
|
|
GST_DEBUG ("display buffer does not have a valid frame");
|
|
|
|
return GST_FLOW_OK;
|
2012-07-27 09:35:52 +00:00
|
|
|
}
|
2005-02-04 13:43:28 +00:00
|
|
|
}
|
|
|
|
|
2005-07-19 20:51:16 +00:00
|
|
|
static GstFlowReturn
|
2012-04-13 23:06:52 +00:00
|
|
|
gst_mpeg2dec_handle_frame (GstVideoDecoder * decoder,
|
|
|
|
GstVideoCodecFrame * frame)
|
2001-12-23 06:03:21 +00:00
|
|
|
{
|
2012-04-13 23:06:52 +00:00
|
|
|
GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (decoder);
|
|
|
|
GstBuffer *buf = frame->input_buffer;
|
2012-06-20 08:06:37 +00:00
|
|
|
GstMapInfo minfo;
|
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
|
|
|
|
2012-07-26 16:30:04 +00:00
|
|
|
GST_LOG_OBJECT (mpeg2dec, "received frame %d, timestamp %"
|
2004-07-07 16:49:49 +00:00
|
|
|
GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT,
|
2012-07-26 16:30:04 +00:00
|
|
|
frame->system_frame_number,
|
2012-04-13 23:06:52 +00:00
|
|
|
GST_TIME_ARGS (frame->pts), GST_TIME_ARGS (frame->duration));
|
|
|
|
|
2012-09-11 05:30:18 +00:00
|
|
|
gst_buffer_ref (buf);
|
2012-06-20 08:06:37 +00:00
|
|
|
if (!gst_buffer_map (buf, &minfo, GST_MAP_READ)) {
|
|
|
|
GST_ERROR_OBJECT (mpeg2dec, "Failed to map input buffer");
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2001-12-23 06:03:21 +00:00
|
|
|
|
2005-10-26 16:45:04 +00:00
|
|
|
info = mpeg2dec->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
|
|
|
GST_LOG_OBJECT (mpeg2dec, "calling mpeg2_buffer");
|
2012-06-20 08:06:37 +00:00
|
|
|
mpeg2_buffer (mpeg2dec->decoder, minfo.data, minfo.data + minfo.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");
|
2013-07-17 14:17:54 +00:00
|
|
|
mpeg2dec->discont_state = MPEG2DEC_DISC_NEW_PICTURE;
|
|
|
|
gst_mpeg2dec_clear_buffers (mpeg2dec);
|
2008-11-24 09:51:39 +00:00
|
|
|
/* 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) {
|
2012-04-13 23:06:52 +00:00
|
|
|
GST_VIDEO_DECODER_ERROR (decoder, 1, STREAM, DECODE,
|
|
|
|
("decoding error"), ("Bad sequence header"), ret);
|
2012-05-01 18:46:31 +00:00
|
|
|
gst_video_decoder_drop_frame (decoder, frame);
|
2013-08-15 13:27:48 +00:00
|
|
|
gst_mpeg2dec_flush (decoder);
|
2012-04-13 23:06:52 +00:00
|
|
|
goto done;
|
2008-02-04 14:27:32 +00:00
|
|
|
}
|
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:
|
2012-04-13 23:06:52 +00:00
|
|
|
ret = handle_picture (mpeg2dec, info, frame);
|
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
|
|
|
case STATE_SLICE:
|
2012-07-27 09:35:52 +00:00
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "display_fbuf:%p, discard_fbuf:%p",
|
|
|
|
info->display_fbuf, info->discard_fbuf);
|
|
|
|
if (info->display_fbuf && info->display_fbuf->id) {
|
2012-04-13 23:06:52 +00:00
|
|
|
ret = handle_slice (mpeg2dec, info);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (mpeg2dec, "no picture to display");
|
|
|
|
}
|
2012-07-27 09:35:52 +00:00
|
|
|
if (info->discard_fbuf && info->discard_fbuf->id)
|
2012-05-01 18:49:03 +00:00
|
|
|
gst_mpeg2dec_discard_buffer (mpeg2dec,
|
2012-07-27 09:35:52 +00:00
|
|
|
GPOINTER_TO_INT (info->discard_fbuf->id) - 1);
|
2012-04-13 23:06:52 +00:00
|
|
|
if (state != STATE_SLICE) {
|
2012-05-01 18:49:03 +00:00
|
|
|
gst_mpeg2dec_clear_buffers (mpeg2dec);
|
2012-04-13 23:06:52 +00:00
|
|
|
}
|
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:
|
2012-04-13 23:06:52 +00:00
|
|
|
GST_VIDEO_DECODER_ERROR (decoder, 1, STREAM, DECODE,
|
|
|
|
("decoding error"), ("Reached libmpeg2 invalid state"), ret);
|
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);
|
2012-04-13 23:06:52 +00:00
|
|
|
ret = GST_FLOW_OK;
|
2012-05-01 18:46:31 +00:00
|
|
|
gst_video_codec_frame_unref (frame);
|
2012-04-13 23:06:52 +00:00
|
|
|
goto done;
|
2002-12-05 00:29:11 +00:00
|
|
|
}
|
2002-12-19 07:45:11 +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
|
|
|
}
|
2005-07-19 20:51:16 +00:00
|
|
|
|
2012-05-01 18:46:31 +00:00
|
|
|
gst_video_codec_frame_unref (frame);
|
|
|
|
|
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-06-20 08:06:37 +00:00
|
|
|
gst_buffer_unmap (buf, &minfo);
|
2012-09-11 05:30:18 +00:00
|
|
|
gst_buffer_unref (buf);
|
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;
|
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,
|
2012-06-20 08:06:37 +00:00
|
|
|
mpeg2dec,
|
2006-04-01 09:54:39 +00:00
|
|
|
"LibMpeg2 decoder", plugin_init, VERSION, "GPL", GST_PACKAGE_NAME,
|
|
|
|
GST_PACKAGE_ORIGIN);
|