2002-03-20 21:44:42 +00:00
|
|
|
/* GStreamer
|
2001-12-23 13:25:04 +00:00
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2004-01-12 04:15:46 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2003-06-07 00:41:32 +00:00
|
|
|
#include "config.h"
|
2004-01-12 04:15:46 +00:00
|
|
|
#endif
|
2003-06-07 00:41:32 +00:00
|
|
|
|
2002-11-06 23:53:46 +00:00
|
|
|
#include <assert.h>
|
2001-12-23 13:25:04 +00:00
|
|
|
#include <string.h>
|
2003-06-07 00:41:32 +00:00
|
|
|
|
2012-04-12 17:41:52 +00:00
|
|
|
#ifdef HAVE_LIBAV_UNINSTALLED
|
2002-11-26 14:50:05 +00:00
|
|
|
#include <avcodec.h>
|
|
|
|
#else
|
2008-10-30 12:05:45 +00:00
|
|
|
#include <libavcodec/avcodec.h>
|
2002-11-26 14:50:05 +00:00
|
|
|
#endif
|
2002-11-06 23:53:46 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
2004-12-18 20:53:55 +00:00
|
|
|
#include "gstffmpeg.h"
|
2003-06-07 00:41:32 +00:00
|
|
|
#include "gstffmpegcodecmap.h"
|
2009-04-15 20:33:16 +00:00
|
|
|
#include "gstffmpegutils.h"
|
2002-11-25 21:37:26 +00:00
|
|
|
|
2012-03-14 10:53:42 +00:00
|
|
|
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
|
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
typedef struct _GstFFMpegAudDec GstFFMpegAudDec;
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2010-10-06 14:00:05 +00:00
|
|
|
#define MAX_TS_MASK 0xff
|
|
|
|
|
2010-10-06 16:15:03 +00:00
|
|
|
/* for each incomming buffer we keep all timing info in a structure like this.
|
|
|
|
* We keep a circular array of these structures around to store the timing info.
|
|
|
|
* The index in the array is what we pass as opaque data (to pictures) and
|
|
|
|
* pts (to parsers) so that ffmpeg can remember them for us. */
|
2010-10-06 14:00:05 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gint idx;
|
2012-04-03 09:52:05 +00:00
|
|
|
GstClockTime dts;
|
|
|
|
GstClockTime pts;
|
2010-10-06 14:00:05 +00:00
|
|
|
GstClockTime duration;
|
|
|
|
gint64 offset;
|
|
|
|
} GstTSInfo;
|
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
struct _GstFFMpegAudDec
|
2004-03-29 16:39:18 +00:00
|
|
|
{
|
2002-11-06 23:53:46 +00:00
|
|
|
GstElement element;
|
|
|
|
|
|
|
|
/* We need to keep track of our pads, so we do so here. */
|
|
|
|
GstPad *srcpad;
|
|
|
|
GstPad *sinkpad;
|
|
|
|
|
2004-12-17 13:08:13 +00:00
|
|
|
/* decoding */
|
2002-11-06 23:53:46 +00:00
|
|
|
AVCodecContext *context;
|
2003-06-07 00:41:32 +00:00
|
|
|
gboolean opened;
|
2011-07-29 08:31:03 +00:00
|
|
|
|
|
|
|
/* current output format */
|
2012-06-14 10:41:34 +00:00
|
|
|
gint channels, samplerate, depth;
|
|
|
|
GstAudioChannelPosition ffmpeg_layout[64], gst_layout[64];
|
2011-07-29 08:31:03 +00:00
|
|
|
|
2006-08-29 09:28:20 +00:00
|
|
|
gboolean discont;
|
2008-09-04 14:08:50 +00:00
|
|
|
gboolean clear_ts;
|
2010-10-07 15:46:22 +00:00
|
|
|
|
|
|
|
/* for tracking DTS/PTS */
|
|
|
|
GstClockTime next_out;
|
2004-07-21 09:20:55 +00:00
|
|
|
|
2004-12-17 13:08:13 +00:00
|
|
|
/* parsing */
|
2010-03-08 18:00:05 +00:00
|
|
|
gboolean turnoff_parser; /* used for turning off aac raw parsing
|
|
|
|
* See bug #566250 */
|
2004-12-17 13:08:13 +00:00
|
|
|
AVCodecParserContext *pctx;
|
|
|
|
GstBuffer *pcache;
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
|
|
|
|
/* clipping segment */
|
|
|
|
GstSegment segment;
|
2007-05-02 16:06:09 +00:00
|
|
|
|
2010-10-06 14:00:05 +00:00
|
|
|
GstTSInfo ts_info[MAX_TS_MASK + 1];
|
|
|
|
gint ts_idx;
|
|
|
|
|
2008-01-16 17:35:58 +00:00
|
|
|
/* reverse playback queue */
|
|
|
|
GList *queued;
|
2011-12-11 05:25:23 +00:00
|
|
|
|
|
|
|
/* prevent reopening the decoder on GST_EVENT_CAPS when caps are same as last time. */
|
|
|
|
GstCaps *last_caps;
|
2002-11-06 23:53:46 +00:00
|
|
|
};
|
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
typedef struct _GstFFMpegAudDecClass GstFFMpegAudDecClass;
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
struct _GstFFMpegAudDecClass
|
2004-03-29 16:39:18 +00:00
|
|
|
{
|
2002-11-06 23:53:46 +00:00
|
|
|
GstElementClass parent_class;
|
|
|
|
|
|
|
|
AVCodec *in_plugin;
|
2003-06-07 00:41:32 +00:00
|
|
|
GstPadTemplate *srctempl, *sinktempl;
|
2002-11-06 23:53:46 +00:00
|
|
|
};
|
|
|
|
|
2010-10-06 14:00:05 +00:00
|
|
|
#define GST_TS_INFO_NONE &ts_info_none
|
|
|
|
static const GstTSInfo ts_info_none = { -1, -1, -1, -1 };
|
|
|
|
|
|
|
|
static const GstTSInfo *
|
2012-06-14 10:41:34 +00:00
|
|
|
gst_ts_info_store (GstFFMpegAudDec * dec, GstClockTime dts, GstClockTime pts,
|
2010-10-06 14:00:05 +00:00
|
|
|
GstClockTime duration, gint64 offset)
|
|
|
|
{
|
|
|
|
gint idx = dec->ts_idx;
|
|
|
|
dec->ts_info[idx].idx = idx;
|
2012-04-03 09:52:05 +00:00
|
|
|
dec->ts_info[idx].dts = dts;
|
|
|
|
dec->ts_info[idx].pts = pts;
|
2010-10-06 14:00:05 +00:00
|
|
|
dec->ts_info[idx].duration = duration;
|
|
|
|
dec->ts_info[idx].offset = offset;
|
|
|
|
dec->ts_idx = (idx + 1) & MAX_TS_MASK;
|
|
|
|
|
|
|
|
return &dec->ts_info[idx];
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GstTSInfo *
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ts_info_get (GstFFMpegAudDec * dec, gint idx)
|
2010-10-06 14:00:05 +00:00
|
|
|
{
|
|
|
|
if (G_UNLIKELY (idx < 0 || idx > MAX_TS_MASK))
|
|
|
|
return GST_TS_INFO_NONE;
|
|
|
|
|
|
|
|
return &dec->ts_info[idx];
|
|
|
|
}
|
|
|
|
|
2002-11-06 23:53:46 +00:00
|
|
|
#define GST_TYPE_FFMPEGDEC \
|
2012-04-07 09:14:45 +00:00
|
|
|
(gst_ffmpegauddec_get_type())
|
2002-11-06 23:53:46 +00:00
|
|
|
#define GST_FFMPEGDEC(obj) \
|
2012-04-07 09:14:45 +00:00
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGDEC,GstFFMpegAudDec))
|
|
|
|
#define GST_FFMPEGAUDDEC_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGDEC,GstFFMpegAudDecClass))
|
2002-11-06 23:53:46 +00:00
|
|
|
#define GST_IS_FFMPEGDEC(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGDEC))
|
2012-04-07 09:14:45 +00:00
|
|
|
#define GST_IS_FFMPEGAUDDEC_CLASS(klass) \
|
2002-11-06 23:53:46 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGDEC))
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2007-02-16 11:48:15 +00:00
|
|
|
/* A number of function prototypes are given so we can refer to them later. */
|
2012-04-07 09:14:45 +00:00
|
|
|
static void gst_ffmpegauddec_base_init (GstFFMpegAudDecClass * klass);
|
|
|
|
static void gst_ffmpegauddec_class_init (GstFFMpegAudDecClass * klass);
|
|
|
|
static void gst_ffmpegauddec_init (GstFFMpegAudDec * ffmpegdec);
|
|
|
|
static void gst_ffmpegauddec_finalize (GObject * object);
|
2003-06-07 00:41:32 +00:00
|
|
|
|
2012-06-14 10:41:34 +00:00
|
|
|
static gboolean gst_ffmpegauddec_setcaps (GstFFMpegAudDec * ffmpegdec,
|
|
|
|
GstCaps * caps);
|
|
|
|
static gboolean gst_ffmpegauddec_sink_event (GstPad * pad, GstObject * parent,
|
2011-11-17 11:49:33 +00:00
|
|
|
GstEvent * event);
|
2012-06-14 10:41:34 +00:00
|
|
|
static gboolean gst_ffmpegauddec_sink_query (GstPad * pad, GstObject * parent,
|
2012-03-12 12:50:46 +00:00
|
|
|
GstQuery * query);
|
2012-06-14 10:41:34 +00:00
|
|
|
static GstFlowReturn gst_ffmpegauddec_chain (GstPad * pad, GstObject * parent,
|
2011-11-17 11:49:33 +00:00
|
|
|
GstBuffer * buf);
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
static GstStateChangeReturn gst_ffmpegauddec_change_state (GstElement * element,
|
2005-09-05 14:06:29 +00:00
|
|
|
GstStateChange transition);
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
static gboolean gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec,
|
2009-05-12 09:16:43 +00:00
|
|
|
gboolean force);
|
2005-05-06 07:47:50 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
static void gst_ffmpegauddec_drain (GstFFMpegAudDec * ffmpegdec);
|
2009-06-09 14:34:04 +00:00
|
|
|
|
2012-04-12 17:41:52 +00:00
|
|
|
#define GST_FFDEC_PARAMS_QDATA g_quark_from_static_string("avdec-params")
|
2007-02-16 11:48:15 +00:00
|
|
|
|
2001-12-23 13:25:04 +00:00
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
|
2003-11-02 13:12:14 +00:00
|
|
|
static void
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_base_init (GstFFMpegAudDecClass * klass)
|
2003-11-02 13:12:14 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
GstPadTemplate *sinktempl, *srctempl;
|
2009-10-22 20:27:28 +00:00
|
|
|
GstCaps *sinkcaps, *srccaps;
|
|
|
|
AVCodec *in_plugin;
|
2012-04-07 09:14:45 +00:00
|
|
|
gchar *longname, *description;
|
2003-11-02 13:12:14 +00:00
|
|
|
|
2009-11-02 08:05:13 +00:00
|
|
|
in_plugin =
|
|
|
|
(AVCodec *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
|
2007-02-16 11:48:15 +00:00
|
|
|
GST_FFDEC_PARAMS_QDATA);
|
2009-11-02 08:05:13 +00:00
|
|
|
g_assert (in_plugin != NULL);
|
2009-10-22 20:27:28 +00:00
|
|
|
|
2003-11-02 13:12:14 +00:00
|
|
|
/* construct the element details struct */
|
2012-04-12 17:41:52 +00:00
|
|
|
longname = g_strdup_printf ("libav %s decoder", in_plugin->long_name);
|
|
|
|
description = g_strdup_printf ("libav %s decoder", in_plugin->name);
|
2012-04-09 23:59:24 +00:00
|
|
|
gst_element_class_set_metadata (element_class, longname,
|
2012-04-07 09:14:45 +00:00
|
|
|
"Codec/Decoder/Audio", description,
|
2010-03-24 10:51:26 +00:00
|
|
|
"Wim Taymans <wim.taymans@gmail.com>, "
|
2007-12-17 12:43:06 +00:00
|
|
|
"Ronald Bultje <rbultje@ronald.bitfreak.net>, "
|
2010-03-24 10:51:26 +00:00
|
|
|
"Edward Hervey <bilboed@bilboed.com>");
|
|
|
|
g_free (longname);
|
|
|
|
g_free (description);
|
2003-11-02 13:12:14 +00:00
|
|
|
|
2009-10-22 20:27:28 +00:00
|
|
|
/* get the caps */
|
|
|
|
sinkcaps = gst_ffmpeg_codecid_to_caps (in_plugin->id, NULL, FALSE);
|
|
|
|
if (!sinkcaps) {
|
|
|
|
GST_DEBUG ("Couldn't get sink caps for decoder '%s'", in_plugin->name);
|
|
|
|
sinkcaps = gst_caps_from_string ("unknown/unknown");
|
|
|
|
}
|
2012-04-07 09:14:45 +00:00
|
|
|
srccaps = gst_ffmpeg_codectype_to_audio_caps (NULL,
|
|
|
|
in_plugin->id, FALSE, in_plugin);
|
2009-10-22 20:27:28 +00:00
|
|
|
if (!srccaps) {
|
|
|
|
GST_DEBUG ("Couldn't get source caps for decoder '%s'", in_plugin->name);
|
|
|
|
srccaps = gst_caps_from_string ("unknown/unknown");
|
|
|
|
}
|
|
|
|
|
2003-11-02 13:12:14 +00:00
|
|
|
/* pad templates */
|
|
|
|
sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK,
|
2009-10-22 20:27:28 +00:00
|
|
|
GST_PAD_ALWAYS, sinkcaps);
|
|
|
|
srctempl = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, srccaps);
|
2003-11-02 13:12:14 +00:00
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class, srctempl);
|
|
|
|
gst_element_class_add_pad_template (element_class, sinktempl);
|
|
|
|
|
2009-10-22 20:27:28 +00:00
|
|
|
klass->in_plugin = in_plugin;
|
2003-11-02 13:12:14 +00:00
|
|
|
klass->srctempl = srctempl;
|
|
|
|
klass->sinktempl = sinktempl;
|
|
|
|
}
|
|
|
|
|
2001-12-23 13:25:04 +00:00
|
|
|
static void
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_class_init (GstFFMpegAudDecClass * klass)
|
2001-12-23 13:25:04 +00:00
|
|
|
{
|
2005-01-31 10:45:20 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2003-11-04 22:31:05 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
gobject_class->finalize = gst_ffmpegauddec_finalize;
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
gstelement_class->change_state = gst_ffmpegauddec_change_state;
|
2003-06-07 00:41:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_init (GstFFMpegAudDec * ffmpegdec)
|
2003-06-07 00:41:32 +00:00
|
|
|
{
|
2012-04-07 09:14:45 +00:00
|
|
|
GstFFMpegAudDecClass *oclass;
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
2003-06-07 00:41:32 +00:00
|
|
|
|
|
|
|
/* setup pads */
|
|
|
|
ffmpegdec->sinkpad = gst_pad_new_from_template (oclass->sinktempl, "sink");
|
2012-03-12 12:50:46 +00:00
|
|
|
gst_pad_set_query_function (ffmpegdec->sinkpad,
|
2012-06-14 10:41:34 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_ffmpegauddec_sink_query));
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
gst_pad_set_event_function (ffmpegdec->sinkpad,
|
2012-04-07 09:14:45 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_ffmpegauddec_sink_event));
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
gst_pad_set_chain_function (ffmpegdec->sinkpad,
|
2012-04-07 09:14:45 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_ffmpegauddec_chain));
|
ext/ffmpeg/: Add simple query functions. Seeking is only cosmetic, it's not actually filled in yet (in ffmpegdec).
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_negotiate), (gst_ffmpegdec_chain):
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_loop):
Add simple query functions. Seeking is only cosmetic, it's not
actually filled in yet (in ffmpegdec).
2005-01-18 21:33:42 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (ffmpegdec), ffmpegdec->sinkpad);
|
|
|
|
|
2003-06-07 00:41:32 +00:00
|
|
|
ffmpegdec->srcpad = gst_pad_new_from_template (oclass->srctempl, "src");
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
gst_pad_use_fixed_caps (ffmpegdec->srcpad);
|
2003-06-07 00:41:32 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (ffmpegdec), ffmpegdec->srcpad);
|
|
|
|
|
|
|
|
/* some ffmpeg data */
|
2004-03-29 16:39:18 +00:00
|
|
|
ffmpegdec->context = avcodec_alloc_context ();
|
2004-12-17 13:08:13 +00:00
|
|
|
ffmpegdec->pctx = NULL;
|
|
|
|
ffmpegdec->pcache = NULL;
|
2003-06-07 00:41:32 +00:00
|
|
|
ffmpegdec->opened = FALSE;
|
2009-05-13 10:37:42 +00:00
|
|
|
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
gst_segment_init (&ffmpegdec->segment, GST_FORMAT_TIME);
|
2003-06-07 00:41:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_finalize (GObject * object)
|
2003-06-07 00:41:32 +00:00
|
|
|
{
|
2012-04-07 09:14:45 +00:00
|
|
|
GstFFMpegAudDec *ffmpegdec = (GstFFMpegAudDec *) object;
|
2003-11-04 22:31:05 +00:00
|
|
|
|
2011-04-29 16:35:55 +00:00
|
|
|
if (ffmpegdec->context != NULL)
|
2008-08-29 09:59:29 +00:00
|
|
|
av_free (ffmpegdec->context);
|
2008-10-15 11:28:05 +00:00
|
|
|
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2001-12-23 13:25:04 +00:00
|
|
|
}
|
|
|
|
|
2010-10-07 15:46:22 +00:00
|
|
|
static void
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_reset_ts (GstFFMpegAudDec * ffmpegdec)
|
2010-10-07 15:46:22 +00:00
|
|
|
{
|
|
|
|
ffmpegdec->next_out = GST_CLOCK_TIME_NONE;
|
|
|
|
}
|
|
|
|
|
2006-03-22 11:36:38 +00:00
|
|
|
/* with LOCK */
|
ext/ffmpeg/gstffmpegcodecmap.*: Change some function names to reflect that they don't really _return_ something, but ...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette),
(gst_ffmpeg_set_palette), (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_caps_with_codectype),
(gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Change some function names to reflect that they don't really
_return_ something, but rather _use_ something to fill a
AVCodecContext. s/to/with/. Restructure the extradata handling,
it's now not picking up the type from the caps but rather
using the type as provided in the function. This is a lot
cleaner. Implement MS RLE palette pickup.
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_pad_link):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
Sync with the above function name changes.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_open), (gst_ffmpegdec_connect),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state):
Add some hacks to convert palette-based raw image formats to
RGBA32. Ugly, but I don't know how else to handle palette-based
RGB, since img_convert() (and thus ffcolorspace) doesn't accept
a palette as argument.
2004-04-16 01:28:36 +00:00
|
|
|
static void
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_close (GstFFMpegAudDec * ffmpegdec)
|
ext/ffmpeg/gstffmpegcodecmap.*: Change some function names to reflect that they don't really _return_ something, but ...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette),
(gst_ffmpeg_set_palette), (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_caps_with_codectype),
(gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Change some function names to reflect that they don't really
_return_ something, but rather _use_ something to fill a
AVCodecContext. s/to/with/. Restructure the extradata handling,
it's now not picking up the type from the caps but rather
using the type as provided in the function. This is a lot
cleaner. Implement MS RLE palette pickup.
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_pad_link):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
Sync with the above function name changes.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_open), (gst_ffmpegdec_connect),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state):
Add some hacks to convert palette-based raw image formats to
RGBA32. Ugly, but I don't know how else to handle palette-based
RGB, since img_convert() (and thus ffcolorspace) doesn't accept
a palette as argument.
2004-04-16 01:28:36 +00:00
|
|
|
{
|
|
|
|
if (!ffmpegdec->opened)
|
2006-03-22 11:36:38 +00:00
|
|
|
return;
|
ext/ffmpeg/gstffmpegcodecmap.*: Change some function names to reflect that they don't really _return_ something, but ...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette),
(gst_ffmpeg_set_palette), (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_caps_with_codectype),
(gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Change some function names to reflect that they don't really
_return_ something, but rather _use_ something to fill a
AVCodecContext. s/to/with/. Restructure the extradata handling,
it's now not picking up the type from the caps but rather
using the type as provided in the function. This is a lot
cleaner. Implement MS RLE palette pickup.
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_pad_link):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
Sync with the above function name changes.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_open), (gst_ffmpegdec_connect),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state):
Add some hacks to convert palette-based raw image formats to
RGBA32. Ugly, but I don't know how else to handle palette-based
RGB, since img_convert() (and thus ffcolorspace) doesn't accept
a palette as argument.
2004-04-16 01:28:36 +00:00
|
|
|
|
2012-06-14 10:41:34 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "closing libav codec");
|
ext/ffmpeg/gstffmpegdec.c: Reenable pad_alloc, seem to work now.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_close), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer), (get_output_buffer),
(gst_ffmpegdec_video_frame), (gst_ffmpegdec_audio_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_set_property), (gst_ffmpegdec_get_property):
Reenable pad_alloc, seem to work now.
Added property to easily disable it later on.
Remove some old code that tried hard to break the get_buffer
functions. Fixes #321662.
2008-01-22 16:32:23 +00:00
|
|
|
|
2011-12-11 05:25:23 +00:00
|
|
|
gst_caps_replace (&ffmpegdec->last_caps, NULL);
|
|
|
|
|
2004-09-20 12:29:03 +00:00
|
|
|
if (ffmpegdec->context->priv_data)
|
2005-12-16 16:23:05 +00:00
|
|
|
gst_ffmpeg_avcodec_close (ffmpegdec->context);
|
ext/ffmpeg/gstffmpegcodecmap.*: Change some function names to reflect that they don't really _return_ something, but ...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette),
(gst_ffmpeg_set_palette), (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_caps_with_codectype),
(gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Change some function names to reflect that they don't really
_return_ something, but rather _use_ something to fill a
AVCodecContext. s/to/with/. Restructure the extradata handling,
it's now not picking up the type from the caps but rather
using the type as provided in the function. This is a lot
cleaner. Implement MS RLE palette pickup.
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_pad_link):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
Sync with the above function name changes.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_open), (gst_ffmpegdec_connect),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state):
Add some hacks to convert palette-based raw image formats to
RGBA32. Ugly, but I don't know how else to handle palette-based
RGB, since img_convert() (and thus ffcolorspace) doesn't accept
a palette as argument.
2004-04-16 01:28:36 +00:00
|
|
|
ffmpegdec->opened = FALSE;
|
|
|
|
|
|
|
|
if (ffmpegdec->context->palctrl) {
|
|
|
|
av_free (ffmpegdec->context->palctrl);
|
|
|
|
ffmpegdec->context->palctrl = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ffmpegdec->context->extradata) {
|
|
|
|
av_free (ffmpegdec->context->extradata);
|
|
|
|
ffmpegdec->context->extradata = NULL;
|
|
|
|
}
|
2004-12-17 13:08:13 +00:00
|
|
|
|
|
|
|
if (ffmpegdec->pctx) {
|
|
|
|
if (ffmpegdec->pcache) {
|
|
|
|
gst_buffer_unref (ffmpegdec->pcache);
|
|
|
|
ffmpegdec->pcache = NULL;
|
|
|
|
}
|
|
|
|
av_parser_close (ffmpegdec->pctx);
|
|
|
|
ffmpegdec->pctx = NULL;
|
|
|
|
}
|
ext/ffmpeg/gstffmpegcodecmap.*: Change some function names to reflect that they don't really _return_ something, but ...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette),
(gst_ffmpeg_set_palette), (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_caps_with_codectype),
(gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Change some function names to reflect that they don't really
_return_ something, but rather _use_ something to fill a
AVCodecContext. s/to/with/. Restructure the extradata handling,
it's now not picking up the type from the caps but rather
using the type as provided in the function. This is a lot
cleaner. Implement MS RLE palette pickup.
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_pad_link):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
Sync with the above function name changes.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_open), (gst_ffmpegdec_connect),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state):
Add some hacks to convert palette-based raw image formats to
RGBA32. Ugly, but I don't know how else to handle palette-based
RGB, since img_convert() (and thus ffcolorspace) doesn't accept
a palette as argument.
2004-04-16 01:28:36 +00:00
|
|
|
}
|
|
|
|
|
2006-03-22 11:36:38 +00:00
|
|
|
/* with LOCK */
|
ext/ffmpeg/gstffmpegcodecmap.*: Change some function names to reflect that they don't really _return_ something, but ...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette),
(gst_ffmpeg_set_palette), (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_caps_with_codectype),
(gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Change some function names to reflect that they don't really
_return_ something, but rather _use_ something to fill a
AVCodecContext. s/to/with/. Restructure the extradata handling,
it's now not picking up the type from the caps but rather
using the type as provided in the function. This is a lot
cleaner. Implement MS RLE palette pickup.
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_pad_link):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
Sync with the above function name changes.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_open), (gst_ffmpegdec_connect),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state):
Add some hacks to convert palette-based raw image formats to
RGBA32. Ugly, but I don't know how else to handle palette-based
RGB, since img_convert() (and thus ffcolorspace) doesn't accept
a palette as argument.
2004-04-16 01:28:36 +00:00
|
|
|
static gboolean
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_open (GstFFMpegAudDec * ffmpegdec)
|
ext/ffmpeg/gstffmpegcodecmap.*: Change some function names to reflect that they don't really _return_ something, but ...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette),
(gst_ffmpeg_set_palette), (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_caps_with_codectype),
(gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Change some function names to reflect that they don't really
_return_ something, but rather _use_ something to fill a
AVCodecContext. s/to/with/. Restructure the extradata handling,
it's now not picking up the type from the caps but rather
using the type as provided in the function. This is a lot
cleaner. Implement MS RLE palette pickup.
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_pad_link):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
Sync with the above function name changes.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_open), (gst_ffmpegdec_connect),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state):
Add some hacks to convert palette-based raw image formats to
RGBA32. Ugly, but I don't know how else to handle palette-based
RGB, since img_convert() (and thus ffcolorspace) doesn't accept
a palette as argument.
2004-04-16 01:28:36 +00:00
|
|
|
{
|
2012-04-07 09:14:45 +00:00
|
|
|
GstFFMpegAudDecClass *oclass;
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
ext/ffmpeg/gstffmpegcodecmap.*: Change some function names to reflect that they don't really _return_ something, but ...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette),
(gst_ffmpeg_set_palette), (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_caps_with_codectype),
(gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Change some function names to reflect that they don't really
_return_ something, but rather _use_ something to fill a
AVCodecContext. s/to/with/. Restructure the extradata handling,
it's now not picking up the type from the caps but rather
using the type as provided in the function. This is a lot
cleaner. Implement MS RLE palette pickup.
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_pad_link):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
Sync with the above function name changes.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_open), (gst_ffmpegdec_connect),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state):
Add some hacks to convert palette-based raw image formats to
RGBA32. Ugly, but I don't know how else to handle palette-based
RGB, since img_convert() (and thus ffcolorspace) doesn't accept
a palette as argument.
2004-04-16 01:28:36 +00:00
|
|
|
|
2005-12-16 16:23:05 +00:00
|
|
|
if (gst_ffmpeg_avcodec_open (ffmpegdec->context, oclass->in_plugin) < 0)
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
goto could_not_open;
|
|
|
|
|
ext/ffmpeg/gstffmpegcodecmap.*: Change some function names to reflect that they don't really _return_ something, but ...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette),
(gst_ffmpeg_set_palette), (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_caps_with_codectype),
(gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Change some function names to reflect that they don't really
_return_ something, but rather _use_ something to fill a
AVCodecContext. s/to/with/. Restructure the extradata handling,
it's now not picking up the type from the caps but rather
using the type as provided in the function. This is a lot
cleaner. Implement MS RLE palette pickup.
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_pad_link):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
Sync with the above function name changes.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_open), (gst_ffmpegdec_connect),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state):
Add some hacks to convert palette-based raw image formats to
RGBA32. Ugly, but I don't know how else to handle palette-based
RGB, since img_convert() (and thus ffcolorspace) doesn't accept
a palette as argument.
2004-04-16 01:28:36 +00:00
|
|
|
ffmpegdec->opened = TRUE;
|
|
|
|
|
2012-06-14 10:41:34 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "Opened libav codec %s, id %d",
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
oclass->in_plugin->name, oclass->in_plugin->id);
|
2005-01-19 15:34:14 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
if (!ffmpegdec->turnoff_parser) {
|
|
|
|
ffmpegdec->pctx = av_parser_init (oclass->in_plugin->id);
|
|
|
|
if (ffmpegdec->pctx)
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "Using parser %p", ffmpegdec->pctx);
|
|
|
|
else
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "No parser for codec");
|
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "Parser deactivated for format");
|
2005-01-19 15:34:14 +00:00
|
|
|
}
|
2004-12-17 13:08:13 +00:00
|
|
|
|
2012-06-14 10:41:34 +00:00
|
|
|
ffmpegdec->samplerate = 0;
|
|
|
|
ffmpegdec->channels = 0;
|
|
|
|
ffmpegdec->depth = 0;
|
2007-05-02 16:06:09 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_reset_ts (ffmpegdec);
|
ext/ffmpeg/: Add simple query functions. Seeking is only cosmetic, it's not actually filled in yet (in ffmpegdec).
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_negotiate), (gst_ffmpegdec_chain):
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_loop):
Add simple query functions. Seeking is only cosmetic, it's not
actually filled in yet (in ffmpegdec).
2005-01-18 21:33:42 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegcodecmap.*: Change some function names to reflect that they don't really _return_ something, but ...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette),
(gst_ffmpeg_set_palette), (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_caps_with_codectype),
(gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Change some function names to reflect that they don't really
_return_ something, but rather _use_ something to fill a
AVCodecContext. s/to/with/. Restructure the extradata handling,
it's now not picking up the type from the caps but rather
using the type as provided in the function. This is a lot
cleaner. Implement MS RLE palette pickup.
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_pad_link):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
Sync with the above function name changes.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_open), (gst_ffmpegdec_connect),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state):
Add some hacks to convert palette-based raw image formats to
RGBA32. Ugly, but I don't know how else to handle palette-based
RGB, since img_convert() (and thus ffcolorspace) doesn't accept
a palette as argument.
2004-04-16 01:28:36 +00:00
|
|
|
return TRUE;
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
could_not_open:
|
|
|
|
{
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_close (ffmpegdec);
|
2012-06-14 10:41:34 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "avdec_%s: Failed to open libav codec",
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
oclass->in_plugin->name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
ext/ffmpeg/gstffmpegcodecmap.*: Change some function names to reflect that they don't really _return_ something, but ...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette),
(gst_ffmpeg_set_palette), (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_caps_with_codectype),
(gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Change some function names to reflect that they don't really
_return_ something, but rather _use_ something to fill a
AVCodecContext. s/to/with/. Restructure the extradata handling,
it's now not picking up the type from the caps but rather
using the type as provided in the function. This is a lot
cleaner. Implement MS RLE palette pickup.
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_pad_link):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
Sync with the above function name changes.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_open), (gst_ffmpegdec_connect),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state):
Add some hacks to convert palette-based raw image formats to
RGBA32. Ugly, but I don't know how else to handle palette-based
RGB, since img_convert() (and thus ffcolorspace) doesn't accept
a palette as argument.
2004-04-16 01:28:36 +00:00
|
|
|
}
|
|
|
|
|
2007-10-10 09:31:32 +00:00
|
|
|
static gboolean
|
2012-06-14 10:41:34 +00:00
|
|
|
gst_ffmpegauddec_setcaps (GstFFMpegAudDec * ffmpegdec, GstCaps * caps)
|
2001-12-23 13:25:04 +00:00
|
|
|
{
|
2012-04-07 09:14:45 +00:00
|
|
|
GstFFMpegAudDecClass *oclass;
|
2004-07-21 09:20:55 +00:00
|
|
|
GstStructure *structure;
|
2005-11-28 11:25:56 +00:00
|
|
|
gboolean ret = TRUE;
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
|
2011-06-02 16:39:07 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "setcaps called");
|
2005-09-19 13:45:38 +00:00
|
|
|
|
2006-03-22 11:36:38 +00:00
|
|
|
GST_OBJECT_LOCK (ffmpegdec);
|
|
|
|
|
2003-06-07 00:41:32 +00:00
|
|
|
/* close old session */
|
2009-06-09 14:34:04 +00:00
|
|
|
if (ffmpegdec->opened) {
|
|
|
|
GST_OBJECT_UNLOCK (ffmpegdec);
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_drain (ffmpegdec);
|
2009-06-09 14:34:04 +00:00
|
|
|
GST_OBJECT_LOCK (ffmpegdec);
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_close (ffmpegdec);
|
2002-06-03 22:48:11 +00:00
|
|
|
|
2009-11-09 18:19:25 +00:00
|
|
|
/* and reset the defaults that were set when a context is created */
|
|
|
|
avcodec_get_context_defaults (ffmpegdec->context);
|
|
|
|
}
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2010-03-08 18:00:05 +00:00
|
|
|
/* default is to let format decide if it needs a parser */
|
|
|
|
ffmpegdec->turnoff_parser = FALSE;
|
|
|
|
|
2003-06-07 20:45:13 +00:00
|
|
|
/* get size and so */
|
ext/ffmpeg/gstffmpegcodecmap.*: Change some function names to reflect that they don't really _return_ something, but ...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_get_palette),
(gst_ffmpeg_set_palette), (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_caps_with_codectype),
(gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Change some function names to reflect that they don't really
_return_ something, but rather _use_ something to fill a
AVCodecContext. s/to/with/. Restructure the extradata handling,
it's now not picking up the type from the caps but rather
using the type as provided in the function. This is a lot
cleaner. Implement MS RLE palette pickup.
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_pad_link):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
Sync with the above function name changes.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_close),
(gst_ffmpegdec_open), (gst_ffmpegdec_connect),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state):
Add some hacks to convert palette-based raw image formats to
RGBA32. Ugly, but I don't know how else to handle palette-based
RGB, since img_convert() (and thus ffcolorspace) doesn't accept
a palette as argument.
2004-04-16 01:28:36 +00:00
|
|
|
gst_ffmpeg_caps_with_codecid (oclass->in_plugin->id,
|
|
|
|
oclass->in_plugin->type, caps, ffmpegdec->context);
|
2005-09-19 13:45:38 +00:00
|
|
|
|
2004-07-21 09:20:55 +00:00
|
|
|
/* get pixel aspect ratio if it's set */
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
2007-05-25 10:41:56 +00:00
|
|
|
|
2011-05-25 08:08:06 +00:00
|
|
|
/* for AAC we only use av_parse if not on stream-format==raw or ==loas */
|
|
|
|
if (oclass->in_plugin->id == CODEC_ID_AAC
|
|
|
|
|| oclass->in_plugin->id == CODEC_ID_AAC_LATM) {
|
2010-03-08 18:00:05 +00:00
|
|
|
const gchar *format = gst_structure_get_string (structure, "stream-format");
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
|
2011-05-26 13:09:18 +00:00
|
|
|
if (format == NULL || strcmp (format, "raw") == 0) {
|
2010-03-08 18:00:05 +00:00
|
|
|
ffmpegdec->turnoff_parser = TRUE;
|
|
|
|
}
|
|
|
|
}
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
|
2011-09-26 18:55:54 +00:00
|
|
|
/* for FLAC, don't parse if it's already parsed */
|
|
|
|
if (oclass->in_plugin->id == CODEC_ID_FLAC) {
|
|
|
|
if (gst_structure_has_field (structure, "streamheader"))
|
|
|
|
ffmpegdec->turnoff_parser = TRUE;
|
2008-03-05 17:02:33 +00:00
|
|
|
}
|
|
|
|
|
2004-09-20 12:29:03 +00:00
|
|
|
/* workaround encoder bugs */
|
|
|
|
ffmpegdec->context->workaround_bugs |= FF_BUG_AUTODETECT;
|
2008-10-30 12:05:45 +00:00
|
|
|
ffmpegdec->context->error_recognition = 1;
|
2007-04-12 10:56:42 +00:00
|
|
|
|
2003-06-07 00:41:32 +00:00
|
|
|
/* open codec - we don't select an output pix_fmt yet,
|
|
|
|
* simply because we don't know! We only get it
|
|
|
|
* during playback... */
|
2012-04-07 09:14:45 +00:00
|
|
|
if (!gst_ffmpegauddec_open (ffmpegdec))
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
goto open_failed;
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
done:
|
|
|
|
GST_OBJECT_UNLOCK (ffmpegdec);
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
return ret;
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
/* ERRORS */
|
|
|
|
open_failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "Failed to open");
|
2005-11-28 11:25:56 +00:00
|
|
|
ret = FALSE;
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
goto done;
|
2004-12-16 12:47:43 +00:00
|
|
|
}
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
}
|
|
|
|
|
2004-12-16 12:47:43 +00:00
|
|
|
static gboolean
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec, gboolean force)
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
{
|
2012-04-07 09:14:45 +00:00
|
|
|
GstFFMpegAudDecClass *oclass;
|
2004-12-16 12:47:43 +00:00
|
|
|
GstCaps *caps;
|
2012-04-07 09:14:45 +00:00
|
|
|
gint depth;
|
2012-06-14 10:41:34 +00:00
|
|
|
GstAudioChannelPosition pos[64] = { 0, };
|
2008-01-26 15:20:10 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
ext/ffmpeg/gstffmpegdec.c: Reenable pad_alloc, seem to work now.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_close), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer), (get_output_buffer),
(gst_ffmpegdec_video_frame), (gst_ffmpegdec_audio_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_set_property), (gst_ffmpegdec_get_property):
Reenable pad_alloc, seem to work now.
Added property to easily disable it later on.
Remove some old code that tried hard to break the get_buffer
functions. Fixes #321662.
2008-01-22 16:32:23 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
depth = av_smp_format_depth (ffmpegdec->context->sample_fmt);
|
2012-06-14 10:41:34 +00:00
|
|
|
gst_ffmpeg_channel_layout_to_gst (ffmpegdec->context, pos);
|
|
|
|
|
|
|
|
if (!force && ffmpegdec->samplerate ==
|
2012-04-07 09:14:45 +00:00
|
|
|
ffmpegdec->context->sample_rate &&
|
2012-06-14 10:41:34 +00:00
|
|
|
ffmpegdec->channels == ffmpegdec->context->channels &&
|
|
|
|
ffmpegdec->depth == depth)
|
2012-04-07 09:14:45 +00:00
|
|
|
return TRUE;
|
2010-02-04 12:26:16 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec,
|
|
|
|
"Renegotiating audio from %dHz@%dchannels (%d) to %dHz@%dchannels (%d)",
|
2012-06-14 10:41:34 +00:00
|
|
|
ffmpegdec->samplerate, ffmpegdec->channels,
|
|
|
|
ffmpegdec->depth,
|
2012-04-07 09:14:45 +00:00
|
|
|
ffmpegdec->context->sample_rate, ffmpegdec->context->channels, depth);
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
|
2012-06-14 10:41:34 +00:00
|
|
|
ffmpegdec->samplerate = ffmpegdec->context->sample_rate;
|
|
|
|
ffmpegdec->channels = ffmpegdec->context->channels;
|
|
|
|
ffmpegdec->depth = depth;
|
|
|
|
memcpy (ffmpegdec->ffmpeg_layout, pos,
|
|
|
|
sizeof (GstAudioChannelPosition) * ffmpegdec->context->channels);
|
2011-04-04 11:18:13 +00:00
|
|
|
|
2012-06-14 10:41:34 +00:00
|
|
|
/* Get GStreamer channel layout */
|
|
|
|
memcpy (ffmpegdec->gst_layout,
|
|
|
|
ffmpegdec->ffmpeg_layout,
|
|
|
|
sizeof (GstAudioChannelPosition) * ffmpegdec->channels);
|
|
|
|
gst_audio_channel_positions_to_valid_order (ffmpegdec->gst_layout,
|
|
|
|
ffmpegdec->channels);
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
|
2004-12-16 12:47:43 +00:00
|
|
|
caps = gst_ffmpeg_codectype_to_caps (oclass->in_plugin->type,
|
2008-10-08 14:20:37 +00:00
|
|
|
ffmpegdec->context, oclass->in_plugin->id, FALSE);
|
2011-07-29 11:40:30 +00:00
|
|
|
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
if (caps == NULL)
|
|
|
|
goto no_caps;
|
2011-07-29 11:40:30 +00:00
|
|
|
|
2012-06-14 10:41:34 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "output caps %" GST_PTR_FORMAT, caps);
|
2008-11-05 17:05:46 +00:00
|
|
|
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
if (!gst_pad_set_caps (ffmpegdec->srcpad, caps))
|
|
|
|
goto caps_failed;
|
2008-11-05 17:05:46 +00:00
|
|
|
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
gst_caps_unref (caps);
|
2008-03-06 14:47:57 +00:00
|
|
|
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
return TRUE;
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
/* ERRORS */
|
|
|
|
no_caps:
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
{
|
2012-06-14 10:41:34 +00:00
|
|
|
#ifdef HAVE_LIBAV_UNINSTALLED
|
2011-01-31 23:28:33 +00:00
|
|
|
/* using internal ffmpeg snapshot */
|
|
|
|
GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION,
|
2012-06-14 10:41:34 +00:00
|
|
|
("Could not find GStreamer caps mapping for libav codec '%s'.",
|
2011-01-31 23:28:33 +00:00
|
|
|
oclass->in_plugin->name), (NULL));
|
|
|
|
#else
|
|
|
|
/* using external ffmpeg */
|
|
|
|
GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION,
|
2012-06-14 10:41:34 +00:00
|
|
|
("Could not find GStreamer caps mapping for libav codec '%s', and "
|
2011-01-31 23:28:33 +00:00
|
|
|
"you are using an external libavcodec. This is most likely due to "
|
|
|
|
"a packaging problem and/or libavcodec having been upgraded to a "
|
|
|
|
"version that is not compatible with this version of "
|
2012-06-14 10:41:34 +00:00
|
|
|
"gstreamer-libav. Make sure your gstreamer-libav and libavcodec "
|
2011-01-31 23:28:33 +00:00
|
|
|
"packages come from the same source/repository.",
|
|
|
|
oclass->in_plugin->name), (NULL));
|
|
|
|
#endif
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
return FALSE;
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
}
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
caps_failed:
|
2011-07-29 11:40:30 +00:00
|
|
|
{
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION, (NULL),
|
2012-06-14 10:41:34 +00:00
|
|
|
("Could not set caps for libav decoder (%s), not fixed?",
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
oclass->in_plugin->name));
|
|
|
|
gst_caps_unref (caps);
|
2004-12-16 12:47:43 +00:00
|
|
|
|
|
|
|
return FALSE;
|
2011-07-29 11:40:30 +00:00
|
|
|
}
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
}
|
|
|
|
|
2008-01-16 17:35:58 +00:00
|
|
|
static void
|
2012-04-07 09:14:45 +00:00
|
|
|
clear_queued (GstFFMpegAudDec * ffmpegdec)
|
2008-01-16 17:35:58 +00:00
|
|
|
{
|
|
|
|
g_list_foreach (ffmpegdec->queued, (GFunc) gst_mini_object_unref, NULL);
|
|
|
|
g_list_free (ffmpegdec->queued);
|
|
|
|
ffmpegdec->queued = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2012-04-07 09:14:45 +00:00
|
|
|
flush_queued (GstFFMpegAudDec * ffmpegdec)
|
2008-01-16 17:35:58 +00:00
|
|
|
{
|
|
|
|
GstFlowReturn res = GST_FLOW_OK;
|
|
|
|
|
|
|
|
while (ffmpegdec->queued) {
|
|
|
|
GstBuffer *buf = GST_BUFFER_CAST (ffmpegdec->queued->data);
|
|
|
|
|
2009-04-09 22:19:50 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "pushing buffer %p, offset %"
|
2009-07-18 14:53:22 +00:00
|
|
|
G_GUINT64_FORMAT ", timestamp %"
|
2008-01-16 17:35:58 +00:00
|
|
|
GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT, buf,
|
2009-04-09 22:19:50 +00:00
|
|
|
GST_BUFFER_OFFSET (buf),
|
2008-01-16 17:35:58 +00:00
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
|
|
|
|
|
|
|
|
/* iterate ouput queue an push downstream */
|
|
|
|
res = gst_pad_push (ffmpegdec->srcpad, buf);
|
|
|
|
|
2008-01-26 15:20:10 +00:00
|
|
|
ffmpegdec->queued =
|
|
|
|
g_list_delete_link (ffmpegdec->queued, ffmpegdec->queued);
|
2008-01-16 17:35:58 +00:00
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2011-06-29 14:22:48 +00:00
|
|
|
static void
|
|
|
|
gst_avpacket_init (AVPacket * packet, guint8 * data, guint size)
|
2011-04-21 10:52:04 +00:00
|
|
|
{
|
2011-06-29 14:22:48 +00:00
|
|
|
memset (packet, 0, sizeof (AVPacket));
|
|
|
|
packet->data = data;
|
|
|
|
packet->size = size;
|
2011-04-21 10:52:04 +00:00
|
|
|
}
|
|
|
|
|
2006-08-29 09:28:20 +00:00
|
|
|
/* returns TRUE if buffer is within segment, else FALSE.
|
|
|
|
* if Buffer is on segment border, it's timestamp and duration will be clipped */
|
|
|
|
static gboolean
|
2012-04-07 09:14:45 +00:00
|
|
|
clip_audio_buffer (GstFFMpegAudDec * dec, GstBuffer * buf, GstClockTime in_ts,
|
2006-08-29 09:28:20 +00:00
|
|
|
GstClockTime in_dur)
|
|
|
|
{
|
|
|
|
GstClockTime stop;
|
2011-06-02 14:23:19 +00:00
|
|
|
gint64 diff;
|
|
|
|
guint64 ctime, cstop;
|
2006-08-29 09:28:20 +00:00
|
|
|
gboolean res = TRUE;
|
2011-04-04 11:18:13 +00:00
|
|
|
gsize size, offset;
|
|
|
|
|
|
|
|
size = gst_buffer_get_size (buf);
|
|
|
|
offset = 0;
|
2006-08-29 09:28:20 +00:00
|
|
|
|
|
|
|
GST_LOG_OBJECT (dec,
|
|
|
|
"timestamp:%" GST_TIME_FORMAT ", duration:%" GST_TIME_FORMAT
|
2011-04-04 11:18:13 +00:00
|
|
|
", size %" G_GSIZE_FORMAT, GST_TIME_ARGS (in_ts), GST_TIME_ARGS (in_dur),
|
|
|
|
size);
|
2006-08-29 09:28:20 +00:00
|
|
|
|
|
|
|
/* can't clip without TIME segment */
|
|
|
|
if (G_UNLIKELY (dec->segment.format != GST_FORMAT_TIME))
|
|
|
|
goto beach;
|
|
|
|
|
|
|
|
/* we need a start time */
|
|
|
|
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (in_ts)))
|
|
|
|
goto beach;
|
|
|
|
|
|
|
|
/* trust duration */
|
|
|
|
stop = in_ts + in_dur;
|
|
|
|
|
|
|
|
res = gst_segment_clip (&dec->segment, GST_FORMAT_TIME, in_ts, stop, &ctime,
|
2007-01-09 14:53:36 +00:00
|
|
|
&cstop);
|
2006-08-29 09:28:20 +00:00
|
|
|
if (G_UNLIKELY (!res))
|
|
|
|
goto out_of_segment;
|
|
|
|
|
|
|
|
/* see if some clipping happened */
|
|
|
|
if (G_UNLIKELY ((diff = ctime - in_ts) > 0)) {
|
|
|
|
/* bring clipped time to bytes */
|
|
|
|
diff =
|
2012-06-14 10:41:34 +00:00
|
|
|
gst_util_uint64_scale_int (diff, dec->samplerate,
|
|
|
|
GST_SECOND) * (dec->depth * dec->channels);
|
2006-08-29 09:28:20 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (dec, "clipping start to %" GST_TIME_FORMAT " %"
|
|
|
|
G_GINT64_FORMAT " bytes", GST_TIME_ARGS (ctime), diff);
|
|
|
|
|
2011-04-04 11:18:13 +00:00
|
|
|
offset += diff;
|
|
|
|
size -= diff;
|
2006-08-29 09:28:20 +00:00
|
|
|
}
|
|
|
|
if (G_UNLIKELY ((diff = stop - cstop) > 0)) {
|
|
|
|
/* bring clipped time to bytes */
|
|
|
|
diff =
|
2012-06-14 10:41:34 +00:00
|
|
|
gst_util_uint64_scale_int (diff, dec->samplerate,
|
|
|
|
GST_SECOND) * (dec->depth * dec->channels);
|
2006-08-29 09:28:20 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (dec, "clipping stop to %" GST_TIME_FORMAT " %"
|
|
|
|
G_GINT64_FORMAT " bytes", GST_TIME_ARGS (cstop), diff);
|
|
|
|
|
2011-04-04 11:18:13 +00:00
|
|
|
size -= diff;
|
2006-08-29 09:28:20 +00:00
|
|
|
}
|
2011-04-04 11:18:13 +00:00
|
|
|
gst_buffer_resize (buf, offset, size);
|
2006-08-29 09:28:20 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (buf) = ctime;
|
|
|
|
GST_BUFFER_DURATION (buf) = cstop - ctime;
|
|
|
|
|
|
|
|
beach:
|
|
|
|
GST_LOG_OBJECT (dec, "%sdropping", (res ? "not " : ""));
|
|
|
|
return res;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
out_of_segment:
|
|
|
|
{
|
|
|
|
GST_LOG_OBJECT (dec, "out of segment");
|
|
|
|
goto beach;
|
|
|
|
}
|
|
|
|
}
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
|
|
|
static gint
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_audio_frame (GstFFMpegAudDec * ffmpegdec,
|
2009-03-04 20:58:08 +00:00
|
|
|
AVCodec * in_plugin, guint8 * data, guint size,
|
2010-10-06 14:00:05 +00:00
|
|
|
const GstTSInfo * dec_info, GstBuffer ** outbuf, GstFlowReturn * ret)
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
{
|
|
|
|
gint len = -1;
|
2007-12-17 12:43:06 +00:00
|
|
|
gint have_data = AVCODEC_MAX_AUDIO_FRAME_SIZE;
|
2012-04-03 09:52:05 +00:00
|
|
|
GstClockTime out_pts, out_duration;
|
2012-01-24 13:40:37 +00:00
|
|
|
GstMapInfo map;
|
2010-10-06 14:00:05 +00:00
|
|
|
gint64 out_offset;
|
2011-04-04 11:18:13 +00:00
|
|
|
int16_t *odata;
|
2011-06-29 14:22:48 +00:00
|
|
|
AVPacket packet;
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec,
|
2012-04-03 09:52:05 +00:00
|
|
|
"size:%d, offset:%" G_GINT64_FORMAT ", dts:%" GST_TIME_FORMAT ", pts:%"
|
|
|
|
GST_TIME_FORMAT ", dur:%" GST_TIME_FORMAT ", ffmpegdec->next_out:%"
|
|
|
|
GST_TIME_FORMAT, size, dec_info->offset, GST_TIME_ARGS (dec_info->dts),
|
|
|
|
GST_TIME_ARGS (dec_info->pts), GST_TIME_ARGS (dec_info->duration),
|
|
|
|
GST_TIME_ARGS (ffmpegdec->next_out));
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
2011-06-02 14:23:19 +00:00
|
|
|
*outbuf = new_aligned_buffer (AVCODEC_MAX_AUDIO_FRAME_SIZE);
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
2012-01-24 13:40:37 +00:00
|
|
|
gst_buffer_map (*outbuf, &map, GST_MAP_WRITE);
|
|
|
|
odata = (int16_t *) map.data;
|
2011-04-29 16:40:36 +00:00
|
|
|
|
2011-06-29 14:22:48 +00:00
|
|
|
gst_avpacket_init (&packet, data, size);
|
2011-07-07 11:50:18 +00:00
|
|
|
len = avcodec_decode_audio3 (ffmpegdec->context, odata, &have_data, &packet);
|
2011-04-29 16:40:36 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec,
|
|
|
|
"Decode audio: len=%d, have_data=%d", len, have_data);
|
|
|
|
|
|
|
|
if (len >= 0 && have_data > 0) {
|
2012-01-10 09:37:50 +00:00
|
|
|
GstAudioFormat fmt;
|
|
|
|
|
2011-04-04 11:18:13 +00:00
|
|
|
/* Buffer size */
|
2012-01-24 13:40:37 +00:00
|
|
|
gst_buffer_unmap (*outbuf, &map);
|
|
|
|
gst_buffer_resize (*outbuf, 0, have_data);
|
2011-04-04 11:18:13 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "Creating output buffer");
|
2012-04-07 09:14:45 +00:00
|
|
|
if (!gst_ffmpegauddec_negotiate (ffmpegdec, FALSE)) {
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
gst_buffer_unref (*outbuf);
|
|
|
|
*outbuf = NULL;
|
|
|
|
len = -1;
|
|
|
|
goto beach;
|
|
|
|
}
|
|
|
|
|
2006-08-29 09:28:20 +00:00
|
|
|
/*
|
|
|
|
* Timestamps:
|
|
|
|
*
|
|
|
|
* 1) Copy input timestamp if valid
|
|
|
|
* 2) else interpolate from previous input timestamp
|
|
|
|
*/
|
|
|
|
/* always take timestamps from the input buffer if any */
|
2012-04-03 09:52:05 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (dec_info->pts)) {
|
|
|
|
out_pts = dec_info->pts;
|
2010-10-06 14:00:05 +00:00
|
|
|
} else {
|
2012-04-03 09:52:05 +00:00
|
|
|
out_pts = ffmpegdec->next_out;
|
2006-08-29 09:28:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Duration:
|
|
|
|
*
|
|
|
|
* 1) calculate based on number of samples
|
|
|
|
*/
|
2010-10-06 14:00:05 +00:00
|
|
|
out_duration = gst_util_uint64_scale (have_data, GST_SECOND,
|
2012-06-14 10:41:34 +00:00
|
|
|
ffmpegdec->depth * ffmpegdec->channels * ffmpegdec->samplerate);
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
2010-10-06 14:00:05 +00:00
|
|
|
/* offset:
|
|
|
|
*
|
|
|
|
* Just copy
|
|
|
|
*/
|
|
|
|
out_offset = dec_info->offset;
|
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec,
|
2012-04-03 09:52:05 +00:00
|
|
|
"Buffer created. Size:%d , pts:%" GST_TIME_FORMAT " , duration:%"
|
2006-08-29 09:28:20 +00:00
|
|
|
GST_TIME_FORMAT, have_data,
|
2012-04-03 09:52:05 +00:00
|
|
|
GST_TIME_ARGS (out_pts), GST_TIME_ARGS (out_duration));
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
2012-04-03 09:52:05 +00:00
|
|
|
GST_BUFFER_PTS (*outbuf) = out_pts;
|
2010-10-06 14:00:05 +00:00
|
|
|
GST_BUFFER_DURATION (*outbuf) = out_duration;
|
|
|
|
GST_BUFFER_OFFSET (*outbuf) = out_offset;
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
2006-08-29 09:28:20 +00:00
|
|
|
/* the next timestamp we'll use when interpolating */
|
2012-04-03 09:52:05 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (out_pts))
|
|
|
|
ffmpegdec->next_out = out_pts + out_duration;
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
2006-08-29 09:28:20 +00:00
|
|
|
/* now see if we need to clip the buffer against the segment boundaries. */
|
2012-04-03 09:52:05 +00:00
|
|
|
if (G_UNLIKELY (!clip_audio_buffer (ffmpegdec, *outbuf, out_pts,
|
2010-10-06 14:00:05 +00:00
|
|
|
out_duration)))
|
2006-08-29 09:28:20 +00:00
|
|
|
goto clipped;
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
2012-01-10 09:45:42 +00:00
|
|
|
|
|
|
|
/* Reorder channels to the GStreamer channel order */
|
|
|
|
/* Only the width really matters here... and it's stored as depth */
|
|
|
|
fmt =
|
|
|
|
gst_audio_format_build_integer (TRUE, G_BYTE_ORDER,
|
2012-06-14 10:41:34 +00:00
|
|
|
ffmpegdec->depth * 8, ffmpegdec->depth * 8);
|
2012-01-10 09:45:42 +00:00
|
|
|
|
|
|
|
gst_audio_buffer_reorder_channels (*outbuf, fmt,
|
2012-06-14 10:41:34 +00:00
|
|
|
ffmpegdec->channels, ffmpegdec->ffmpeg_layout, ffmpegdec->gst_layout);
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
} else {
|
2012-01-24 13:40:37 +00:00
|
|
|
gst_buffer_unmap (*outbuf, &map);
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
gst_buffer_unref (*outbuf);
|
|
|
|
*outbuf = NULL;
|
|
|
|
}
|
|
|
|
|
2009-03-04 20:10:22 +00:00
|
|
|
/* If we don't error out after the first failed read with the AAC decoder,
|
|
|
|
* we must *not* carry on pushing data, else we'll cause segfaults... */
|
2011-05-25 08:08:06 +00:00
|
|
|
if (len == -1 && (in_plugin->id == CODEC_ID_AAC
|
|
|
|
|| in_plugin->id == CODEC_ID_AAC_LATM)) {
|
2009-03-06 11:01:55 +00:00
|
|
|
GST_ELEMENT_ERROR (ffmpegdec, STREAM, DECODE, (NULL),
|
2012-04-12 17:41:52 +00:00
|
|
|
("Decoding of AAC stream by libav failed."));
|
2009-03-04 20:10:22 +00:00
|
|
|
*ret = GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
beach:
|
2006-08-29 09:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "return flow %d, out %p, len %d",
|
|
|
|
*ret, *outbuf, len);
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
return len;
|
2006-08-29 09:28:20 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
clipped:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "buffer clipped");
|
|
|
|
gst_buffer_unref (*outbuf);
|
|
|
|
*outbuf = NULL;
|
|
|
|
goto beach;
|
|
|
|
}
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
}
|
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
/* gst_ffmpegauddec_frame:
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
* ffmpegdec:
|
|
|
|
* data: pointer to the data to decode
|
|
|
|
* size: size of data in bytes
|
|
|
|
* got_data: 0 if no data was decoded, != 0 otherwise.
|
2006-09-05 17:16:05 +00:00
|
|
|
* in_time: timestamp of data
|
|
|
|
* in_duration: duration of data
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
* ret: GstFlowReturn to return in the chain function
|
|
|
|
*
|
|
|
|
* Decode the given frame and pushes it downstream.
|
|
|
|
*
|
|
|
|
* Returns: Number of bytes used in decoding, -1 on error/failure.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static gint
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_frame (GstFFMpegAudDec * ffmpegdec,
|
2010-10-06 14:00:05 +00:00
|
|
|
guint8 * data, guint size, gint * got_data, const GstTSInfo * dec_info,
|
2009-04-09 22:19:50 +00:00
|
|
|
GstFlowReturn * ret)
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
{
|
2012-04-07 09:14:45 +00:00
|
|
|
GstFFMpegAudDecClass *oclass;
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
GstBuffer *outbuf = NULL;
|
|
|
|
gint have_data = 0, len = 0;
|
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
if (G_UNLIKELY (ffmpegdec->context->codec == NULL))
|
|
|
|
goto no_codec;
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
2010-10-12 14:17:51 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "data:%p, size:%d, id:%d", data, size,
|
|
|
|
dec_info->idx);
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
|
|
|
*ret = GST_FLOW_OK;
|
|
|
|
ffmpegdec->context->frame_number++;
|
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
2006-09-05 17:16:05 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
len =
|
|
|
|
gst_ffmpegauddec_audio_frame (ffmpegdec, oclass->in_plugin, data, size,
|
|
|
|
dec_info, &outbuf, ret);
|
|
|
|
|
|
|
|
/* if we did not get an output buffer and we have a pending discont, don't
|
|
|
|
* clear the input timestamps, we will put them on the next buffer because
|
|
|
|
* else we might create the first buffer with a very big timestamp gap. */
|
|
|
|
if (outbuf == NULL && ffmpegdec->discont) {
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "no buffer but keeping timestamp");
|
|
|
|
ffmpegdec->clear_ts = FALSE;
|
2005-01-18 23:19:46 +00:00
|
|
|
}
|
2005-11-14 16:00:38 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
if (outbuf)
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
have_data = 1;
|
|
|
|
|
2005-01-18 23:19:46 +00:00
|
|
|
if (len < 0 || have_data < 0) {
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
GST_WARNING_OBJECT (ffmpegdec,
|
2012-04-12 17:41:52 +00:00
|
|
|
"avdec_%s: decoding error (len: %d, have_data: %d)",
|
2005-01-18 23:19:46 +00:00
|
|
|
oclass->in_plugin->name, len, have_data);
|
|
|
|
*got_data = 0;
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
goto beach;
|
2005-01-18 23:19:46 +00:00
|
|
|
} else if (len == 0 && have_data == 0) {
|
|
|
|
*got_data = 0;
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
goto beach;
|
2005-01-18 23:19:46 +00:00
|
|
|
} else {
|
2005-01-19 16:08:17 +00:00
|
|
|
/* this is where I lost my last clue on ffmpeg... */
|
2007-01-09 14:53:36 +00:00
|
|
|
*got_data = 1;
|
2005-01-18 23:19:46 +00:00
|
|
|
}
|
2005-11-14 16:00:38 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
if (outbuf) {
|
|
|
|
GST_LOG_OBJECT (ffmpegdec,
|
2009-04-09 22:19:50 +00:00
|
|
|
"Decoded data, now pushing buffer %p with offset %" G_GINT64_FORMAT
|
|
|
|
", timestamp %" GST_TIME_FORMAT " and duration %" GST_TIME_FORMAT,
|
|
|
|
outbuf, GST_BUFFER_OFFSET (outbuf),
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)));
|
2005-01-18 23:19:46 +00:00
|
|
|
|
2006-08-29 09:28:20 +00:00
|
|
|
/* mark pending discont */
|
|
|
|
if (ffmpegdec->discont) {
|
|
|
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
|
|
|
ffmpegdec->discont = FALSE;
|
|
|
|
}
|
2008-01-16 17:35:58 +00:00
|
|
|
if (ffmpegdec->segment.rate > 0.0) {
|
|
|
|
/* and off we go */
|
|
|
|
*ret = gst_pad_push (ffmpegdec->srcpad, outbuf);
|
2008-01-26 15:20:10 +00:00
|
|
|
} else {
|
2008-09-04 14:08:50 +00:00
|
|
|
/* reverse playback, queue frame till later when we get a discont. */
|
2008-01-16 17:35:58 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "queued frame");
|
|
|
|
ffmpegdec->queued = g_list_prepend (ffmpegdec->queued, outbuf);
|
|
|
|
*ret = GST_FLOW_OK;
|
|
|
|
}
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "We didn't get a decoded buffer");
|
2005-01-18 23:19:46 +00:00
|
|
|
}
|
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
beach:
|
2005-01-18 23:19:46 +00:00
|
|
|
return len;
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_codec:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (ffmpegdec, "no codec context");
|
|
|
|
return -1;
|
|
|
|
}
|
2005-01-18 23:19:46 +00:00
|
|
|
}
|
|
|
|
|
2008-01-18 17:48:21 +00:00
|
|
|
static void
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_drain (GstFFMpegAudDec * ffmpegdec)
|
2008-01-18 17:48:21 +00:00
|
|
|
{
|
2012-04-07 09:14:45 +00:00
|
|
|
GstFFMpegAudDecClass *oclass;
|
2008-01-18 17:48:21 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
2008-01-18 17:48:21 +00:00
|
|
|
|
|
|
|
if (oclass->in_plugin->capabilities & CODEC_CAP_DELAY) {
|
|
|
|
gint have_data, len, try = 0;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ffmpegdec,
|
2012-04-12 17:41:52 +00:00
|
|
|
"codec has delay capabilities, calling until libav has drained everything");
|
2008-01-18 17:48:21 +00:00
|
|
|
|
|
|
|
do {
|
|
|
|
GstFlowReturn ret;
|
|
|
|
|
2010-10-06 14:00:05 +00:00
|
|
|
len =
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_frame (ffmpegdec, NULL, 0, &have_data, &ts_info_none,
|
2010-10-06 14:00:05 +00:00
|
|
|
&ret);
|
2008-01-18 17:48:21 +00:00
|
|
|
if (len < 0 || have_data == 0)
|
|
|
|
break;
|
|
|
|
} while (try++ < 10);
|
|
|
|
}
|
|
|
|
if (ffmpegdec->segment.rate < 0.0) {
|
|
|
|
/* if we have some queued frames for reverse playback, flush them now */
|
|
|
|
flush_queued (ffmpegdec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
static void
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_flush_pcache (GstFFMpegAudDec * ffmpegdec)
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
{
|
2010-12-21 11:11:32 +00:00
|
|
|
if (ffmpegdec->pctx) {
|
2011-04-19 14:26:55 +00:00
|
|
|
gint size, bsize;
|
2010-12-21 11:11:32 +00:00
|
|
|
guint8 *data;
|
|
|
|
guint8 bdata[FF_INPUT_BUFFER_PADDING_SIZE];
|
|
|
|
|
|
|
|
bsize = FF_INPUT_BUFFER_PADDING_SIZE;
|
|
|
|
memset (bdata, 0, bsize);
|
|
|
|
|
|
|
|
/* parse some dummy data to work around some ffmpeg weirdness where it keeps
|
|
|
|
* the previous pts around */
|
2011-04-21 10:51:25 +00:00
|
|
|
av_parser_parse2 (ffmpegdec->pctx, ffmpegdec->context,
|
|
|
|
&data, &size, bdata, bsize, -1, -1, -1);
|
2010-12-21 11:11:32 +00:00
|
|
|
ffmpegdec->pctx->pts = -1;
|
|
|
|
ffmpegdec->pctx->dts = -1;
|
|
|
|
}
|
|
|
|
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
if (ffmpegdec->pcache) {
|
|
|
|
gst_buffer_unref (ffmpegdec->pcache);
|
|
|
|
ffmpegdec->pcache = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
static gboolean
|
2012-06-14 10:41:34 +00:00
|
|
|
gst_ffmpegauddec_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
2005-01-19 11:46:49 +00:00
|
|
|
{
|
2012-04-07 09:14:45 +00:00
|
|
|
GstFFMpegAudDec *ffmpegdec;
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
2012-06-14 10:41:34 +00:00
|
|
|
ffmpegdec = (GstFFMpegAudDec *) parent;
|
2005-04-25 18:16:20 +00:00
|
|
|
|
2005-11-14 16:00:38 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "Handling %s event",
|
|
|
|
GST_EVENT_TYPE_NAME (event));
|
2005-01-19 15:34:14 +00:00
|
|
|
|
2005-01-19 11:46:49 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2008-01-16 17:35:58 +00:00
|
|
|
case GST_EVENT_EOS:
|
|
|
|
{
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_drain (ffmpegdec);
|
2005-11-14 16:00:38 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-01-16 17:35:58 +00:00
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
{
|
2005-01-19 14:32:49 +00:00
|
|
|
if (ffmpegdec->opened) {
|
|
|
|
avcodec_flush_buffers (ffmpegdec->context);
|
|
|
|
}
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_reset_ts (ffmpegdec);
|
|
|
|
gst_ffmpegauddec_flush_pcache (ffmpegdec);
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
gst_segment_init (&ffmpegdec->segment, GST_FORMAT_TIME);
|
2008-01-16 17:35:58 +00:00
|
|
|
clear_queued (ffmpegdec);
|
2005-11-14 16:00:38 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-06-02 16:39:07 +00:00
|
|
|
case GST_EVENT_CAPS:
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
gst_event_parse_caps (event, &caps);
|
|
|
|
|
2011-12-11 05:25:23 +00:00
|
|
|
if (!ffmpegdec->last_caps
|
|
|
|
|| !gst_caps_is_equal (ffmpegdec->last_caps, caps)) {
|
2012-06-14 10:41:34 +00:00
|
|
|
ret = gst_ffmpegauddec_setcaps (ffmpegdec, caps);
|
2011-12-11 05:25:23 +00:00
|
|
|
if (ret) {
|
|
|
|
gst_caps_replace (&ffmpegdec->last_caps, caps);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
2011-06-02 16:39:07 +00:00
|
|
|
|
2011-06-29 09:44:27 +00:00
|
|
|
gst_event_unref (event);
|
2011-06-02 16:39:07 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2011-06-02 14:23:19 +00:00
|
|
|
case GST_EVENT_SEGMENT:
|
2008-01-16 17:35:58 +00:00
|
|
|
{
|
2011-06-02 14:23:19 +00:00
|
|
|
GstSegment segment;
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
|
2011-06-02 14:23:19 +00:00
|
|
|
gst_event_copy_segment (event, &segment);
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
|
2011-06-02 14:23:19 +00:00
|
|
|
switch (segment.format) {
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
case GST_FORMAT_TIME:
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
/* fine, our native segment format */
|
|
|
|
break;
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
{
|
2006-04-11 17:53:21 +00:00
|
|
|
gint bit_rate;
|
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
bit_rate = ffmpegdec->context->bit_rate;
|
2006-04-11 17:53:21 +00:00
|
|
|
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
/* convert to time or fail */
|
2006-04-11 17:53:21 +00:00
|
|
|
if (!bit_rate)
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
goto no_bitrate;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "bitrate: %d", bit_rate);
|
|
|
|
|
|
|
|
/* convert values to TIME */
|
2011-06-02 14:23:19 +00:00
|
|
|
if (segment.start != -1)
|
|
|
|
segment.start =
|
|
|
|
gst_util_uint64_scale_int (segment.start, GST_SECOND, bit_rate);
|
|
|
|
if (segment.stop != -1)
|
|
|
|
segment.stop =
|
|
|
|
gst_util_uint64_scale_int (segment.stop, GST_SECOND, bit_rate);
|
|
|
|
if (segment.time != -1)
|
|
|
|
segment.time =
|
|
|
|
gst_util_uint64_scale_int (segment.time, GST_SECOND, bit_rate);
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
|
|
|
/* unref old event */
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
gst_event_unref (event);
|
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
/* create new converted time segment */
|
2011-06-02 14:23:19 +00:00
|
|
|
segment.format = GST_FORMAT_TIME;
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
/* FIXME, bitrate is not good enough too find a good stop, let's
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
* hope start and time were 0... meh. */
|
2011-06-02 14:23:19 +00:00
|
|
|
segment.stop = -1;
|
|
|
|
event = gst_event_new_segment (&segment);
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
break;
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
/* invalid format */
|
|
|
|
goto invalid_format;
|
2005-01-19 11:46:49 +00:00
|
|
|
}
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
|
2011-06-02 14:23:19 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "SEGMENT in time %" GST_SEGMENT_FORMAT,
|
|
|
|
&segment);
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
|
|
|
|
/* and store the values */
|
2011-06-02 14:23:19 +00:00
|
|
|
gst_segment_copy_into (&segment, &ffmpegdec->segment);
|
2005-11-14 16:00:38 +00:00
|
|
|
break;
|
2005-01-19 11:46:49 +00:00
|
|
|
}
|
|
|
|
default:
|
2005-11-14 16:00:38 +00:00
|
|
|
break;
|
2005-01-19 11:46:49 +00:00
|
|
|
}
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
/* and push segment downstream */
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
ret = gst_pad_push_event (ffmpegdec->srcpad, event);
|
|
|
|
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
done:
|
2005-11-14 16:00:38 +00:00
|
|
|
|
|
|
|
return ret;
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_bitrate:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (ffmpegdec, "no bitrate to convert BYTES to TIME");
|
|
|
|
gst_event_unref (event);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
invalid_format:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (ffmpegdec, "unknown format received in NEWSEGMENT");
|
|
|
|
gst_event_unref (event);
|
|
|
|
goto done;
|
|
|
|
}
|
2005-01-19 11:46:49 +00:00
|
|
|
}
|
|
|
|
|
2012-03-12 12:50:46 +00:00
|
|
|
static gboolean
|
2012-06-14 10:41:34 +00:00
|
|
|
gst_ffmpegauddec_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
2012-03-12 12:50:46 +00:00
|
|
|
{
|
2012-06-14 10:41:34 +00:00
|
|
|
GstFFMpegAudDec *ffmpegdec;
|
2012-03-12 12:50:46 +00:00
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
2012-06-14 10:41:34 +00:00
|
|
|
ffmpegdec = (GstFFMpegAudDec *) parent;
|
2012-03-12 12:50:46 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "Handling %s query",
|
|
|
|
GST_QUERY_TYPE_NAME (query));
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_ACCEPT_CAPS:
|
|
|
|
{
|
|
|
|
GstPadTemplate *templ;
|
|
|
|
|
|
|
|
ret = FALSE;
|
|
|
|
if ((templ = GST_PAD_PAD_TEMPLATE (pad))) {
|
|
|
|
GstCaps *tcaps;
|
|
|
|
|
|
|
|
if ((tcaps = GST_PAD_TEMPLATE_CAPS (templ))) {
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
gst_query_parse_accept_caps (query, &caps);
|
|
|
|
gst_query_set_accept_caps_result (query,
|
|
|
|
gst_caps_is_subset (caps, tcaps));
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
ret = gst_pad_query_default (pad, parent, query);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
static GstFlowReturn
|
2012-06-14 10:41:34 +00:00
|
|
|
gst_ffmpegauddec_chain (GstPad * pad, GstObject * parent, GstBuffer * inbuf)
|
2001-12-23 13:25:04 +00:00
|
|
|
{
|
2012-04-07 09:14:45 +00:00
|
|
|
GstFFMpegAudDec *ffmpegdec;
|
|
|
|
GstFFMpegAudDecClass *oclass;
|
2011-04-04 14:37:42 +00:00
|
|
|
guint8 *data, *bdata;
|
2012-01-24 13:40:37 +00:00
|
|
|
GstMapInfo map;
|
2006-09-05 15:34:00 +00:00
|
|
|
gint size, bsize, len, have_data;
|
2005-08-16 09:50:03 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2012-04-03 09:52:05 +00:00
|
|
|
GstClockTime in_pts, in_dts, in_duration;
|
2008-01-18 14:50:46 +00:00
|
|
|
gboolean discont;
|
2010-10-06 14:00:05 +00:00
|
|
|
gint64 in_offset;
|
|
|
|
const GstTSInfo *in_info;
|
|
|
|
const GstTSInfo *dec_info;
|
2003-06-17 11:44:38 +00:00
|
|
|
|
2012-06-14 10:41:34 +00:00
|
|
|
ffmpegdec = (GstFFMpegAudDec *) parent;
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
|
|
|
|
if (G_UNLIKELY (!ffmpegdec->opened))
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
goto not_negotiated;
|
2005-11-14 16:00:38 +00:00
|
|
|
|
2008-01-18 14:50:46 +00:00
|
|
|
discont = GST_BUFFER_IS_DISCONT (inbuf);
|
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
/* The discont flags marks a buffer that is not continuous with the previous
|
2012-04-20 14:16:25 +00:00
|
|
|
* buffer. This means we need to clear whatever data we currently have. We let
|
|
|
|
* ffmpeg continue with the data that it has. We currently drain the old
|
|
|
|
* frames that might be inside the decoder and we clear any partial data in
|
|
|
|
* the pcache, we might be able to remove the drain and flush too. */
|
2008-01-18 14:50:46 +00:00
|
|
|
if (G_UNLIKELY (discont)) {
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "received DISCONT");
|
2008-01-18 17:48:21 +00:00
|
|
|
/* drain what we have queued */
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_drain (ffmpegdec);
|
|
|
|
gst_ffmpegauddec_flush_pcache (ffmpegdec);
|
2006-08-29 09:28:20 +00:00
|
|
|
ffmpegdec->discont = TRUE;
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_reset_ts (ffmpegdec);
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
}
|
2008-09-04 14:08:50 +00:00
|
|
|
/* by default we clear the input timestamp after decoding each frame so that
|
|
|
|
* interpollation can work. */
|
|
|
|
ffmpegdec->clear_ts = TRUE;
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
|
2012-04-07 09:14:45 +00:00
|
|
|
oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
2006-10-09 13:31:55 +00:00
|
|
|
|
2010-10-06 10:30:57 +00:00
|
|
|
/* parse cache joining. If there is cached data */
|
|
|
|
if (ffmpegdec->pcache) {
|
|
|
|
/* join with previous data */
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "join parse cache");
|
2012-03-28 10:50:19 +00:00
|
|
|
inbuf = gst_buffer_append (ffmpegdec->pcache, inbuf);
|
2010-10-06 10:30:57 +00:00
|
|
|
/* no more cached data, we assume we can consume the complete cache */
|
|
|
|
ffmpegdec->pcache = NULL;
|
|
|
|
}
|
2010-02-19 19:33:06 +00:00
|
|
|
|
2012-04-03 09:52:05 +00:00
|
|
|
in_dts = GST_BUFFER_DTS (inbuf);
|
|
|
|
in_pts = GST_BUFFER_PTS (inbuf);
|
2008-01-18 12:18:08 +00:00
|
|
|
in_duration = GST_BUFFER_DURATION (inbuf);
|
2009-04-09 22:19:50 +00:00
|
|
|
in_offset = GST_BUFFER_OFFSET (inbuf);
|
2006-09-05 15:34:00 +00:00
|
|
|
|
2010-10-06 14:00:05 +00:00
|
|
|
/* get handle to timestamp info, we can pass this around to ffmpeg */
|
2012-04-03 09:52:05 +00:00
|
|
|
in_info =
|
|
|
|
gst_ts_info_store (ffmpegdec, in_dts, in_pts, in_duration, in_offset);
|
|
|
|
|
2006-02-06 17:51:41 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec,
|
2009-04-18 06:50:12 +00:00
|
|
|
"Received new data of size %u, offset:%" G_GUINT64_FORMAT ", ts:%"
|
2010-10-06 14:00:05 +00:00
|
|
|
GST_TIME_FORMAT ", dur:%" GST_TIME_FORMAT ", info %d",
|
2012-06-14 10:41:34 +00:00
|
|
|
gst_buffer_get_size (inbuf), GST_BUFFER_OFFSET (inbuf),
|
|
|
|
GST_TIME_ARGS (in_pts), GST_TIME_ARGS (in_duration), in_info->idx);
|
2010-10-07 15:46:22 +00:00
|
|
|
|
2004-12-17 13:08:13 +00:00
|
|
|
/* workarounds, functions write to buffers:
|
|
|
|
* libavcodec/svq1.c:svq1_decode_frame writes to the given buffer.
|
|
|
|
* libavcodec/svq3.c:svq3_decode_slice_header too.
|
|
|
|
* ffmpeg devs know about it and will fix it (they said). */
|
2006-09-05 15:34:00 +00:00
|
|
|
if (oclass->in_plugin->id == CODEC_ID_SVQ1 ||
|
2004-12-17 13:08:13 +00:00
|
|
|
oclass->in_plugin->id == CODEC_ID_SVQ3) {
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
inbuf = gst_buffer_make_writable (inbuf);
|
2004-12-17 13:08:13 +00:00
|
|
|
}
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2012-01-24 13:40:37 +00:00
|
|
|
gst_buffer_map (inbuf, &map, GST_MAP_READ);
|
2011-04-04 10:23:05 +00:00
|
|
|
|
2012-01-24 13:40:37 +00:00
|
|
|
bdata = map.data;
|
|
|
|
bsize = map.size;
|
2011-04-04 10:23:05 +00:00
|
|
|
|
|
|
|
GST_LOG_OBJECT (ffmpegdec,
|
2012-04-03 09:52:05 +00:00
|
|
|
"Received new data of size %u, offset:%" G_GUINT64_FORMAT ", dts:%"
|
|
|
|
GST_TIME_FORMAT ", pts:%" GST_TIME_FORMAT ", dur:%" GST_TIME_FORMAT
|
|
|
|
", info %d", bsize, in_offset, GST_TIME_ARGS (in_dts),
|
|
|
|
GST_TIME_ARGS (in_pts), GST_TIME_ARGS (in_duration), in_info->idx);
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
|
2001-12-23 13:25:04 +00:00
|
|
|
do {
|
2004-12-17 13:08:13 +00:00
|
|
|
/* parse, if at all possible */
|
2005-01-19 15:41:35 +00:00
|
|
|
if (ffmpegdec->pctx) {
|
2004-12-17 13:08:13 +00:00
|
|
|
gint res;
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
|
2006-09-13 11:39:49 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec,
|
2011-04-21 10:51:25 +00:00
|
|
|
"Calling av_parser_parse2 with offset %" G_GINT64_FORMAT ", ts:%"
|
2012-04-03 09:52:05 +00:00
|
|
|
GST_TIME_FORMAT " size %d", in_offset, GST_TIME_ARGS (in_pts), bsize);
|
2006-09-13 11:39:49 +00:00
|
|
|
|
2010-10-06 14:00:05 +00:00
|
|
|
/* feed the parser. We pass the timestamp info so that we can recover all
|
|
|
|
* info again later */
|
2011-04-21 10:51:25 +00:00
|
|
|
res = av_parser_parse2 (ffmpegdec->pctx, ffmpegdec->context,
|
|
|
|
&data, &size, bdata, bsize, in_info->idx, in_info->idx, in_offset);
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec,
|
2011-01-05 15:59:55 +00:00
|
|
|
"parser returned res %d and size %d, id %" G_GINT64_FORMAT, res, size,
|
2012-02-27 05:26:02 +00:00
|
|
|
(gint64) ffmpegdec->pctx->pts);
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
|
2010-10-06 10:30:57 +00:00
|
|
|
/* store pts for decoding */
|
2011-05-31 10:16:26 +00:00
|
|
|
if (ffmpegdec->pctx->pts != AV_NOPTS_VALUE && ffmpegdec->pctx->pts != -1)
|
2010-12-21 11:11:32 +00:00
|
|
|
dec_info = gst_ts_info_get (ffmpegdec, ffmpegdec->pctx->pts);
|
|
|
|
else {
|
|
|
|
/* ffmpeg sometimes loses track after a flush, help it by feeding a
|
|
|
|
* valid start time */
|
|
|
|
ffmpegdec->pctx->pts = in_info->idx;
|
|
|
|
ffmpegdec->pctx->dts = in_info->idx;
|
|
|
|
dec_info = in_info;
|
|
|
|
}
|
2008-01-18 12:18:08 +00:00
|
|
|
|
2010-10-06 14:00:05 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "consuming %d bytes. id %d", size,
|
|
|
|
dec_info->idx);
|
2006-11-27 18:58:38 +00:00
|
|
|
|
2008-09-04 14:08:50 +00:00
|
|
|
if (res) {
|
|
|
|
/* there is output, set pointers for next round. */
|
|
|
|
bsize -= res;
|
|
|
|
bdata += res;
|
2008-10-15 11:28:05 +00:00
|
|
|
} else {
|
|
|
|
/* Parser did not consume any data, make sure we don't clear the
|
|
|
|
* timestamp for the next round */
|
2008-09-04 14:08:50 +00:00
|
|
|
ffmpegdec->clear_ts = FALSE;
|
|
|
|
}
|
2006-11-27 18:58:38 +00:00
|
|
|
|
2006-09-05 17:16:05 +00:00
|
|
|
/* if there is no output, we must break and wait for more data. also the
|
|
|
|
* timestamp in the context is not updated. */
|
2006-11-27 18:58:38 +00:00
|
|
|
if (size == 0) {
|
2007-01-09 14:53:36 +00:00
|
|
|
if (bsize > 0)
|
|
|
|
continue;
|
2006-11-27 18:58:38 +00:00
|
|
|
else
|
2007-01-09 14:53:36 +00:00
|
|
|
break;
|
2006-11-27 18:58:38 +00:00
|
|
|
}
|
2007-01-09 14:53:36 +00:00
|
|
|
} else {
|
2004-12-17 13:08:13 +00:00
|
|
|
data = bdata;
|
|
|
|
size = bsize;
|
2008-01-18 12:18:08 +00:00
|
|
|
|
2010-10-06 14:00:05 +00:00
|
|
|
dec_info = in_info;
|
2004-12-17 13:08:13 +00:00
|
|
|
}
|
|
|
|
|
2012-06-14 10:41:34 +00:00
|
|
|
/* decode a frame of audio now */
|
2007-01-09 14:53:36 +00:00
|
|
|
len =
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_frame (ffmpegdec, data, size, &have_data, dec_info,
|
|
|
|
&ret);
|
2006-09-05 17:16:05 +00:00
|
|
|
|
2008-01-18 12:18:08 +00:00
|
|
|
if (ret != GST_FLOW_OK) {
|
2008-01-26 15:20:10 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "breaking because of flow ret %s",
|
|
|
|
gst_flow_get_name (ret));
|
2012-03-19 09:29:34 +00:00
|
|
|
/* bad flow return, make sure we discard all data and exit */
|
2008-01-18 12:18:08 +00:00
|
|
|
bsize = 0;
|
|
|
|
break;
|
|
|
|
}
|
2005-01-18 23:19:46 +00:00
|
|
|
if (!ffmpegdec->pctx) {
|
2008-07-01 09:39:19 +00:00
|
|
|
if (len == 0 && !have_data) {
|
2008-01-18 12:18:08 +00:00
|
|
|
/* nothing was decoded, this could be because no data was available or
|
|
|
|
* because we were skipping frames.
|
|
|
|
* If we have no context we must exit and wait for more data, we keep the
|
|
|
|
* data we tried. */
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "Decoding didn't return any data, breaking");
|
|
|
|
break;
|
2008-01-26 15:20:10 +00:00
|
|
|
} else if (len < 0) {
|
2008-01-18 12:18:08 +00:00
|
|
|
/* a decoding error happened, we must break and try again with next data. */
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "Decoding error, breaking");
|
|
|
|
bsize = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* prepare for the next round, for codecs with a context we did this
|
|
|
|
* already when using the parser. */
|
2004-12-17 13:08:13 +00:00
|
|
|
bsize -= len;
|
|
|
|
bdata += len;
|
2008-01-26 15:20:10 +00:00
|
|
|
} else {
|
2008-01-18 12:18:08 +00:00
|
|
|
if (len == 0) {
|
|
|
|
/* nothing was decoded, this could be because no data was available or
|
|
|
|
* because we were skipping frames. Since we have a parser we can
|
2008-01-26 15:20:10 +00:00
|
|
|
* continue with the next frame */
|
|
|
|
GST_LOG_OBJECT (ffmpegdec,
|
|
|
|
"Decoding didn't return any data, trying next");
|
|
|
|
} else if (len < 0) {
|
|
|
|
/* we have a context that will bring us to the next frame */
|
2008-01-18 12:18:08 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "Decoding error, trying next");
|
|
|
|
}
|
2005-01-18 23:19:46 +00:00
|
|
|
}
|
ext/ffmpeg/gstffmpegdec.c: Make some enums const.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_lowres_get_type),
(gst_ffmpegdec_skipframe_get_type), (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (clip_video_buffer), (check_keyframe),
(get_output_buffer), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Make some enums const.
Cleanups, refactoring.
Better video frame clipping.
Timestamp fixe: use timestamp from incomming buffer even if there
is no input framerate given (as this is totally unrelated).
2006-07-19 16:35:13 +00:00
|
|
|
|
2008-01-18 12:18:08 +00:00
|
|
|
/* make sure we don't use the same old timestamp for the next frame and let
|
|
|
|
* the interpollation take care of it. */
|
2008-09-04 14:08:50 +00:00
|
|
|
if (ffmpegdec->clear_ts) {
|
2012-04-03 09:52:05 +00:00
|
|
|
in_dts = GST_CLOCK_TIME_NONE;
|
|
|
|
in_pts = GST_CLOCK_TIME_NONE;
|
2008-09-04 14:08:50 +00:00
|
|
|
in_duration = GST_CLOCK_TIME_NONE;
|
2009-04-09 22:19:50 +00:00
|
|
|
in_offset = GST_BUFFER_OFFSET_NONE;
|
2010-10-06 14:00:05 +00:00
|
|
|
in_info = GST_TS_INFO_NONE;
|
2008-10-15 11:28:05 +00:00
|
|
|
} else {
|
2008-09-04 14:08:50 +00:00
|
|
|
ffmpegdec->clear_ts = TRUE;
|
|
|
|
}
|
2008-01-18 12:18:08 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "Before (while bsize>0). bsize:%d , bdata:%p",
|
|
|
|
bsize, bdata);
|
2005-01-19 15:41:35 +00:00
|
|
|
} while (bsize > 0);
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2012-01-24 13:40:37 +00:00
|
|
|
gst_buffer_unmap (inbuf, &map);
|
2011-04-04 10:23:05 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
/* keep left-over */
|
2008-07-01 09:39:19 +00:00
|
|
|
if (ffmpegdec->pctx && bsize > 0) {
|
2012-04-03 09:52:05 +00:00
|
|
|
in_pts = GST_BUFFER_PTS (inbuf);
|
|
|
|
in_dts = GST_BUFFER_DTS (inbuf);
|
2009-04-09 22:19:50 +00:00
|
|
|
in_offset = GST_BUFFER_OFFSET (inbuf);
|
2008-01-18 12:18:08 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegdec.c: Split out audio and video frame decoding.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_video_frame),
(gst_ffmpegdec_audio_frame), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Split out audio and video frame decoding.
Added dropping/clipping of decoded buffers.
Ran gst-indent on code.
Small non-invasive code cleanups.
2006-06-02 12:29:38 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec,
|
2012-04-03 09:52:05 +00:00
|
|
|
"Keeping %d bytes of data with offset %" G_GINT64_FORMAT ", pts %"
|
|
|
|
GST_TIME_FORMAT, bsize, in_offset, GST_TIME_ARGS (in_pts));
|
2004-12-18 20:53:55 +00:00
|
|
|
|
2011-04-04 10:23:05 +00:00
|
|
|
ffmpegdec->pcache = gst_buffer_copy_region (inbuf, GST_BUFFER_COPY_ALL,
|
|
|
|
gst_buffer_get_size (inbuf) - bsize, bsize);
|
2006-02-06 17:51:41 +00:00
|
|
|
/* we keep timestamp, even though all we really know is that the correct
|
|
|
|
* timestamp is not below the one from inbuf */
|
2012-04-03 09:52:05 +00:00
|
|
|
GST_BUFFER_PTS (ffmpegdec->pcache) = in_pts;
|
|
|
|
GST_BUFFER_DTS (ffmpegdec->pcache) = in_dts;
|
2009-04-09 22:19:50 +00:00
|
|
|
GST_BUFFER_OFFSET (ffmpegdec->pcache) = in_offset;
|
2006-09-05 17:16:05 +00:00
|
|
|
} else if (bsize > 0) {
|
2005-07-22 16:07:02 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "Dropping %d bytes of data", bsize);
|
2004-12-17 13:08:13 +00:00
|
|
|
}
|
2001-12-23 13:25:04 +00:00
|
|
|
gst_buffer_unref (inbuf);
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
|
2005-08-16 09:50:03 +00:00
|
|
|
return ret;
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
not_negotiated:
|
|
|
|
{
|
2012-04-07 09:14:45 +00:00
|
|
|
oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION, (NULL),
|
2012-04-12 17:41:52 +00:00
|
|
|
("avdec_%s: input format was not set before data start",
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
oclass->in_plugin->name));
|
ext/ffmpeg/:
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_avpicture_fill):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_finalize),
(gst_ffmpegdec_query), (gst_ffmpegdec_update_qos),
(gst_ffmpegdec_reset_qos), (gst_ffmpegdec_read_qos),
(gst_ffmpegdec_src_event), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_get_buffer),
(gst_ffmpegdec_release_buffer),
(gst_ffmpegdec_add_pixel_aspect_ratio), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_do_qos), (gst_ffmpegdec_frame),
(gst_ffmpegdec_flush_pcache), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
2006-04-08 10:51:32 +00:00
|
|
|
gst_buffer_unref (inbuf);
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
}
|
2001-12-23 13:25:04 +00:00
|
|
|
}
|
|
|
|
|
2005-09-05 14:06:29 +00:00
|
|
|
static GstStateChangeReturn
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_change_state (GstElement * element, GstStateChange transition)
|
2001-12-23 13:25:04 +00:00
|
|
|
{
|
2012-04-07 09:14:45 +00:00
|
|
|
GstFFMpegAudDec *ffmpegdec = (GstFFMpegAudDec *) element;
|
2005-09-05 14:06:29 +00:00
|
|
|
GstStateChangeReturn ret;
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
|
2005-09-05 14:06:29 +00:00
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
2003-06-07 00:41:32 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-05 14:06:29 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2006-03-22 11:36:38 +00:00
|
|
|
GST_OBJECT_LOCK (ffmpegdec);
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_close (ffmpegdec);
|
2006-03-22 11:36:38 +00:00
|
|
|
GST_OBJECT_UNLOCK (ffmpegdec);
|
2008-01-16 17:35:58 +00:00
|
|
|
clear_queued (ffmpegdec);
|
2001-12-23 13:25:04 +00:00
|
|
|
break;
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
default:
|
|
|
|
break;
|
2001-12-23 13:25:04 +00:00
|
|
|
}
|
|
|
|
|
Backport BRANCH-THREADED to HEAD, fix a bit.
Original commit message from CVS:
* configure.ac:
* ext/ffmpeg/Makefile.am:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_with_codecid):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_class_init),
(gst_ffmpegdec_init), (gst_ffmpegdec_query), (gst_ffmpegdec_event),
(gst_ffmpegdec_open), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_get_buffer), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain), (gst_ffmpegdec_change_state),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
(gst_ffmpegenc_init), (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/libpostproc/Makefile.am:
Backport BRANCH-THREADED to HEAD, fix a bit.
2005-08-05 15:29:56 +00:00
|
|
|
return ret;
|
2001-12-23 13:25:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2012-04-07 09:14:45 +00:00
|
|
|
gst_ffmpegauddec_register (GstPlugin * plugin)
|
2001-12-23 13:25:04 +00:00
|
|
|
{
|
|
|
|
GTypeInfo typeinfo = {
|
2012-04-07 09:14:45 +00:00
|
|
|
sizeof (GstFFMpegAudDecClass),
|
|
|
|
(GBaseInitFunc) gst_ffmpegauddec_base_init,
|
2001-12-23 13:25:04 +00:00
|
|
|
NULL,
|
2012-04-07 09:14:45 +00:00
|
|
|
(GClassInitFunc) gst_ffmpegauddec_class_init,
|
2001-12-23 13:25:04 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2012-04-07 09:14:45 +00:00
|
|
|
sizeof (GstFFMpegAudDec),
|
2001-12-23 13:25:04 +00:00
|
|
|
0,
|
2012-04-07 09:14:45 +00:00
|
|
|
(GInstanceInitFunc) gst_ffmpegauddec_init,
|
2001-12-23 13:25:04 +00:00
|
|
|
};
|
|
|
|
GType type;
|
|
|
|
AVCodec *in_plugin;
|
2004-09-22 07:53:48 +00:00
|
|
|
gint rank;
|
2004-03-29 16:39:18 +00:00
|
|
|
|
2008-10-30 12:05:45 +00:00
|
|
|
in_plugin = av_codec_next (NULL);
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2007-12-17 12:43:06 +00:00
|
|
|
GST_LOG ("Registering decoders");
|
|
|
|
|
2001-12-23 13:25:04 +00:00
|
|
|
while (in_plugin) {
|
2003-11-02 13:12:14 +00:00
|
|
|
gchar *type_name;
|
2007-12-17 12:43:06 +00:00
|
|
|
gchar *plugin_name;
|
|
|
|
|
|
|
|
/* only decoders */
|
2012-04-07 09:14:45 +00:00
|
|
|
if (!in_plugin->decode || in_plugin->type != AVMEDIA_TYPE_AUDIO) {
|
2007-12-17 12:43:06 +00:00
|
|
|
goto next;
|
|
|
|
}
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2003-06-17 11:44:38 +00:00
|
|
|
/* no quasi-codecs, please */
|
2012-04-07 09:14:45 +00:00
|
|
|
if (in_plugin->id >= CODEC_ID_PCM_S16LE &&
|
|
|
|
in_plugin->id <= CODEC_ID_PCM_BLURAY) {
|
2003-06-17 11:44:38 +00:00
|
|
|
goto next;
|
2001-12-23 13:25:04 +00:00
|
|
|
}
|
2003-06-17 11:44:38 +00:00
|
|
|
|
2009-03-10 20:11:43 +00:00
|
|
|
/* No decoders depending on external libraries (we don't build them, but
|
|
|
|
* people who build against an external ffmpeg might have them.
|
|
|
|
* We have native gstreamer plugins for all of those libraries anyway. */
|
|
|
|
if (!strncmp (in_plugin->name, "lib", 3)) {
|
|
|
|
GST_DEBUG
|
|
|
|
("Not using external library decoder %s. Use the gstreamer-native ones instead.",
|
|
|
|
in_plugin->name);
|
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
|
2008-10-15 11:28:05 +00:00
|
|
|
GST_DEBUG ("Trying plugin %s [%s]", in_plugin->name, in_plugin->long_name);
|
2008-06-13 17:06:55 +00:00
|
|
|
|
2007-12-17 12:43:06 +00:00
|
|
|
/* no codecs for which we're GUARANTEED to have better alternatives */
|
2009-01-24 16:59:11 +00:00
|
|
|
/* MP1 : Use MP3 for decoding */
|
2007-12-17 12:43:06 +00:00
|
|
|
/* MP2 : Use MP3 for decoding */
|
2009-07-29 18:49:56 +00:00
|
|
|
/* Theora: Use libtheora based theoradec */
|
2012-04-07 09:14:45 +00:00
|
|
|
if (!strcmp (in_plugin->name, "vorbis") ||
|
2008-01-04 22:14:50 +00:00
|
|
|
!strcmp (in_plugin->name, "wavpack") ||
|
2009-01-24 16:59:11 +00:00
|
|
|
!strcmp (in_plugin->name, "mp1") ||
|
2008-05-26 07:43:00 +00:00
|
|
|
!strcmp (in_plugin->name, "mp2") ||
|
|
|
|
!strcmp (in_plugin->name, "libfaad") ||
|
2011-09-02 20:25:16 +00:00
|
|
|
!strcmp (in_plugin->name, "mpeg4aac") ||
|
|
|
|
!strcmp (in_plugin->name, "ass") ||
|
|
|
|
!strcmp (in_plugin->name, "srt") ||
|
|
|
|
!strcmp (in_plugin->name, "pgssub") ||
|
|
|
|
!strcmp (in_plugin->name, "dvdsub") ||
|
|
|
|
!strcmp (in_plugin->name, "dvbsub")) {
|
2007-12-17 12:43:06 +00:00
|
|
|
GST_LOG ("Ignoring decoder %s", in_plugin->name);
|
2001-12-23 13:25:04 +00:00
|
|
|
goto next;
|
|
|
|
}
|
2003-06-07 00:41:32 +00:00
|
|
|
|
2002-03-19 04:09:41 +00:00
|
|
|
/* construct the type */
|
2007-12-17 12:43:06 +00:00
|
|
|
plugin_name = g_strdup ((gchar *) in_plugin->name);
|
|
|
|
g_strdelimit (plugin_name, NULL, '_');
|
2012-04-12 17:41:52 +00:00
|
|
|
type_name = g_strdup_printf ("avdec_%s", plugin_name);
|
2007-12-17 12:43:06 +00:00
|
|
|
g_free (plugin_name);
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2009-06-05 11:19:03 +00:00
|
|
|
type = g_type_from_name (type_name);
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2009-06-05 11:19:03 +00:00
|
|
|
if (!type) {
|
|
|
|
/* create the gtype now */
|
|
|
|
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
|
2009-11-02 08:05:13 +00:00
|
|
|
g_type_set_qdata (type, GST_FFDEC_PARAMS_QDATA, (gpointer) in_plugin);
|
2009-06-05 11:19:03 +00:00
|
|
|
}
|
2004-09-22 07:53:48 +00:00
|
|
|
|
|
|
|
/* (Ronald) MPEG-4 gets a higher priority because it has been well-
|
|
|
|
* tested and by far outperforms divxdec/xviddec - so we prefer it.
|
2004-12-19 23:41:03 +00:00
|
|
|
* msmpeg4v3 same, as it outperforms divxdec for divx3 playback.
|
2005-04-21 19:01:36 +00:00
|
|
|
* VC1/WMV3 are not working and thus unpreferred for now. */
|
2004-09-22 07:53:48 +00:00
|
|
|
switch (in_plugin->id) {
|
2009-03-04 19:04:25 +00:00
|
|
|
case CODEC_ID_RA_144:
|
|
|
|
case CODEC_ID_RA_288:
|
2007-08-14 14:29:36 +00:00
|
|
|
case CODEC_ID_COOK:
|
2004-09-22 07:53:48 +00:00
|
|
|
rank = GST_RANK_PRIMARY;
|
|
|
|
break;
|
2012-04-07 09:14:45 +00:00
|
|
|
/* SIPR: decoder should have a higher rank than realaudiodec.
|
2010-05-25 11:55:14 +00:00
|
|
|
*/
|
|
|
|
case CODEC_ID_SIPR:
|
2006-04-21 15:48:17 +00:00
|
|
|
rank = GST_RANK_SECONDARY;
|
|
|
|
break;
|
2011-01-07 17:08:15 +00:00
|
|
|
case CODEC_ID_MP3:
|
|
|
|
rank = GST_RANK_NONE;
|
|
|
|
break;
|
2007-08-14 14:29:36 +00:00
|
|
|
default:
|
|
|
|
rank = GST_RANK_MARGINAL;
|
|
|
|
break;
|
2004-09-22 07:53:48 +00:00
|
|
|
}
|
|
|
|
if (!gst_element_register (plugin, type_name, rank, type)) {
|
ext/: Update to ffmpeg snapshot of Jul 20 2005 4:00 PM GMT. Mostly some added codecs, some API changes, etc. Also add...
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.h:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_formatid_get_codecids),
(gst_ffmpeg_caps_to_codecid), (gst_ffmpeg_get_codecid_longname),
(gst_ffmpeg_img_convert):
* ext/ffmpeg/gstffmpegcodecmap.h:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_chain),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegdeinterlace.c:
(gst_ffmpegdeinterlace_getcaps), (gst_ffmpegdeinterlace_pad_link):
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_link), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_write):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_pad_link):
* ext/libpostproc/gstpostproc.c: (gst_postproc_chain):
Update to ffmpeg snapshot of Jul 20 2005 4:00 PM GMT. Mostly
some added codecs, some API changes, etc. Also adds a VOB muxer
for MPEG-2 video and adds h264 to .mp4 muxing.
2005-07-20 15:40:57 +00:00
|
|
|
g_warning ("Failed to register %s", type_name);
|
2004-02-02 20:27:13 +00:00
|
|
|
g_free (type_name);
|
2003-11-02 13:12:14 +00:00
|
|
|
return FALSE;
|
2004-02-02 20:27:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_free (type_name);
|
2003-06-07 00:41:32 +00:00
|
|
|
|
2004-03-29 16:39:18 +00:00
|
|
|
next:
|
2008-10-30 12:05:45 +00:00
|
|
|
in_plugin = av_codec_next (in_plugin);
|
2001-12-23 13:25:04 +00:00
|
|
|
}
|
|
|
|
|
2007-12-17 12:43:06 +00:00
|
|
|
GST_LOG ("Finished Registering decoders");
|
|
|
|
|
2001-12-23 13:25:04 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|