2002-01-19 14:50:50 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@temple-baptist.com>
|
2001-12-22 23:27:31 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2006-11-08 12:04:03 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-flxdec
|
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <para>
|
|
|
|
* This element decodes fli/flc/flx-video into raw video
|
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* http://www.coolutils.com/Formats/FLI
|
|
|
|
* http://woodshole.er.usgs.gov/operations/modeling/flc.html
|
|
|
|
*/
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2001-12-22 23:27:31 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "flx_fmt.h"
|
|
|
|
#include "gstflxdec.h"
|
2003-07-06 20:49:52 +00:00
|
|
|
#include <gst/video/video.h>
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2002-06-16 21:56:49 +00:00
|
|
|
#define JIFFIE (GST_SECOND/70)
|
2002-01-13 22:27:25 +00:00
|
|
|
|
ext/flac/gstflacdec.c: Only return true if we actually filled something in. Prevents player applications from showing...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flacdec_src_query):
Only return true if we actually filled something in. Prevents
player applications from showing a random length for flac files.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_class_init),
(gst_riff_read_use_event), (gst_riff_read_handle_event),
(gst_riff_read_seek), (gst_riff_read_skip), (gst_riff_read_strh),
(gst_riff_read_strf_vids_with_data),
(gst_riff_read_strf_auds_with_data), (gst_riff_read_strf_iavs):
OK, ok, so I implemented event handling. Apparently it's normal
that we receive random events at random points without asking
for it.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Implement non-lineair chunk handling and subchunk processing.
The first solves playback of AVI files where the audio and video
data of individual buffers that we read are not synchronized.
This should not happen according to the wonderful AVI specs, but
of course it does happen in reality. It is also a prerequisite for
the second. Subchunk processing allows us to cut chunks in small
pieces and process each of these pieces separately. This is
required because I've seen several AVI files with incredibly large
audio chunks, even some files with only one audio chunk for the
whole file. This allows for proper playback including seeking.
This patch is supposed to fix all AVI A/V sync issues.
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(flx_decode_chunks), (flx_decode_color), (gst_flxdec_loop):
Work.
* gst/modplug/gstmodplug.cc:
Proper return value setting for the query() function.
* gst/playback/gstplaybasebin.c: (setup_source):
Being in non-playing state (after, e.g., EOS) is not necessarily
a bad thing. Allow for that. This fixes playback of short files.
They don't actually playback fully now, because the clock already
runs. This means that small files (<500kB) with a small length
(<2sec) will still not or barely play. Other files, such as mod
or flx, will work correctly, however.
2004-09-29 09:45:40 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (flxdec_debug);
|
|
|
|
#define GST_CAT_DEFAULT flxdec_debug
|
|
|
|
|
2001-12-22 23:27:31 +00:00
|
|
|
/* flx element information */
|
Define GstElementDetails as const and also static (when defined as global)
Original commit message from CVS:
* ext/aalib/gstaasink.c:
* ext/annodex/gstcmmldec.c:
* ext/annodex/gstcmmlenc.c:
* ext/cairo/gsttextoverlay.c:
* ext/cairo/gsttimeoverlay.c:
* ext/cdio/gstcdiocddasrc.c:
* ext/dv/gstdvdec.c:
* ext/dv/gstdvdemux.c:
* ext/esd/esdmon.c:
* ext/esd/esdsink.c:
* ext/flac/gstflacenc.c:
* ext/flac/gstflactag.c:
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_base_init):
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_base_init):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_base_init):
* ext/gdk_pixbuf/pixbufscale.c:
* ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_base_init):
* ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_base_init):
* ext/jpeg/gstjpegdec.c:
* ext/jpeg/gstjpegenc.c:
* ext/jpeg/gstsmokedec.c:
* ext/jpeg/gstsmokeenc.c:
* ext/libcaca/gstcacasink.c:
* ext/libmng/gstmngdec.c:
* ext/libmng/gstmngenc.c:
* ext/libpng/gstpngdec.c:
* ext/libpng/gstpngenc.c:
* ext/mikmod/gstmikmod.c:
* ext/raw1394/gstdv1394src.c:
* ext/shout2/gstshout2.c: (gst_shout2send_init):
* ext/shout2/gstshout2.h:
* ext/speex/gstspeexdec.c:
* ext/speex/gstspeexenc.c:
* gst/alpha/gstalpha.c:
* gst/alpha/gstalphacolor.c:
* gst/apetag/gstapedemux.c:
* gst/auparse/gstauparse.c:
* gst/autodetect/gstautoaudiosink.c:
(gst_auto_audio_sink_base_init):
* gst/autodetect/gstautovideosink.c:
(gst_auto_video_sink_base_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_base_init):
* gst/avi/gstavimux.c: (gst_avimux_base_init):
* gst/cutter/gstcutter.c:
* gst/debug/breakmydata.c:
* gst/debug/efence.c:
* gst/debug/gstnavigationtest.c:
* gst/debug/gstnavseek.c:
* gst/debug/negotiation.c:
* gst/debug/progressreport.c:
* gst/debug/testplugin.c:
* gst/effectv/gstaging.c:
* gst/effectv/gstdice.c:
* gst/effectv/gstedge.c:
* gst/effectv/gstquark.c:
* gst/effectv/gstrev.c:
* gst/effectv/gstshagadelic.c:
* gst/effectv/gstvertigo.c:
* gst/effectv/gstwarp.c:
* gst/flx/gstflxdec.c:
* gst/goom/gstgoom.c:
* gst/icydemux/gsticydemux.c:
* gst/id3demux/gstid3demux.c:
* gst/interleave/deinterleave.c:
* gst/interleave/interleave.c:
* gst/law/alaw-decode.c: (gst_alawdec_base_init):
* gst/law/alaw-encode.c: (gst_alawenc_base_init):
* gst/law/mulaw-decode.c: (gst_mulawdec_base_init):
* gst/law/mulaw-encode.c: (gst_mulawenc_base_init):
* gst/level/gstlevel.c:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init):
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init):
* gst/median/gstmedian.c:
* gst/monoscope/gstmonoscope.c:
* gst/multipart/multipartdemux.c:
* gst/multipart/multipartmux.c:
* gst/oldcore/gstaggregator.c:
* gst/oldcore/gstfdsink.c:
* gst/oldcore/gstmd5sink.c:
* gst/oldcore/gstmultifilesrc.c:
* gst/oldcore/gstpipefilter.c:
* gst/oldcore/gstshaper.c:
* gst/oldcore/gststatistics.c:
* gst/rtp/gstasteriskh263.c:
* gst/rtp/gstrtpL16depay.c:
* gst/rtp/gstrtpL16pay.c:
* gst/rtp/gstrtpamrdepay.c:
* gst/rtp/gstrtpamrpay.c:
* gst/rtp/gstrtpdepay.c:
* gst/rtp/gstrtpgsmpay.c:
* gst/rtp/gstrtph263pay.c:
* gst/rtp/gstrtph263pdepay.c:
* gst/rtp/gstrtph263ppay.c:
* gst/rtp/gstrtpilbcdepay.c:
* gst/rtp/gstrtpmp4gpay.c:
* gst/rtp/gstrtpmp4vdepay.c:
* gst/rtp/gstrtpmp4vpay.c:
* gst/rtp/gstrtpmpadepay.c:
* gst/rtp/gstrtpmpapay.c:
* gst/rtp/gstrtppcmadepay.c:
* gst/rtp/gstrtppcmapay.c:
* gst/rtp/gstrtppcmudepay.c:
* gst/rtp/gstrtppcmupay.c:
* gst/rtp/gstrtpspeexdepay.c:
* gst/rtp/gstrtpspeexpay.c:
* gst/rtsp/gstrtpdec.c:
* gst/rtsp/gstrtspsrc.c:
* gst/smpte/gstsmpte.c:
* gst/udp/gstdynudpsink.c:
* gst/udp/gstmultiudpsink.c:
* gst/udp/gstudpsink.c:
* gst/udp/gstudpsrc.c:
* gst/videobox/gstvideobox.c:
* gst/videofilter/gstgamma.c: (gst_gamma_base_init):
* gst/videofilter/gstvideobalance.c:
* gst/videofilter/gstvideoflip.c:
* gst/videofilter/gstvideotemplate.c:
(gst_videotemplate_base_init):
* gst/videomixer/videomixer.c:
* gst/wavparse/gstwavparse.c: (gst_wavparse_base_init),
(gst_wavparse_class_init), (gst_wavparse_dispose),
(gst_wavparse_reset), (gst_wavparse_init),
(gst_wavparse_perform_seek), (gst_wavparse_peek_chunk_info),
(gst_wavparse_peek_chunk), (gst_wavparse_stream_headers),
(gst_wavparse_parse_stream_init), (gst_wavparse_send_event),
(gst_wavparse_add_src_pad), (gst_wavparse_stream_data),
(gst_wavparse_chain), (gst_wavparse_srcpad_event),
(gst_wavparse_sink_activate), (gst_wavparse_sink_activate_pull),
(gst_wavparse_change_state):
* gst/wavparse/gstwavparse.h:
* sys/oss/gstossmixerelement.c:
* sys/oss/gstosssink.c:
* sys/oss/gstosssrc.c:
* sys/osxaudio/gstosxaudioelement.c:
* sys/osxaudio/gstosxaudiosink.c:
* sys/osxaudio/gstosxaudiosrc.c:
* sys/sunaudio/gstsunaudiomixer.c:
* sys/sunaudio/gstsunaudiosink.c:
Define GstElementDetails as const and also static (when defined as
global)
2006-04-25 21:39:46 +00:00
|
|
|
static const GstElementDetails flxdec_details =
|
2006-03-30 15:37:05 +00:00
|
|
|
GST_ELEMENT_DETAILS ("FLX audio decoder",
|
2006-11-08 12:04:03 +00:00
|
|
|
"Codec/Decoder/Video",
|
|
|
|
"FLC/FLI/FLX video decoder",
|
2006-03-30 15:37:05 +00:00
|
|
|
"Sepp Wijnands <mrrazz@garbage-coderz.net>, Zeeshan Ali <zeenix@gmail.com>");
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
/* input */
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("video/x-fli")
|
|
|
|
);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
/* output */
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstStaticPadTemplate src_video_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN)
|
|
|
|
);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_flxdec_class_init (GstFlxDecClass * klass);
|
|
|
|
static void gst_flxdec_base_init (GstFlxDecClass * klass);
|
|
|
|
static void gst_flxdec_init (GstFlxDec * flxdec);
|
Fix a bunch of leaks shown by the newly-added states test.
Original commit message from CVS:
* ext/flac/gstflacenc.c: (gst_flac_enc_finalize):
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_class_init),
(gst_gconf_audio_sink_dispose), (gst_gconf_audio_sink_finalize):
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_base_init),
(gst_gconf_audio_src_class_init), (gst_gconf_audio_src_dispose),
(gst_gconf_audio_src_finalize), (do_toggle_element):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init),
(gst_gconf_video_sink_class_init), (gst_gconf_video_sink_finalize),
(do_toggle_element):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_base_init),
(gst_gconf_video_src_class_init), (gst_gconf_video_src_dispose),
(gst_gconf_video_src_finalize), (do_toggle_element):
* ext/gconf/gstswitchsink.c: (gst_switch_sink_class_init),
(gst_switch_sink_reset), (gst_switch_sink_set_child):
* ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_base_init):
* ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_base_init):
* ext/shout2/gstshout2.c: (gst_shout2send_class_init),
(gst_shout2send_init), (gst_shout2send_finalize):
* gst/debug/testplugin.c: (gst_test_class_init),
(gst_test_finalize):
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(gst_flxdec_dispose):
* gst/multipart/multipartmux.c: (gst_multipart_mux_finalize):
* gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_finalize):
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init),
(gst_rtspsrc_finalize):
* gst/rtsp/rtspextwms.c: (rtsp_ext_wms_free_context):
* gst/rtsp/rtspextwms.h:
* gst/smpte/gstsmpte.c: (gst_smpte_class_init),
(gst_smpte_finalize):
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_finalize):
* gst/udp/gstudpsink.c: (gst_udpsink_class_init),
(gst_udpsink_finalize):
* gst/wavparse/gstwavparse.c: (gst_wavparse_dispose),
(gst_wavparse_sink_activate):
* sys/oss/gstosssink.c: (gst_oss_sink_finalise):
* sys/oss/gstosssrc.c: (gst_oss_src_class_init),
(gst_oss_src_finalize):
* sys/v4l2/gstv4l2object.c: (gst_v4l2_object_destroy):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_finalize):
* sys/ximage/gstximagesrc.c: (gst_ximage_src_ximage_get):
Fix a bunch of leaks shown by the newly-added states test.
2007-03-04 13:52:03 +00:00
|
|
|
static void gst_flxdec_dispose (GstFlxDec * flxdec);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
static GstFlowReturn gst_flxdec_chain (GstPad * pad, GstBuffer * buf);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
static GstStateChangeReturn gst_flxdec_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2002-01-13 22:27:25 +00:00
|
|
|
|
2006-02-19 11:57:58 +00:00
|
|
|
static gboolean gst_flxdec_src_query_handler (GstPad * pad, GstQuery * query);
|
2005-10-16 21:19:44 +00:00
|
|
|
static gboolean gst_flxdec_src_event_handler (GstPad * pad, GstEvent * event);
|
|
|
|
static gboolean gst_flxdec_sink_event_handler (GstPad * pad, GstEvent * event);
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void flx_decode_color (GstFlxDec *, guchar *, guchar *, gint);
|
|
|
|
static void flx_decode_brun (GstFlxDec *, guchar *, guchar *);
|
|
|
|
static void flx_decode_delta_fli (GstFlxDec *, guchar *, guchar *);
|
|
|
|
static void flx_decode_delta_flc (GstFlxDec *, guchar *, guchar *);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2006-02-19 11:57:58 +00:00
|
|
|
#define rndalign(off) ((off) + ((off) & 1))
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
|
|
|
|
GType
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_flxdec_get_type (void)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
|
|
|
static GType flxdec_type = 0;
|
|
|
|
|
|
|
|
if (!flxdec_type) {
|
|
|
|
static const GTypeInfo flxdec_info = {
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstFlxDecClass),
|
|
|
|
(GBaseInitFunc) gst_flxdec_base_init,
|
2001-12-22 23:27:31 +00:00
|
|
|
NULL,
|
2004-03-14 22:34:33 +00:00
|
|
|
(GClassInitFunc) gst_flxdec_class_init,
|
2001-12-22 23:27:31 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstFlxDec),
|
2001-12-22 23:27:31 +00:00
|
|
|
0,
|
2004-03-14 22:34:33 +00:00
|
|
|
(GInstanceInitFunc) gst_flxdec_init,
|
2001-12-22 23:27:31 +00:00
|
|
|
};
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
flxdec_type =
|
2004-03-15 19:32:27 +00:00
|
|
|
g_type_register_static (GST_TYPE_ELEMENT, "GstFlxDec", &flxdec_info, 0);
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
return flxdec_type;
|
|
|
|
}
|
|
|
|
|
2003-11-02 17:36:30 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_flxdec_base_init (GstFlxDecClass * klass)
|
2003-11-02 17:36:30 +00:00
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-11-02 17:36:30 +00:00
|
|
|
gst_element_class_set_details (gstelement_class, &flxdec_details);
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_static_pad_template_get (&sink_factory));
|
2003-11-02 17:36:30 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_static_pad_template_get (&src_video_factory));
|
2003-11-02 17:36:30 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
gst_flxdec_class_init (GstFlxDecClass * klass)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2006-04-08 21:21:45 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
Fix a bunch of leaks shown by the newly-added states test.
Original commit message from CVS:
* ext/flac/gstflacenc.c: (gst_flac_enc_finalize):
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_class_init),
(gst_gconf_audio_sink_dispose), (gst_gconf_audio_sink_finalize):
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_base_init),
(gst_gconf_audio_src_class_init), (gst_gconf_audio_src_dispose),
(gst_gconf_audio_src_finalize), (do_toggle_element):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init),
(gst_gconf_video_sink_class_init), (gst_gconf_video_sink_finalize),
(do_toggle_element):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_base_init),
(gst_gconf_video_src_class_init), (gst_gconf_video_src_dispose),
(gst_gconf_video_src_finalize), (do_toggle_element):
* ext/gconf/gstswitchsink.c: (gst_switch_sink_class_init),
(gst_switch_sink_reset), (gst_switch_sink_set_child):
* ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_base_init):
* ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_base_init):
* ext/shout2/gstshout2.c: (gst_shout2send_class_init),
(gst_shout2send_init), (gst_shout2send_finalize):
* gst/debug/testplugin.c: (gst_test_class_init),
(gst_test_finalize):
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(gst_flxdec_dispose):
* gst/multipart/multipartmux.c: (gst_multipart_mux_finalize):
* gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_finalize):
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init),
(gst_rtspsrc_finalize):
* gst/rtsp/rtspextwms.c: (rtsp_ext_wms_free_context):
* gst/rtsp/rtspextwms.h:
* gst/smpte/gstsmpte.c: (gst_smpte_class_init),
(gst_smpte_finalize):
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_finalize):
* gst/udp/gstudpsink.c: (gst_udpsink_class_init),
(gst_udpsink_finalize):
* gst/wavparse/gstwavparse.c: (gst_wavparse_dispose),
(gst_wavparse_sink_activate):
* sys/oss/gstosssink.c: (gst_oss_sink_finalise):
* sys/oss/gstosssrc.c: (gst_oss_src_class_init),
(gst_oss_src_finalize):
* sys/v4l2/gstv4l2object.c: (gst_v4l2_object_destroy):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_finalize):
* sys/ximage/gstximagesrc.c: (gst_ximage_src_ximage_get):
Fix a bunch of leaks shown by the newly-added states test.
2007-03-04 13:52:03 +00:00
|
|
|
gobject_class->dispose = (GObjectFinalizeFunc) gst_flxdec_dispose;
|
|
|
|
|
ext/flac/gstflacdec.c: Only return true if we actually filled something in. Prevents player applications from showing...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flacdec_src_query):
Only return true if we actually filled something in. Prevents
player applications from showing a random length for flac files.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_class_init),
(gst_riff_read_use_event), (gst_riff_read_handle_event),
(gst_riff_read_seek), (gst_riff_read_skip), (gst_riff_read_strh),
(gst_riff_read_strf_vids_with_data),
(gst_riff_read_strf_auds_with_data), (gst_riff_read_strf_iavs):
OK, ok, so I implemented event handling. Apparently it's normal
that we receive random events at random points without asking
for it.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Implement non-lineair chunk handling and subchunk processing.
The first solves playback of AVI files where the audio and video
data of individual buffers that we read are not synchronized.
This should not happen according to the wonderful AVI specs, but
of course it does happen in reality. It is also a prerequisite for
the second. Subchunk processing allows us to cut chunks in small
pieces and process each of these pieces separately. This is
required because I've seen several AVI files with incredibly large
audio chunks, even some files with only one audio chunk for the
whole file. This allows for proper playback including seeking.
This patch is supposed to fix all AVI A/V sync issues.
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(flx_decode_chunks), (flx_decode_color), (gst_flxdec_loop):
Work.
* gst/modplug/gstmodplug.cc:
Proper return value setting for the query() function.
* gst/playback/gstplaybasebin.c: (setup_source):
Being in non-playing state (after, e.g., EOS) is not necessarily
a bad thing. Allow for that. This fixes playback of short files.
They don't actually playback fully now, because the clock already
runs. This means that small files (<500kB) with a small length
(<2sec) will still not or barely play. Other files, such as mod
or flx, will work correctly, however.
2004-09-29 09:45:40 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (flxdec_debug, "flxdec", 0, "FLX video decoder");
|
|
|
|
|
2002-01-13 22:27:25 +00:00
|
|
|
gstelement_class->change_state = gst_flxdec_change_state;
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
gst_flxdec_init (GstFlxDec * flxdec)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
2006-03-15 16:17:12 +00:00
|
|
|
flxdec->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink");
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (flxdec), flxdec->sinkpad);
|
2005-10-16 21:19:44 +00:00
|
|
|
gst_pad_set_chain_function (flxdec->sinkpad, gst_flxdec_chain);
|
|
|
|
gst_pad_set_event_function (flxdec->sinkpad, gst_flxdec_sink_event_handler);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2006-03-15 16:17:12 +00:00
|
|
|
flxdec->srcpad = gst_pad_new_from_static_template (&src_video_factory, "src");
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (flxdec), flxdec->srcpad);
|
2006-02-19 11:57:58 +00:00
|
|
|
gst_pad_set_query_function (flxdec->srcpad, gst_flxdec_src_query_handler);
|
2005-10-16 21:19:44 +00:00
|
|
|
gst_pad_set_event_function (flxdec->srcpad, gst_flxdec_src_event_handler);
|
|
|
|
|
|
|
|
gst_pad_use_fixed_caps (flxdec->srcpad);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2002-01-13 22:27:25 +00:00
|
|
|
flxdec->frame = NULL;
|
|
|
|
flxdec->delta = NULL;
|
2005-10-16 21:19:44 +00:00
|
|
|
|
|
|
|
flxdec->adapter = gst_adapter_new ();
|
|
|
|
}
|
|
|
|
|
Fix a bunch of leaks shown by the newly-added states test.
Original commit message from CVS:
* ext/flac/gstflacenc.c: (gst_flac_enc_finalize):
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_class_init),
(gst_gconf_audio_sink_dispose), (gst_gconf_audio_sink_finalize):
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_base_init),
(gst_gconf_audio_src_class_init), (gst_gconf_audio_src_dispose),
(gst_gconf_audio_src_finalize), (do_toggle_element):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init),
(gst_gconf_video_sink_class_init), (gst_gconf_video_sink_finalize),
(do_toggle_element):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_base_init),
(gst_gconf_video_src_class_init), (gst_gconf_video_src_dispose),
(gst_gconf_video_src_finalize), (do_toggle_element):
* ext/gconf/gstswitchsink.c: (gst_switch_sink_class_init),
(gst_switch_sink_reset), (gst_switch_sink_set_child):
* ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_base_init):
* ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_base_init):
* ext/shout2/gstshout2.c: (gst_shout2send_class_init),
(gst_shout2send_init), (gst_shout2send_finalize):
* gst/debug/testplugin.c: (gst_test_class_init),
(gst_test_finalize):
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(gst_flxdec_dispose):
* gst/multipart/multipartmux.c: (gst_multipart_mux_finalize):
* gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_finalize):
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init),
(gst_rtspsrc_finalize):
* gst/rtsp/rtspextwms.c: (rtsp_ext_wms_free_context):
* gst/rtsp/rtspextwms.h:
* gst/smpte/gstsmpte.c: (gst_smpte_class_init),
(gst_smpte_finalize):
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_finalize):
* gst/udp/gstudpsink.c: (gst_udpsink_class_init),
(gst_udpsink_finalize):
* gst/wavparse/gstwavparse.c: (gst_wavparse_dispose),
(gst_wavparse_sink_activate):
* sys/oss/gstosssink.c: (gst_oss_sink_finalise):
* sys/oss/gstosssrc.c: (gst_oss_src_class_init),
(gst_oss_src_finalize):
* sys/v4l2/gstv4l2object.c: (gst_v4l2_object_destroy):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_finalize):
* sys/ximage/gstximagesrc.c: (gst_ximage_src_ximage_get):
Fix a bunch of leaks shown by the newly-added states test.
2007-03-04 13:52:03 +00:00
|
|
|
static void
|
|
|
|
gst_flxdec_dispose (GstFlxDec * flxdec)
|
|
|
|
{
|
|
|
|
if (flxdec->adapter) {
|
|
|
|
g_object_unref (flxdec->adapter);
|
|
|
|
flxdec->adapter = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispose ((GObject *) flxdec);
|
|
|
|
}
|
|
|
|
|
2006-02-19 11:57:58 +00:00
|
|
|
static gboolean
|
|
|
|
gst_flxdec_src_query_handler (GstPad * pad, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstFlxDec *flxdec = (GstFlxDec *) gst_pad_get_parent (pad);
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_DURATION:
|
|
|
|
{
|
|
|
|
GstFormat format;
|
|
|
|
|
|
|
|
gst_query_parse_duration (query, &format, NULL);
|
|
|
|
|
|
|
|
if (format != GST_FORMAT_TIME)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
gst_query_set_duration (query, format, flxdec->duration);
|
|
|
|
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
done:
|
|
|
|
gst_object_unref (flxdec);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
static gboolean
|
|
|
|
gst_flxdec_src_event_handler (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstFlxDec *flxdec = (GstFlxDec *) gst_pad_get_parent (pad);
|
2005-11-21 18:09:02 +00:00
|
|
|
gboolean ret;
|
2005-10-16 21:19:44 +00:00
|
|
|
|
|
|
|
/* TODO: implement the seek and other event handling */
|
|
|
|
|
2005-11-21 18:09:02 +00:00
|
|
|
ret = gst_pad_push_event (flxdec->sinkpad, event);
|
|
|
|
|
|
|
|
gst_object_unref (flxdec);
|
|
|
|
|
|
|
|
return ret;
|
2005-10-16 21:19:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_flxdec_sink_event_handler (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
2005-11-21 18:09:02 +00:00
|
|
|
GstFlxDec *flxdec;
|
|
|
|
gboolean ret;
|
2005-10-16 21:19:44 +00:00
|
|
|
|
2005-11-21 18:09:02 +00:00
|
|
|
flxdec = GST_FLXDEC (gst_pad_get_parent (pad));
|
2005-10-16 21:19:44 +00:00
|
|
|
|
2005-11-21 18:09:02 +00:00
|
|
|
ret = gst_pad_push_event (flxdec->srcpad, event);
|
2005-10-16 21:19:44 +00:00
|
|
|
|
2005-11-21 18:09:02 +00:00
|
|
|
gst_object_unref (flxdec);
|
|
|
|
return ret;
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-10-17 14:56:12 +00:00
|
|
|
flx_decode_chunks (GstFlxDec * flxdec, gulong count, guchar * data,
|
|
|
|
guchar * dest)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
FlxFrameChunk *hdr;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_return_if_fail (data != NULL);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
while (count--) {
|
2004-03-14 22:34:33 +00:00
|
|
|
hdr = (FlxFrameChunk *) data;
|
2005-12-11 16:43:42 +00:00
|
|
|
FLX_FRAME_CHUNK_FIX_ENDIANNESS (hdr);
|
2001-12-22 23:27:31 +00:00
|
|
|
data += FlxFrameChunkSize;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
switch (hdr->id) {
|
2001-12-22 23:27:31 +00:00
|
|
|
case FLX_COLOR64:
|
2004-03-15 19:32:27 +00:00
|
|
|
flx_decode_color (flxdec, data, dest, 2);
|
|
|
|
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
|
|
|
break;
|
2002-01-18 18:41:58 +00:00
|
|
|
|
2001-12-22 23:27:31 +00:00
|
|
|
case FLX_COLOR256:
|
2004-03-15 19:32:27 +00:00
|
|
|
flx_decode_color (flxdec, data, dest, 0);
|
|
|
|
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
|
|
|
break;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
case FLX_BRUN:
|
2004-03-15 19:32:27 +00:00
|
|
|
flx_decode_brun (flxdec, data, dest);
|
|
|
|
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
|
|
|
break;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
case FLX_LC:
|
2004-03-15 19:32:27 +00:00
|
|
|
flx_decode_delta_fli (flxdec, data, dest);
|
|
|
|
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
|
|
|
break;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
case FLX_SS2:
|
2004-03-15 19:32:27 +00:00
|
|
|
flx_decode_delta_flc (flxdec, data, dest);
|
|
|
|
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
|
|
|
break;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
case FLX_BLACK:
|
2004-03-15 19:32:27 +00:00
|
|
|
memset (dest, 0, flxdec->size);
|
|
|
|
break;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
case FLX_MINI:
|
2004-03-15 19:32:27 +00:00
|
|
|
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
|
|
|
break;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
default:
|
ext/flac/gstflacdec.c: Only return true if we actually filled something in. Prevents player applications from showing...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flacdec_src_query):
Only return true if we actually filled something in. Prevents
player applications from showing a random length for flac files.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_class_init),
(gst_riff_read_use_event), (gst_riff_read_handle_event),
(gst_riff_read_seek), (gst_riff_read_skip), (gst_riff_read_strh),
(gst_riff_read_strf_vids_with_data),
(gst_riff_read_strf_auds_with_data), (gst_riff_read_strf_iavs):
OK, ok, so I implemented event handling. Apparently it's normal
that we receive random events at random points without asking
for it.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Implement non-lineair chunk handling and subchunk processing.
The first solves playback of AVI files where the audio and video
data of individual buffers that we read are not synchronized.
This should not happen according to the wonderful AVI specs, but
of course it does happen in reality. It is also a prerequisite for
the second. Subchunk processing allows us to cut chunks in small
pieces and process each of these pieces separately. This is
required because I've seen several AVI files with incredibly large
audio chunks, even some files with only one audio chunk for the
whole file. This allows for proper playback including seeking.
This patch is supposed to fix all AVI A/V sync issues.
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(flx_decode_chunks), (flx_decode_color), (gst_flxdec_loop):
Work.
* gst/modplug/gstmodplug.cc:
Proper return value setting for the query() function.
* gst/playback/gstplaybasebin.c: (setup_source):
Being in non-playing state (after, e.g., EOS) is not necessarily
a bad thing. Allow for that. This fixes playback of short files.
They don't actually playback fully now, because the clock already
runs. This means that small files (<500kB) with a small length
(<2sec) will still not or barely play. Other files, such as mod
or flx, will work correctly, however.
2004-09-29 09:45:40 +00:00
|
|
|
GST_WARNING ("Unimplented chunk type: 0x%02x size: %d - skipping",
|
2004-03-15 19:32:27 +00:00
|
|
|
hdr->id, hdr->size);
|
|
|
|
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
|
|
|
break;
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
flx_decode_color (GstFlxDec * flxdec, guchar * data, guchar * dest, gint scale)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
|
|
|
guint packs, count, indx;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_return_if_fail (flxdec != NULL);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
packs = (data[0] + (data[1] << 8));
|
|
|
|
|
|
|
|
data += 2;
|
2004-03-14 22:34:33 +00:00
|
|
|
indx = 0;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
ext/flac/gstflacdec.c: Only return true if we actually filled something in. Prevents player applications from showing...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flacdec_src_query):
Only return true if we actually filled something in. Prevents
player applications from showing a random length for flac files.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_class_init),
(gst_riff_read_use_event), (gst_riff_read_handle_event),
(gst_riff_read_seek), (gst_riff_read_skip), (gst_riff_read_strh),
(gst_riff_read_strf_vids_with_data),
(gst_riff_read_strf_auds_with_data), (gst_riff_read_strf_iavs):
OK, ok, so I implemented event handling. Apparently it's normal
that we receive random events at random points without asking
for it.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Implement non-lineair chunk handling and subchunk processing.
The first solves playback of AVI files where the audio and video
data of individual buffers that we read are not synchronized.
This should not happen according to the wonderful AVI specs, but
of course it does happen in reality. It is also a prerequisite for
the second. Subchunk processing allows us to cut chunks in small
pieces and process each of these pieces separately. This is
required because I've seen several AVI files with incredibly large
audio chunks, even some files with only one audio chunk for the
whole file. This allows for proper playback including seeking.
This patch is supposed to fix all AVI A/V sync issues.
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(flx_decode_chunks), (flx_decode_color), (gst_flxdec_loop):
Work.
* gst/modplug/gstmodplug.cc:
Proper return value setting for the query() function.
* gst/playback/gstplaybasebin.c: (setup_source):
Being in non-playing state (after, e.g., EOS) is not necessarily
a bad thing. Allow for that. This fixes playback of short files.
They don't actually playback fully now, because the clock already
runs. This means that small files (<500kB) with a small length
(<2sec) will still not or barely play. Other files, such as mod
or flx, will work correctly, however.
2004-09-29 09:45:40 +00:00
|
|
|
GST_LOG ("GstFlxDec: cmap packs: %d", packs);
|
2001-12-22 23:27:31 +00:00
|
|
|
while (packs--) {
|
|
|
|
/* color map index + skip count */
|
|
|
|
indx += *data++;
|
|
|
|
|
|
|
|
/* number of rgb triplets */
|
|
|
|
count = *data++ & 0xff;
|
|
|
|
if (count == 0)
|
|
|
|
count = 256;
|
|
|
|
|
2006-02-19 11:57:58 +00:00
|
|
|
GST_LOG ("GstFlxDec: cmap count: %d (indx: %d)", count, indx);
|
2004-03-14 22:34:33 +00:00
|
|
|
flx_set_palette_vector (flxdec->converter, indx, count, data, scale);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
data += (count * 3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
flx_decode_brun (GstFlxDec * flxdec, guchar * data, guchar * dest)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
gulong count, lines, row;
|
|
|
|
guchar x;
|
|
|
|
|
|
|
|
g_return_if_fail (flxdec != NULL);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
lines = flxdec->hdr.height;
|
2004-03-14 22:34:33 +00:00
|
|
|
while (lines--) {
|
2001-12-22 23:27:31 +00:00
|
|
|
/* packet count.
|
|
|
|
* should not be used anymore, since the flc format can
|
|
|
|
* contain more then 255 RLE packets. we use the frame
|
|
|
|
* width instead.
|
|
|
|
*/
|
|
|
|
data++;
|
|
|
|
|
|
|
|
row = flxdec->hdr.width;
|
2004-03-14 22:34:33 +00:00
|
|
|
while (row) {
|
2001-12-22 23:27:31 +00:00
|
|
|
count = *data++;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if (count > 0x7f) {
|
2004-03-15 19:32:27 +00:00
|
|
|
/* literal run */
|
|
|
|
count = 0x100 - count;
|
|
|
|
row -= count;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
while (count--)
|
|
|
|
*dest++ = *data++;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
} else {
|
2004-03-15 19:32:27 +00:00
|
|
|
/* replicate run */
|
|
|
|
row -= count;
|
|
|
|
x = *data++;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
while (count--)
|
|
|
|
*dest++ = x;
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
flx_decode_delta_fli (GstFlxDec * flxdec, guchar * data, guchar * dest)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
gulong count, packets, lines, start_line, start_l;
|
|
|
|
guchar *start_p, x;
|
|
|
|
|
|
|
|
g_return_if_fail (flxdec != NULL);
|
|
|
|
g_return_if_fail (flxdec->delta != NULL);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
/* use last frame for delta */
|
2004-03-14 22:34:33 +00:00
|
|
|
memcpy (dest, GST_BUFFER_DATA (flxdec->delta),
|
|
|
|
GST_BUFFER_SIZE (flxdec->delta));
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
start_line = (data[0] + (data[1] << 8));
|
2004-03-14 22:34:33 +00:00
|
|
|
lines = (data[2] + (data[3] << 8));
|
|
|
|
data += 4;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
/* start position of delta */
|
|
|
|
dest += (flxdec->hdr.width * start_line);
|
|
|
|
start_p = dest;
|
|
|
|
start_l = lines;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
while (lines--) {
|
2001-12-22 23:27:31 +00:00
|
|
|
/* packet count */
|
|
|
|
packets = *data++;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
while (packets--) {
|
2001-12-22 23:27:31 +00:00
|
|
|
/* skip count */
|
|
|
|
dest += *data++;
|
|
|
|
|
|
|
|
/* RLE count */
|
|
|
|
count = *data++;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if (count > 0x7f) {
|
2004-03-15 19:32:27 +00:00
|
|
|
/* literal run */
|
|
|
|
count = 0x100 - count;
|
|
|
|
x = *data++;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
while (count--)
|
|
|
|
*dest++ = x;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
} else {
|
2004-03-15 19:32:27 +00:00
|
|
|
/* replicate run */
|
|
|
|
while (count--)
|
|
|
|
*dest++ = *data++;
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
}
|
2002-01-18 19:41:04 +00:00
|
|
|
start_p += flxdec->hdr.width;
|
|
|
|
dest = start_p;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
flx_decode_delta_flc (GstFlxDec * flxdec, guchar * data, guchar * dest)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
gulong count, lines, start_l, opcode;
|
|
|
|
guchar *start_p;
|
|
|
|
|
|
|
|
g_return_if_fail (flxdec != NULL);
|
|
|
|
g_return_if_fail (flxdec->delta != NULL);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
/* use last frame for delta */
|
2004-03-14 22:34:33 +00:00
|
|
|
memcpy (dest, GST_BUFFER_DATA (flxdec->delta),
|
|
|
|
GST_BUFFER_SIZE (flxdec->delta));
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
lines = (data[0] + (data[1] << 8));
|
|
|
|
data += 2;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
start_p = dest;
|
|
|
|
start_l = lines;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2002-01-18 19:41:04 +00:00
|
|
|
while (lines) {
|
2001-12-22 23:27:31 +00:00
|
|
|
dest = start_p + (flxdec->hdr.width * (start_l - lines));
|
|
|
|
|
|
|
|
/* process opcode(s) */
|
|
|
|
while ((opcode = (data[0] + (data[1] << 8))) & 0xc000) {
|
|
|
|
data += 2;
|
|
|
|
if ((opcode & 0xc000) == 0xc000) {
|
2004-03-15 19:32:27 +00:00
|
|
|
/* skip count */
|
|
|
|
start_l += (0x10000 - opcode);
|
|
|
|
dest += flxdec->hdr.width * (0x10000 - opcode);
|
2001-12-22 23:27:31 +00:00
|
|
|
} else {
|
2004-03-15 19:32:27 +00:00
|
|
|
/* last pixel */
|
|
|
|
dest += flxdec->hdr.width;
|
|
|
|
*dest++ = (opcode & 0xff);
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
data += 2;
|
|
|
|
|
|
|
|
/* last opcode is the packet count */
|
2004-03-14 22:34:33 +00:00
|
|
|
while (opcode--) {
|
2001-12-22 23:27:31 +00:00
|
|
|
/* skip count */
|
|
|
|
dest += *data++;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2001-12-22 23:27:31 +00:00
|
|
|
/* RLE count */
|
|
|
|
count = *data++;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2001-12-22 23:27:31 +00:00
|
|
|
if (count > 0x7f) {
|
2004-03-15 19:32:27 +00:00
|
|
|
/* replicate word run */
|
|
|
|
count = 0x100 - count;
|
|
|
|
while (count--) {
|
|
|
|
*dest++ = data[0];
|
|
|
|
*dest++ = data[1];
|
|
|
|
}
|
|
|
|
data += 2;
|
2001-12-22 23:27:31 +00:00
|
|
|
} else {
|
2004-03-15 19:32:27 +00:00
|
|
|
/* literal word run */
|
|
|
|
while (count--) {
|
|
|
|
*dest++ = *data++;
|
|
|
|
*dest++ = *data++;
|
|
|
|
}
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
}
|
2002-01-18 19:41:04 +00:00
|
|
|
lines--;
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_flxdec_chain (GstPad * pad, GstBuffer * buf)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
GstCaps *caps;
|
2005-10-16 21:19:44 +00:00
|
|
|
guint avail;
|
|
|
|
GstFlowReturn res = GST_FLOW_OK;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
GstFlxDec *flxdec;
|
|
|
|
FlxHeader *flxh;
|
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
|
|
|
|
flxdec = (GstFlxDec *) gst_pad_get_parent (pad);
|
|
|
|
g_return_val_if_fail (flxdec != NULL, GST_FLOW_ERROR);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
gst_adapter_push (flxdec->adapter, buf);
|
|
|
|
avail = gst_adapter_available (flxdec->adapter);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2002-01-13 22:27:25 +00:00
|
|
|
if (flxdec->state == GST_FLXDEC_READ_HEADER) {
|
2005-10-16 21:19:44 +00:00
|
|
|
if (avail >= FlxHeaderSize) {
|
|
|
|
const guint8 *data = gst_adapter_peek (flxdec->adapter, FlxHeaderSize);
|
2002-01-19 18:46:23 +00:00
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
memcpy ((gchar *) & flxdec->hdr, data, FlxHeaderSize);
|
2005-12-11 16:43:42 +00:00
|
|
|
FLX_HDR_FIX_ENDIANNESS (&(flxdec->hdr));
|
2005-10-16 21:19:44 +00:00
|
|
|
gst_adapter_flush (flxdec->adapter, FlxHeaderSize);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
flxh = &flxdec->hdr;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
/* check header */
|
|
|
|
if (flxh->type != FLX_MAGICHDR_FLI &&
|
2006-02-19 11:57:58 +00:00
|
|
|
flxh->type != FLX_MAGICHDR_FLC && flxh->type != FLX_MAGICHDR_FLX)
|
|
|
|
goto wrong_type;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2006-02-19 11:57:58 +00:00
|
|
|
GST_LOG ("size : %d", flxh->size);
|
|
|
|
GST_LOG ("frames : %d", flxh->frames);
|
|
|
|
GST_LOG ("width : %d", flxh->width);
|
|
|
|
GST_LOG ("height : %d", flxh->height);
|
|
|
|
GST_LOG ("depth : %d", flxh->depth);
|
|
|
|
GST_LOG ("speed : %d", flxh->speed);
|
2002-01-13 22:27:25 +00:00
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
flxdec->next_time = 0;
|
2002-01-13 22:27:25 +00:00
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
if (flxh->type == FLX_MAGICHDR_FLI) {
|
|
|
|
flxdec->frame_time = JIFFIE * flxh->speed;
|
2005-12-13 10:45:04 +00:00
|
|
|
} else if (flxh->speed == 0) {
|
|
|
|
flxdec->frame_time = GST_SECOND / 70;
|
2005-10-16 21:19:44 +00:00
|
|
|
} else {
|
|
|
|
flxdec->frame_time = flxh->speed * GST_MSECOND;
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2006-02-19 11:57:58 +00:00
|
|
|
flxdec->duration = flxh->frames * flxdec->frame_time;
|
2006-02-19 12:09:19 +00:00
|
|
|
GST_LOG ("duration : %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (flxdec->duration));
|
2006-02-19 11:57:58 +00:00
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
caps = gst_caps_from_string (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN);
|
|
|
|
gst_caps_set_simple (caps,
|
|
|
|
"width", G_TYPE_INT, flxh->width,
|
|
|
|
"height", G_TYPE_INT, flxh->height,
|
2005-11-22 22:21:37 +00:00
|
|
|
"framerate", GST_TYPE_FRACTION, (gint) GST_MSECOND,
|
|
|
|
(gint) flxdec->frame_time / 1000, NULL);
|
2005-10-16 21:19:44 +00:00
|
|
|
|
|
|
|
gst_pad_set_caps (flxdec->srcpad, caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
if (flxh->depth <= 8)
|
|
|
|
flxdec->converter =
|
|
|
|
flx_colorspace_converter_new (flxh->width, flxh->height);
|
|
|
|
|
|
|
|
if (flxh->type == FLX_MAGICHDR_FLC || flxh->type == FLX_MAGICHDR_FLX) {
|
2006-02-19 11:57:58 +00:00
|
|
|
GST_LOG ("(FLC) aspect_dx : %d", flxh->aspect_dx);
|
|
|
|
GST_LOG ("(FLC) aspect_dy : %d", flxh->aspect_dy);
|
|
|
|
GST_LOG ("(FLC) oframe1 : 0x%08x", flxh->oframe1);
|
|
|
|
GST_LOG ("(FLC) oframe2 : 0x%08x", flxh->oframe2);
|
2005-10-16 21:19:44 +00:00
|
|
|
}
|
2004-10-06 13:56:07 +00:00
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
flxdec->size = (flxh->width * flxh->height);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
/* create delta and output frame */
|
|
|
|
flxdec->frame = gst_buffer_new ();
|
|
|
|
flxdec->delta = gst_buffer_new ();
|
|
|
|
GST_BUFFER_DATA (flxdec->frame) = g_malloc (flxdec->size);
|
2006-02-19 11:57:58 +00:00
|
|
|
GST_BUFFER_MALLOCDATA (flxdec->frame) = GST_BUFFER_DATA (flxdec->frame);
|
2005-10-16 21:19:44 +00:00
|
|
|
GST_BUFFER_SIZE (flxdec->frame) = flxdec->size;
|
|
|
|
GST_BUFFER_DATA (flxdec->delta) = g_malloc (flxdec->size);
|
2006-02-19 11:57:58 +00:00
|
|
|
GST_BUFFER_MALLOCDATA (flxdec->delta) = GST_BUFFER_DATA (flxdec->delta);
|
2005-10-16 21:19:44 +00:00
|
|
|
GST_BUFFER_SIZE (flxdec->delta) = flxdec->size;
|
2002-01-13 22:27:25 +00:00
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
flxdec->state = GST_FLXDEC_PLAYING;
|
2002-01-13 22:27:25 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
} else if (flxdec->state == GST_FLXDEC_PLAYING) {
|
2002-01-19 18:26:20 +00:00
|
|
|
GstBuffer *out;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2006-02-19 11:57:58 +00:00
|
|
|
/* while we have enough data in the adapter */
|
|
|
|
while (avail >= FlxFrameChunkSize) {
|
2005-11-09 21:35:29 +00:00
|
|
|
FlxFrameChunk flxfh;
|
2006-02-19 11:57:58 +00:00
|
|
|
guchar *chunk;
|
|
|
|
const guint8 *data;
|
|
|
|
|
|
|
|
chunk = NULL;
|
|
|
|
data = gst_adapter_peek (flxdec->adapter, FlxFrameChunkSize);
|
2005-11-09 21:35:29 +00:00
|
|
|
memcpy (&flxfh, data, FlxFrameChunkSize);
|
2005-12-11 16:43:42 +00:00
|
|
|
FLX_FRAME_CHUNK_FIX_ENDIANNESS (&flxfh);
|
2005-10-16 21:19:44 +00:00
|
|
|
|
2005-11-09 21:35:29 +00:00
|
|
|
switch (flxfh.id) {
|
2005-10-16 21:19:44 +00:00
|
|
|
case FLX_FRAME_TYPE:
|
2006-02-19 11:57:58 +00:00
|
|
|
/* check if we have the complete frame */
|
|
|
|
if (avail < flxfh.size)
|
|
|
|
goto need_more_data;
|
2005-10-16 21:19:44 +00:00
|
|
|
|
2006-02-19 11:57:58 +00:00
|
|
|
/* flush header */
|
2005-10-16 21:19:44 +00:00
|
|
|
gst_adapter_flush (flxdec->adapter, FlxFrameChunkSize);
|
|
|
|
|
2006-02-19 11:57:58 +00:00
|
|
|
chunk = gst_adapter_take (flxdec->adapter,
|
|
|
|
flxfh.size - FlxFrameChunkSize);
|
2005-12-11 16:43:42 +00:00
|
|
|
FLX_FRAME_TYPE_FIX_ENDIANNESS ((FlxFrameType *) chunk);
|
2005-10-16 21:19:44 +00:00
|
|
|
if (((FlxFrameType *) chunk)->chunks == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* create 32 bits output frame */
|
2005-12-05 13:03:00 +00:00
|
|
|
res = gst_pad_alloc_buffer_and_set_caps (flxdec->srcpad,
|
2005-10-16 21:19:44 +00:00
|
|
|
GST_BUFFER_OFFSET_NONE,
|
|
|
|
flxdec->size * 4, GST_PAD_CAPS (flxdec->srcpad), &out);
|
|
|
|
if (res != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* decode chunks */
|
|
|
|
flx_decode_chunks (flxdec,
|
|
|
|
((FlxFrameType *) chunk)->chunks,
|
|
|
|
chunk + FlxFrameTypeSize, GST_BUFFER_DATA (flxdec->frame));
|
|
|
|
|
|
|
|
/* save copy of the current frame for possible delta. */
|
|
|
|
memcpy (GST_BUFFER_DATA (flxdec->delta),
|
|
|
|
GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_SIZE (flxdec->delta));
|
|
|
|
|
|
|
|
/* convert current frame. */
|
|
|
|
flx_colorspace_convert (flxdec->converter,
|
|
|
|
GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_DATA (out));
|
|
|
|
|
|
|
|
GST_BUFFER_TIMESTAMP (out) = flxdec->next_time;
|
|
|
|
flxdec->next_time += flxdec->frame_time;
|
|
|
|
|
|
|
|
gst_pad_push (flxdec->srcpad, out);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2005-10-16 21:19:44 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-10-16 21:19:44 +00:00
|
|
|
if (chunk)
|
|
|
|
g_free (chunk);
|
2006-02-19 11:57:58 +00:00
|
|
|
|
|
|
|
avail = gst_adapter_available (flxdec->adapter);
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
2002-01-13 22:27:25 +00:00
|
|
|
}
|
2006-02-19 11:57:58 +00:00
|
|
|
need_more_data:
|
close #333784 unref the result of gst_pad_get_parent() by: Christophe Fergeau.
Original commit message from CVS:
* ext/cairo/gsttextoverlay.c: (gst_text_overlay_setcaps):
* ext/esd/esdmon.c: (gst_esdmon_get):
* ext/flac/gstflactag.c: (gst_flac_tag_chain):
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_setcaps),
(gst_gdk_pixbuf_sink_getcaps):
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_getcaps),
(gst_jpegenc_setcaps):
* ext/jpeg/gstsmokedec.c: (gst_smokedec_chain):
* ext/jpeg/gstsmokeenc.c: (gst_smokeenc_getcaps),
(gst_smokeenc_setcaps):
* ext/libmng/gstmngdec.c: (gst_mngdec_sinklink),
(gst_mngdec_src_getcaps):
* ext/libmng/gstmngenc.c: (gst_mngenc_sinklink),
(gst_mngenc_chain):
* ext/libpng/gstpngenc.c: (gst_pngenc_setcaps):
* ext/mikmod/gstmikmod.c: (gst_mikmod_srclink):
* ext/speex/gstspeexdec.c: (speex_dec_convert),
(speex_dec_src_event), (speex_dec_chain):
* gst/avi/gstavimux.c: (gst_avimux_vidsinkconnect),
(gst_avimux_audsinkconnect), (gst_avimux_handle_event):
* gst/debug/negotiation.c: (gst_negotiation_getcaps),
(gst_negotiation_pad_link), (gst_negotiation_chain):
* gst/flx/gstflxdec.c: (gst_flxdec_src_query_handler),
(gst_flxdec_chain):
* gst/interleave/deinterleave.c: (deinterleave_sink_link),
(deinterleave_chain):
* gst/law/mulaw-encode.c: (mulawenc_setcaps):
* gst/median/gstmedian.c: (gst_median_link):
* gst/monoscope/gstmonoscope.c: (gst_monoscope_srcconnect),
(gst_monoscope_chain):
* gst/rtp/gstrtpL16pay.c: (gst_rtpL16pay_sinkconnect):
* gst/wavenc/gstwavenc.c: (gst_wavenc_sink_setcaps):
* sys/osxaudio/gstosxaudiosink.c: (gst_osxaudiosink_chain):
* sys/osxaudio/gstosxaudiosrc.c: (gst_osxaudiosrc_get):
close #333784 unref the result of gst_pad_get_parent()
by: Christophe Fergeau.
2006-03-13 15:49:08 +00:00
|
|
|
gst_object_unref (flxdec);
|
2005-10-16 21:19:44 +00:00
|
|
|
return res;
|
2006-02-19 11:57:58 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
wrong_type:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (flxdec, STREAM, WRONG_TYPE, (NULL),
|
|
|
|
("not a flx file (type %x)", flxh->type));
|
close #333784 unref the result of gst_pad_get_parent() by: Christophe Fergeau.
Original commit message from CVS:
* ext/cairo/gsttextoverlay.c: (gst_text_overlay_setcaps):
* ext/esd/esdmon.c: (gst_esdmon_get):
* ext/flac/gstflactag.c: (gst_flac_tag_chain):
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_setcaps),
(gst_gdk_pixbuf_sink_getcaps):
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_getcaps),
(gst_jpegenc_setcaps):
* ext/jpeg/gstsmokedec.c: (gst_smokedec_chain):
* ext/jpeg/gstsmokeenc.c: (gst_smokeenc_getcaps),
(gst_smokeenc_setcaps):
* ext/libmng/gstmngdec.c: (gst_mngdec_sinklink),
(gst_mngdec_src_getcaps):
* ext/libmng/gstmngenc.c: (gst_mngenc_sinklink),
(gst_mngenc_chain):
* ext/libpng/gstpngenc.c: (gst_pngenc_setcaps):
* ext/mikmod/gstmikmod.c: (gst_mikmod_srclink):
* ext/speex/gstspeexdec.c: (speex_dec_convert),
(speex_dec_src_event), (speex_dec_chain):
* gst/avi/gstavimux.c: (gst_avimux_vidsinkconnect),
(gst_avimux_audsinkconnect), (gst_avimux_handle_event):
* gst/debug/negotiation.c: (gst_negotiation_getcaps),
(gst_negotiation_pad_link), (gst_negotiation_chain):
* gst/flx/gstflxdec.c: (gst_flxdec_src_query_handler),
(gst_flxdec_chain):
* gst/interleave/deinterleave.c: (deinterleave_sink_link),
(deinterleave_chain):
* gst/law/mulaw-encode.c: (mulawenc_setcaps):
* gst/median/gstmedian.c: (gst_median_link):
* gst/monoscope/gstmonoscope.c: (gst_monoscope_srcconnect),
(gst_monoscope_chain):
* gst/rtp/gstrtpL16pay.c: (gst_rtpL16pay_sinkconnect):
* gst/wavenc/gstwavenc.c: (gst_wavenc_sink_setcaps):
* sys/osxaudio/gstosxaudiosink.c: (gst_osxaudiosink_chain):
* sys/osxaudio/gstosxaudiosrc.c: (gst_osxaudiosrc_get):
close #333784 unref the result of gst_pad_get_parent()
by: Christophe Fergeau.
2006-03-13 15:49:08 +00:00
|
|
|
gst_object_unref (flxdec);
|
2006-02-19 11:57:58 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2002-01-13 22:27:25 +00:00
|
|
|
}
|
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_flxdec_change_state (GstElement * element, GstStateChange transition)
|
2002-01-13 22:27:25 +00:00
|
|
|
{
|
|
|
|
GstFlxDec *flxdec;
|
2005-11-16 17:00:32 +00:00
|
|
|
GstStateChangeReturn ret;
|
2002-01-13 22:27:25 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
flxdec = GST_FLXDEC (element);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
2002-01-13 22:27:25 +00:00
|
|
|
break;
|
2005-09-02 15:44:50 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2005-10-16 21:19:44 +00:00
|
|
|
gst_adapter_clear (flxdec->adapter);
|
2002-01-13 22:27:25 +00:00
|
|
|
flxdec->state = GST_FLXDEC_READ_HEADER;
|
|
|
|
break;
|
2005-09-02 15:44:50 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
2002-01-13 22:27:25 +00:00
|
|
|
break;
|
2005-11-16 17:00:32 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = parent_class->change_state (element, transition);
|
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:44:50 +00:00
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
2002-01-13 22:27:25 +00:00
|
|
|
break;
|
2005-09-02 15:44:50 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2005-11-16 17:00:32 +00:00
|
|
|
if (flxdec->frame) {
|
|
|
|
gst_buffer_unref (flxdec->frame);
|
|
|
|
flxdec->frame = NULL;
|
|
|
|
}
|
|
|
|
if (flxdec->delta) {
|
|
|
|
gst_buffer_unref (flxdec->delta);
|
|
|
|
flxdec->delta = NULL;
|
|
|
|
}
|
2002-01-13 22:27:25 +00:00
|
|
|
break;
|
2005-09-02 15:44:50 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
2002-01-13 22:27:25 +00:00
|
|
|
break;
|
2005-11-16 17:00:32 +00:00
|
|
|
default:
|
|
|
|
break;
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
2005-11-16 17:00:32 +00:00
|
|
|
return ret;
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
2003-11-02 17:36:30 +00:00
|
|
|
return gst_element_register (plugin, "flxdec",
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_RANK_PRIMARY, GST_TYPE_FLXDEC);
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"flxdec",
|
2006-11-08 12:04:03 +00:00
|
|
|
"FLC/FLI/FLX video decoder",
|
2005-11-14 02:13:35 +00:00
|
|
|
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|