Remove some more unused cruft left over from our ancient avifile period

Original commit message from CVS:
Remove some more unused cruft left over from our ancient avifile period
This commit is contained in:
Ronald S. Bultje 2003-06-26 21:33:14 +00:00
parent f40cfecbee
commit 082ae36645
6 changed files with 2 additions and 801 deletions

View file

@ -3,18 +3,13 @@ plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
plugin_LTLIBRARIES = \
libgstavimux.la \
libgstavidemux.la
# libgstaviparse.la
# libgstaviaudiodecoder.la
libgstavidemux_la_SOURCES = gstavidemux.c
libgstavimux_la_SOURCES = gstavimux.c
#libgstaviparse_la_SOURCES = gstaviparse.c
# libgstaviaudiodecoder_la_SOURCES = gstaviaudiodecoder.c
noinst_HEADERS = \
gstavimux.h \
gstavidemux.h \
gstaviaudiodecoder.h
gstavidemux.h
#CFLAGS += $(GST_CFLAGS) -O3 $(GST_OPT_CFLAGS) $(GST_FUNROLL_CFLAGS) -fomit-frame-pointer -DNDEBUG
@ -26,12 +21,4 @@ libgstavimux_la_CFLAGS = -O2 $(GST_FFASTMATH_CFLAGS) $(GST_CFLAGS)
libgstavimux_la_LIBADD =
libgstavimux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
#libgstaviparse_la_CFLAGS = -O2 $(GST_FFASTMATH_CFLAGS) $(GST_CFLAGS)
#libgstaviparse_la_LIBADD =
#libgstaviparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
# libgstaviaudiodecoder_la_CFLAGS = -O2 $(GST_FFASTMATH_CFLAGS) $(GST_CFLAGS)
# libgstaviaudiodecoder_la_LIBADD =
# libgstaviaudiodecoder_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
EXTRA_DIST = README_win32dll README
EXTRA_DIST = README

View file

@ -1,3 +0,0 @@
The current win32 dll loader don't work with all versions availble
out there. Make sure to get the windows dll where divxc32.dll has the date
older than 24 january 2000. The 24 january one does currently not work.

View file

