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
|
|
|
|
2002-11-26 14:50:05 +00:00
|
|
|
#ifdef HAVE_FFMPEG_UNINSTALLED
|
|
|
|
#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>
|
2009-05-12 09:16:43 +00:00
|
|
|
#include <gst/video/video.h>
|
2002-11-06 23:53:46 +00:00
|
|
|
|
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
|
|
|
|
2008-01-23 16:08:27 +00:00
|
|
|
/* define to enable alternative buffer refcounting algorithm */
|
|
|
|
#undef EXTRA_REF
|
|
|
|
|
2009-05-13 10:37:42 +00:00
|
|
|
#define TS_MAP_COUNT 0xFF
|
|
|
|
#define TS_MAP_INC(ind) ind = (ind + 1) & TS_MAP_COUNT
|
|
|
|
|
2009-07-30 15:02:12 +00:00
|
|
|
typedef struct _GstDataPassThrough GstDataPassThrough;
|
|
|
|
|
|
|
|
struct _GstDataPassThrough
|
|
|
|
{
|
|
|
|
guint64 ts;
|
|
|
|
guint64 offset;
|
|
|
|
};
|
|
|
|
|
2009-05-13 10:37:42 +00:00
|
|
|
typedef struct _GstTSMap GstTSMap;
|
|
|
|
|
|
|
|
struct _GstTSMap
|
|
|
|
{
|
|
|
|
/* timestamp */
|
|
|
|
guint64 ts;
|
|
|
|
|
2009-07-30 15:02:12 +00:00
|
|
|
/* offset */
|
|
|
|
gint64 offset;
|
|
|
|
|
2009-05-13 10:37:42 +00:00
|
|
|
/* buffer size */
|
|
|
|
gint size;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _GstTSHandler GstTSHandler;
|
|
|
|
|
|
|
|
struct _GstTSHandler
|
|
|
|
{
|
|
|
|
/* ts list indexes */
|
|
|
|
gint buf_head;
|
|
|
|
gint buf_tail;
|
2009-06-18 00:11:25 +00:00
|
|
|
guint buf_count;
|
2009-05-13 10:37:42 +00:00
|
|
|
|
|
|
|
/* incomming buffer timestamp tracking */
|
|
|
|
GstTSMap buffers[TS_MAP_COUNT + 1];
|
|
|
|
};
|
|
|
|
|
2002-11-06 23:53:46 +00:00
|
|
|
typedef struct _GstFFMpegDec GstFFMpegDec;
|
|
|
|
|
2004-03-29 16:39:18 +00:00
|
|
|
struct _GstFFMpegDec
|
|
|
|
{
|
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;
|
2002-12-12 13:12:44 +00:00
|
|
|
AVFrame *picture;
|
2003-06-07 00:41:32 +00:00
|
|
|
gboolean opened;
|
2005-11-14 16:00:38 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
ext/ffmpeg/gstffmpegdec.c: Backported some fixes from 0.8. Most importantly, use demuxer's timestamping information i...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_close), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Backported some fixes from 0.8. Most importantly, use
demuxer's timestamping information if we use its framerate
value. Makes divx play properly again among other things
(#319616, #313970, #317596). Did not backport memory leak
fix.
2005-10-26 17:41:58 +00:00
|
|
|
gint width, height;
|
2007-01-09 14:53:36 +00:00
|
|
|
gint clip_width, clip_height;
|
2005-11-22 23:12:51 +00:00
|
|
|
gint fps_n, fps_d;
|
|
|
|
gint old_fps_n, old_fps_d;
|
2009-05-12 09:16:43 +00:00
|
|
|
gboolean interlaced;
|
2005-11-22 23:12:51 +00:00
|
|
|
|
2005-07-11 13:51:45 +00:00
|
|
|
enum PixelFormat pix_fmt;
|
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
|
|
|
} video;
|
2005-11-14 16:00:38 +00:00
|
|
|
struct
|
|
|
|
{
|
2006-08-29 09:28:20 +00:00
|
|
|
gint channels;
|
|
|
|
gint samplerate;
|
ext/ffmpeg/gstffmpegcodecmap.*: Add mapping for EAC3 and QCELP audio codecs.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_aud_caps_new),
(gst_ffmpeg_codecid_to_caps), (gst_ffmpeg_smpfmt_to_caps),
(gst_ffmpeg_codectype_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_codecid), (av_smp_format_depth):
* ext/ffmpeg/gstffmpegcodecmap.h:
Add mapping for EAC3 and QCELP audio codecs.
Add conversion functions for all available audo SampleFormat.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(clip_audio_buffer), (gst_ffmpegdec_audio_frame):
Remove assumptions that we can only handle stereo 16bit signed integer
audio, and store the depth locally.
2008-12-17 12:05:12 +00:00
|
|
|
gint depth;
|
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
|
|
|
} audio;
|
2005-01-19 11:46:49 +00:00
|
|
|
} format;
|
2005-04-01 10:09:15 +00:00
|
|
|
gboolean waiting_for_key;
|
2006-08-29 09:28:20 +00:00
|
|
|
gboolean discont;
|
2008-09-04 14:08:50 +00:00
|
|
|
gboolean clear_ts;
|
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
|
|
|
guint64 next_ts;
|
2008-01-18 12:18:08 +00:00
|
|
|
guint64 in_ts;
|
2009-04-09 22:19:50 +00:00
|
|
|
gint64 in_offset;
|
2008-03-05 17:02:33 +00:00
|
|
|
GstClockTime last_out;
|
|
|
|
gboolean ts_is_dts;
|
|
|
|
gboolean has_b_frames;
|
2004-07-21 09:20:55 +00:00
|
|
|
|
2004-12-17 13:08:13 +00:00
|
|
|
/* parsing */
|
|
|
|
AVCodecParserContext *pctx;
|
|
|
|
GstBuffer *pcache;
|
2008-01-23 18:23:37 +00:00
|
|
|
guint8 *padded;
|
|
|
|
guint padded_size;
|
2004-12-17 13:08:13 +00:00
|
|
|
|
2005-11-14 16:00:38 +00:00
|
|
|
GValue *par; /* pixel aspect ratio of incoming data */
|
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
|
|
|
gboolean current_dr; /* if direct rendering is enabled */
|
2008-01-23 16:08:27 +00:00
|
|
|
gboolean extra_ref; /* keep extra ref around in get/release */
|
2005-01-31 10:45:20 +00:00
|
|
|
|
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
|
|
|
/* some properties */
|
|
|
|
gint hurry_up;
|
|
|
|
gint lowres;
|
|
|
|
gboolean direct_rendering;
|
2008-01-23 18:23:37 +00:00
|
|
|
gboolean do_padding;
|
2008-02-11 18:45:53 +00:00
|
|
|
gboolean debug_mv;
|
2008-11-06 11:47:40 +00:00
|
|
|
gboolean crop;
|
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
|
|
|
|
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
|
|
|
/* QoS stuff *//* with LOCK */
|
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
|
|
|
gdouble proportion;
|
|
|
|
GstClockTime earliest_time;
|
|
|
|
|
|
|
|
/* clipping segment */
|
|
|
|
GstSegment segment;
|
2007-05-02 16:06:09 +00:00
|
|
|
|
2007-08-07 10:21:19 +00:00
|
|
|
gboolean is_realvideo;
|
2008-01-16 17:35:58 +00:00
|
|
|
|
2009-05-13 10:37:42 +00:00
|
|
|
GstTSHandler ts_handler;
|
|
|
|
|
2009-07-30 15:02:12 +00:00
|
|
|
GList *opaque;
|
|
|
|
|
2008-01-16 17:35:58 +00:00
|
|
|
/* reverse playback queue */
|
|
|
|
GList *queued;
|
2009-03-08 10:31:35 +00:00
|
|
|
|
|
|
|
/* Can downstream allocate 16bytes aligned data. */
|
|
|
|
gboolean can_allocate_aligned;
|
2002-11-06 23:53:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _GstFFMpegDecClass GstFFMpegDecClass;
|
|
|
|
|
2004-03-29 16:39:18 +00:00
|
|
|
struct _GstFFMpegDecClass
|
|
|
|
{
|
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
|
|
|
};
|
|
|
|
|
|
|
|
#define GST_TYPE_FFMPEGDEC \
|
|
|
|
(gst_ffmpegdec_get_type())
|
|
|
|
#define GST_FFMPEGDEC(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGDEC,GstFFMpegDec))
|
|
|
|
#define GST_FFMPEGDEC_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGDEC,GstFFMpegDecClass))
|
|
|
|
#define GST_IS_FFMPEGDEC(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGDEC))
|
2006-09-16 22:19:40 +00:00
|
|
|
#define GST_IS_FFMPEGDEC_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
|
|
|
|
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
|
|
|
#define DEFAULT_LOWRES 0
|
|
|
|
#define DEFAULT_SKIPFRAME 0
|
2008-11-05 17:05:46 +00:00
|
|
|
#define DEFAULT_DIRECT_RENDERING TRUE
|
2008-01-23 18:23:37 +00:00
|
|
|
#define DEFAULT_DO_PADDING TRUE
|
2008-02-11 18:45:53 +00:00
|
|
|
#define DEFAULT_DEBUG_MV FALSE
|
2008-11-06 11:47:40 +00:00
|
|
|
#define DEFAULT_CROP TRUE
|
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
|
|
|
|
2004-03-29 16:39:18 +00:00
|
|
|
enum
|
|
|
|
{
|
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
|
|
|
PROP_0,
|
|
|
|
PROP_LOWRES,
|
|
|
|
PROP_SKIPFRAME,
|
2008-01-23 18:23:37 +00:00
|
|
|
PROP_DIRECT_RENDERING,
|
2008-02-11 18:45:53 +00:00
|
|
|
PROP_DO_PADDING,
|
|
|
|
PROP_DEBUG_MV,
|
2008-11-06 11:47:40 +00:00
|
|
|
PROP_CROP,
|
2008-02-11 18:45:53 +00:00
|
|
|
PROP_LAST
|
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. */
|
2004-03-29 16:39:18 +00:00
|
|
|
static void gst_ffmpegdec_base_init (GstFFMpegDecClass * klass);
|
|
|
|
static void gst_ffmpegdec_class_init (GstFFMpegDecClass * klass);
|
|
|
|
static void gst_ffmpegdec_init (GstFFMpegDec * 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 gst_ffmpegdec_finalize (GObject * object);
|
2003-06-07 00:41:32 +00:00
|
|
|
|
2005-11-14 16:00:38 +00:00
|
|
|
static gboolean gst_ffmpegdec_query (GstPad * pad, GstQuery * query);
|
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 gboolean gst_ffmpegdec_src_event (GstPad * pad, GstEvent * event);
|
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
|
|
|
|
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 gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps);
|
|
|
|
static gboolean gst_ffmpegdec_sink_event (GstPad * pad, GstEvent * event);
|
|
|
|
static GstFlowReturn gst_ffmpegdec_chain (GstPad * pad, GstBuffer * buf);
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2005-09-05 14:06:29 +00:00
|
|
|
static GstStateChangeReturn gst_ffmpegdec_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2005-01-31 10:45:20 +00:00
|
|
|
static void gst_ffmpegdec_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_ffmpegdec_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
|
|
|
|
2009-05-12 09:16:43 +00:00
|
|
|
static gboolean gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec,
|
|
|
|
gboolean force);
|
2005-05-06 07:47:50 +00:00
|
|
|
|
2003-06-07 00:41:32 +00:00
|
|
|
/* some sort of bufferpool handling, but different */
|
2004-03-29 16:39:18 +00:00
|
|
|
static int gst_ffmpegdec_get_buffer (AVCodecContext * context,
|
|
|
|
AVFrame * picture);
|
|
|
|
static void gst_ffmpegdec_release_buffer (AVCodecContext * context,
|
|
|
|
AVFrame * picture);
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2009-06-09 14:34:04 +00:00
|
|
|
static void gst_ffmpegdec_drain (GstFFMpegDec * ffmpegdec);
|
|
|
|
|
2009-05-13 10:37:42 +00:00
|
|
|
static void gst_ts_handler_init (GstFFMpegDec * ffmpegdec);
|
|
|
|
static void gst_ts_handler_append (GstFFMpegDec * ffmpegdec,
|
|
|
|
GstBuffer * buffer);
|
|
|
|
static void gst_ts_handler_consume (GstFFMpegDec * ffmpegdec, gint size);
|
2009-08-06 04:56:44 +00:00
|
|
|
static guint64 gst_ts_handler_get_ts (GstFFMpegDec * ffmpegdec,
|
|
|
|
gint64 * offset);
|
2009-05-13 10:37:42 +00:00
|
|
|
|
2007-02-16 11:48:15 +00:00
|
|
|
#define GST_FFDEC_PARAMS_QDATA g_quark_from_static_string("ffdec-params")
|
|
|
|
|
2001-12-23 13:25:04 +00:00
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
|
2005-01-31 10:45:20 +00:00
|
|
|
#define GST_FFMPEGDEC_TYPE_LOWRES (gst_ffmpegdec_lowres_get_type())
|
|
|
|
static GType
|
|
|
|
gst_ffmpegdec_lowres_get_type (void)
|
|
|
|
{
|
|
|
|
static GType ffmpegdec_lowres_type = 0;
|
|
|
|
|
|
|
|
if (!ffmpegdec_lowres_type) {
|
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
|
|
|
static const GEnumValue ffmpegdec_lowres[] = {
|
2005-01-31 10:45:20 +00:00
|
|
|
{0, "0", "full"},
|
|
|
|
{1, "1", "1/2-size"},
|
|
|
|
{2, "2", "1/4-size"},
|
|
|
|
{0, NULL, NULL},
|
|
|
|
};
|
|
|
|
|
|
|
|
ffmpegdec_lowres_type =
|
|
|
|
g_enum_register_static ("GstFFMpegDecLowres", ffmpegdec_lowres);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ffmpegdec_lowres_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GST_FFMPEGDEC_TYPE_SKIPFRAME (gst_ffmpegdec_skipframe_get_type())
|
|
|
|
static GType
|
|
|
|
gst_ffmpegdec_skipframe_get_type (void)
|
|
|
|
{
|
|
|
|
static GType ffmpegdec_skipframe_type = 0;
|
|
|
|
|
|
|
|
if (!ffmpegdec_skipframe_type) {
|
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
|
|
|
static const GEnumValue ffmpegdec_skipframe[] = {
|
2005-01-31 10:45:20 +00:00
|
|
|
{0, "0", "Skip nothing"},
|
|
|
|
{1, "1", "Skip B-frames"},
|
|
|
|
{2, "2", "Skip IDCT/Dequantization"},
|
|
|
|
{5, "5", "Skip everything"},
|
|
|
|
{0, NULL, NULL},
|
|
|
|
};
|
|
|
|
|
|
|
|
ffmpegdec_skipframe_type =
|
|
|
|
g_enum_register_static ("GstFFMpegDecSkipFrame", ffmpegdec_skipframe);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ffmpegdec_skipframe_type;
|
|
|
|
}
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2003-11-02 13:12:14 +00:00
|
|
|
static void
|
2004-03-29 16:39:18 +00:00
|
|
|
gst_ffmpegdec_base_init (GstFFMpegDecClass * klass)
|
2003-11-02 13:12:14 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
2004-02-11 08:38:26 +00:00
|
|
|
GstElementDetails details;
|
2003-11-02 13:12:14 +00:00
|
|
|
GstPadTemplate *sinktempl, *srctempl;
|
2009-10-22 20:27:28 +00:00
|
|
|
GstCaps *sinkcaps, *srccaps;
|
|
|
|
AVCodec *in_plugin;
|
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 */
|
2009-04-15 20:11:10 +00:00
|
|
|
details.longname = g_strdup_printf ("FFmpeg %s decoder",
|
2009-11-02 08:05:13 +00:00
|
|
|
in_plugin->long_name);
|
2004-07-08 14:01:28 +00:00
|
|
|
details.klass = g_strdup_printf ("Codec/Decoder/%s",
|
2009-11-02 08:05:13 +00:00
|
|
|
(in_plugin->type == CODEC_TYPE_VIDEO) ? "Video" : "Audio");
|
|
|
|
details.description = g_strdup_printf ("FFmpeg %s decoder", in_plugin->name);
|
2008-01-25 11:44:29 +00:00
|
|
|
details.author = "Wim Taymans <wim.taymans@gmail.com>, "
|
2007-12-17 12:43:06 +00:00
|
|
|
"Ronald Bultje <rbultje@ronald.bitfreak.net>, "
|
|
|
|
"Edward Hervey <bilboed@bilboed.com>";
|
2004-02-11 08:38:26 +00:00
|
|
|
gst_element_class_set_details (element_class, &details);
|
|
|
|
g_free (details.longname);
|
|
|
|
g_free (details.klass);
|
|
|
|
g_free (details.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");
|
|
|
|
}
|
|
|
|
if (in_plugin->type == CODEC_TYPE_VIDEO) {
|
|
|
|
srccaps = gst_caps_from_string ("video/x-raw-rgb; video/x-raw-yuv");
|
|
|
|
} else {
|
|
|
|
srccaps = gst_ffmpeg_codectype_to_audio_caps (NULL,
|
|
|
|
in_plugin->id, FALSE, in_plugin);
|
|
|
|
}
|
|
|
|
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
|
2004-03-29 16:39:18 +00:00
|
|
|
gst_ffmpegdec_class_init (GstFFMpegDecClass * 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
|
|
|
|
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
|
|
|
gobject_class->finalize = gst_ffmpegdec_finalize;
|
|
|
|
|
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
|
|
|
gobject_class->set_property = gst_ffmpegdec_set_property;
|
|
|
|
gobject_class->get_property = gst_ffmpegdec_get_property;
|
|
|
|
|
2006-05-07 01:18:46 +00:00
|
|
|
if (klass->in_plugin->type == CODEC_TYPE_VIDEO) {
|
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
|
|
|
g_object_class_install_property (gobject_class, PROP_SKIPFRAME,
|
2006-05-07 01:18:46 +00:00
|
|
|
g_param_spec_enum ("skip-frame", "Skip frames",
|
|
|
|
"Which types of frames to skip during decoding",
|
2008-11-06 11:47:40 +00:00
|
|
|
GST_FFMPEGDEC_TYPE_SKIPFRAME, 0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
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
|
|
|
g_object_class_install_property (gobject_class, PROP_LOWRES,
|
2006-05-07 01:18:46 +00:00
|
|
|
g_param_spec_enum ("lowres", "Low resolution",
|
2008-11-06 11:47:40 +00:00
|
|
|
"At which resolution to decode images", GST_FFMPEGDEC_TYPE_LOWRES,
|
|
|
|
0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
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
|
|
|
g_object_class_install_property (gobject_class, PROP_DIRECT_RENDERING,
|
2008-01-22 18:24:40 +00:00
|
|
|
g_param_spec_boolean ("direct-rendering", "Direct Rendering",
|
2008-11-06 11:47:40 +00:00
|
|
|
"Enable direct rendering", DEFAULT_DIRECT_RENDERING,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2008-01-23 18:23:37 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_DO_PADDING,
|
|
|
|
g_param_spec_boolean ("do-padding", "Do Padding",
|
2008-11-06 11:47:40 +00:00
|
|
|
"Add 0 padding before decoding data", DEFAULT_DO_PADDING,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2008-02-11 18:45:53 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_DEBUG_MV,
|
|
|
|
g_param_spec_boolean ("debug-mv", "Debug motion vectors",
|
|
|
|
"Whether ffmpeg should print motion vectors on top of the image",
|
2008-11-06 11:47:40 +00:00
|
|
|
DEFAULT_DEBUG_MV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
#if 0
|
|
|
|
g_object_class_install_property (gobject_class, PROP_CROP,
|
|
|
|
g_param_spec_boolean ("crop", "Crop",
|
|
|
|
"Crop images to the display region",
|
|
|
|
DEFAULT_CROP, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
#endif
|
2006-05-07 01:18: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
|
|
|
|
|
|
|
gstelement_class->change_state = gst_ffmpegdec_change_state;
|
2003-06-07 00:41:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-29 16:39:18 +00:00
|
|
|
gst_ffmpegdec_init (GstFFMpegDec * ffmpegdec)
|
2003-06-07 00:41:32 +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
|
|
|
GstFFMpegDecClass *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
|
|
|
|
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 = (GstFFMpegDecClass *) (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");
|
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_setcaps_function (ffmpegdec->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_ffmpegdec_setcaps));
|
|
|
|
gst_pad_set_event_function (ffmpegdec->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_ffmpegdec_sink_event));
|
|
|
|
gst_pad_set_chain_function (ffmpegdec->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_ffmpegdec_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);
|
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_pad_set_event_function (ffmpegdec->srcpad,
|
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_FUNCPTR (gst_ffmpegdec_src_event));
|
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_pad_set_query_function (ffmpegdec->srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_ffmpegdec_query));
|
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 ();
|
|
|
|
ffmpegdec->picture = avcodec_alloc_frame ();
|
2004-12-17 13:08:13 +00:00
|
|
|
ffmpegdec->pctx = NULL;
|
|
|
|
ffmpegdec->pcache = NULL;
|
2004-12-16 12:47:43 +00:00
|
|
|
ffmpegdec->par = NULL;
|
2003-06-07 00:41:32 +00:00
|
|
|
ffmpegdec->opened = 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
|
|
|
ffmpegdec->waiting_for_key = TRUE;
|
2005-01-31 10:45:20 +00:00
|
|
|
ffmpegdec->hurry_up = ffmpegdec->lowres = 0;
|
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
|
|
|
ffmpegdec->direct_rendering = DEFAULT_DIRECT_RENDERING;
|
2008-01-23 18:23:37 +00:00
|
|
|
ffmpegdec->do_padding = DEFAULT_DO_PADDING;
|
2008-02-11 18:45:53 +00:00
|
|
|
ffmpegdec->debug_mv = DEFAULT_DEBUG_MV;
|
2008-11-06 11:47:40 +00:00
|
|
|
ffmpegdec->crop = DEFAULT_CROP;
|
2009-07-30 15:02:12 +00:00
|
|
|
ffmpegdec->opaque = NULL;
|
ext/ffmpeg/gstffmpegdec.c: Backported some fixes from 0.8. Most importantly, use demuxer's timestamping information i...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_close), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Backported some fixes from 0.8. Most importantly, use
demuxer's timestamping information if we use its framerate
value. Makes divx play properly again among other things
(#319616, #313970, #317596). Did not backport memory leak
fix.
2005-10-26 17:41:58 +00:00
|
|
|
|
2009-05-13 10:37:42 +00:00
|
|
|
gst_ts_handler_init (ffmpegdec);
|
|
|
|
|
2005-11-22 23:12:51 +00:00
|
|
|
ffmpegdec->format.video.fps_n = -1;
|
|
|
|
ffmpegdec->format.video.old_fps_n = -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
|
|
|
gst_segment_init (&ffmpegdec->segment, GST_FORMAT_TIME);
|
2009-03-08 10:31:35 +00:00
|
|
|
|
|
|
|
/* We initially assume downstream can allocate 16 bytes aligned buffers */
|
|
|
|
ffmpegdec->can_allocate_aligned = TRUE;
|
2003-06-07 00:41:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
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_ffmpegdec_finalize (GObject * object)
|
2003-06-07 00:41:32 +00:00
|
|
|
{
|
|
|
|
GstFFMpegDec *ffmpegdec = (GstFFMpegDec *) object;
|
2003-11-04 22:31:05 +00:00
|
|
|
|
2008-12-03 17:43:45 +00:00
|
|
|
if (ffmpegdec->context != NULL) {
|
2008-08-29 09:59:29 +00:00
|
|
|
av_free (ffmpegdec->context);
|
2008-12-03 17:43:45 +00:00
|
|
|
ffmpegdec->context = NULL;
|
|
|
|
}
|
2008-10-15 11:28:05 +00:00
|
|
|
|
2008-12-03 17:43:45 +00:00
|
|
|
if (ffmpegdec->picture != NULL) {
|
|
|
|
av_free (ffmpegdec->picture);
|
|
|
|
ffmpegdec->picture = NULL;
|
2008-08-29 09:59:29 +00:00
|
|
|
}
|
2008-12-03 17:43:45 +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
|
|
|
}
|
|
|
|
|
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
|
|
|
static gboolean
|
2005-11-14 16:00:38 +00:00
|
|
|
gst_ffmpegdec_query (GstPad * pad, GstQuery * query)
|
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
|
|
|
{
|
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
|
|
|
GstFFMpegDec *ffmpegdec;
|
|
|
|
GstPad *peer;
|
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 res;
|
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/:
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
|
|
|
ffmpegdec = (GstFFMpegDec *) gst_pad_get_parent (pad);
|
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/:
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
|
|
|
res = FALSE;
|
2005-01-25 15:17:44 +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 ((peer = gst_pad_get_peer (ffmpegdec->sinkpad))) {
|
|
|
|
/* just forward to peer */
|
|
|
|
res = gst_pad_query (peer, query);
|
|
|
|
gst_object_unref (peer);
|
|
|
|
}
|
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
|
|
|
#if 0
|
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
|
|
|
{
|
|
|
|
GstFormat bfmt;
|
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
|
|
|
|
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
|
|
|
bfmt = GST_FORMAT_BYTES;
|
|
|
|
|
|
|
|
/* ok, do bitrate calc... */
|
|
|
|
if ((type != GST_QUERY_POSITION && type != GST_QUERY_TOTAL) ||
|
|
|
|
*fmt != GST_FORMAT_TIME || ffmpegdec->context->bit_rate == 0 ||
|
|
|
|
!gst_pad_query (peer, type, &bfmt, value))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (ffmpegdec->pcache && type == GST_QUERY_POSITION)
|
|
|
|
*value -= GST_BUFFER_SIZE (ffmpegdec->pcache);
|
|
|
|
*value *= GST_SECOND / ffmpegdec->context->bit_rate;
|
|
|
|
}
|
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
|
|
|
#endif
|
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/:
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_object_unref (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
|
|
|
|
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 res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
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_ffmpegdec_update_qos (GstFFMpegDec * ffmpegdec, gdouble proportion,
|
|
|
|
GstClockTime 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
|
|
|
{
|
|
|
|
GST_OBJECT_LOCK (ffmpegdec);
|
|
|
|
ffmpegdec->proportion = proportion;
|
|
|
|
ffmpegdec->earliest_time = time;
|
|
|
|
GST_OBJECT_UNLOCK (ffmpegdec);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
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_ffmpegdec_reset_qos (GstFFMpegDec * 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_ffmpegdec_update_qos (ffmpegdec, 0.5, GST_CLOCK_TIME_NONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
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_ffmpegdec_read_qos (GstFFMpegDec * ffmpegdec, gdouble * proportion,
|
|
|
|
GstClockTime * 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
|
|
|
{
|
|
|
|
GST_OBJECT_LOCK (ffmpegdec);
|
|
|
|
*proportion = ffmpegdec->proportion;
|
|
|
|
*time = ffmpegdec->earliest_time;
|
|
|
|
GST_OBJECT_UNLOCK (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
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
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_ffmpegdec_src_event (GstPad * pad, GstEvent * event)
|
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
|
|
|
{
|
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
|
|
|
GstFFMpegDec *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 res;
|
2005-11-14 16:00:38 +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
|
|
|
ffmpegdec = (GstFFMpegDec *) gst_pad_get_parent (pad);
|
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/:
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
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_QOS:
|
|
|
|
{
|
|
|
|
gdouble proportion;
|
|
|
|
GstClockTimeDiff diff;
|
|
|
|
GstClockTime timestamp;
|
2005-11-14 16:00:38 +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_event_parse_qos (event, &proportion, &diff, ×tamp);
|
|
|
|
|
|
|
|
/* update our QoS values */
|
|
|
|
gst_ffmpegdec_update_qos (ffmpegdec, proportion, timestamp + diff);
|
|
|
|
|
|
|
|
/* forward upstream */
|
|
|
|
res = gst_pad_push_event (ffmpegdec->sinkpad, event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
/* forward upstream */
|
|
|
|
res = gst_pad_push_event (ffmpegdec->sinkpad, event);
|
|
|
|
break;
|
2005-01-25 15:17:44 +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_object_unref (ffmpegdec);
|
2005-01-25 15:17:44 +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 res;
|
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
|
|
|
}
|
|
|
|
|
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
|
2005-11-14 16:00:38 +00:00
|
|
|
gst_ffmpegdec_close (GstFFMpegDec * 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
|
|
|
|
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
|
|
|
GST_LOG_OBJECT (ffmpegdec, "closing ffmpeg codec");
|
|
|
|
|
2004-12-16 12:47:43 +00:00
|
|
|
if (ffmpegdec->par) {
|
|
|
|
g_free (ffmpegdec->par);
|
|
|
|
ffmpegdec->par = 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/gstffmpegdec.c: Backported some fixes from 0.8. Most importantly, use demuxer's timestamping information i...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_close), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Backported some fixes from 0.8. Most importantly, use
demuxer's timestamping information if we use its framerate
value. Makes divx play properly again among other things
(#319616, #313970, #317596). Did not backport memory leak
fix.
2005-10-26 17:41:58 +00:00
|
|
|
|
2005-11-22 23:12:51 +00:00
|
|
|
ffmpegdec->format.video.fps_n = -1;
|
|
|
|
ffmpegdec->format.video.old_fps_n = -1;
|
2009-05-12 09:16:43 +00:00
|
|
|
ffmpegdec->format.video.interlaced = 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
|
|
|
}
|
|
|
|
|
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
|
2005-11-14 16:00:38 +00:00
|
|
|
gst_ffmpegdec_open (GstFFMpegDec * 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
|
|
|
{
|
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
|
|
|
GstFFMpegDecClass *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
|
|
|
|
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 = (GstFFMpegDecClass *) (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;
|
2007-08-07 10:21:19 +00:00
|
|
|
ffmpegdec->is_realvideo = 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
|
|
|
|
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_LOG_OBJECT (ffmpegdec, "Opened ffmpeg codec %s, id %d",
|
|
|
|
oclass->in_plugin->name, oclass->in_plugin->id);
|
2005-01-19 15:34:14 +00:00
|
|
|
|
2006-09-13 11:39:49 +00:00
|
|
|
/* open a parser if we can */
|
|
|
|
switch (oclass->in_plugin->id) {
|
|
|
|
case CODEC_ID_MPEG4:
|
|
|
|
case CODEC_ID_MJPEG:
|
2008-01-04 22:14:50 +00:00
|
|
|
case CODEC_ID_VC1:
|
2006-09-13 11:39:49 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "not using parser, blacklisted codec");
|
|
|
|
ffmpegdec->pctx = NULL;
|
|
|
|
break;
|
2006-11-27 18:58:38 +00:00
|
|
|
case CODEC_ID_H264:
|
|
|
|
/* For H264, only use a parser if there is no context data, if there is,
|
|
|
|
* we're talking AVC */
|
|
|
|
if (ffmpegdec->context->extradata_size == 0) {
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "H264 with no extradata, creating parser");
|
|
|
|
ffmpegdec->pctx = av_parser_init (oclass->in_plugin->id);
|
2007-01-09 14:53:36 +00:00
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (ffmpegdec,
|
2006-11-27 18:58:38 +00:00
|
|
|
"H264 with extradata implies framed data - not using parser");
|
|
|
|
ffmpegdec->pctx = NULL;
|
|
|
|
}
|
|
|
|
break;
|
2007-08-07 10:21:19 +00:00
|
|
|
case CODEC_ID_RV10:
|
2007-10-01 17:27:42 +00:00
|
|
|
case CODEC_ID_RV30:
|
2007-08-07 10:21:19 +00:00
|
|
|
case CODEC_ID_RV20:
|
2007-10-01 17:27:42 +00:00
|
|
|
case CODEC_ID_RV40:
|
2007-08-07 10:21:19 +00:00
|
|
|
ffmpegdec->is_realvideo = TRUE;
|
|
|
|
break;
|
2006-09-13 11:39:49 +00:00
|
|
|
default:
|
|
|
|
ffmpegdec->pctx = av_parser_init (oclass->in_plugin->id);
|
2007-08-07 10:21:19 +00:00
|
|
|
if (ffmpegdec->pctx)
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "Using parser %p", ffmpegdec->pctx);
|
|
|
|
else
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "No parser for codec");
|
2006-09-13 11:39:49 +00:00
|
|
|
break;
|
2005-01-19 15:34:14 +00:00
|
|
|
}
|
2004-12-17 13:08:13 +00:00
|
|
|
|
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
|
|
|
switch (oclass->in_plugin->type) {
|
|
|
|
case CODEC_TYPE_VIDEO:
|
|
|
|
ffmpegdec->format.video.width = 0;
|
|
|
|
ffmpegdec->format.video.height = 0;
|
2007-01-09 14:53:36 +00:00
|
|
|
ffmpegdec->format.video.clip_width = -1;
|
|
|
|
ffmpegdec->format.video.clip_height = -1;
|
2005-07-11 13:51:45 +00:00
|
|
|
ffmpegdec->format.video.pix_fmt = PIX_FMT_NB;
|
2009-05-12 09:16:43 +00:00
|
|
|
ffmpegdec->format.video.interlaced = FALSE;
|
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
|
|
|
break;
|
|
|
|
case CODEC_TYPE_AUDIO:
|
|
|
|
ffmpegdec->format.audio.samplerate = 0;
|
|
|
|
ffmpegdec->format.audio.channels = 0;
|
ext/ffmpeg/gstffmpegcodecmap.*: Add mapping for EAC3 and QCELP audio codecs.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_aud_caps_new),
(gst_ffmpeg_codecid_to_caps), (gst_ffmpeg_smpfmt_to_caps),
(gst_ffmpeg_codectype_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_codecid), (av_smp_format_depth):
* ext/ffmpeg/gstffmpegcodecmap.h:
Add mapping for EAC3 and QCELP audio codecs.
Add conversion functions for all available audo SampleFormat.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(clip_audio_buffer), (gst_ffmpegdec_audio_frame):
Remove assumptions that we can only handle stereo 16bit signed integer
audio, and store the depth locally.
2008-12-17 12:05:12 +00:00
|
|
|
ffmpegdec->format.audio.depth = 0;
|
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
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2007-05-02 16:06:09 +00:00
|
|
|
|
2008-03-06 14:47:57 +00:00
|
|
|
ffmpegdec->last_out = GST_CLOCK_TIME_NONE;
|
2006-08-29 09:28:20 +00:00
|
|
|
ffmpegdec->next_ts = GST_CLOCK_TIME_NONE;
|
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
|
|
|
/* FIXME, reset_qos holds the LOCK */
|
|
|
|
ffmpegdec->proportion = 0.0;
|
|
|
|
ffmpegdec->earliest_time = -1;
|
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:
|
|
|
|
{
|
|
|
|
gst_ffmpegdec_close (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_DEBUG_OBJECT (ffmpegdec, "ffdec_%s: Failed to open FFMPEG 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
|
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_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps)
|
2001-12-23 13:25:04 +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
|
|
|
GstFFMpegDec *ffmpegdec;
|
|
|
|
GstFFMpegDecClass *oclass;
|
2004-07-21 09:20:55 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
const GValue *par;
|
2005-11-22 23:12:51 +00:00
|
|
|
const GValue *fps;
|
2005-11-28 11:25:56 +00:00
|
|
|
gboolean ret = TRUE;
|
2001-12-23 13:25:04 +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
|
|
|
ffmpegdec = (GstFFMpegDec *) (gst_pad_get_parent (pad));
|
|
|
|
oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
|
|
|
|
2006-02-06 17:51:41 +00:00
|
|
|
GST_DEBUG_OBJECT (pad, "setcaps called");
|
2005-09-19 13:45:38 +00:00
|
|
|
|
2006-03-22 11:36:38 +00:00
|
|
|
GST_OBJECT_LOCK (ffmpegdec);
|
|
|
|
|
2008-05-07 09:47:57 +00:00
|
|
|
/* stupid check for VC1 */
|
2008-05-07 10:15:53 +00:00
|
|
|
if ((oclass->in_plugin->id == CODEC_ID_WMV3) ||
|
|
|
|
(oclass->in_plugin->id == CODEC_ID_VC1))
|
|
|
|
oclass->in_plugin->id = gst_ffmpeg_caps_to_codecid (caps, NULL);
|
2008-05-07 09:47:57 +00:00
|
|
|
|
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);
|
|
|
|
gst_ffmpegdec_drain (ffmpegdec);
|
|
|
|
GST_OBJECT_LOCK (ffmpegdec);
|
2009-11-09 18:19:25 +00:00
|
|
|
gst_ffmpegdec_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
|
|
|
|
2005-11-14 16:00:38 +00:00
|
|
|
/* set buffer functions */
|
2003-06-07 00:41:32 +00:00
|
|
|
ffmpegdec->context->get_buffer = gst_ffmpegdec_get_buffer;
|
2005-11-14 16:00:38 +00:00
|
|
|
ffmpegdec->context->release_buffer = gst_ffmpegdec_release_buffer;
|
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
|
|
|
ffmpegdec->context->draw_horiz_band = NULL;
|
2005-11-14 16:00:38 +00:00
|
|
|
|
2008-03-05 17:02:33 +00:00
|
|
|
/* assume PTS as input, we will adapt when we detect timestamp reordering
|
|
|
|
* in the output frames. */
|
|
|
|
ffmpegdec->ts_is_dts = FALSE;
|
|
|
|
ffmpegdec->has_b_frames = FALSE;
|
|
|
|
|
2008-11-06 11:47:40 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "size %dx%d", ffmpegdec->context->width,
|
|
|
|
ffmpegdec->context->height);
|
2008-11-05 17:05:46 +00:00
|
|
|
|
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
|
|
|
|
2008-11-06 11:47:40 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "size after %dx%d", ffmpegdec->context->width,
|
|
|
|
ffmpegdec->context->height);
|
2008-11-05 17:05:46 +00:00
|
|
|
|
2005-11-14 16:00:38 +00:00
|
|
|
if (!ffmpegdec->context->time_base.den || !ffmpegdec->context->time_base.num) {
|
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, "forcing 25/1 framerate");
|
2005-07-27 16:03:51 +00:00
|
|
|
ffmpegdec->context->time_base.num = 1;
|
|
|
|
ffmpegdec->context->time_base.den = 25;
|
|
|
|
}
|
2001-12-23 13:25:04 +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);
|
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-07-21 09:20:55 +00:00
|
|
|
par = gst_structure_get_value (structure, "pixel-aspect-ratio");
|
|
|
|
if (par) {
|
2005-11-28 11:25:56 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "sink caps have pixel-aspect-ratio of %d:%d",
|
|
|
|
gst_value_get_fraction_numerator (par),
|
|
|
|
gst_value_get_fraction_denominator (par));
|
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
|
|
|
/* should be NULL */
|
|
|
|
if (ffmpegdec->par)
|
|
|
|
g_free (ffmpegdec->par);
|
2004-07-21 09:20:55 +00:00
|
|
|
ffmpegdec->par = g_new0 (GValue, 1);
|
|
|
|
gst_value_init_and_copy (ffmpegdec->par, par);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* get the framerate from incomming caps. fps_n is set to -1 when
|
|
|
|
* there is no valid framerate */
|
2005-11-22 23:12:51 +00:00
|
|
|
fps = gst_structure_get_value (structure, "framerate");
|
|
|
|
if (fps != NULL && GST_VALUE_HOLDS_FRACTION (fps)) {
|
|
|
|
ffmpegdec->format.video.fps_n = gst_value_get_fraction_numerator (fps);
|
|
|
|
ffmpegdec->format.video.fps_d = gst_value_get_fraction_denominator (fps);
|
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, "Using framerate %d/%d from incoming caps",
|
2006-02-06 17:51:41 +00:00
|
|
|
ffmpegdec->format.video.fps_n, ffmpegdec->format.video.fps_d);
|
ext/ffmpeg/gstffmpegdec.c: Backported some fixes from 0.8. Most importantly, use demuxer's timestamping information i...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_close), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Backported some fixes from 0.8. Most importantly, use
demuxer's timestamping information if we use its framerate
value. Makes divx play properly again among other things
(#319616, #313970, #317596). Did not backport memory leak
fix.
2005-10-26 17:41:58 +00:00
|
|
|
} else {
|
2005-11-22 23:12:51 +00:00
|
|
|
ffmpegdec->format.video.fps_n = -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
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "Using framerate from codec");
|
ext/ffmpeg/gstffmpegdec.c: Backported some fixes from 0.8. Most importantly, use demuxer's timestamping information i...
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_close), (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event),
(gst_ffmpegdec_chain):
Backported some fixes from 0.8. Most importantly, use
demuxer's timestamping information if we use its framerate
value. Makes divx play properly again among other things
(#319616, #313970, #317596). Did not backport memory leak
fix.
2005-10-26 17:41:58 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
/* figure out if we can use direct rendering */
|
|
|
|
ffmpegdec->current_dr = FALSE;
|
2008-01-23 16:08:27 +00:00
|
|
|
ffmpegdec->extra_ref = FALSE;
|
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
|
|
|
if (ffmpegdec->direct_rendering) {
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "trying to enable direct rendering");
|
2008-11-07 11:43:42 +00:00
|
|
|
if (oclass->in_plugin->capabilities & CODEC_CAP_DR1) {
|
|
|
|
if (oclass->in_plugin->id == CODEC_ID_H264) {
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "disable direct rendering setup for H264");
|
|
|
|
/* does not work, many stuff reads outside of the planes */
|
|
|
|
ffmpegdec->current_dr = FALSE;
|
|
|
|
ffmpegdec->extra_ref = TRUE;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "enabled direct rendering");
|
|
|
|
ffmpegdec->current_dr = TRUE;
|
|
|
|
}
|
ext/ffmpeg/gstffmpegcodecmap.*: Add mapping for EAC3 and QCELP audio codecs.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_aud_caps_new),
(gst_ffmpeg_codecid_to_caps), (gst_ffmpeg_smpfmt_to_caps),
(gst_ffmpeg_codectype_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_codecid), (av_smp_format_depth):
* ext/ffmpeg/gstffmpegcodecmap.h:
Add mapping for EAC3 and QCELP audio codecs.
Add conversion functions for all available audo SampleFormat.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(clip_audio_buffer), (gst_ffmpegdec_audio_frame):
Remove assumptions that we can only handle stereo 16bit signed integer
audio, and store the depth locally.
2008-12-17 12:05:12 +00:00
|
|
|
} else {
|
2008-11-07 11:43:42 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "direct rendering not supported");
|
2008-01-26 15:20:10 +00:00
|
|
|
}
|
2007-04-12 10:56:42 +00:00
|
|
|
}
|
2008-01-23 16:08:27 +00:00
|
|
|
if (ffmpegdec->current_dr) {
|
2008-11-07 11:43:42 +00:00
|
|
|
/* do *not* draw edges when in direct rendering, for some reason it draws
|
|
|
|
* outside of the memory. */
|
2008-01-23 16:08:27 +00:00
|
|
|
ffmpegdec->context->flags |= CODEC_FLAG_EMU_EDGE;
|
|
|
|
}
|
2003-06-07 11:01:54 +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
|
|
|
|
2005-01-31 10:45:20 +00:00
|
|
|
/* for slow cpus */
|
|
|
|
ffmpegdec->context->lowres = ffmpegdec->lowres;
|
|
|
|
ffmpegdec->context->hurry_up = ffmpegdec->hurry_up;
|
|
|
|
|
2008-02-11 18:45:53 +00:00
|
|
|
/* ffmpeg can draw motion vectors on top of the image (not every decoder
|
|
|
|
* supports it) */
|
|
|
|
ffmpegdec->context->debug_mv = ffmpegdec->debug_mv;
|
|
|
|
|
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... */
|
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 (!gst_ffmpegdec_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: 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
|
|
|
|
2007-01-09 14:53:36 +00:00
|
|
|
/* clipping region */
|
|
|
|
gst_structure_get_int (structure, "width",
|
|
|
|
&ffmpegdec->format.video.clip_width);
|
|
|
|
gst_structure_get_int (structure, "height",
|
|
|
|
&ffmpegdec->format.video.clip_height);
|
|
|
|
|
2008-03-05 17:02:33 +00:00
|
|
|
/* take into account the lowres property */
|
2008-11-06 11:47:40 +00:00
|
|
|
if (ffmpegdec->format.video.clip_width != -1)
|
|
|
|
ffmpegdec->format.video.clip_width >>= ffmpegdec->lowres;
|
|
|
|
if (ffmpegdec->format.video.clip_height != -1)
|
|
|
|
ffmpegdec->format.video.clip_height >>= ffmpegdec->lowres;
|
2008-03-05 17:02:33 +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);
|
|
|
|
|
|
|
|
gst_object_unref (ffmpegdec);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
open_failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "Failed to open");
|
2004-12-16 12:47:43 +00:00
|
|
|
if (ffmpegdec->par) {
|
|
|
|
g_free (ffmpegdec->par);
|
|
|
|
ffmpegdec->par = NULL;
|
|
|
|
}
|
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
|
|
|
}
|
2001-12-23 13:25:04 +00:00
|
|
|
}
|
|
|
|
|
2008-01-23 16:08:27 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
alloc_output_buffer (GstFFMpegDec * ffmpegdec, GstBuffer ** outbuf,
|
|
|
|
gint width, gint height)
|
|
|
|
{
|
|
|
|
GstFlowReturn ret;
|
|
|
|
gint fsize;
|
|
|
|
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
*outbuf = NULL;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "alloc output buffer");
|
|
|
|
|
|
|
|
/* see if we need renegotiation */
|
2009-05-12 09:16:43 +00:00
|
|
|
if (G_UNLIKELY (!gst_ffmpegdec_negotiate (ffmpegdec, FALSE)))
|
2008-01-23 16:08:27 +00:00
|
|
|
goto negotiate_failed;
|
|
|
|
|
|
|
|
/* get the size of the gstreamer output buffer given a
|
|
|
|
* width/height/format */
|
|
|
|
fsize = gst_ffmpeg_avpicture_get_size (ffmpegdec->context->pix_fmt,
|
|
|
|
width, height);
|
|
|
|
|
2009-03-08 10:31:35 +00:00
|
|
|
if (!ffmpegdec->context->palctrl && ffmpegdec->can_allocate_aligned) {
|
2008-11-07 11:43:42 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "calling pad_alloc");
|
2008-01-23 16:08:27 +00:00
|
|
|
/* no pallete, we can use the buffer size to alloc */
|
|
|
|
ret = gst_pad_alloc_buffer_and_set_caps (ffmpegdec->srcpad,
|
|
|
|
GST_BUFFER_OFFSET_NONE, fsize,
|
|
|
|
GST_PAD_CAPS (ffmpegdec->srcpad), outbuf);
|
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK))
|
|
|
|
goto alloc_failed;
|
2009-03-08 10:31:35 +00:00
|
|
|
|
|
|
|
/* If buffer isn't 128-bit aligned, create a memaligned one ourselves */
|
|
|
|
if (((uintptr_t) GST_BUFFER_DATA (*outbuf)) % 16) {
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec,
|
|
|
|
"Downstream can't allocate aligned buffers.");
|
|
|
|
ffmpegdec->can_allocate_aligned = FALSE;
|
|
|
|
gst_buffer_unref (*outbuf);
|
|
|
|
*outbuf = new_aligned_buffer (fsize, GST_PAD_CAPS (ffmpegdec->srcpad));
|
|
|
|
}
|
2008-01-23 16:08:27 +00:00
|
|
|
} else {
|
2009-03-08 10:31:35 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec,
|
|
|
|
"not calling pad_alloc, we have a pallete or downstream can't give 16 byte aligned buffers.");
|
2008-01-23 16:08:27 +00:00
|
|
|
/* for paletted data we can't use pad_alloc_buffer(), because
|
|
|
|
* fsize contains the size of the palette, so the overall size
|
|
|
|
* is bigger than ffmpegcolorspace's unit size, which will
|
|
|
|
* prompt GstBaseTransform to complain endlessly ... */
|
2009-03-08 10:31:35 +00:00
|
|
|
*outbuf = new_aligned_buffer (fsize, GST_PAD_CAPS (ffmpegdec->srcpad));
|
2008-01-23 16:08:27 +00:00
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* special cases */
|
|
|
|
negotiate_failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "negotiate failed");
|
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
}
|
|
|
|
alloc_failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "pad_alloc failed");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-06-07 00:41:32 +00:00
|
|
|
static int
|
2004-03-29 16:39:18 +00:00
|
|
|
gst_ffmpegdec_get_buffer (AVCodecContext * context, AVFrame * picture)
|
2003-06-07 00:41:32 +00:00
|
|
|
{
|
|
|
|
GstBuffer *buf = NULL;
|
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
|
|
|
GstFFMpegDec *ffmpegdec;
|
2008-11-05 17:05:46 +00:00
|
|
|
gint width, height;
|
|
|
|
gint coded_width, coded_height;
|
|
|
|
gint res;
|
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
|
|
|
|
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
|
|
|
ffmpegdec = (GstFFMpegDec *) context->opaque;
|
|
|
|
|
2008-01-26 15:20:10 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "getting buffer, apply pts %" G_GINT64_FORMAT,
|
|
|
|
ffmpegdec->in_ts);
|
2008-01-18 12:18:08 +00:00
|
|
|
|
|
|
|
/* apply the last timestamp we have seen to this picture, when we get the
|
|
|
|
* picture back from ffmpeg we can use this to correctly timestamp the output
|
|
|
|
* buffer */
|
|
|
|
picture->pts = ffmpegdec->in_ts;
|
2009-05-13 11:47:58 +00:00
|
|
|
picture->reordered_opaque = context->reordered_opaque;
|
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
|
|
|
/* make sure we don't free the buffer when it's not ours */
|
|
|
|
picture->opaque = NULL;
|
|
|
|
|
2008-11-05 17:05:46 +00:00
|
|
|
/* take width and height before clipping */
|
|
|
|
width = context->width;
|
|
|
|
height = context->height;
|
|
|
|
coded_width = context->coded_width;
|
|
|
|
coded_height = context->coded_height;
|
|
|
|
|
2008-11-06 11:47:40 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "dimension %dx%d, coded %dx%d", width, height,
|
|
|
|
coded_width, coded_height);
|
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
|
|
|
if (!ffmpegdec->current_dr) {
|
2008-01-23 16:08:27 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "direct rendering disabled, fallback alloc");
|
2008-11-05 17:05:46 +00:00
|
|
|
res = avcodec_default_get_buffer (context, picture);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "linsize %d %d %d", picture->linesize[0],
|
2008-11-06 11:47:40 +00:00
|
|
|
picture->linesize[1], picture->linesize[2]);
|
2009-11-05 23:54:47 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "data %u %u %u", 0,
|
|
|
|
(guint) (picture->data[1] - picture->data[0]),
|
|
|
|
(guint) (picture->data[2] - picture->data[0]));
|
2008-11-05 17:05:46 +00:00
|
|
|
return res;
|
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
|
|
|
}
|
2008-01-18 12:18:08 +00:00
|
|
|
|
2003-06-07 00:41:32 +00:00
|
|
|
switch (context->codec_type) {
|
|
|
|
case CODEC_TYPE_VIDEO:
|
2008-01-04 22:14:50 +00:00
|
|
|
/* some ffmpeg video plugins don't see the point in setting codec_type ... */
|
2007-12-17 12:43:06 +00:00
|
|
|
case CODEC_TYPE_UNKNOWN:
|
2008-01-23 16:08:27 +00:00
|
|
|
{
|
|
|
|
GstFlowReturn ret;
|
|
|
|
gint clip_width, clip_height;
|
2005-11-14 16:00:38 +00:00
|
|
|
|
2008-01-23 16:08:27 +00:00
|
|
|
/* take final clipped output size */
|
|
|
|
if ((clip_width = ffmpegdec->format.video.clip_width) == -1)
|
2008-01-26 15:20:10 +00:00
|
|
|
clip_width = width;
|
2008-01-23 16:08:27 +00:00
|
|
|
if ((clip_height = ffmpegdec->format.video.clip_height) == -1)
|
2008-01-26 15:20:10 +00:00
|
|
|
clip_height = height;
|
2005-11-14 16:00:38 +00:00
|
|
|
|
2008-11-05 17:05:46 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "raw outsize %d/%d", width, height);
|
|
|
|
|
2008-01-23 16:08:27 +00:00
|
|
|
/* this is the size ffmpeg needs for the buffer */
|
2008-01-26 15:20:10 +00:00
|
|
|
avcodec_align_dimensions (context, &width, &height);
|
2005-11-14 16:00:38 +00:00
|
|
|
|
2008-01-26 15:20:10 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "aligned outsize %d/%d, clip %d/%d",
|
|
|
|
width, height, clip_width, clip_height);
|
2008-01-23 16:08:27 +00:00
|
|
|
|
|
|
|
if (width != clip_width || height != clip_height) {
|
|
|
|
/* We can't alloc if we need to clip the output buffer later */
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "we need clipping, fallback alloc");
|
2005-11-14 16:00:38 +00:00
|
|
|
return avcodec_default_get_buffer (context, picture);
|
2005-05-06 07:47:50 +00:00
|
|
|
}
|
2005-11-14 16:00:38 +00:00
|
|
|
|
2008-01-23 16:08:27 +00:00
|
|
|
/* alloc with aligned dimensions for ffmpeg */
|
|
|
|
ret = alloc_output_buffer (ffmpegdec, &buf, width, height);
|
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK)) {
|
2008-01-26 15:20:10 +00:00
|
|
|
/* alloc default buffer when we can't get one from downstream */
|
2008-01-23 16:08:27 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "alloc failed, fallback alloc");
|
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
|
|
|
return avcodec_default_get_buffer (context, picture);
|
|
|
|
}
|
2005-11-14 16:00:38 +00:00
|
|
|
|
2008-01-23 16:08:27 +00:00
|
|
|
/* copy the right pointers and strides in the picture object */
|
2004-10-29 09:47:41 +00:00
|
|
|
gst_ffmpeg_avpicture_fill ((AVPicture *) picture,
|
2008-01-23 16:08:27 +00:00
|
|
|
GST_BUFFER_DATA (buf), context->pix_fmt, width, height);
|
2003-06-07 00:41:32 +00:00
|
|
|
break;
|
2008-01-23 16:08:27 +00:00
|
|
|
}
|
2003-06-07 00:41:32 +00:00
|
|
|
case CODEC_TYPE_AUDIO:
|
|
|
|
default:
|
2008-10-15 11:28:05 +00:00
|
|
|
GST_ERROR_OBJECT (ffmpegdec,
|
|
|
|
"_get_buffer() should never get called for non-video buffers !");
|
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_assert_not_reached ();
|
2003-06-07 00:41:32 +00:00
|
|
|
break;
|
2001-12-23 13:25:04 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
/* tell ffmpeg we own this buffer, tranfer the ref we have on the buffer to
|
|
|
|
* the opaque data. */
|
2003-06-07 00:41:32 +00:00
|
|
|
picture->type = FF_BUFFER_TYPE_USER;
|
2008-01-26 15:20:10 +00:00
|
|
|
picture->age = 256 * 256 * 256 * 64;
|
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
|
|
|
picture->opaque = buf;
|
2003-06-07 00:41:32 +00:00
|
|
|
|
2008-01-23 16:08:27 +00:00
|
|
|
#ifdef EXTRA_REF
|
|
|
|
if (picture->reference != 0 || ffmpegdec->extra_ref) {
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "adding extra ref");
|
|
|
|
gst_buffer_ref (buf);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
GST_LOG_OBJECT (ffmpegdec, "returned buffer %p", buf);
|
2005-11-11 14:43:01 +00:00
|
|
|
|
2003-06-07 00:41:32 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2003-06-07 00:41:32 +00:00
|
|
|
static void
|
2004-03-29 16:39:18 +00:00
|
|
|
gst_ffmpegdec_release_buffer (AVCodecContext * context, AVFrame * picture)
|
2003-06-07 00:41:32 +00:00
|
|
|
{
|
|
|
|
gint i;
|
2005-11-16 21:48:06 +00:00
|
|
|
GstBuffer *buf;
|
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
|
|
|
GstFFMpegDec *ffmpegdec;
|
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
|
|
|
|
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
|
|
|
ffmpegdec = (GstFFMpegDec *) context->opaque;
|
|
|
|
|
2008-01-18 12:18:08 +00:00
|
|
|
/* check if it was our buffer */
|
|
|
|
if (picture->opaque == NULL) {
|
2008-01-23 16:08:27 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "default release buffer");
|
2008-01-18 12:18:08 +00:00
|
|
|
avcodec_default_release_buffer (context, picture);
|
|
|
|
return;
|
|
|
|
}
|
2004-03-29 16:39:18 +00:00
|
|
|
|
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
|
|
|
/* we remove the opaque data now */
|
|
|
|
buf = GST_BUFFER_CAST (picture->opaque);
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "release buffer %p", buf);
|
2005-11-16 21:48:06 +00:00
|
|
|
picture->opaque = NULL;
|
2003-06-07 00:41:32 +00:00
|
|
|
|
2008-01-23 16:08:27 +00:00
|
|
|
#ifdef EXTRA_REF
|
|
|
|
if (picture->reference != 0 || ffmpegdec->extra_ref) {
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "remove extra ref");
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
#endif
|
|
|
|
|
2003-06-07 00:41:32 +00:00
|
|
|
/* zero out the reference in ffmpeg */
|
2004-03-29 16:39:18 +00:00
|
|
|
for (i = 0; i < 4; i++) {
|
2003-06-07 00:41:32 +00:00
|
|
|
picture->data[i] = NULL;
|
|
|
|
picture->linesize[i] = 0;
|
|
|
|
}
|
2001-12-23 13:25:04 +00:00
|
|
|
}
|
|
|
|
|
2005-11-28 11:25:56 +00:00
|
|
|
static void
|
|
|
|
gst_ffmpegdec_add_pixel_aspect_ratio (GstFFMpegDec * ffmpegdec,
|
|
|
|
GstStructure * s)
|
|
|
|
{
|
|
|
|
gboolean demuxer_par_set = FALSE;
|
|
|
|
gboolean decoder_par_set = FALSE;
|
2006-03-31 22:26:12 +00:00
|
|
|
gint demuxer_num = 1, demuxer_denom = 1;
|
|
|
|
gint decoder_num = 1, decoder_denom = 1;
|
2005-11-28 11:25:56 +00:00
|
|
|
|
|
|
|
GST_OBJECT_LOCK (ffmpegdec);
|
|
|
|
|
|
|
|
if (ffmpegdec->par) {
|
|
|
|
demuxer_num = gst_value_get_fraction_numerator (ffmpegdec->par);
|
|
|
|
demuxer_denom = gst_value_get_fraction_denominator (ffmpegdec->par);
|
|
|
|
demuxer_par_set = TRUE;
|
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, "Demuxer PAR: %d:%d", demuxer_num,
|
|
|
|
demuxer_denom);
|
2005-11-28 11:25:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ffmpegdec->context->sample_aspect_ratio.num &&
|
|
|
|
ffmpegdec->context->sample_aspect_ratio.den) {
|
|
|
|
decoder_num = ffmpegdec->context->sample_aspect_ratio.num;
|
|
|
|
decoder_denom = ffmpegdec->context->sample_aspect_ratio.den;
|
|
|
|
decoder_par_set = TRUE;
|
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, "Decoder PAR: %d:%d", decoder_num,
|
|
|
|
decoder_denom);
|
2005-11-28 11:25:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (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
|
|
|
if (!demuxer_par_set && !decoder_par_set)
|
|
|
|
goto no_par;
|
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
|
|
|
|
2005-11-28 11:25:56 +00:00
|
|
|
if (demuxer_par_set && !decoder_par_set)
|
|
|
|
goto use_demuxer_par;
|
|
|
|
|
|
|
|
if (decoder_par_set && !demuxer_par_set)
|
|
|
|
goto use_decoder_par;
|
|
|
|
|
|
|
|
/* Both the demuxer and the decoder provide a PAR. If one of
|
|
|
|
* the two PARs is 1:1 and the other one is not, use the one
|
2008-10-15 11:28:05 +00:00
|
|
|
* that is not 1:1. */
|
2005-11-28 11:25:56 +00:00
|
|
|
if (demuxer_num == demuxer_denom && decoder_num != decoder_denom)
|
|
|
|
goto use_decoder_par;
|
|
|
|
|
|
|
|
if (decoder_num == decoder_denom && demuxer_num != demuxer_denom)
|
|
|
|
goto use_demuxer_par;
|
|
|
|
|
2008-10-15 11:28:05 +00:00
|
|
|
/* Both PARs are non-1:1, so use the PAR provided by the demuxer */
|
|
|
|
goto use_demuxer_par;
|
|
|
|
|
2005-11-28 11:25:56 +00:00
|
|
|
use_decoder_par:
|
|
|
|
{
|
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,
|
|
|
|
"Setting decoder provided pixel-aspect-ratio of %u:%u", decoder_num,
|
|
|
|
decoder_denom);
|
|
|
|
gst_structure_set (s, "pixel-aspect-ratio", GST_TYPE_FRACTION, decoder_num,
|
|
|
|
decoder_denom, NULL);
|
2005-11-28 11:25:56 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
use_demuxer_par:
|
|
|
|
{
|
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,
|
|
|
|
"Setting demuxer provided pixel-aspect-ratio of %u:%u", demuxer_num,
|
|
|
|
demuxer_denom);
|
|
|
|
gst_structure_set (s, "pixel-aspect-ratio", GST_TYPE_FRACTION, demuxer_num,
|
|
|
|
demuxer_denom, NULL);
|
2005-11-28 11:25:56 +00:00
|
|
|
return;
|
|
|
|
}
|
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
|
|
|
no_par:
|
|
|
|
{
|
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,
|
|
|
|
"Neither demuxer nor codec provide a pixel-aspect-ratio");
|
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;
|
|
|
|
}
|
2005-11-28 11:25:56 +00:00
|
|
|
}
|
|
|
|
|
2004-12-16 12:47:43 +00:00
|
|
|
static gboolean
|
2009-05-12 09:16:43 +00:00
|
|
|
gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec, gboolean force)
|
2004-12-16 12:47:43 +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
|
|
|
GstFFMpegDecClass *oclass;
|
2004-12-16 12:47:43 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
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 = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (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
|
|
|
switch (oclass->in_plugin->type) {
|
|
|
|
case CODEC_TYPE_VIDEO:
|
2009-05-12 09:16:43 +00:00
|
|
|
if (!force && ffmpegdec->format.video.width == ffmpegdec->context->width
|
|
|
|
&& ffmpegdec->format.video.height == ffmpegdec->context->height
|
|
|
|
&& ffmpegdec->format.video.fps_n == ffmpegdec->format.video.old_fps_n
|
|
|
|
&& ffmpegdec->format.video.fps_d == ffmpegdec->format.video.old_fps_d
|
|
|
|
&& ffmpegdec->format.video.pix_fmt == ffmpegdec->context->pix_fmt)
|
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
|
|
|
return TRUE;
|
2006-02-06 17:51:41 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec,
|
|
|
|
"Renegotiating video from %dx%d@ %d/%d fps to %dx%d@ %d/%d fps",
|
2005-01-19 15:34:14 +00:00
|
|
|
ffmpegdec->format.video.width, ffmpegdec->format.video.height,
|
2005-11-22 23:12:51 +00:00
|
|
|
ffmpegdec->format.video.old_fps_n, ffmpegdec->format.video.old_fps_n,
|
2005-11-28 11:25:56 +00:00
|
|
|
ffmpegdec->context->width, ffmpegdec->context->height,
|
|
|
|
ffmpegdec->format.video.fps_n, ffmpegdec->format.video.fps_d);
|
2005-01-19 15:34:14 +00:00
|
|
|
ffmpegdec->format.video.width = ffmpegdec->context->width;
|
|
|
|
ffmpegdec->format.video.height = ffmpegdec->context->height;
|
2005-11-22 23:12:51 +00:00
|
|
|
ffmpegdec->format.video.old_fps_n = ffmpegdec->format.video.fps_n;
|
|
|
|
ffmpegdec->format.video.old_fps_d = ffmpegdec->format.video.fps_d;
|
2005-07-11 13:51:45 +00:00
|
|
|
ffmpegdec->format.video.pix_fmt = ffmpegdec->context->pix_fmt;
|
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
|
|
|
break;
|
|
|
|
case CODEC_TYPE_AUDIO:
|
ext/ffmpeg/gstffmpegcodecmap.*: Add mapping for EAC3 and QCELP audio codecs.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_aud_caps_new),
(gst_ffmpeg_codecid_to_caps), (gst_ffmpeg_smpfmt_to_caps),
(gst_ffmpeg_codectype_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_codecid), (av_smp_format_depth):
* ext/ffmpeg/gstffmpegcodecmap.h:
Add mapping for EAC3 and QCELP audio codecs.
Add conversion functions for all available audo SampleFormat.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(clip_audio_buffer), (gst_ffmpegdec_audio_frame):
Remove assumptions that we can only handle stereo 16bit signed integer
audio, and store the depth locally.
2008-12-17 12:05:12 +00:00
|
|
|
{
|
|
|
|
gint depth = av_smp_format_depth (ffmpegdec->context->sample_fmt);
|
2009-05-12 09:16:43 +00:00
|
|
|
if (!force && ffmpegdec->format.audio.samplerate ==
|
2005-11-14 16:00:38 +00:00
|
|
|
ffmpegdec->context->sample_rate &&
|
ext/ffmpeg/gstffmpegcodecmap.*: Add mapping for EAC3 and QCELP audio codecs.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_aud_caps_new),
(gst_ffmpeg_codecid_to_caps), (gst_ffmpeg_smpfmt_to_caps),
(gst_ffmpeg_codectype_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_codecid), (av_smp_format_depth):
* ext/ffmpeg/gstffmpegcodecmap.h:
Add mapping for EAC3 and QCELP audio codecs.
Add conversion functions for all available audo SampleFormat.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(clip_audio_buffer), (gst_ffmpegdec_audio_frame):
Remove assumptions that we can only handle stereo 16bit signed integer
audio, and store the depth locally.
2008-12-17 12:05:12 +00:00
|
|
|
ffmpegdec->format.audio.channels == ffmpegdec->context->channels &&
|
|
|
|
ffmpegdec->format.audio.depth == depth)
|
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
|
|
|
return TRUE;
|
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,
|
ext/ffmpeg/gstffmpegcodecmap.*: Add mapping for EAC3 and QCELP audio codecs.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_aud_caps_new),
(gst_ffmpeg_codecid_to_caps), (gst_ffmpeg_smpfmt_to_caps),
(gst_ffmpeg_codectype_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_codecid), (av_smp_format_depth):
* ext/ffmpeg/gstffmpegcodecmap.h:
Add mapping for EAC3 and QCELP audio codecs.
Add conversion functions for all available audo SampleFormat.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(clip_audio_buffer), (gst_ffmpegdec_audio_frame):
Remove assumptions that we can only handle stereo 16bit signed integer
audio, and store the depth locally.
2008-12-17 12:05:12 +00:00
|
|
|
"Renegotiating audio from %dHz@%dchannels (%d) to %dHz@%dchannels (%d)",
|
2005-01-19 15:34:14 +00:00
|
|
|
ffmpegdec->format.audio.samplerate, ffmpegdec->format.audio.channels,
|
ext/ffmpeg/gstffmpegcodecmap.*: Add mapping for EAC3 and QCELP audio codecs.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_aud_caps_new),
(gst_ffmpeg_codecid_to_caps), (gst_ffmpeg_smpfmt_to_caps),
(gst_ffmpeg_codectype_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_codecid), (av_smp_format_depth):
* ext/ffmpeg/gstffmpegcodecmap.h:
Add mapping for EAC3 and QCELP audio codecs.
Add conversion functions for all available audo SampleFormat.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(clip_audio_buffer), (gst_ffmpegdec_audio_frame):
Remove assumptions that we can only handle stereo 16bit signed integer
audio, and store the depth locally.
2008-12-17 12:05:12 +00:00
|
|
|
ffmpegdec->format.audio.depth,
|
|
|
|
ffmpegdec->context->sample_rate, ffmpegdec->context->channels, depth);
|
2005-01-19 15:34:14 +00:00
|
|
|
ffmpegdec->format.audio.samplerate = ffmpegdec->context->sample_rate;
|
2005-01-25 16:56:45 +00:00
|
|
|
ffmpegdec->format.audio.channels = ffmpegdec->context->channels;
|
ext/ffmpeg/gstffmpegcodecmap.*: Add mapping for EAC3 and QCELP audio codecs.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_aud_caps_new),
(gst_ffmpeg_codecid_to_caps), (gst_ffmpeg_smpfmt_to_caps),
(gst_ffmpeg_codectype_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_codecid), (av_smp_format_depth):
* ext/ffmpeg/gstffmpegcodecmap.h:
Add mapping for EAC3 and QCELP audio codecs.
Add conversion functions for all available audo SampleFormat.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(clip_audio_buffer), (gst_ffmpegdec_audio_frame):
Remove assumptions that we can only handle stereo 16bit signed integer
audio, and store the depth locally.
2008-12-17 12:05:12 +00:00
|
|
|
ffmpegdec->format.audio.depth = depth;
|
|
|
|
}
|
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
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
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);
|
2004-12-16 12:47:43 +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;
|
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
|
|
|
switch (oclass->in_plugin->type) {
|
|
|
|
case CODEC_TYPE_VIDEO:
|
2007-01-09 14:53:36 +00:00
|
|
|
{
|
|
|
|
gint width, height;
|
2009-05-12 09:16:43 +00:00
|
|
|
gboolean interlaced;
|
2007-01-09 14:53:36 +00:00
|
|
|
|
|
|
|
width = ffmpegdec->format.video.clip_width;
|
|
|
|
height = ffmpegdec->format.video.clip_height;
|
2009-05-12 09:16:43 +00:00
|
|
|
interlaced = ffmpegdec->format.video.interlaced;
|
2007-01-09 14:53:36 +00:00
|
|
|
|
|
|
|
if (width != -1 && height != -1) {
|
2008-01-23 16:08:27 +00:00
|
|
|
/* overwrite the output size with the dimension of the
|
2008-01-26 15:20:10 +00:00
|
|
|
* clipping region */
|
2007-01-09 14:53:36 +00:00
|
|
|
gst_caps_set_simple (caps,
|
|
|
|
"width", G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL);
|
|
|
|
}
|
2009-05-12 09:16:43 +00:00
|
|
|
gst_caps_set_simple (caps, "interlaced", G_TYPE_BOOLEAN, interlaced,
|
|
|
|
NULL);
|
|
|
|
|
2006-08-29 09:28:20 +00:00
|
|
|
/* If a demuxer provided a framerate then use it (#313970) */
|
|
|
|
if (ffmpegdec->format.video.fps_n != -1) {
|
|
|
|
gst_caps_set_simple (caps, "framerate",
|
|
|
|
GST_TYPE_FRACTION, ffmpegdec->format.video.fps_n,
|
|
|
|
ffmpegdec->format.video.fps_d, NULL);
|
|
|
|
}
|
|
|
|
gst_ffmpegdec_add_pixel_aspect_ratio (ffmpegdec,
|
|
|
|
gst_caps_get_structure (caps, 0));
|
|
|
|
break;
|
2007-01-09 14:53:36 +00:00
|
|
|
}
|
2006-08-29 09:28:20 +00:00
|
|
|
case CODEC_TYPE_AUDIO:
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
2004-12-16 12:47:43 +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;
|
|
|
|
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_caps:
|
|
|
|
{
|
2004-12-16 12:47:43 +00:00
|
|
|
GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION, (NULL),
|
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
|
|
|
("could not find caps for codec (%s), unknown type",
|
2005-11-14 16:00:38 +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
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
caps_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION, (NULL),
|
|
|
|
("Could not set caps for ffmpeg decoder (%s), not fixed?",
|
|
|
|
oclass->in_plugin->name));
|
|
|
|
gst_caps_unref (caps);
|
2004-12-16 12:47:43 +00:00
|
|
|
|
|
|
|
return 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
|
|
|
}
|
2004-12-16 12:47:43 +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
|
|
|
/* perform qos calculations before decoding the next frame.
|
|
|
|
*
|
|
|
|
* Sets the hurry_up flag and if things are really bad, skips to the next
|
|
|
|
* keyframe.
|
|
|
|
*
|
|
|
|
* Returns TRUE if the frame should be decoded, FALSE if the frame can be dropped
|
|
|
|
* entirely.
|
|
|
|
*/
|
|
|
|
static gboolean
|
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_ffmpegdec_do_qos (GstFFMpegDec * ffmpegdec, GstClockTime timestamp,
|
|
|
|
gboolean * mode_switch)
|
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
|
|
|
{
|
|
|
|
GstClockTimeDiff diff;
|
|
|
|
gdouble proportion;
|
|
|
|
GstClockTime qostime, earliest_time;
|
|
|
|
|
|
|
|
*mode_switch = FALSE;
|
|
|
|
|
|
|
|
/* no timestamp, can't do QoS */
|
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 (!GST_CLOCK_TIME_IS_VALID (timestamp)))
|
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 no_qos;
|
|
|
|
|
|
|
|
/* get latest QoS observation values */
|
|
|
|
gst_ffmpegdec_read_qos (ffmpegdec, &proportion, &earliest_time);
|
|
|
|
|
|
|
|
/* skip qos if we have no observation (yet) */
|
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 (!GST_CLOCK_TIME_IS_VALID (earliest_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
|
|
|
/* no hurry_up initialy */
|
|
|
|
ffmpegdec->context->hurry_up = 0;
|
|
|
|
goto no_qos;
|
|
|
|
}
|
|
|
|
|
2009-06-05 11:47:15 +00:00
|
|
|
/* qos is done on running time of the timestamp */
|
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
|
|
|
qostime = gst_segment_to_running_time (&ffmpegdec->segment, 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
|
|
|
timestamp);
|
2004-12-16 12:47:43 +00:00
|
|
|
|
2009-06-05 11:47:15 +00:00
|
|
|
/* timestamp can be out of segment, then we don't do QoS */
|
|
|
|
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (qostime)))
|
|
|
|
goto no_qos;
|
|
|
|
|
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
|
|
|
/* see how our next timestamp relates to the latest qos timestamp. negative
|
|
|
|
* values mean we are early, positive values mean we are too late. */
|
|
|
|
diff = GST_CLOCK_DIFF (qostime, earliest_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
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "QOS: qostime %" GST_TIME_FORMAT
|
|
|
|
", earliest %" GST_TIME_FORMAT, GST_TIME_ARGS (qostime),
|
|
|
|
GST_TIME_ARGS (earliest_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
|
|
|
|
|
|
|
/* if we using less than 40% of the available time, we can try to
|
|
|
|
* speed up again when we were slow. */
|
|
|
|
if (proportion < 0.4 && diff < 0) {
|
|
|
|
goto normal_mode;
|
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 {
|
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 we're more than two seconds late, switch to the next keyframe */
|
|
|
|
/* FIXME, let the demuxer decide what's the best since we might be dropping
|
|
|
|
* a lot of frames when the keyframe is far away or we even might not get a new
|
|
|
|
* keyframe at all.. */
|
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 (diff > ((GstClockTimeDiff) GST_SECOND * 2)
|
|
|
|
&& !ffmpegdec->waiting_for_key) {
|
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 skip_to_keyframe;
|
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 if (diff >= 0) {
|
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
|
|
|
/* we're too slow, try to speed up */
|
|
|
|
if (ffmpegdec->waiting_for_key) {
|
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
|
|
|
/* we were waiting for a keyframe, that's ok */
|
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 skipping;
|
|
|
|
}
|
|
|
|
/* switch to hurry_up mode */
|
|
|
|
goto hurry_up;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
no_qos:
|
2004-12-16 12:47:43 +00:00
|
|
|
return 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
|
|
|
|
|
|
|
skipping:
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
normal_mode:
|
|
|
|
{
|
|
|
|
if (ffmpegdec->context->hurry_up != 0) {
|
|
|
|
ffmpegdec->context->hurry_up = 0;
|
|
|
|
*mode_switch = TRUE;
|
2006-04-08 11:04:50 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "QOS: normal mode %g < 0.4", proportion);
|
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;
|
|
|
|
}
|
|
|
|
skip_to_keyframe:
|
|
|
|
{
|
|
|
|
ffmpegdec->context->hurry_up = 1;
|
|
|
|
ffmpegdec->waiting_for_key = TRUE;
|
|
|
|
*mode_switch = TRUE;
|
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,
|
|
|
|
"QOS: keyframe, %" G_GINT64_FORMAT " > GST_SECOND/2", diff);
|
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
|
|
|
/* we can skip the current frame */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
hurry_up:
|
|
|
|
{
|
|
|
|
if (ffmpegdec->context->hurry_up != 1) {
|
|
|
|
ffmpegdec->context->hurry_up = 1;
|
|
|
|
*mode_switch = TRUE;
|
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,
|
|
|
|
"QOS: hurry up, diff %" G_GINT64_FORMAT " >= 0", diff);
|
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;
|
|
|
|
}
|
2004-12-16 12:47:43 +00:00
|
|
|
}
|
2004-11-05 18:03:04 +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
|
|
|
/* 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
|
|
|
|
clip_video_buffer (GstFFMpegDec * dec, GstBuffer * buf, GstClockTime in_ts,
|
|
|
|
GstClockTime in_dur)
|
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
gint64 cstart, cstop;
|
|
|
|
GstClockTime stop;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (dec,
|
|
|
|
"timestamp:%" GST_TIME_FORMAT " , duration:%" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (in_ts), GST_TIME_ARGS (in_dur));
|
|
|
|
|
|
|
|
/* can't clip without TIME segment */
|
2006-08-29 09:28:20 +00:00
|
|
|
if (G_UNLIKELY (dec->segment.format != GST_FORMAT_TIME))
|
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
|
|
|
goto beach;
|
|
|
|
|
|
|
|
/* we need a start time */
|
|
|
|
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (in_ts)))
|
|
|
|
goto beach;
|
|
|
|
|
|
|
|
/* generate valid stop, if duration unknown, we have unknown stop */
|
|
|
|
stop =
|
|
|
|
GST_CLOCK_TIME_IS_VALID (in_dur) ? (in_ts + in_dur) : GST_CLOCK_TIME_NONE;
|
|
|
|
|
|
|
|
/* now clip */
|
2006-08-29 09:28:20 +00:00
|
|
|
res =
|
|
|
|
gst_segment_clip (&dec->segment, GST_FORMAT_TIME, in_ts, stop, &cstart,
|
|
|
|
&cstop);
|
2009-11-16 12:54:16 +00:00
|
|
|
if (G_UNLIKELY (!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
|
|
|
goto beach;
|
|
|
|
|
2007-05-25 10:41:56 +00:00
|
|
|
/* we're pretty sure the duration of this buffer is not till the end of this
|
|
|
|
* segment (which _clip will assume when the stop is -1) */
|
|
|
|
if (stop == GST_CLOCK_TIME_NONE)
|
|
|
|
cstop = GST_CLOCK_TIME_NONE;
|
|
|
|
|
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
|
|
|
/* update timestamp and possibly duration if the clipped stop time is
|
|
|
|
* valid */
|
|
|
|
GST_BUFFER_TIMESTAMP (buf) = cstart;
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (cstop))
|
|
|
|
GST_BUFFER_DURATION (buf) = cstop - cstart;
|
|
|
|
|
2007-05-25 10:41:56 +00:00
|
|
|
GST_LOG_OBJECT (dec,
|
|
|
|
"clipped timestamp:%" GST_TIME_FORMAT " , duration:%" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (cstart), GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
|
|
|
|
|
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
|
|
|
beach:
|
|
|
|
GST_LOG_OBJECT (dec, "%sdropping", (res ? "not " : ""));
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* figure out if the current picture is a keyframe, return TRUE if that is
|
|
|
|
* the case. */
|
|
|
|
static gboolean
|
|
|
|
check_keyframe (GstFFMpegDec * ffmpegdec)
|
|
|
|
{
|
|
|
|
GstFFMpegDecClass *oclass;
|
|
|
|
gboolean is_itype = FALSE;
|
|
|
|
gboolean is_reference = FALSE;
|
|
|
|
gboolean iskeyframe;
|
|
|
|
|
|
|
|
/* figure out if we are dealing with a keyframe */
|
|
|
|
oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
|
|
|
|
2008-03-05 17:02:33 +00:00
|
|
|
/* remember that we have B frames, we need this for the DTS -> PTS conversion
|
|
|
|
* code */
|
|
|
|
if (!ffmpegdec->has_b_frames && ffmpegdec->picture->pict_type == FF_B_TYPE) {
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "we have B frames");
|
|
|
|
ffmpegdec->has_b_frames = 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
|
|
|
is_itype = (ffmpegdec->picture->pict_type == FF_I_TYPE);
|
|
|
|
is_reference = (ffmpegdec->picture->reference == 1);
|
|
|
|
|
|
|
|
iskeyframe = (is_itype || is_reference || ffmpegdec->picture->key_frame)
|
|
|
|
|| (oclass->in_plugin->id == CODEC_ID_INDEO3)
|
|
|
|
|| (oclass->in_plugin->id == CODEC_ID_MSZH)
|
|
|
|
|| (oclass->in_plugin->id == CODEC_ID_ZLIB)
|
|
|
|
|| (oclass->in_plugin->id == CODEC_ID_VP3)
|
|
|
|
|| (oclass->in_plugin->id == CODEC_ID_HUFFYUV);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ffmpegdec,
|
2006-09-13 11:39:49 +00:00
|
|
|
"current picture: type: %d, is_keyframe:%d, is_itype:%d, is_reference:%d",
|
|
|
|
ffmpegdec->picture->pict_type, iskeyframe, is_itype, is_reference);
|
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
|
|
|
|
|
|
|
return iskeyframe;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get an outbuf buffer with the current picture */
|
|
|
|
static GstFlowReturn
|
|
|
|
get_output_buffer (GstFFMpegDec * ffmpegdec, GstBuffer ** outbuf)
|
|
|
|
{
|
|
|
|
GstFlowReturn ret;
|
|
|
|
|
2008-01-23 16:08:27 +00:00
|
|
|
ret = GST_FLOW_OK;
|
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
|
|
|
*outbuf = NULL;
|
|
|
|
|
|
|
|
if (ffmpegdec->picture->opaque != NULL) {
|
2008-01-23 16:08:27 +00:00
|
|
|
/* we allocated a picture already for ffmpeg to decode into, let's pick it
|
|
|
|
* up and use it now. */
|
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
|
|
|
*outbuf = (GstBuffer *) ffmpegdec->picture->opaque;
|
2008-01-23 18:23:37 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "using opaque buffer %p", *outbuf);
|
2008-01-23 16:08:27 +00:00
|
|
|
#ifndef EXTRA_REF
|
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
|
|
|
gst_buffer_ref (*outbuf);
|
2008-01-23 16:08:27 +00:00
|
|
|
#endif
|
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
|
|
|
} else {
|
2008-11-05 17:05:46 +00:00
|
|
|
AVPicture pic, *outpic;
|
2007-01-09 14:53:36 +00:00
|
|
|
gint width, height;
|
2008-01-26 15:20:10 +00:00
|
|
|
|
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
|
|
|
GST_LOG_OBJECT (ffmpegdec, "get output buffer");
|
|
|
|
|
2008-01-23 16:08:27 +00:00
|
|
|
/* figure out size of output buffer, this is the clipped output size because
|
|
|
|
* we will copy the picture into it. */
|
2007-01-09 14:53:36 +00:00
|
|
|
if ((width = ffmpegdec->format.video.clip_width) == -1)
|
|
|
|
width = ffmpegdec->context->width;
|
|
|
|
if ((height = ffmpegdec->format.video.clip_height) == -1)
|
|
|
|
height = ffmpegdec->context->height;
|
|
|
|
|
2008-11-06 11:47:40 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "clip width %d/height %d", width, height);
|
2008-11-05 17:05:46 +00:00
|
|
|
|
2008-01-23 16:08:27 +00:00
|
|
|
ret = alloc_output_buffer (ffmpegdec, outbuf, width, height);
|
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK))
|
|
|
|
goto alloc_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
|
|
|
|
|
|
|
/* original ffmpeg code does not handle odd sizes correctly.
|
|
|
|
* This patched up version does */
|
|
|
|
gst_ffmpeg_avpicture_fill (&pic, GST_BUFFER_DATA (*outbuf),
|
2007-01-09 14:53:36 +00:00
|
|
|
ffmpegdec->context->pix_fmt, width, height);
|
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-11-05 17:05:46 +00:00
|
|
|
outpic = (AVPicture *) ffmpegdec->picture;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "linsize %d %d %d", outpic->linesize[0],
|
2008-11-06 11:47:40 +00:00
|
|
|
outpic->linesize[1], outpic->linesize[2]);
|
2009-11-05 23:54:47 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "data %u %u %u", 0,
|
|
|
|
(guint) (outpic->data[1] - outpic->data[0]),
|
|
|
|
(guint) (outpic->data[2] - outpic->data[0]));
|
2008-11-05 17:05:46 +00:00
|
|
|
|
2008-11-06 11:47:40 +00:00
|
|
|
av_picture_copy (&pic, outpic, ffmpegdec->context->pix_fmt, width, height);
|
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-03-06 14:47:57 +00:00
|
|
|
ffmpegdec->picture->pts = -1;
|
|
|
|
|
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
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* special cases */
|
|
|
|
alloc_failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "pad_alloc failed");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-16 17:35:58 +00:00
|
|
|
static void
|
2008-01-26 15:20:10 +00:00
|
|
|
clear_queued (GstFFMpegDec * 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
|
2008-01-26 15:20:10 +00:00
|
|
|
flush_queued (GstFFMpegDec * 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;
|
|
|
|
}
|
|
|
|
|
2009-07-30 15:02:12 +00:00
|
|
|
static gpointer
|
|
|
|
opaque_store (GstFFMpegDec * ffmpegdec, guint64 ts, guint64 offset)
|
|
|
|
{
|
|
|
|
GstDataPassThrough *opaque = g_slice_new0 (GstDataPassThrough);
|
|
|
|
opaque->ts = ts;
|
|
|
|
opaque->offset = offset;
|
|
|
|
ffmpegdec->opaque = g_list_append (ffmpegdec->opaque, (gpointer) opaque);
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "Stored ts:%" GST_TIME_FORMAT ", offset:%"
|
|
|
|
G_GUINT64_FORMAT " as opaque %p", GST_TIME_ARGS (ts), offset,
|
|
|
|
(gpointer) opaque);
|
|
|
|
return opaque;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2009-08-06 04:56:44 +00:00
|
|
|
opaque_find (GstFFMpegDec * ffmpegdec, gpointer opaque_val, guint64 * _ts,
|
|
|
|
gint64 * _offset)
|
2009-07-30 15:02:12 +00:00
|
|
|
{
|
|
|
|
GstClockTime ts = GST_CLOCK_TIME_NONE;
|
|
|
|
gint64 offset = GST_BUFFER_OFFSET_NONE;
|
|
|
|
GList *i;
|
2009-08-06 04:56:44 +00:00
|
|
|
for (i = ffmpegdec->opaque; i != NULL; i = g_list_next (i)) {
|
|
|
|
if (i->data == (gpointer) opaque_val) {
|
2009-07-30 15:02:12 +00:00
|
|
|
ts = ((GstDataPassThrough *) i->data)->ts;
|
|
|
|
offset = ((GstDataPassThrough *) i->data)->offset;
|
2009-08-06 04:56:44 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec,
|
|
|
|
"Found opaque %p - ts:%" GST_TIME_FORMAT ", offset:%" G_GINT64_FORMAT,
|
|
|
|
i->data, GST_TIME_ARGS (ts), offset);
|
|
|
|
if (_ts)
|
|
|
|
*_ts = ts;
|
|
|
|
if (_offset)
|
|
|
|
*_offset = offset;
|
2009-07-30 15:02:12 +00:00
|
|
|
g_slice_free (GstDataPassThrough, i->data);
|
|
|
|
ffmpegdec->opaque = g_list_delete_link (ffmpegdec->opaque, i);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 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_ffmpegdec_[video|audio]_frame:
|
|
|
|
* ffmpegdec:
|
|
|
|
* data: pointer to the data to decode
|
|
|
|
* size: size of data in bytes
|
2006-09-05 17:16:05 +00:00
|
|
|
* in_timestamp: incoming timestamp.
|
|
|
|
* in_duration: incoming duration.
|
2009-04-09 22:19:50 +00:00
|
|
|
* in_offset: incoming offset (frame number).
|
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
|
|
|
* outbuf: outgoing buffer. Different from NULL ONLY if it contains decoded data.
|
|
|
|
* ret: Return flow.
|
|
|
|
*
|
|
|
|
* Returns: number of bytes used in decoding. The check for successful decode is
|
|
|
|
* outbuf being non-NULL.
|
|
|
|
*/
|
2005-01-18 23:19:46 +00:00
|
|
|
static gint
|
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_ffmpegdec_video_frame (GstFFMpegDec * ffmpegdec,
|
|
|
|
guint8 * data, guint size,
|
2007-01-09 14:53:36 +00:00
|
|
|
GstClockTime in_timestamp, GstClockTime in_duration,
|
2009-04-09 22:19:50 +00:00
|
|
|
gint64 in_offset, GstBuffer ** outbuf, GstFlowReturn * ret)
|
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
|
|
|
gint len = -1;
|
|
|
|
gint have_data;
|
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
|
|
|
gboolean iskeyframe;
|
|
|
|
gboolean mode_switch;
|
2008-01-25 11:44:29 +00:00
|
|
|
gboolean decode;
|
2008-01-26 15:20:10 +00:00
|
|
|
gint hurry_up = 0;
|
2008-03-05 17:02:33 +00:00
|
|
|
GstClockTime out_timestamp, out_duration, out_pts;
|
2009-04-09 22:19:50 +00:00
|
|
|
gint64 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
|
|
|
|
|
|
|
*ret = GST_FLOW_OK;
|
|
|
|
*outbuf = NULL;
|
|
|
|
|
|
|
|
ffmpegdec->context->opaque = ffmpegdec;
|
|
|
|
|
2008-01-18 12:18:08 +00:00
|
|
|
/* in case we skip frames */
|
|
|
|
ffmpegdec->picture->pict_type = -1;
|
2007-05-02 16:06:09 +00:00
|
|
|
|
2008-01-25 11:44:29 +00:00
|
|
|
/* run QoS code, we don't stop decoding the frame when we are late because
|
|
|
|
* else we might skip a reference frame */
|
|
|
|
decode = gst_ffmpegdec_do_qos (ffmpegdec, in_timestamp, &mode_switch);
|
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
|
|
|
|
2007-08-07 10:21:19 +00:00
|
|
|
if (ffmpegdec->is_realvideo && data != NULL) {
|
|
|
|
gint slice_count;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
/* setup the slice table for realvideo */
|
|
|
|
if (ffmpegdec->context->slice_offset == NULL)
|
|
|
|
ffmpegdec->context->slice_offset = g_malloc (sizeof (guint32) * 1000);
|
|
|
|
|
|
|
|
slice_count = (*data++) + 1;
|
|
|
|
ffmpegdec->context->slice_count = slice_count;
|
|
|
|
|
|
|
|
for (i = 0; i < slice_count; i++) {
|
|
|
|
data += 4;
|
|
|
|
ffmpegdec->context->slice_offset[i] = GST_READ_UINT32_LE (data);
|
|
|
|
data += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-25 11:44:29 +00:00
|
|
|
if (!decode) {
|
|
|
|
/* no decoding needed, save previous hurry_up value and brutely skip
|
|
|
|
* decoding everything */
|
|
|
|
hurry_up = ffmpegdec->context->hurry_up;
|
|
|
|
ffmpegdec->context->hurry_up = 2;
|
|
|
|
}
|
|
|
|
|
2009-08-06 04:56:44 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec,
|
|
|
|
"Going to store opaque values, current ts:%" GST_TIME_FORMAT ", offset: %"
|
|
|
|
G_GINT64_FORMAT, GST_TIME_ARGS (in_timestamp), in_offset);
|
2009-07-30 15:02:12 +00:00
|
|
|
|
|
|
|
out_timestamp = gst_ts_handler_get_ts (ffmpegdec, &out_offset);
|
|
|
|
/* Never do this at home...
|
|
|
|
* 1) We know that ffmpegdec->context->reordered_opaque is 64-bit, and thus
|
2009-08-12 08:57:18 +00:00
|
|
|
* is capable of holding virtually anything including pointers
|
|
|
|
* (unless we're on 128-bit platform...)
|
2009-07-30 15:02:12 +00:00
|
|
|
*/
|
2009-08-12 08:57:18 +00:00
|
|
|
ffmpegdec->context->reordered_opaque = (gint64)
|
2009-08-06 04:56:44 +00:00
|
|
|
GPOINTER_TO_SIZE (opaque_store (ffmpegdec, out_timestamp, out_offset));
|
2009-05-13 10:37:42 +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
|
|
|
/* now decode the 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
|
|
|
len = avcodec_decode_video (ffmpegdec->context,
|
|
|
|
ffmpegdec->picture, &have_data, data, size);
|
|
|
|
|
2009-05-13 10:37:42 +00:00
|
|
|
gst_ts_handler_consume (ffmpegdec, len);
|
|
|
|
|
2008-01-25 11:44:29 +00:00
|
|
|
/* restore previous state */
|
|
|
|
if (!decode)
|
|
|
|
ffmpegdec->context->hurry_up = hurry_up;
|
|
|
|
|
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_DEBUG_OBJECT (ffmpegdec, "after decode: len %d, have_data %d",
|
|
|
|
len, have_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
|
|
|
|
|
|
|
/* when we are in hurry_up mode, don't complain when ffmpeg returned
|
|
|
|
* no data because we told it to skip stuff. */
|
|
|
|
if (len < 0 && (mode_switch || ffmpegdec->context->hurry_up))
|
|
|
|
len = 0;
|
|
|
|
|
2009-09-01 19:42:26 +00:00
|
|
|
if (len > 0 && have_data <= 0 && (mode_switch
|
|
|
|
|| ffmpegdec->context->hurry_up)) {
|
|
|
|
/* we consumed some bytes but nothing decoded and we are skipping frames,
|
|
|
|
* disable the interpollation of DTS timestamps */
|
|
|
|
ffmpegdec->ts_is_dts = FALSE;
|
|
|
|
ffmpegdec->last_out = -1;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* no data, we're done */
|
|
|
|
if (len < 0 || have_data <= 0)
|
|
|
|
goto beach;
|
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
|
|
|
|
2009-06-05 10:32:25 +00:00
|
|
|
/* recuperate the reordered timestamp */
|
2009-08-06 04:56:44 +00:00
|
|
|
if (!opaque_find (ffmpegdec,
|
2009-08-13 15:38:32 +00:00
|
|
|
(gpointer) (gulong) ffmpegdec->picture->reordered_opaque, &out_pts,
|
|
|
|
&out_offset)) {
|
2009-08-06 04:56:44 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "Failed to find opaque %p",
|
2009-08-13 15:38:32 +00:00
|
|
|
(gpointer) (gulong) ffmpegdec->picture->reordered_opaque);
|
2009-07-30 15:02:12 +00:00
|
|
|
out_pts = -1;
|
|
|
|
out_offset = GST_BUFFER_OFFSET_NONE;
|
2009-08-06 04:56:44 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec,
|
|
|
|
"Found opaque values, current ts:%" GST_TIME_FORMAT ", offset: %"
|
|
|
|
G_GINT64_FORMAT, GST_TIME_ARGS (in_timestamp), in_offset);
|
2009-07-30 15:02:12 +00:00
|
|
|
}
|
2008-03-05 17:02:33 +00:00
|
|
|
|
2009-06-05 10:32:25 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "ts-handler: pts %" G_GUINT64_FORMAT, out_pts);
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "picture: pts %" G_GUINT64_FORMAT,
|
|
|
|
ffmpegdec->picture->pts);
|
2007-01-09 14:53:36 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "picture: num %d",
|
|
|
|
ffmpegdec->picture->coded_picture_number);
|
2008-03-05 17:02:33 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "picture: ref %d",
|
|
|
|
ffmpegdec->picture->reference);
|
2007-01-09 14:53:36 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "picture: display %d",
|
|
|
|
ffmpegdec->picture->display_picture_number);
|
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
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "picture: opaque %p",
|
|
|
|
ffmpegdec->picture->opaque);
|
2009-05-12 09:16:43 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "repeat_pict:%d",
|
|
|
|
ffmpegdec->picture->repeat_pict);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (ffmpegdec->picture->interlaced_frame !=
|
|
|
|
ffmpegdec->format.video.interlaced)) {
|
|
|
|
GST_WARNING ("Change in interlacing ! picture:%d, recorded:%d",
|
|
|
|
ffmpegdec->picture->interlaced_frame,
|
|
|
|
ffmpegdec->format.video.interlaced);
|
|
|
|
ffmpegdec->format.video.interlaced = ffmpegdec->picture->interlaced_frame;
|
|
|
|
gst_ffmpegdec_negotiate (ffmpegdec, TRUE);
|
|
|
|
}
|
2006-09-13 11:39:49 +00:00
|
|
|
|
2008-03-05 17:02:33 +00:00
|
|
|
/* check if we are dealing with a keyframe here, this will also check if we
|
|
|
|
* are dealing with B frames. */
|
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
|
|
|
iskeyframe = check_keyframe (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-03-05 17:02:33 +00:00
|
|
|
/* check that the timestamps go upwards */
|
|
|
|
if (ffmpegdec->last_out != -1) {
|
|
|
|
if (ffmpegdec->last_out > out_pts) {
|
|
|
|
/* timestamps go backwards, this means frames were reordered and we must
|
|
|
|
* be dealing with DTS as the buffer timestamps */
|
|
|
|
ffmpegdec->ts_is_dts = TRUE;
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec,
|
|
|
|
"timestamp discont, we have DTS as timestamps");
|
|
|
|
}
|
|
|
|
}
|
2008-03-06 14:47:57 +00:00
|
|
|
|
|
|
|
if (out_pts == 0 && out_pts == ffmpegdec->last_out) {
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "ffmpeg returns 0 timestamps, ignoring");
|
|
|
|
/* some codecs only output 0 timestamps, when that happens, make us select an
|
|
|
|
* output timestamp based on the input timestamp. We do this by making the
|
|
|
|
* ffmpeg timestamp and the interpollated next timestamp invalid. */
|
|
|
|
out_pts = -1;
|
|
|
|
ffmpegdec->next_ts = -1;
|
2008-05-07 09:47:57 +00:00
|
|
|
} else
|
2008-03-06 14:47:57 +00:00
|
|
|
ffmpegdec->last_out = out_pts;
|
2008-03-05 17:02:33 +00:00
|
|
|
|
|
|
|
if (ffmpegdec->ts_is_dts) {
|
|
|
|
/* we are dealing with DTS as the timestamps, only copy the DTS on the picture
|
|
|
|
* to the PTS of the output frame if we are dealing with a non-reference
|
|
|
|
* frame, else we leave the timestamp as -1, which will interpollate from the
|
|
|
|
* last outputted value. */
|
|
|
|
if (ffmpegdec->context->has_b_frames && ffmpegdec->has_b_frames &&
|
|
|
|
ffmpegdec->picture->reference && ffmpegdec->next_ts != -1) {
|
|
|
|
/* we have b frames and this picture is a reference picture, don't use the
|
2009-07-30 15:02:12 +00:00
|
|
|
* DTS as the PTS, same for offset */
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "DTS as timestamps, interpolate");
|
2008-03-05 17:02:33 +00:00
|
|
|
out_pts = -1;
|
2009-07-30 15:02:12 +00:00
|
|
|
out_offset = -1;
|
2008-03-05 17:02:33 +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
|
|
|
/* when we're waiting for a keyframe, see if we have one or drop the current
|
|
|
|
* non-keyframe */
|
|
|
|
if (G_UNLIKELY (ffmpegdec->waiting_for_key)) {
|
|
|
|
if (G_LIKELY (!iskeyframe))
|
|
|
|
goto drop_non_keyframe;
|
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
|
|
|
|
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
|
|
|
/* we have a keyframe, we can stop waiting for one */
|
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->waiting_for_key = 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
|
|
|
|
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
|
|
|
/* get a handle to the output buffer */
|
|
|
|
*ret = get_output_buffer (ffmpegdec, outbuf);
|
|
|
|
if (G_UNLIKELY (*ret != GST_FLOW_OK))
|
|
|
|
goto no_output;
|
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
|
|
|
/*
|
|
|
|
* Timestamps:
|
|
|
|
*
|
2008-01-18 12:18:08 +00:00
|
|
|
* 1) Copy picture timestamp if valid
|
|
|
|
* 2) else interpolate from previous output timestamp
|
2008-01-29 17:53:47 +00:00
|
|
|
* 3) else copy input timestamp
|
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-29 17:53:47 +00:00
|
|
|
out_timestamp = -1;
|
2009-06-05 10:32:25 +00:00
|
|
|
if (out_pts != -1) {
|
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
|
|
|
/* Get (interpolated) timestamp from FFMPEG */
|
2008-03-05 17:02:33 +00:00
|
|
|
out_timestamp = (GstClockTime) out_pts;
|
2008-01-29 17:53:47 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "using timestamp %" GST_TIME_FORMAT
|
|
|
|
" returned by ffmpeg", GST_TIME_ARGS (out_timestamp));
|
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
|
|
|
}
|
2009-06-05 10:32:25 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (out_timestamp) && ffmpegdec->next_ts != -1) {
|
|
|
|
out_timestamp = ffmpegdec->next_ts;
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "using next timestamp %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (out_timestamp));
|
|
|
|
}
|
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (out_timestamp)) {
|
|
|
|
out_timestamp = in_timestamp;
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "using in timestamp %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (out_timestamp));
|
|
|
|
}
|
2008-01-29 17:53:47 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (*outbuf) = out_timestamp;
|
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
|
|
|
|
2009-04-09 22:19:50 +00:00
|
|
|
/*
|
|
|
|
* Offset:
|
2009-07-30 15:02:12 +00:00
|
|
|
* 0) Use stored input offset (from opaque)
|
|
|
|
* 1) Use value converted from timestamp if valid
|
|
|
|
* 2) Use input offset if valid
|
2009-04-09 22:19:50 +00:00
|
|
|
*/
|
2009-07-30 15:02:12 +00:00
|
|
|
if (out_offset != GST_BUFFER_OFFSET_NONE) {
|
|
|
|
/* out_offset already contains the offset from opaque_find() call */
|
2009-09-10 12:11:18 +00:00
|
|
|
} else if (out_timestamp != GST_CLOCK_TIME_NONE) {
|
2009-07-18 14:53:22 +00:00
|
|
|
GstFormat out_fmt = GST_FORMAT_DEFAULT;
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "Using offset converted from timestamp");
|
|
|
|
gst_pad_query_peer_convert (ffmpegdec->sinkpad,
|
|
|
|
GST_FORMAT_TIME, out_timestamp, &out_fmt, &out_offset);
|
2009-07-30 15:02:12 +00:00
|
|
|
} else if (in_offset != GST_BUFFER_OFFSET_NONE) {
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "using in_offset %" G_GINT64_FORMAT, in_offset);
|
|
|
|
out_offset = in_offset;
|
2009-07-18 14:53:22 +00:00
|
|
|
} else {
|
2009-04-09 22:19:50 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "no valid offset found");
|
|
|
|
out_offset = GST_BUFFER_OFFSET_NONE;
|
|
|
|
}
|
|
|
|
GST_BUFFER_OFFSET (*outbuf) = out_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
|
|
|
/*
|
|
|
|
* Duration:
|
|
|
|
*
|
|
|
|
* 1) Copy input duration if valid
|
|
|
|
* 2) else use input framerate
|
|
|
|
* 3) else use ffmpeg framerate
|
|
|
|
*/
|
2008-01-29 17:53:47 +00:00
|
|
|
out_duration = -1;
|
2006-09-05 17:16:05 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (in_duration)) {
|
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 we have an input framerate, use that */
|
2007-07-25 15:39:43 +00:00
|
|
|
if (ffmpegdec->format.video.fps_n != -1 &&
|
|
|
|
(ffmpegdec->format.video.fps_n != 1000 &&
|
ext/ffmpeg/: gst-indent cleanup.
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (gst_ffmpeg_avcodec_open),
(gst_ffmpeg_avcodec_close), (gst_ffmpeg_av_find_stream_info),
(gst_ffmpeg_log_callback), (plugin_init):
* ext/ffmpeg/gstffmpegcfg.c: (gst_ffmpeg_mb_decision_get_type),
(gst_ffmpeg_flags_get_type), (gst_ffmpeg_cfg_init),
(gst_ffmpeg_cfg_codec_has_pspec),
(gst_ffmpeg_cfg_install_property), (gst_ffmpeg_cfg_set_property),
(gst_ffmpeg_cfg_get_property), (gst_ffmpeg_cfg_set_defaults),
(gst_ffmpeg_cfg_fill_context), (gst_ffmpeg_cfg_finalize):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_save_incoming_values),
(gst_ffmpegdec_get_best_values), (gst_ffmpegdec_video_frame):
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_base_init),
(gst_ffmpegdemux_src_query):
* ext/ffmpeg/gstffmpegenc.c: (ffmpegenc_setup_working_buf),
(gst_ffmpegenc_chain_video), (gst_ffmpegenc_flush_buffers):
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_read),
(gst_ffmpegdata_write), (gst_ffmpegdata_seek),
(gst_ffmpegdata_close):
gst-indent cleanup.
2007-11-03 16:14:53 +00:00
|
|
|
ffmpegdec->format.video.fps_d != 1)) {
|
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_LOG_OBJECT (ffmpegdec, "using input framerate for duration");
|
2008-01-29 17:53:47 +00:00
|
|
|
out_duration = gst_util_uint64_scale_int (GST_SECOND,
|
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
|
|
|
ffmpegdec->format.video.fps_d, ffmpegdec->format.video.fps_n);
|
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 {
|
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
|
|
|
/* don't try to use the decoder's framerate when it seems a bit abnormal,
|
|
|
|
* which we assume when den >= 1000... */
|
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 (ffmpegdec->context->time_base.num != 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
|
|
|
(ffmpegdec->context->time_base.den > 0 &&
|
|
|
|
ffmpegdec->context->time_base.den < 1000)) {
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "using decoder's framerate for duration");
|
2008-01-29 17:53:47 +00:00
|
|
|
out_duration = gst_util_uint64_scale_int (GST_SECOND,
|
2009-08-08 16:41:18 +00:00
|
|
|
ffmpegdec->context->time_base.num *
|
2009-03-17 22:44:43 +00:00
|
|
|
ffmpegdec->context->ticks_per_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->context->time_base.den);
|
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
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "no valid duration found");
|
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: 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
|
|
|
}
|
ext/ffmpeg/: gst-indent cleanup.
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (gst_ffmpeg_avcodec_open),
(gst_ffmpeg_avcodec_close), (gst_ffmpeg_av_find_stream_info),
(gst_ffmpeg_log_callback), (plugin_init):
* ext/ffmpeg/gstffmpegcfg.c: (gst_ffmpeg_mb_decision_get_type),
(gst_ffmpeg_flags_get_type), (gst_ffmpeg_cfg_init),
(gst_ffmpeg_cfg_codec_has_pspec),
(gst_ffmpeg_cfg_install_property), (gst_ffmpeg_cfg_set_property),
(gst_ffmpeg_cfg_get_property), (gst_ffmpeg_cfg_set_defaults),
(gst_ffmpeg_cfg_fill_context), (gst_ffmpeg_cfg_finalize):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_save_incoming_values),
(gst_ffmpegdec_get_best_values), (gst_ffmpegdec_video_frame):
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_base_init),
(gst_ffmpegdemux_src_query):
* ext/ffmpeg/gstffmpegenc.c: (ffmpegenc_setup_working_buf),
(gst_ffmpegenc_chain_video), (gst_ffmpegenc_flush_buffers):
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_read),
(gst_ffmpegdata_write), (gst_ffmpegdata_seek),
(gst_ffmpegdata_close):
gst-indent cleanup.
2007-11-03 16:14:53 +00:00
|
|
|
} else {
|
2007-05-25 10:41:56 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "using in_duration");
|
2008-01-29 17:53:47 +00:00
|
|
|
out_duration = in_duration;
|
2007-05-25 10:41:56 +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
|
|
|
/* Take repeat_pict into account */
|
2008-01-29 17:53:47 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (out_duration)) {
|
|
|
|
out_duration += out_duration * ffmpegdec->picture->repeat_pict / 2;
|
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-29 17:53:47 +00:00
|
|
|
GST_BUFFER_DURATION (*outbuf) = out_duration;
|
2005-11-14 16:00:38 +00:00
|
|
|
|
2008-01-29 17:53:47 +00:00
|
|
|
if (out_timestamp != -1 && out_duration != -1)
|
|
|
|
ffmpegdec->next_ts = out_timestamp + out_duration;
|
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
|
|
|
/* palette is not part of raw video frame in gst and the size
|
|
|
|
* of the outgoing buffer needs to be adjusted accordingly */
|
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 (ffmpegdec->context->palctrl != NULL)
|
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_SIZE (*outbuf) -= AVPALETTE_SIZE;
|
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
|
|
|
/* now see if we need to clip the buffer against the segment boundaries. */
|
2008-01-29 17:53:47 +00:00
|
|
|
if (G_UNLIKELY (!clip_video_buffer (ffmpegdec, *outbuf, out_timestamp,
|
|
|
|
out_duration)))
|
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
|
|
|
goto clipped;
|
2005-02-03 17:19:06 +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
|
|
|
/* mark as keyframe or delta unit */
|
|
|
|
if (!iskeyframe)
|
|
|
|
GST_BUFFER_FLAG_SET (*outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
|
2005-01-18 23:19:46 +00:00
|
|
|
|
2009-05-12 09:16:43 +00:00
|
|
|
if (ffmpegdec->picture->top_field_first)
|
|
|
|
GST_BUFFER_FLAG_SET (*outbuf, GST_VIDEO_BUFFER_TFF);
|
|
|
|
|
|
|
|
|
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:
|
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_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;
|
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
|
|
|
|
|
|
|
/* special cases */
|
|
|
|
drop_non_keyframe:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (ffmpegdec, "Dropping non-keyframe (seek/init)");
|
|
|
|
goto beach;
|
|
|
|
}
|
|
|
|
no_output:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "no output buffer");
|
|
|
|
len = -1;
|
|
|
|
goto beach;
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|
2005-04-18 09:51:44 +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
|
|
|
|
clip_audio_buffer (GstFFMpegDec * dec, GstBuffer * buf, GstClockTime in_ts,
|
|
|
|
GstClockTime in_dur)
|
|
|
|
{
|
|
|
|
GstClockTime stop;
|
|
|
|
gint64 diff, ctime, cstop;
|
|
|
|
gboolean res = TRUE;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (dec,
|
|
|
|
"timestamp:%" GST_TIME_FORMAT ", duration:%" GST_TIME_FORMAT
|
|
|
|
", size %u", GST_TIME_ARGS (in_ts), GST_TIME_ARGS (in_dur),
|
|
|
|
GST_BUFFER_SIZE (buf));
|
|
|
|
|
|
|
|
/* 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 =
|
|
|
|
gst_util_uint64_scale_int (diff, dec->format.audio.samplerate,
|
ext/ffmpeg/gstffmpegcodecmap.*: Add mapping for EAC3 and QCELP audio codecs.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_aud_caps_new),
(gst_ffmpeg_codecid_to_caps), (gst_ffmpeg_smpfmt_to_caps),
(gst_ffmpeg_codectype_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_codecid), (av_smp_format_depth):
* ext/ffmpeg/gstffmpegcodecmap.h:
Add mapping for EAC3 and QCELP audio codecs.
Add conversion functions for all available audo SampleFormat.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(clip_audio_buffer), (gst_ffmpegdec_audio_frame):
Remove assumptions that we can only handle stereo 16bit signed integer
audio, and store the depth locally.
2008-12-17 12:05:12 +00:00
|
|
|
GST_SECOND) * (dec->format.audio.depth * dec->format.audio.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);
|
|
|
|
|
|
|
|
GST_BUFFER_SIZE (buf) -= diff;
|
|
|
|
GST_BUFFER_DATA (buf) += diff;
|
|
|
|
}
|
|
|
|
if (G_UNLIKELY ((diff = stop - cstop) > 0)) {
|
|
|
|
/* bring clipped time to bytes */
|
|
|
|
diff =
|
|
|
|
gst_util_uint64_scale_int (diff, dec->format.audio.samplerate,
|
ext/ffmpeg/gstffmpegcodecmap.*: Add mapping for EAC3 and QCELP audio codecs.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_aud_caps_new),
(gst_ffmpeg_codecid_to_caps), (gst_ffmpeg_smpfmt_to_caps),
(gst_ffmpeg_codectype_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_codecid), (av_smp_format_depth):
* ext/ffmpeg/gstffmpegcodecmap.h:
Add mapping for EAC3 and QCELP audio codecs.
Add conversion functions for all available audo SampleFormat.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(clip_audio_buffer), (gst_ffmpegdec_audio_frame):
Remove assumptions that we can only handle stereo 16bit signed integer
audio, and store the depth locally.
2008-12-17 12:05:12 +00:00
|
|
|
GST_SECOND) * (dec->format.audio.depth * dec->format.audio.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);
|
|
|
|
|
|
|
|
GST_BUFFER_SIZE (buf) -= diff;
|
|
|
|
}
|
|
|
|
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
|
|
|
|
gst_ffmpegdec_audio_frame (GstFFMpegDec * ffmpegdec,
|
2009-03-04 20:58:08 +00:00
|
|
|
AVCodec * in_plugin, guint8 * data, guint size,
|
2007-01-09 14:53:36 +00:00
|
|
|
GstClockTime in_timestamp, GstClockTime in_duration,
|
2009-04-09 22:19:50 +00:00
|
|
|
gint64 in_offset, 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;
|
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,
|
2009-04-09 22:19:50 +00:00
|
|
|
"size:%d, offset:%" G_GINT64_FORMAT ", ts:%" GST_TIME_FORMAT ", dur:%"
|
|
|
|
GST_TIME_FORMAT ", ffmpegdec->next_ts:%" GST_TIME_FORMAT, size,
|
|
|
|
in_offset, GST_TIME_ARGS (in_timestamp), GST_TIME_ARGS (in_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
|
|
|
GST_TIME_ARGS (ffmpegdec->next_ts));
|
|
|
|
|
2009-03-08 10:31:35 +00:00
|
|
|
*outbuf =
|
|
|
|
new_aligned_buffer (AVCODEC_MAX_AUDIO_FRAME_SIZE,
|
|
|
|
GST_PAD_CAPS (ffmpegdec->srcpad));
|
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
|
|
|
|
2007-12-17 12:43:06 +00:00
|
|
|
len = avcodec_decode_audio2 (ffmpegdec->context,
|
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
|
|
|
(int16_t *) GST_BUFFER_DATA (*outbuf), &have_data, data, size);
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec,
|
|
|
|
"Decode audio: len=%d, have_data=%d", len, have_data);
|
|
|
|
|
|
|
|
if (len >= 0 && have_data > 0) {
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "Creating output buffer");
|
2009-05-12 09:16:43 +00:00
|
|
|
if (!gst_ffmpegdec_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
|
|
|
/* Buffer 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
|
|
|
GST_BUFFER_SIZE (*outbuf) = have_data;
|
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 */
|
2006-09-05 17:16:05 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (in_timestamp)) {
|
|
|
|
in_timestamp = ffmpegdec->next_ts;
|
2006-08-29 09:28:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Duration:
|
|
|
|
*
|
|
|
|
* 1) calculate based on number of samples
|
|
|
|
*/
|
2009-03-09 17:17:30 +00:00
|
|
|
in_duration = gst_util_uint64_scale (have_data, GST_SECOND,
|
ext/ffmpeg/gstffmpegcodecmap.*: Add mapping for EAC3 and QCELP audio codecs.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_aud_caps_new),
(gst_ffmpeg_codecid_to_caps), (gst_ffmpeg_smpfmt_to_caps),
(gst_ffmpeg_codectype_to_caps), (gst_ffmpeg_caps_to_smpfmt),
(gst_ffmpeg_caps_to_codecid), (av_smp_format_depth):
* ext/ffmpeg/gstffmpegcodecmap.h:
Add mapping for EAC3 and QCELP audio codecs.
Add conversion functions for all available audo SampleFormat.
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_negotiate),
(clip_audio_buffer), (gst_ffmpegdec_audio_frame):
Remove assumptions that we can only handle stereo 16bit signed integer
audio, and store the depth locally.
2008-12-17 12:05:12 +00:00
|
|
|
ffmpegdec->format.audio.depth * ffmpegdec->format.audio.channels *
|
|
|
|
ffmpegdec->format.audio.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
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec,
|
|
|
|
"Buffer created. Size:%d , timestamp:%" GST_TIME_FORMAT " , duration:%"
|
2006-08-29 09:28:20 +00:00
|
|
|
GST_TIME_FORMAT, have_data,
|
2006-09-05 17:16:05 +00:00
|
|
|
GST_TIME_ARGS (in_timestamp), GST_TIME_ARGS (in_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-09-05 17:16:05 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (*outbuf) = in_timestamp;
|
|
|
|
GST_BUFFER_DURATION (*outbuf) = in_duration;
|
2009-04-09 22:19:50 +00:00
|
|
|
GST_BUFFER_OFFSET (*outbuf) = in_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 */
|
2006-09-05 17:16:05 +00:00
|
|
|
ffmpegdec->next_ts = in_timestamp + in_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. */
|
2007-01-09 14:53:36 +00:00
|
|
|
if (G_UNLIKELY (!clip_audio_buffer (ffmpegdec, *outbuf, in_timestamp,
|
|
|
|
in_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
|
|
|
|
|
|
|
} else if (len > 0 && have_data == 0) {
|
|
|
|
/* cache output, because it may be used for caching (in-place) */
|
|
|
|
*outbuf = NULL;
|
|
|
|
} else {
|
|
|
|
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... */
|
2009-03-04 20:58:08 +00:00
|
|
|
if (len == -1 && in_plugin->id == CODEC_ID_AAC) {
|
2009-03-06 11:01:55 +00:00
|
|
|
GST_ELEMENT_ERROR (ffmpegdec, STREAM, DECODE, (NULL),
|
|
|
|
("Decoding of AAC stream by FFMPEG 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
|
|
|
}
|
|
|
|
|
|
|
|
/* gst_ffmpegdec_frame:
|
|
|
|
* 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
|
|
|
|
gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
|
|
|
|
guint8 * data, guint size, gint * got_data,
|
2009-04-09 22:19:50 +00:00
|
|
|
GstClockTime in_timestamp, GstClockTime in_duration, gint64 in_offset,
|
|
|
|
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
|
|
|
{
|
2006-09-05 17:16:05 +00:00
|
|
|
GstFFMpegDecClass *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
|
|
|
|
|
|
|
GST_LOG_OBJECT (ffmpegdec,
|
2009-04-09 22:19:50 +00:00
|
|
|
"data:%p, size:%d, offset:%" G_GINT64_FORMAT ", ts:%" GST_TIME_FORMAT
|
|
|
|
", dur:%" GST_TIME_FORMAT, data, size, in_offset,
|
|
|
|
GST_TIME_ARGS (in_timestamp), GST_TIME_ARGS (in_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
|
|
|
|
|
|
|
*ret = GST_FLOW_OK;
|
|
|
|
ffmpegdec->context->frame_number++;
|
|
|
|
|
2006-09-05 17:16:05 +00:00
|
|
|
oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
|
|
|
|
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
|
|
|
switch (oclass->in_plugin->type) {
|
|
|
|
case CODEC_TYPE_VIDEO:
|
|
|
|
len =
|
2007-01-09 14:53:36 +00:00
|
|
|
gst_ffmpegdec_video_frame (ffmpegdec, data, size, in_timestamp,
|
2009-04-09 22:19:50 +00:00
|
|
|
in_duration, in_offset, &outbuf, 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
|
|
|
break;
|
|
|
|
case CODEC_TYPE_AUDIO:
|
|
|
|
len =
|
2009-03-04 20:58:08 +00:00
|
|
|
gst_ffmpegdec_audio_frame (ffmpegdec, oclass->in_plugin, data, size,
|
2009-04-09 22:19:50 +00:00
|
|
|
in_timestamp, in_duration, in_offset, &outbuf, ret);
|
2008-09-04 14:08:50 +00:00
|
|
|
|
|
|
|
/* 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");
|
2008-10-15 11:28:05 +00:00
|
|
|
ffmpegdec->clear_ts = FALSE;
|
2008-09-04 14:08:50 +00:00
|
|
|
}
|
2005-01-18 23:19:46 +00:00
|
|
|
break;
|
|
|
|
default:
|
2008-08-29 09:59:29 +00:00
|
|
|
GST_ERROR_OBJECT (ffmpegdec, "Asked to decode non-audio/video frame !");
|
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
|
|
|
g_assert_not_reached ();
|
2005-01-18 23:19:46 +00:00
|
|
|
break;
|
|
|
|
}
|
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,
|
2005-01-18 23:19:46 +00:00
|
|
|
"ffdec_%s: decoding error (len: %d, have_data: %d)",
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
/* set caps */
|
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_buffer_set_caps (outbuf, GST_PAD_CAPS (ffmpegdec->srcpad));
|
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
|
|
|
|
gst_ffmpegdec_drain (GstFFMpegDec * ffmpegdec)
|
|
|
|
{
|
|
|
|
GstFFMpegDecClass *oclass;
|
|
|
|
|
|
|
|
oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
|
|
|
|
|
|
|
if (oclass->in_plugin->capabilities & CODEC_CAP_DELAY) {
|
|
|
|
gint have_data, len, try = 0;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (ffmpegdec,
|
|
|
|
"codec has delay capabilities, calling until ffmpeg has drained everything");
|
|
|
|
|
|
|
|
do {
|
|
|
|
GstFlowReturn ret;
|
|
|
|
|
|
|
|
len = gst_ffmpegdec_frame (ffmpegdec, NULL, 0, &have_data,
|
2009-04-09 22:19:50 +00:00
|
|
|
GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE, -1, &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
|
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_ffmpegdec_flush_pcache (GstFFMpegDec * 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
|
|
|
{
|
|
|
|
if (ffmpegdec->pcache) {
|
|
|
|
gst_buffer_unref (ffmpegdec->pcache);
|
|
|
|
ffmpegdec->pcache = NULL;
|
|
|
|
}
|
|
|
|
if (ffmpegdec->pctx) {
|
|
|
|
GstFFMpegDecClass *oclass;
|
|
|
|
|
|
|
|
oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
|
|
|
|
|
|
|
av_parser_close (ffmpegdec->pctx);
|
|
|
|
ffmpegdec->pctx = av_parser_init (oclass->in_plugin->id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
gst_ffmpegdec_sink_event (GstPad * pad, GstEvent * event)
|
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
|
|
|
GstFFMpegDec *ffmpegdec;
|
|
|
|
GstFFMpegDecClass *oclass;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
ffmpegdec = (GstFFMpegDec *) gst_pad_get_parent (pad);
|
|
|
|
oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
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:
|
|
|
|
{
|
2008-01-18 17:48:21 +00:00
|
|
|
gst_ffmpegdec_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);
|
|
|
|
}
|
2008-03-05 17:02:33 +00:00
|
|
|
ffmpegdec->last_out = GST_CLOCK_TIME_NONE;
|
2006-08-29 09:28:20 +00:00
|
|
|
ffmpegdec->next_ts = GST_CLOCK_TIME_NONE;
|
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_ffmpegdec_reset_qos (ffmpegdec);
|
|
|
|
gst_ffmpegdec_flush_pcache (ffmpegdec);
|
2009-08-18 11:20:29 +00:00
|
|
|
gst_ts_handler_init (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
|
|
|
ffmpegdec->waiting_for_key = TRUE;
|
|
|
|
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;
|
|
|
|
}
|
2008-01-16 17:35:58 +00:00
|
|
|
case GST_EVENT_NEWSEGMENT:
|
|
|
|
{
|
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 update;
|
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
|
|
|
GstFormat fmt;
|
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
|
|
|
gint64 start, stop, time;
|
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
|
|
|
gdouble rate, arate;
|
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
|
|
|
gst_event_parse_new_segment_full (event, &update, &rate, &arate, &fmt,
|
|
|
|
&start, &stop, &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
|
|
|
|
|
|
|
switch (fmt) {
|
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 */
|
|
|
|
if (start != -1)
|
|
|
|
start = gst_util_uint64_scale_int (start, GST_SECOND, bit_rate);
|
|
|
|
if (stop != -1)
|
|
|
|
stop = gst_util_uint64_scale_int (stop, GST_SECOND, bit_rate);
|
|
|
|
if (time != -1)
|
|
|
|
time = gst_util_uint64_scale_int (time, GST_SECOND, bit_rate);
|
|
|
|
|
|
|
|
/* 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 */
|
|
|
|
fmt = GST_FORMAT_TIME;
|
|
|
|
/* 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. */
|
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
|
|
|
stop = -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
|
|
|
event = gst_event_new_new_segment (update, rate, fmt,
|
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
|
|
|
start, stop, 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
|
|
|
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
|
|
|
|
2008-03-11 16:07:11 +00:00
|
|
|
/* drain pending frames before trying to use the new segment, queued
|
|
|
|
* buffers belonged to the previous segment. */
|
2008-03-18 10:35:40 +00:00
|
|
|
if (ffmpegdec->context->codec)
|
|
|
|
gst_ffmpegdec_drain (ffmpegdec);
|
2008-03-11 16:07:11 +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_DEBUG_OBJECT (ffmpegdec,
|
2006-08-29 09:28:20 +00:00
|
|
|
"NEWSEGMENT in time start %" GST_TIME_FORMAT " -- stop %"
|
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_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (stop));
|
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 */
|
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_segment_set_newsegment_full (&ffmpegdec->segment, update,
|
|
|
|
rate, arate, fmt, start, stop, time);
|
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:
|
|
|
|
gst_object_unref (ffmpegdec);
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
|
gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf)
|
2001-12-23 13:25:04 +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
|
|
|
GstFFMpegDec *ffmpegdec;
|
|
|
|
GstFFMpegDecClass *oclass;
|
2008-01-23 18:23:37 +00:00
|
|
|
guint8 *data, *bdata, *pdata;
|
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;
|
2006-09-05 17:16:05 +00:00
|
|
|
GstClockTime in_timestamp, in_duration;
|
2008-01-18 14:50:46 +00:00
|
|
|
gboolean discont;
|
2009-04-09 22:19:50 +00:00
|
|
|
gint64 in_offset;
|
2003-06-17 11:44:38 +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
|
|
|
ffmpegdec = (GstFFMpegDec *) (GST_PAD_PARENT (pad));
|
|
|
|
|
|
|
|
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
|
|
|
|
* buffer. This means we need to clear whatever data we currently have. We
|
|
|
|
* currently also wait for a new keyframe, which might be suboptimal in the
|
|
|
|
* case of a network error, better show the errors than to drop all data.. */
|
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 */
|
|
|
|
gst_ffmpegdec_drain (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_ffmpegdec_flush_pcache (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
|
|
|
avcodec_flush_buffers (ffmpegdec->context);
|
2006-08-29 09:28:20 +00:00
|
|
|
ffmpegdec->discont = TRUE;
|
2008-03-06 14:47:57 +00:00
|
|
|
ffmpegdec->last_out = GST_CLOCK_TIME_NONE;
|
2006-08-29 09:28:20 +00:00
|
|
|
ffmpegdec->next_ts = GST_CLOCK_TIME_NONE;
|
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
|
|
|
|
2009-05-13 10:37:42 +00:00
|
|
|
/* append the unaltered buffer timestamp to list */
|
|
|
|
gst_ts_handler_append (ffmpegdec, inbuf);
|
|
|
|
|
2006-10-09 13:31:55 +00:00
|
|
|
oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (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
|
|
|
/* do early keyframe check pretty bad to rely on the keyframe flag in the
|
|
|
|
* source for this as it might not even be parsed (UDP/file/..). */
|
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->waiting_for_key)) {
|
2009-07-01 09:23:59 +00:00
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "waiting for keyframe");
|
2006-10-09 13:31:55 +00:00
|
|
|
if (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_DELTA_UNIT) &&
|
2007-01-09 14:53:36 +00:00
|
|
|
oclass->in_plugin->type != CODEC_TYPE_AUDIO)
|
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 skip_keyframe;
|
|
|
|
|
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_DEBUG_OBJECT (ffmpegdec, "got keyframe");
|
2006-04-10 20:29:14 +00:00
|
|
|
ffmpegdec->waiting_for_key = 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
|
|
|
}
|
|
|
|
|
2008-01-18 12:18:08 +00:00
|
|
|
in_timestamp = GST_BUFFER_TIMESTAMP (inbuf);
|
|
|
|
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
|
|
|
|
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:%"
|
|
|
|
GST_TIME_FORMAT ", dur:%" GST_TIME_FORMAT,
|
|
|
|
GST_BUFFER_SIZE (inbuf), GST_BUFFER_OFFSET (inbuf),
|
2009-04-18 07:08:39 +00:00
|
|
|
GST_TIME_ARGS (in_timestamp), GST_TIME_ARGS (in_duration));
|
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-05 15:34:00 +00:00
|
|
|
/* parse cache joining. If there is cached data, its timestamp will be what we
|
|
|
|
* send to the parse. */
|
2004-12-17 13:08:13 +00:00
|
|
|
if (ffmpegdec->pcache) {
|
2006-09-05 17:46:50 +00:00
|
|
|
/* use timestamp and duration of what is in the cache */
|
|
|
|
in_timestamp = GST_BUFFER_TIMESTAMP (ffmpegdec->pcache);
|
2007-01-09 14:53:36 +00:00
|
|
|
in_duration = GST_BUFFER_DURATION (ffmpegdec->pcache);
|
2009-04-09 22:19:50 +00:00
|
|
|
in_offset = GST_BUFFER_OFFSET (ffmpegdec->pcache);
|
2006-09-05 17:46:50 +00:00
|
|
|
|
2006-09-05 15:34:00 +00:00
|
|
|
/* join with previous data */
|
2006-01-17 09:24:40 +00:00
|
|
|
inbuf = gst_buffer_join (ffmpegdec->pcache, inbuf);
|
2006-09-05 17:16: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
|
|
|
GST_LOG_OBJECT (ffmpegdec,
|
2009-04-09 22:19:50 +00:00
|
|
|
"joined parse cache, inbuf now has offset %" G_GINT64_FORMAT ", ts:%"
|
|
|
|
GST_TIME_FORMAT, in_offset, GST_TIME_ARGS (in_timestamp));
|
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-05 15:34:00 +00:00
|
|
|
/* no more cached data, we assume we can consume the complete cache */
|
2004-12-17 13:08:13 +00:00
|
|
|
ffmpegdec->pcache = NULL;
|
2006-09-05 15:34:00 +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
|
|
|
|
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
|
|
|
bdata = GST_BUFFER_DATA (inbuf);
|
|
|
|
bsize = GST_BUFFER_SIZE (inbuf);
|
|
|
|
|
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,
|
2009-04-09 22:19:50 +00:00
|
|
|
"Calling av_parser_parse with offset %" G_GINT64_FORMAT ", ts:%"
|
|
|
|
GST_TIME_FORMAT, in_offset, GST_TIME_ARGS (in_timestamp));
|
2006-09-13 11:39:49 +00:00
|
|
|
|
2008-01-21 11:19:03 +00:00
|
|
|
/* feed the parser. We store the raw gstreamer timestamp because
|
|
|
|
* converting it to ffmpeg timestamps can corrupt it if the framerate is
|
|
|
|
* wrong. */
|
2004-12-17 13:08:13 +00:00
|
|
|
res = av_parser_parse (ffmpegdec->pctx, ffmpegdec->context,
|
2008-01-21 11:19:03 +00:00
|
|
|
&data, &size, bdata, bsize, in_timestamp, in_timestamp);
|
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,
|
2007-01-09 14:53:36 +00:00
|
|
|
"parser returned res %d and size %d", res, 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
|
|
|
|
2008-01-18 12:18:08 +00:00
|
|
|
/* store pts for get_buffer */
|
|
|
|
ffmpegdec->in_ts = ffmpegdec->pctx->pts;
|
|
|
|
|
2008-01-21 11:19:03 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "consuming %d bytes. ts:%"
|
|
|
|
GST_TIME_FORMAT, size, GST_TIME_ARGS (ffmpegdec->pctx->pts));
|
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
|
|
|
|
2008-01-21 11:19:03 +00:00
|
|
|
ffmpegdec->in_ts = in_timestamp;
|
2009-04-09 22:19:50 +00:00
|
|
|
ffmpegdec->in_offset = in_offset;
|
2004-12-17 13:08:13 +00:00
|
|
|
}
|
|
|
|
|
2008-01-23 18:23:37 +00:00
|
|
|
if (ffmpegdec->do_padding) {
|
|
|
|
/* add padding */
|
2009-04-17 17:07:26 +00:00
|
|
|
if (ffmpegdec->padded_size < size + FF_INPUT_BUFFER_PADDING_SIZE) {
|
2008-01-23 18:23:37 +00:00
|
|
|
ffmpegdec->padded_size = size + FF_INPUT_BUFFER_PADDING_SIZE;
|
2008-01-26 15:20:10 +00:00
|
|
|
ffmpegdec->padded =
|
|
|
|
g_realloc (ffmpegdec->padded, ffmpegdec->padded_size);
|
2008-01-23 18:23:37 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "resized padding buffer to %d",
|
2008-01-26 15:20:10 +00:00
|
|
|
ffmpegdec->padded_size);
|
2008-01-23 18:23:37 +00:00
|
|
|
}
|
|
|
|
memcpy (ffmpegdec->padded, data, size);
|
|
|
|
memset (ffmpegdec->padded + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
|
|
|
|
|
|
|
|
pdata = ffmpegdec->padded;
|
2008-01-26 15:20:10 +00:00
|
|
|
} else {
|
2008-01-23 18:23:37 +00:00
|
|
|
pdata = data;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* decode a frame of audio/video now */
|
2007-01-09 14:53:36 +00:00
|
|
|
len =
|
2008-01-23 18:23:37 +00:00
|
|
|
gst_ffmpegdec_frame (ffmpegdec, pdata, size, &have_data, in_timestamp,
|
2009-04-09 22:19:50 +00:00
|
|
|
in_duration, in_offset, &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));
|
2008-01-18 12:18:08 +00:00
|
|
|
/* bad flow retun, make sure we discard all data and exit */
|
|
|
|
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) {
|
|
|
|
in_timestamp = GST_CLOCK_TIME_NONE;
|
|
|
|
in_duration = GST_CLOCK_TIME_NONE;
|
2009-04-09 22:19:50 +00:00
|
|
|
in_offset = GST_BUFFER_OFFSET_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
|
|
|
|
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) {
|
2008-01-18 12:18:08 +00:00
|
|
|
in_timestamp = GST_BUFFER_TIMESTAMP (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,
|
2009-04-09 22:19:50 +00:00
|
|
|
"Keeping %d bytes of data with offset %" G_GINT64_FORMAT ", timestamp %"
|
|
|
|
GST_TIME_FORMAT, bsize, in_offset, GST_TIME_ARGS (in_timestamp));
|
2004-12-18 20:53:55 +00:00
|
|
|
|
2004-12-17 13:08:13 +00:00
|
|
|
ffmpegdec->pcache = gst_buffer_create_sub (inbuf,
|
|
|
|
GST_BUFFER_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 */
|
2006-09-05 17:16:05 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (ffmpegdec->pcache) = in_timestamp;
|
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:
|
|
|
|
{
|
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 = (GstFFMpegDecClass *) (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),
|
|
|
|
("ffdec_%s: input format was not set before data start",
|
|
|
|
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;
|
|
|
|
}
|
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
|
|
|
skip_keyframe:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (ffmpegdec, "skipping non keyframe");
|
|
|
|
gst_buffer_unref (inbuf);
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2001-12-23 13:25:04 +00:00
|
|
|
}
|
|
|
|
|
2005-09-05 14:06:29 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_ffmpegdec_change_state (GstElement * element, GstStateChange transition)
|
2001-12-23 13:25:04 +00:00
|
|
|
{
|
2003-06-07 00:41:32 +00:00
|
|
|
GstFFMpegDec *ffmpegdec = (GstFFMpegDec *) 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);
|
2005-06-08 18:29:39 +00:00
|
|
|
gst_ffmpegdec_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);
|
2008-01-23 18:23:37 +00:00
|
|
|
g_free (ffmpegdec->padded);
|
|
|
|
ffmpegdec->padded = NULL;
|
|
|
|
ffmpegdec->padded_size = 0;
|
2009-03-08 10:31:35 +00:00
|
|
|
ffmpegdec->can_allocate_aligned = TRUE;
|
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
|
|
|
}
|
|
|
|
|
2005-01-31 10:45:20 +00:00
|
|
|
static void
|
|
|
|
gst_ffmpegdec_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstFFMpegDec *ffmpegdec = (GstFFMpegDec *) object;
|
|
|
|
|
|
|
|
switch (prop_id) {
|
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
|
|
|
case PROP_LOWRES:
|
2005-11-14 16:00:38 +00:00
|
|
|
ffmpegdec->lowres = ffmpegdec->context->lowres = g_value_get_enum (value);
|
2005-01-31 10:45:20 +00:00
|
|
|
break;
|
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
|
|
|
case PROP_SKIPFRAME:
|
2005-01-31 10:45:20 +00:00
|
|
|
ffmpegdec->hurry_up = ffmpegdec->context->hurry_up =
|
|
|
|
g_value_get_enum (value);
|
|
|
|
break;
|
2008-01-22 16:44:51 +00:00
|
|
|
case PROP_DIRECT_RENDERING:
|
|
|
|
ffmpegdec->direct_rendering = g_value_get_boolean (value);
|
|
|
|
break;
|
2008-01-23 18:23:37 +00:00
|
|
|
case PROP_DO_PADDING:
|
|
|
|
ffmpegdec->do_padding = g_value_get_boolean (value);
|
|
|
|
break;
|
2008-02-11 18:45:53 +00:00
|
|
|
case PROP_DEBUG_MV:
|
2008-03-05 17:02:33 +00:00
|
|
|
ffmpegdec->debug_mv = ffmpegdec->context->debug_mv =
|
2008-02-11 18:45:53 +00:00
|
|
|
g_value_get_boolean (value);
|
|
|
|
break;
|
2008-11-06 11:47:40 +00:00
|
|
|
case PROP_CROP:
|
|
|
|
ffmpegdec->crop = g_value_get_boolean (value);
|
|
|
|
break;
|
2005-01-31 10:45:20 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ffmpegdec_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstFFMpegDec *ffmpegdec = (GstFFMpegDec *) object;
|
|
|
|
|
|
|
|
switch (prop_id) {
|
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
|
|
|
case PROP_LOWRES:
|
2005-01-31 10:45:20 +00:00
|
|
|
g_value_set_enum (value, ffmpegdec->context->lowres);
|
|
|
|
break;
|
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
|
|
|
case PROP_SKIPFRAME:
|
2005-01-31 10:45:20 +00:00
|
|
|
g_value_set_enum (value, ffmpegdec->context->hurry_up);
|
|
|
|
break;
|
2008-01-22 16:44:51 +00:00
|
|
|
case PROP_DIRECT_RENDERING:
|
|
|
|
g_value_set_boolean (value, ffmpegdec->direct_rendering);
|
|
|
|
break;
|
2008-01-23 18:23:37 +00:00
|
|
|
case PROP_DO_PADDING:
|
|
|
|
g_value_set_boolean (value, ffmpegdec->do_padding);
|
|
|
|
break;
|
2008-02-11 18:45:53 +00:00
|
|
|
case PROP_DEBUG_MV:
|
|
|
|
g_value_set_boolean (value, ffmpegdec->context->debug_mv);
|
|
|
|
break;
|
2008-11-06 11:47:40 +00:00
|
|
|
case PROP_CROP:
|
|
|
|
g_value_set_boolean (value, ffmpegdec->crop);
|
|
|
|
break;
|
2005-01-31 10:45:20 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-23 13:25:04 +00:00
|
|
|
gboolean
|
2004-03-29 16:39:18 +00:00
|
|
|
gst_ffmpegdec_register (GstPlugin * plugin)
|
2001-12-23 13:25:04 +00:00
|
|
|
{
|
|
|
|
GTypeInfo typeinfo = {
|
2004-03-29 16:39:18 +00:00
|
|
|
sizeof (GstFFMpegDecClass),
|
|
|
|
(GBaseInitFunc) gst_ffmpegdec_base_init,
|
2001-12-23 13:25:04 +00:00
|
|
|
NULL,
|
2004-03-29 16:39:18 +00:00
|
|
|
(GClassInitFunc) gst_ffmpegdec_class_init,
|
2001-12-23 13:25:04 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-29 16:39:18 +00:00
|
|
|
sizeof (GstFFMpegDec),
|
2001-12-23 13:25:04 +00:00
|
|
|
0,
|
2004-03-29 16:39:18 +00:00
|
|
|
(GInstanceInitFunc) gst_ffmpegdec_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 */
|
|
|
|
if (!in_plugin->decode) {
|
|
|
|
goto next;
|
|
|
|
}
|
2001-12-23 13:25:04 +00:00
|
|
|
|
2003-06-17 11:44:38 +00:00
|
|
|
/* no quasi-codecs, please */
|
|
|
|
if (in_plugin->id == CODEC_ID_RAWVIDEO ||
|
2004-03-29 16:39:18 +00:00
|
|
|
(in_plugin->id >= CODEC_ID_PCM_S16LE &&
|
2009-04-15 19:56:00 +00:00
|
|
|
in_plugin->id <= CODEC_ID_PCM_F64LE)) {
|
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;
|
|
|
|
}
|
|
|
|
|
2009-03-11 12:25:40 +00:00
|
|
|
/* No vdpau plugins until we can figure out how to properly use them
|
|
|
|
* outside of ffmpeg. */
|
2009-12-09 15:27:14 +00:00
|
|
|
if (g_str_has_suffix (in_plugin->name, "_vdpau")) {
|
2009-03-11 12:25:40 +00:00
|
|
|
GST_DEBUG
|
|
|
|
("Ignoring VDPAU decoder %s. We can't handle this outside of ffmpeg",
|
|
|
|
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 */
|
|
|
|
/* MPEG1VIDEO : the mpeg2video decoder is preferred */
|
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 */
|
2007-12-17 12:43:06 +00:00
|
|
|
if (!strcmp (in_plugin->name, "gif") ||
|
|
|
|
!strcmp (in_plugin->name, "vorbis") ||
|
2009-07-29 18:49:56 +00:00
|
|
|
!strcmp (in_plugin->name, "theora") ||
|
2007-12-17 12:43:06 +00:00
|
|
|
!strcmp (in_plugin->name, "mpeg1video") ||
|
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") ||
|
|
|
|
!strcmp (in_plugin->name, "mpeg4aac")) {
|
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, '_');
|
|
|
|
type_name = g_strdup_printf ("ffdec_%s", plugin_name);
|
|
|
|
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) {
|
|
|
|
case CODEC_ID_MPEG4:
|
|
|
|
case CODEC_ID_MSMPEG4V3:
|
2005-06-03 13:44:04 +00:00
|
|
|
case CODEC_ID_H264:
|
2009-03-04 19:04:25 +00:00
|
|
|
case CODEC_ID_RA_144:
|
|
|
|
case CODEC_ID_RA_288:
|
|
|
|
case CODEC_ID_RV10:
|
|
|
|
case CODEC_ID_RV20:
|
|
|
|
case CODEC_ID_RV30:
|
|
|
|
case CODEC_ID_RV40:
|
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;
|
2006-04-21 15:48:17 +00:00
|
|
|
case CODEC_ID_DVVIDEO:
|
|
|
|
/* we have a good dv decoder, fast on both ppc as well as x86. they say
|
|
|
|
libdv's quality is better though. leave as secondary.
|
|
|
|
note: if you change this, see the code in gstdv.c in good/ext/dv. */
|
|
|
|
rank = GST_RANK_SECONDARY;
|
|
|
|
break;
|
2009-03-05 11:09:32 +00:00
|
|
|
case CODEC_ID_AAC:
|
|
|
|
/* The ffmpeg AAC decoder isn't complete, and there's no way to figure out
|
|
|
|
* before decoding whether it will support the given stream or not.
|
|
|
|
* We therefore set it to NONE until it can handle the full specs. */
|
|
|
|
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;
|
|
|
|
}
|
2009-05-13 10:37:42 +00:00
|
|
|
|
|
|
|
/** initialize the timestamp handler */
|
|
|
|
static void
|
|
|
|
gst_ts_handler_init (GstFFMpegDec * ffmpegdec)
|
|
|
|
{
|
|
|
|
GstTSHandler *ts_handler = &ffmpegdec->ts_handler;
|
|
|
|
memset (ts_handler, 0, sizeof (GstTSHandler));
|
|
|
|
ts_handler->buf_tail = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** add a new entry to the list from a GstBuffer */
|
|
|
|
static void
|
|
|
|
gst_ts_handler_append (GstFFMpegDec * ffmpegdec, GstBuffer * buffer)
|
|
|
|
{
|
|
|
|
GstTSHandler *ts_handler = &ffmpegdec->ts_handler;
|
|
|
|
guint64 ts = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
gint size = GST_BUFFER_SIZE (buffer);
|
2009-07-30 15:02:12 +00:00
|
|
|
guint64 offset = GST_BUFFER_OFFSET (buffer);
|
2009-05-13 10:37:42 +00:00
|
|
|
gint ind = ts_handler->buf_head;
|
|
|
|
|
2009-06-18 00:11:25 +00:00
|
|
|
if ((ts != -1) || (ts == -1 && !ts_handler->buf_count)) {
|
2009-05-13 10:37:42 +00:00
|
|
|
/* null timestamps are only valid for the first entry */
|
|
|
|
TS_MAP_INC (ind);
|
|
|
|
/** debugging trace
|
|
|
|
printf ("app [%02X] %4d\t%6.3f\t%8d\n",
|
|
|
|
ind, ts_handler->buf_count,
|
|
|
|
ts != -1 ? (double) ts / GST_SECOND : -1.0, size);
|
|
|
|
**/
|
2009-06-18 00:11:25 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "store timestamp @ index [%02X] buf_count: %d"
|
2009-07-30 15:02:12 +00:00
|
|
|
" ts: %" GST_TIME_FORMAT ", offset: %" G_GUINT64_FORMAT ", size: %d",
|
|
|
|
ind, ts_handler->buf_count, GST_TIME_ARGS (ts), offset, size);
|
2009-05-13 10:37:42 +00:00
|
|
|
ts_handler->buffers[ind].ts = ts;
|
2009-07-30 15:02:12 +00:00
|
|
|
ts_handler->buffers[ind].offset = offset;
|
2009-05-13 10:37:42 +00:00
|
|
|
ts_handler->buffers[ind].size = size;
|
|
|
|
ts_handler->buf_head = ind;
|
|
|
|
ts_handler->buf_count++;
|
|
|
|
} else {
|
|
|
|
/* append size to existing entry */
|
2009-06-18 00:11:25 +00:00
|
|
|
GST_LOG_OBJECT (ffmpegdec, "Extending index [%02X] buf_count: %d"
|
2009-07-30 15:02:12 +00:00
|
|
|
" ts: %" GST_TIME_FORMAT ", offset: %" G_GUINT64_FORMAT
|
|
|
|
", new size: %d",
|
2009-06-18 00:11:25 +00:00
|
|
|
ind, ts_handler->buf_count,
|
2009-06-29 11:53:50 +00:00
|
|
|
GST_TIME_ARGS (ts_handler->buffers[ind].ts),
|
2009-07-30 15:02:12 +00:00
|
|
|
ts_handler->buffers[ind].offset, ts_handler->buffers[ind].size);
|
2009-05-13 10:37:42 +00:00
|
|
|
ts_handler->buffers[ind].size += size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** indicate that the decoder has consumed some data */
|
|
|
|
static void
|
|
|
|
gst_ts_handler_consume (GstFFMpegDec * ffmpegdec, gint size)
|
|
|
|
{
|
|
|
|
GstTSHandler *ts_handler = &ffmpegdec->ts_handler;
|
|
|
|
gint buf = ts_handler->buf_tail;
|
|
|
|
|
|
|
|
/* eat some bytes from the buffer map */
|
2009-06-18 00:11:25 +00:00
|
|
|
while (size > 0 && ts_handler->buf_count > 0) {
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "Stepping over %d bytes @ index %d has %d bytes",
|
|
|
|
size, buf, ts_handler->buffers[buf].size);
|
2009-05-13 10:37:42 +00:00
|
|
|
if (size >= ts_handler->buffers[buf].size) {
|
|
|
|
size -= ts_handler->buffers[buf].size;
|
|
|
|
/* reset this entry */
|
|
|
|
memset (ts_handler->buffers + buf, -1, sizeof (GstTSMap));
|
|
|
|
TS_MAP_INC (buf);
|
2009-06-18 00:11:25 +00:00
|
|
|
/* Decrement the active buffer count */
|
|
|
|
ts_handler->buf_count--;
|
2009-05-13 10:37:42 +00:00
|
|
|
/* update the buffer tail */
|
|
|
|
ts_handler->buf_tail = buf;
|
|
|
|
} else {
|
|
|
|
ts_handler->buffers[buf].size -= size;
|
|
|
|
size = 0;
|
|
|
|
}
|
|
|
|
}
|
2009-06-18 00:11:25 +00:00
|
|
|
if (size == -1 && ts_handler->buf_count > 0) {
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "Stepping over %d bytes @ index %d has %d bytes",
|
|
|
|
size, buf, ts_handler->buffers[buf].size);
|
2009-05-13 10:37:42 +00:00
|
|
|
/* just consume the one buffer regardless */
|
|
|
|
memset (ts_handler->buffers + buf, -1, sizeof (GstTSMap));
|
2009-06-18 00:11:25 +00:00
|
|
|
/* Decrement the active buffer count */
|
|
|
|
ts_handler->buf_count--;
|
2009-05-13 10:37:42 +00:00
|
|
|
TS_MAP_INC (buf);
|
|
|
|
/* update the buffer tail */
|
|
|
|
ts_handler->buf_tail = buf;
|
|
|
|
size = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** get the timestamp from the tail of the list */
|
|
|
|
static guint64
|
2009-08-06 04:56:44 +00:00
|
|
|
gst_ts_handler_get_ts (GstFFMpegDec * ffmpegdec, gint64 * _offset)
|
2009-05-13 10:37:42 +00:00
|
|
|
{
|
|
|
|
GstTSHandler *ts_handler = &ffmpegdec->ts_handler;
|
|
|
|
guint64 ts = ts_handler->buffers[ts_handler->buf_tail].ts;
|
2009-07-30 15:02:12 +00:00
|
|
|
gint64 offset = ts_handler->buffers[ts_handler->buf_tail].offset;
|
|
|
|
GST_LOG_OBJECT (ffmpegdec, "Index %d yielded ts %" GST_TIME_FORMAT
|
|
|
|
" offset %" G_GINT64_FORMAT, ts_handler->buf_tail,
|
|
|
|
GST_TIME_ARGS (ts), offset);
|
2009-08-06 04:56:44 +00:00
|
|
|
if (_offset)
|
|
|
|
*_offset = offset;
|
2009-05-13 10:37:42 +00:00
|
|
|
ts_handler->buffers[ts_handler->buf_tail].ts = -1;
|
2009-07-30 15:02:12 +00:00
|
|
|
ts_handler->buffers[ts_handler->buf_tail].offset = -1;
|
2009-05-13 10:37:42 +00:00
|
|
|
return ts;
|
|
|
|
}
|