@ -1,189 +0,0 @@
/* GStreamer
* 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.
*/
/*#define DEBUG_ENABLED */
#include <wine/winbase.h>
#include <wine/winerror.h>
#include <wine/driver.h>
#include <wine/msacm.h>
#define WIN32
#include <gstavidecoder.h>
typedef struct _GstWinLoaderAudioData GstWinLoaderAudioData;
struct _GstWinLoaderAudioData {
guchar ext_info[64];
WAVEFORMATEX wf;
HACMSTREAM srcstream;
GstPad *out;
};
static GstPad *gst_avi_decoder_get_audio_srcpad_MPEG(GstAviDecoder *avi_decoder, guint pad_nr, GstPadTemplate *temp);
static GstPad *gst_avi_decoder_get_audio_srcpad_winloader(GstAviDecoder *avi_decoder, guint pad_nr, gst_riff_strf_auds *strf, GstPadTemplate *temp);
static void gst_avi_decoder_winloader_audio_chain(GstPad *pad, GstBuffer *buf);
GstPad *gst_avi_decoder_get_audio_srcpad(GstAviDecoder *avi_decoder, guint pad_nr, gst_riff_strf_auds *strf, GstPadTemplate *temp)
{
GstPad *newpad;
switch (strf->format) {
case GST_RIFF_WAVE_FORMAT_PCM:
newpad = gst_pad_new("audio_00", GST_PAD_SRC);
gst_pad_try_set_caps (newpad,
GST_CAPS_NEW (
"avidecoder_caps",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT ((gint)strf->size),
"depth", GST_PROPS_INT ((gint)strf->size),
"rate", GST_PROPS_INT ((gint)strf->rate),
"channels", GST_PROPS_INT ((gint)strf->channels)
));
avi_decoder->audio_pad[pad_nr] = newpad;
return newpad;
case GST_RIFF_WAVE_FORMAT_MPEGL12:
case GST_RIFF_WAVE_FORMAT_MPEGL3:
return gst_avi_decoder_get_audio_srcpad_MPEG(avi_decoder, pad_nr, temp);
default:
newpad = gst_avi_decoder_get_audio_srcpad_winloader(avi_decoder, pad_nr, strf, temp);
if (newpad) return newpad;
printf("audio format %04x not supported\n", strf->format);
break;
}
return NULL;
}
static GstPad *gst_avi_decoder_get_audio_srcpad_MPEG(GstAviDecoder *avi_decoder, guint pad_nr, GstPadTemplate *temp)
{
GstElement *parse_audio, *decode;
GstPad *srcpad, *sinkpad, *newpad;
parse_audio = gst_element_factory_make("mp3parse", "parse_audio");
g_return_val_if_fail(parse_audio != NULL, NULL);
decode = gst_element_factory_make("mpg123", "decode_audio");
g_return_val_if_fail(decode != NULL, NULL);
gst_element_set_state(GST_ELEMENT(gst_object_get_parent(GST_OBJECT(avi_decoder))), GST_STATE_PAUSED);
gst_bin_add(GST_BIN(gst_object_get_parent(GST_OBJECT(avi_decoder))), parse_audio);
gst_bin_add(GST_BIN(gst_object_get_parent(GST_OBJECT(avi_decoder))), decode);
newpad = gst_pad_new("video", GST_PAD_SRC);
gst_pad_set_parent(newpad, GST_ELEMENT(avi_decoder));
sinkpad = gst_element_get_pad(parse_audio,"sink");
gst_pad_connect(gst_element_get_pad(parse_audio,"src"),
gst_element_get_pad(decode,"sink"));
gst_pad_set_chain_function (gst_element_get_pad(parse_audio,"src"),
GST_RPAD_CHAINFUNC (gst_element_get_pad(decode,"sink")));
srcpad = gst_element_get_pad(decode,"src");
gst_pad_connect(newpad, sinkpad);
gst_pad_set_name(srcpad, "audio_00");
gst_pad_set_chain_function (newpad, GST_RPAD_CHAINFUNC (sinkpad));
avi_decoder->audio_pad[pad_nr] = newpad;
gst_element_set_state(GST_ELEMENT(gst_object_get_parent(GST_OBJECT(avi_decoder))), GST_STATE_PLAYING);
return srcpad;
}
static GstPad *gst_avi_decoder_get_audio_srcpad_winloader(GstAviDecoder *avi_decoder, guint pad_nr, gst_riff_strf_auds *strf, GstPadTemplate *temp)
{
HRESULT h;
GstWinLoaderAudioData *data;
GstPad *sinkpad, *newpad;
if (!gst_library_load("winloader")) {
gst_info("audiocodecs: could not load support library: 'winloader'\n");
return NULL;
}
gst_info("audiocodecs: winloader loaded\n");
avi_decoder->extra_data = g_malloc0(sizeof(GstWinLoaderAudioData));
data = (GstWinLoaderAudioData *)avi_decoder->extra_data;
memcpy(data->ext_info, strf, sizeof(WAVEFORMATEX));
memset(data->ext_info+18, 0, 32);
if (strf->rate == 0)
return NULL;
data->wf.nChannels=strf->channels;
data->wf.nSamplesPerSec=strf->rate;
data->wf.nAvgBytesPerSec=2*data->wf.nSamplesPerSec*data->wf.nChannels;
data->wf.wFormatTag=strf->format;
data->wf.nBlockAlign=strf->blockalign;
data->wf.wBitsPerSample=strf->av_bps;
data->wf.cbSize=0;
gst_info("audiocodecs: trying to open library %p\n", data);
h = acmStreamOpen(
&data->srcstream,
(HACMDRIVER)NULL,
(WAVEFORMATEX*)data->ext_info,
(WAVEFORMATEX*)&data->wf,
NULL,
0,
0,
0);
if(h != S_OK)
{
if(h == ACMERR_NOTPOSSIBLE) {
printf("audiocodecs:: Unappropriate audio format\n");
}
printf("audiocodecs:: acmStreamOpen error\n");
return NULL;
}
newpad = gst_pad_new("audio", GST_PAD_SINK);
gst_pad_set_parent(newpad, GST_ELEMENT(avi_decoder));
gst_pad_set_chain_function(newpad, gst_avi_decoder_winloader_audio_chain);
sinkpad = gst_pad_new("audio_00", GST_PAD_SRC);
gst_pad_set_parent(sinkpad, GST_ELEMENT(avi_decoder));
gst_pad_connect(newpad, sinkpad);
gst_pad_set_chain_function (newpad, GST_RPAD_CHAINFUNC (sinkpad));
/*gst_pad_connect(newpad, sinkpad); */
avi_decoder->audio_pad[pad_nr] = newpad;
data->out = sinkpad;
GST_DEBUG (0,"gst_avi_decoder: pads created");
return sinkpad;
}
static void gst_avi_decoder_winloader_audio_chain(GstPad *pad, GstBuffer *buf)
{
GST_DEBUG (0,"gst_avi_decoder: got buffer %08lx %p", *(gulong *)GST_BUFFER_DATA(buf), GST_BUFFER_DATA(buf));
gst_buffer_unref(buf);
}

View file

@ -1,197 +0,0 @@
/* GStreamer
* 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.
*/
/*#define GST_DEBUG_ENABLED */
#include <string.h>
#include "gstaviaudiodecoder.h"
/* elementfactory information */
static GstElementDetails gst_avi_audio_decoder_details = {
".avi parser",
"Parser/Video",
"LGPL",
"Parse a .avi file into audio and video",
VERSION,
"Erik Walthinsen <omega@cse.ogi.edu>\n"
"Wim Taymans <wim.taymans@tvd.be>",
"(C) 1999",
};
/* AviAudioDecoder signals and args */
enum {
/* FILL ME */
LAST_SIGNAL
};
enum {
ARG_0,
/* FILL ME */
};
GST_PAD_TEMPLATE_FACTORY (sink_templ,
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"avidecoder_sink",
"video/avi",
"format", GST_PROPS_STRING ("strf_auds")
)
)
GST_PAD_TEMPLATE_FACTORY (src_audio_templ,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"src_audio",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (11025, 44100),
"channels", GST_PROPS_INT_RANGE (1, 2)
)
)
static void gst_avi_audio_decoder_class_init (GstAviAudioDecoderClass *klass);
static void gst_avi_audio_decoder_init (GstAviAudioDecoder *avi_audio_decoder);
static void gst_avi_audio_decoder_chain (GstPad *pad, GstBuffer *buf);
static void gst_avi_audio_decoder_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static GstElementClass *parent_class = NULL;
/*static guint gst_avi_audio_decoder_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_avi_audio_decoder_get_type(void)
{
static GType avi_audio_decoder_type = 0;
if (!avi_audio_decoder_type) {
static const GTypeInfo avi_audio_decoder_info = {
sizeof(GstAviAudioDecoderClass),
NULL,
NULL,
(GClassInitFunc)gst_avi_audio_decoder_class_init,
NULL,
NULL,
sizeof(GstAviAudioDecoder),
0,
(GInstanceInitFunc)gst_avi_audio_decoder_init,
};
avi_audio_decoder_type = g_type_register_static(GST_TYPE_ELEMENT, "GstAviAudioDecoder", &avi_audio_decoder_info, 0);
}
return avi_audio_decoder_type;
}
static void
gst_avi_audio_decoder_class_init (GstAviAudioDecoderClass *klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
gobject_class = (GObjectClass*)klass;
gstelement_class = (GstElementClass*)klass;
parent_class = g_type_class_ref (GST_TYPE_BIN);
gobject_class->get_property = gst_avi_audio_decoder_get_property;
}
static void
gst_avi_audio_decoder_init (GstAviAudioDecoder *avi_audio_decoder)
{
}
static void
gst_avi_audio_decoder_chain (GstPad *pad,
GstBuffer *buf)
{
GstAviAudioDecoder *avi_audio_decoder;
guchar *data;
gulong size;
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD(pad));
g_return_if_fail (buf != NULL);
g_return_if_fail (GST_BUFFER_DATA(buf) != NULL);
avi_audio_decoder = GST_AVI_AUDIO_DECODER (gst_pad_get_parent (pad));
GST_DEBUG (0,"gst_avi_audio_decoder_chain: got buffer in %u", GST_BUFFER_OFFSET (buf));
g_print ("gst_avi_audio_decoder_chain: got buffer in %u\n", GST_BUFFER_OFFSET (buf));
data = (guchar *)GST_BUFFER_DATA (buf);
size = GST_BUFFER_SIZE (buf);
gst_buffer_unref (buf);
}
static void
gst_avi_audio_decoder_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
GstAviAudioDecoder *src;
g_return_if_fail (GST_IS_AVI_AUDIO_DECODER (object));
src = GST_AVI_AUDIO_DECODER (object);
switch(prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
{
GstElementFactory *factory;
/* create an elementfactory for the avi_audio_decoder element */
factory = gst_element_factory_new ("aviaudiodecoder",GST_TYPE_AVI_AUDIO_DECODER,
&gst_avi_audio_decoder_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_PRIMARY);
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_templ));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_audio_templ));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE;
}
GstPluginDesc plugin_desc = {
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"aviaudiodecoder",
plugin_init
};

View file

@ -1,65 +0,0 @@
/* GStreamer
* 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.
*/
#ifndef __GST_AVI_AUDIO_DECODER_H__
#define __GST_AVI_AUDIO_DECODER_H__
#include <config.h>
#include <gst/gst.h>
#include <gst/riff/riff.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GST_TYPE_AVI_AUDIO_DECODER \
(gst_avi_audio_decoder_get_type())
#define GST_AVI_AUDIO_DECODER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AVI_AUDIO_DECODER,GstAviAudioDecoder))
#define GST_AVI_AUDIO_DECODER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AVI_AUDIO_DECODER,GstAviAudioDecoder))
#define GST_IS_AVI_AUDIO_DECODER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AVI_AUDIO_DECODER))
#define GST_IS_AVI_AUDIO_DECODER_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AVI_AUDIO_DECODER))
typedef struct _GstAviAudioDecoder GstAviAudioDecoder;
typedef struct _GstAviAudioDecoderClass GstAviAudioDecoderClass;
struct _GstAviAudioDecoder {
GstBin bin;
};
struct _GstAviAudioDecoderClass {
GstBinClass parent_class;
};
GType gst_avi_audio_decoder_get_type (void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GST_AVI_AUDIO_DECODER_H__ */

View file

@ -1,332 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@temple-baptist.com>
*
* 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.
*/
/* #define GST_DEBUG_ENABLED */
#include <string.h>
#include <config.h>
#include <gst/gst.h>
#include <gst/bytestream/bytestream.h>
#include <gst/riff/riff.h>
#define GST_TYPE_AVI_PARSE \
(gst_avi_parse_get_type())
#define GST_AVI_PARSE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AVI_PARSE,GstAviParse))
#define GST_AVI_PARSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AVI_PARSE,GstAviParse))
#define GST_IS_AVI_PARSE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AVI_PARSE))
#define GST_IS_AVI_PARSE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AVI_PARSE))
typedef struct _GstAviParse GstAviParse;
typedef struct _GstAviParseClass GstAviParseClass;
struct _GstAviParse {
GstElement element;
/* pads */
GstPad *sinkpad,
*srcpad;
GstRiffParse *rp;
};
struct _GstAviParseClass {
GstElementClass parent_class;
};
/* elementfactory information */
static GstElementDetails gst_avi_parse_details = {
"Avi parseer",
"Codec/Parseer",
"LGPL",
"Demultiplex an avi file into audio and video",
VERSION,
"Wim Taymans <wim.taymans@tvd.be>",
"(C) 2003",
};
static GstCaps* avi_type_find (GstBuffer *buf, gpointer private);
/* typefactory for 'avi' */
static GstTypeDefinition avidefinition = {
"aviparse_video/avi",
"video/avi",
".avi",
avi_type_find,
};
/* AviParse signals and args */
enum {
/* FILL ME */
LAST_SIGNAL
};
enum {
ARG_0,
ARG_BITRATE,
/* FILL ME */
};
GST_PAD_TEMPLATE_FACTORY (sink_templ,
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"aviparse_sink",
"video/avi",
"format", GST_PROPS_STRING ("AVI")
)
)
GST_PAD_TEMPLATE_FACTORY (src_templ,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"aviparse_sink",
"video/avi",
"format", GST_PROPS_STRING ("AVI")
)
)
static void gst_avi_parse_class_init (GstAviParseClass *klass);
static void gst_avi_parse_init (GstAviParse *avi_parse);
static void gst_avi_parse_loop (GstElement *element);
static GstElementStateReturn
gst_avi_parse_change_state (GstElement *element);
static void gst_avi_parse_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec);
static GstElementClass *parent_class = NULL;
/*static guint gst_avi_parse_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_avi_parse_get_type(void)
{
static GType avi_parse_type = 0;
if (!avi_parse_type) {
static const GTypeInfo avi_parse_info = {
sizeof(GstAviParseClass),
NULL,
NULL,
(GClassInitFunc)gst_avi_parse_class_init,
NULL,
NULL,
sizeof(GstAviParse),
0,
(GInstanceInitFunc)gst_avi_parse_init,
};
avi_parse_type = g_type_register_static(GST_TYPE_ELEMENT, "GstAviParse", &avi_parse_info, 0);
}
return avi_parse_type;
}
static void
gst_avi_parse_class_init (GstAviParseClass *klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
gobject_class = (GObjectClass*)klass;
gstelement_class = (GstElementClass*)klass;
g_object_class_install_property (G_OBJECT_CLASS(klass), ARG_BITRATE,
g_param_spec_long ("bitrate","bitrate","bitrate",
G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->get_property = gst_avi_parse_get_property;
gstelement_class->change_state = gst_avi_parse_change_state;
}
static void
gst_avi_parse_init (GstAviParse *avi_parse)
{
GST_FLAG_SET (avi_parse, GST_ELEMENT_EVENT_AWARE);
avi_parse->sinkpad = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (sink_templ), "sink");
gst_element_add_pad (GST_ELEMENT (avi_parse), avi_parse->sinkpad);
avi_parse->srcpad = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (src_templ), "src");
gst_element_add_pad (GST_ELEMENT (avi_parse), avi_parse->srcpad);
gst_element_set_loop_function (GST_ELEMENT (avi_parse), gst_avi_parse_loop);
}
static GstCaps*
avi_type_find (GstBuffer *buf,
gpointer private)
{
gchar *data = GST_BUFFER_DATA (buf);
GstCaps *new;
GST_DEBUG (0,"avi_parse: typefind");
if (GUINT32_FROM_LE (((guint32 *)data)[0]) != GST_RIFF_TAG_RIFF)
return NULL;
if (GUINT32_FROM_LE (((guint32 *)data)[2]) != GST_RIFF_RIFF_AVI)
return NULL;
new = GST_CAPS_NEW ("avi_type_find",
"video/avi",
"format", GST_PROPS_STRING ("AVI"));
return new;
}
static void
gst_avi_parse_loop (GstElement *element)
{
GstAviParse *avi_parse;
GstRiffParse *rp;
GstRiffReturn res;
gst_riff_chunk chunk;
guint32 data_size;
guint64 pos;
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_AVI_PARSE (element));
avi_parse = GST_AVI_PARSE (element);
rp = avi_parse->rp;
pos = gst_bytestream_tell (rp->bs);
res = gst_riff_parse_next_chunk (rp, &chunk);
if (res == GST_RIFF_EOS) {
gst_element_set_eos (element);
return;
}
switch (chunk.id) {
case GST_RIFF_TAG_RIFF:
case GST_RIFF_TAG_LIST:
g_print ("%08llx: %4.4s %08x %4.4s\n", pos, (gchar *)&chunk.id, chunk.size, (gchar *)&chunk.type);
data_size = 0;
break;
default:
g_print ("%08llx: %4.4s %08x\n", pos, (gchar *)&chunk.id, chunk.size);
data_size = chunk.size;
break;
}
if (GST_PAD_IS_USABLE (avi_parse->srcpad) && data_size) {
GstBuffer *buf;
gst_riff_parse_peek (rp, &buf, data_size);
gst_pad_push (avi_parse->srcpad, buf);
}
data_size = (data_size + 1) & ~1;
gst_riff_parse_flush (rp, data_size);
}
static GstElementStateReturn
gst_avi_parse_change_state (GstElement *element)
{
GstAviParse *avi_parse = GST_AVI_PARSE (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
break;
case GST_STATE_READY_TO_PAUSED:
avi_parse->rp = gst_riff_parse_new (avi_parse->sinkpad);
break;
case GST_STATE_PAUSED_TO_PLAYING:
break;
case GST_STATE_PLAYING_TO_PAUSED:
break;
case GST_STATE_PAUSED_TO_READY:
gst_riff_parse_free (avi_parse->rp);
break;
case GST_STATE_READY_TO_NULL:
break;
default:
break;
}
parent_class->change_state (element);
return GST_STATE_SUCCESS;
}
static void
gst_avi_parse_get_property (GObject *object, guint prop_id, GValue *value,
GParamSpec *pspec)
{
GstAviParse *src;
g_return_if_fail (GST_IS_AVI_PARSE (object));
src = GST_AVI_PARSE (object);
switch (prop_id) {
case ARG_BITRATE:
break;
default:
break;
}
}
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
{
GstElementFactory *factory;
GstTypeFactory *type;
/* this filter needs the riff parser */
if (!gst_library_load ("gstbytestream"))
return FALSE;
/* create an elementfactory for the avi_parse element */
factory = gst_element_factory_new ("aviparse", GST_TYPE_AVI_PARSE,
&gst_avi_parse_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_PRIMARY);
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_templ));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_templ));
type = gst_type_factory_new (&avidefinition);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE;
}
GstPluginDesc plugin_desc = {
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"aviparse",
plugin_init
};