indent

Original commit message from CVS:
indent
parent d5cfdabb
2004-03-29 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/ffmpeg/*.c: indent
2004-03-25 Ronald Bultje <rbultje@ronald.bitfreak.net> 2004-03-25 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_base_init): * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_base_init):
......
...@@ -33,16 +33,16 @@ ...@@ -33,16 +33,16 @@
#include <ffmpeg/avformat.h> #include <ffmpeg/avformat.h>
#endif #endif
extern gboolean gst_ffmpegdemux_register (GstPlugin *plugin); extern gboolean gst_ffmpegdemux_register (GstPlugin * plugin);
extern gboolean gst_ffmpegdec_register (GstPlugin *plugin); extern gboolean gst_ffmpegdec_register (GstPlugin * plugin);
extern gboolean gst_ffmpegenc_register (GstPlugin *plugin); extern gboolean gst_ffmpegenc_register (GstPlugin * plugin);
extern gboolean gst_ffmpegmux_register (GstPlugin *plugin); extern gboolean gst_ffmpegmux_register (GstPlugin * plugin);
extern gboolean gst_ffmpegcsp_register (GstPlugin *plugin); extern gboolean gst_ffmpegcsp_register (GstPlugin * plugin);
extern URLProtocol gstreamer_protocol; extern URLProtocol gstreamer_protocol;
static gboolean static gboolean
plugin_init (GstPlugin *plugin) plugin_init (GstPlugin * plugin)
{ {
if (!gst_library_load ("gstbytestream")) if (!gst_library_load ("gstbytestream"))
return FALSE; return FALSE;
...@@ -54,7 +54,7 @@ plugin_init (GstPlugin *plugin) ...@@ -54,7 +54,7 @@ plugin_init (GstPlugin *plugin)
gst_ffmpegenc_register (plugin); gst_ffmpegenc_register (plugin);
gst_ffmpegdec_register (plugin); gst_ffmpegdec_register (plugin);
gst_ffmpegdemux_register (plugin); gst_ffmpegdemux_register (plugin);
/*gst_ffmpegmux_register (plugin);*/ /*gst_ffmpegmux_register (plugin); */
gst_ffmpegcsp_register (plugin); gst_ffmpegcsp_register (plugin);
register_protocol (&gstreamer_protocol); register_protocol (&gstreamer_protocol);
...@@ -63,14 +63,9 @@ plugin_init (GstPlugin *plugin) ...@@ -63,14 +63,9 @@ plugin_init (GstPlugin *plugin)
return TRUE; return TRUE;
} }
GST_PLUGIN_DEFINE ( GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"ffmpeg", "ffmpeg",
"All FFMPEG codecs", "All FFMPEG codecs",
plugin_init, plugin_init,
FFMPEG_VERSION, FFMPEG_VERSION, "LGPL", "FFMpeg", "http://ffmpeg.sourceforge.net/")
"LGPL",
"FFMpeg",
"http://ffmpeg.sourceforge.net/"
)
This diff is collapsed.
...@@ -46,22 +46,21 @@ ...@@ -46,22 +46,21 @@
typedef struct _GstFFMpegCsp GstFFMpegCsp; typedef struct _GstFFMpegCsp GstFFMpegCsp;
typedef struct _GstFFMpegCspClass GstFFMpegCspClass; typedef struct _GstFFMpegCspClass GstFFMpegCspClass;
struct _GstFFMpegCsp { struct _GstFFMpegCsp
{
GstElement element; GstElement element;
GstPad *sinkpad, *srcpad; GstPad *sinkpad, *srcpad;
gint width, height; gint width, height;
gfloat fps; gfloat fps;
enum PixelFormat enum PixelFormat from_pixfmt, to_pixfmt;
from_pixfmt, AVFrame *from_frame, *to_frame;
to_pixfmt;
AVFrame *from_frame,
*to_frame;
GstCaps *sinkcaps; GstCaps *sinkcaps;
}; };
struct _GstFFMpegCspClass { struct _GstFFMpegCspClass
{
GstElementClass parent_class; GstElementClass parent_class;
}; };
...@@ -75,72 +74,68 @@ static GstElementDetails ffmpegcsp_details = { ...@@ -75,72 +74,68 @@ static GstElementDetails ffmpegcsp_details = {
/* Stereo signals and args */ /* Stereo signals and args */
enum { enum
{
/* FILL ME */ /* FILL ME */
LAST_SIGNAL LAST_SIGNAL
}; };
enum { enum
{
ARG_0, ARG_0,
}; };
static GType gst_ffmpegcsp_get_type (void); static GType gst_ffmpegcsp_get_type (void);
static void gst_ffmpegcsp_base_init (GstFFMpegCspClass *klass); static void gst_ffmpegcsp_base_init (GstFFMpegCspClass * klass);
static void gst_ffmpegcsp_class_init (GstFFMpegCspClass *klass); static void gst_ffmpegcsp_class_init (GstFFMpegCspClass * klass);
static void gst_ffmpegcsp_init (GstFFMpegCsp *space); static void gst_ffmpegcsp_init (GstFFMpegCsp * space);
static void gst_ffmpegcsp_set_property (GObject *object, static void gst_ffmpegcsp_set_property (GObject * object,
guint prop_id, guint prop_id, const GValue * value, GParamSpec * pspec);
const GValue *value, static void gst_ffmpegcsp_get_property (GObject * object,
GParamSpec *pspec); guint prop_id, GValue * value, GParamSpec * pspec);
static void gst_ffmpegcsp_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static GstPadLinkReturn static GstPadLinkReturn
gst_ffmpegcsp_pad_link (GstPad *pad, gst_ffmpegcsp_pad_link (GstPad * pad, const GstCaps * caps);
const GstCaps *caps);
static void gst_ffmpegcsp_chain (GstPad *pad, static void gst_ffmpegcsp_chain (GstPad * pad, GstData * data);
GstData *data); static GstElementStateReturn gst_ffmpegcsp_change_state (GstElement * element);
static GstElementStateReturn
gst_ffmpegcsp_change_state (GstElement *element);
static GstPadTemplate *srctempl, *sinktempl; static GstPadTemplate *srctempl, *sinktempl;
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
/*static guint gst_ffmpegcsp_signals[LAST_SIGNAL] = { 0 }; */ /*static guint gst_ffmpegcsp_signals[LAST_SIGNAL] = { 0 }; */
static GstCaps * static GstCaps *
gst_ffmpegcsp_caps_remove_format_info (GstCaps *caps) gst_ffmpegcsp_caps_remove_format_info (GstCaps * caps)
{ {
int i; int i;
GstStructure *structure; GstStructure *structure;
GstCaps *rgbcaps; GstCaps *rgbcaps;
for(i=0;i<gst_caps_get_size (caps);i++){ for (i = 0; i < gst_caps_get_size (caps); i++) {
structure = gst_caps_get_structure (caps, i); structure = gst_caps_get_structure (caps, i);
gst_structure_set_name (structure,"video/x-raw-yuv"); gst_structure_set_name (structure, "video/x-raw-yuv");
gst_structure_remove_field (structure,"format"); gst_structure_remove_field (structure, "format");
gst_structure_remove_field (structure,"endianness"); gst_structure_remove_field (structure, "endianness");
gst_structure_remove_field (structure,"depth"); gst_structure_remove_field (structure, "depth");
gst_structure_remove_field (structure,"bpp"); gst_structure_remove_field (structure, "bpp");
gst_structure_remove_field (structure,"red_mask"); gst_structure_remove_field (structure, "red_mask");
gst_structure_remove_field (structure,"green_mask"); gst_structure_remove_field (structure, "green_mask");
gst_structure_remove_field (structure,"blue_mask"); gst_structure_remove_field (structure, "blue_mask");
} }
rgbcaps = gst_caps_simplify (caps); rgbcaps = gst_caps_simplify (caps);
gst_caps_free (caps); gst_caps_free (caps);
caps = gst_caps_copy (rgbcaps); caps = gst_caps_copy (rgbcaps);
for(i=0;i<gst_caps_get_size (rgbcaps);i++){ for (i = 0; i < gst_caps_get_size (rgbcaps); i++) {
structure = gst_caps_get_structure (rgbcaps, i); structure = gst_caps_get_structure (rgbcaps, i);
gst_structure_set_name (structure,"video/x-raw-rgb"); gst_structure_set_name (structure, "video/x-raw-rgb");
} }
gst_caps_append (caps, rgbcaps); gst_caps_append (caps, rgbcaps);
...@@ -149,7 +144,7 @@ gst_ffmpegcsp_caps_remove_format_info (GstCaps *caps) ...@@ -149,7 +144,7 @@ gst_ffmpegcsp_caps_remove_format_info (GstCaps *caps)
} }
static GstCaps * static GstCaps *
gst_ffmpegcsp_getcaps (GstPad *pad) gst_ffmpegcsp_getcaps (GstPad * pad)
{ {
GstFFMpegCsp *space; GstFFMpegCsp *space;
GstCaps *othercaps; GstCaps *othercaps;
...@@ -171,8 +166,7 @@ gst_ffmpegcsp_getcaps (GstPad *pad) ...@@ -171,8 +166,7 @@ gst_ffmpegcsp_getcaps (GstPad *pad)
} }
static GstPadLinkReturn static GstPadLinkReturn
gst_ffmpegcsp_pad_link (GstPad *pad, gst_ffmpegcsp_pad_link (GstPad * pad, const GstCaps * caps)
const GstCaps *caps)
{ {
GstStructure *structure; GstStructure *structure;
AVCodecContext *ctx; AVCodecContext *ctx;
...@@ -223,8 +217,7 @@ gst_ffmpegcsp_pad_link (GstPad *pad, ...@@ -223,8 +217,7 @@ gst_ffmpegcsp_pad_link (GstPad *pad,
gst_caps_set_simple (caps, gst_caps_set_simple (caps,
"width", G_TYPE_INT, width, "width", G_TYPE_INT, width,
"height", G_TYPE_INT, height, "height", G_TYPE_INT, height,
"framerate", G_TYPE_DOUBLE, framerate, "framerate", G_TYPE_DOUBLE, framerate, NULL);
NULL);
ret = gst_pad_try_set_caps (otherpad, caps); ret = gst_pad_try_set_caps (otherpad, caps);
if (GST_PAD_LINK_FAILED (ret)) { if (GST_PAD_LINK_FAILED (ret)) {
return ret; return ret;
...@@ -270,15 +263,14 @@ gst_ffmpegcsp_get_type (void) ...@@ -270,15 +263,14 @@ gst_ffmpegcsp_get_type (void)
}; };
ffmpegcsp_type = g_type_register_static (GST_TYPE_ELEMENT, ffmpegcsp_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstFFMpegCsp", "GstFFMpegCsp", &ffmpegcsp_info, 0);
&ffmpegcsp_info, 0);
} }
return ffmpegcsp_type; return ffmpegcsp_type;
} }
static void static void
gst_ffmpegcsp_base_init (GstFFMpegCspClass *klass) gst_ffmpegcsp_base_init (GstFFMpegCspClass * klass)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
...@@ -288,13 +280,13 @@ gst_ffmpegcsp_base_init (GstFFMpegCspClass *klass) ...@@ -288,13 +280,13 @@ gst_ffmpegcsp_base_init (GstFFMpegCspClass *klass)
} }
static void static void
gst_ffmpegcsp_class_init (GstFFMpegCspClass *klass) gst_ffmpegcsp_class_init (GstFFMpegCspClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
gobject_class = (GObjectClass*) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass*) klass; gstelement_class = (GstElementClass *) klass;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT); parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
...@@ -305,13 +297,13 @@ gst_ffmpegcsp_class_init (GstFFMpegCspClass *klass) ...@@ -305,13 +297,13 @@ gst_ffmpegcsp_class_init (GstFFMpegCspClass *klass)
} }
static void static void
gst_ffmpegcsp_init (GstFFMpegCsp *space) gst_ffmpegcsp_init (GstFFMpegCsp * space)
{ {
space->sinkpad = gst_pad_new_from_template (sinktempl, "sink"); space->sinkpad = gst_pad_new_from_template (sinktempl, "sink");
gst_pad_set_link_function (space->sinkpad, gst_ffmpegcsp_pad_link); gst_pad_set_link_function (space->sinkpad, gst_ffmpegcsp_pad_link);
gst_pad_set_getcaps_function (space->sinkpad, gst_ffmpegcsp_getcaps); gst_pad_set_getcaps_function (space->sinkpad, gst_ffmpegcsp_getcaps);
gst_pad_set_chain_function (space->sinkpad,gst_ffmpegcsp_chain); gst_pad_set_chain_function (space->sinkpad, gst_ffmpegcsp_chain);
gst_element_add_pad (GST_ELEMENT(space), space->sinkpad); gst_element_add_pad (GST_ELEMENT (space), space->sinkpad);
space->srcpad = gst_pad_new_from_template (srctempl, "src"); space->srcpad = gst_pad_new_from_template (srctempl, "src");
gst_element_add_pad (GST_ELEMENT (space), space->srcpad); gst_element_add_pad (GST_ELEMENT (space), space->srcpad);
...@@ -323,8 +315,7 @@ gst_ffmpegcsp_init (GstFFMpegCsp *space) ...@@ -323,8 +315,7 @@ gst_ffmpegcsp_init (GstFFMpegCsp *space)
} }
static void static void
gst_ffmpegcsp_chain (GstPad *pad, gst_ffmpegcsp_chain (GstPad * pad, GstData * data)
GstData *data)
{ {
GstBuffer *inbuf = GST_BUFFER (data); GstBuffer *inbuf = GST_BUFFER (data);
GstFFMpegCsp *space; GstFFMpegCsp *space;
...@@ -339,8 +330,7 @@ gst_ffmpegcsp_chain (GstPad *pad, ...@@ -339,8 +330,7 @@ gst_ffmpegcsp_chain (GstPad *pad,
g_return_if_fail (space != NULL); g_return_if_fail (space != NULL);
g_return_if_fail (GST_IS_FFMPEGCSP (space)); g_return_if_fail (GST_IS_FFMPEGCSP (space));
if (space->from_pixfmt == PIX_FMT_NB || if (space->from_pixfmt == PIX_FMT_NB || space->to_pixfmt == PIX_FMT_NB) {
space->to_pixfmt == PIX_FMT_NB) {
GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, NULL, GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, NULL,
("attempting to convert colorspaces between unknown formats")); ("attempting to convert colorspaces between unknown formats"));
gst_buffer_unref (inbuf); gst_buffer_unref (inbuf);
...@@ -354,8 +344,8 @@ gst_ffmpegcsp_chain (GstPad *pad, ...@@ -354,8 +344,8 @@ gst_ffmpegcsp_chain (GstPad *pad,
guint size = avpicture_get_size (space->to_pixfmt, guint size = avpicture_get_size (space->to_pixfmt,
space->width, space->width,
space->height); space->height);
outbuf = gst_pad_alloc_buffer (space->srcpad,
GST_BUFFER_OFFSET_NONE, size); outbuf = gst_pad_alloc_buffer (space->srcpad, GST_BUFFER_OFFSET_NONE, size);
/* convert */ /* convert */
avpicture_fill ((AVPicture *) space->from_frame, GST_BUFFER_DATA (inbuf), avpicture_fill ((AVPicture *) space->from_frame, GST_BUFFER_DATA (inbuf),
...@@ -376,7 +366,7 @@ gst_ffmpegcsp_chain (GstPad *pad, ...@@ -376,7 +366,7 @@ gst_ffmpegcsp_chain (GstPad *pad,
} }
static GstElementStateReturn static GstElementStateReturn
gst_ffmpegcsp_change_state (GstElement *element) gst_ffmpegcsp_change_state (GstElement * element)
{ {
GstFFMpegCsp *space; GstFFMpegCsp *space;
...@@ -400,10 +390,8 @@ gst_ffmpegcsp_change_state (GstElement *element) ...@@ -400,10 +390,8 @@ gst_ffmpegcsp_change_state (GstElement *element)
} }
static void static void
gst_ffmpegcsp_set_property (GObject *object, gst_ffmpegcsp_set_property (GObject * object,
guint prop_id, guint prop_id, const GValue * value, GParamSpec * pspec)
const GValue *value,
GParamSpec *pspec)
{ {
GstFFMpegCsp *space; GstFFMpegCsp *space;
...@@ -418,10 +406,8 @@ gst_ffmpegcsp_set_property (GObject *object, ...@@ -418,10 +406,8 @@ gst_ffmpegcsp_set_property (GObject *object,
} }
static void static void
gst_ffmpegcsp_get_property (GObject *object, gst_ffmpegcsp_get_property (GObject * object,
guint prop_id, guint prop_id, GValue * value, GParamSpec * pspec)
GValue *value,
GParamSpec *pspec)
{ {
GstFFMpegCsp *space; GstFFMpegCsp *space;
...@@ -437,7 +423,7 @@ gst_ffmpegcsp_get_property (GObject *object, ...@@ -437,7 +423,7 @@ gst_ffmpegcsp_get_property (GObject *object,
} }
gboolean gboolean
gst_ffmpegcsp_register (GstPlugin *plugin) gst_ffmpegcsp_register (GstPlugin * plugin)
{ {
GstCaps *caps; GstCaps *caps;
...@@ -446,13 +432,8 @@ gst_ffmpegcsp_register (GstPlugin *plugin) ...@@ -446,13 +432,8 @@ gst_ffmpegcsp_register (GstPlugin *plugin)
/* build templates */ /* build templates */
srctempl = gst_pad_template_new ("src", srctempl = gst_pad_template_new ("src",
GST_PAD_SRC, GST_PAD_SRC, GST_PAD_ALWAYS, gst_caps_copy (caps));
GST_PAD_ALWAYS, sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
gst_caps_copy (caps));
sinktempl = gst_pad_template_new ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
caps);
return gst_element_register (plugin, "ffcolorspace", return gst_element_register (plugin, "ffcolorspace",
GST_RANK_NONE, GST_TYPE_FFMPEGCSP); GST_RANK_NONE, GST_TYPE_FFMPEGCSP);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
typedef struct _GstProtocolInfo GstProtocolInfo; typedef struct _GstProtocolInfo GstProtocolInfo;
struct _GstProtocolInfo { struct _GstProtocolInfo
{
GstPad *pad; GstPad *pad;
int flags; int flags;
...@@ -43,9 +44,7 @@ struct _GstProtocolInfo { ...@@ -43,9 +44,7 @@ struct _GstProtocolInfo {
}; };
static int static int
gst_ffmpegdata_open (URLContext *h, gst_ffmpegdata_open (URLContext * h, const char *filename, int flags)
const char *filename,
int flags)
{ {
GstProtocolInfo *info; GstProtocolInfo *info;
GstPad *pad; GstPad *pad;
...@@ -54,8 +53,7 @@ gst_ffmpegdata_open (URLContext *h, ...@@ -54,8 +53,7 @@ gst_ffmpegdata_open (URLContext *h,
info->flags = flags; info->flags = flags;
/* we don't support R/W together */ /* we don't support R/W together */
if (flags != URL_RDONLY && if (flags != URL_RDONLY && flags != URL_WRONLY) {
flags != URL_WRONLY) {
g_warning ("Only read-only or write-only are supported"); g_warning ("Only read-only or write-only are supported");
return -EINVAL; return -EINVAL;
} }
...@@ -88,9 +86,7 @@ gst_ffmpegdata_open (URLContext *h, ...@@ -88,9 +86,7 @@ gst_ffmpegdata_open (URLContext *h,
} }
static int static int
gst_ffmpegdata_read (URLContext *h, gst_ffmpegdata_read (URLContext * h, unsigned char *buf, int size)
unsigned char *buf,
int size)
{ {
GstByteStream *bs; GstByteStream *bs;
guint32 total, request; guint32 total, request;
...@@ -152,9 +148,7 @@ gst_ffmpegdata_read (URLContext *h, ...@@ -152,9 +148,7 @@ gst_ffmpegdata_read (URLContext *h,
} }
static int static int
gst_ffmpegdata_write (URLContext *h, gst_ffmpegdata_write (URLContext * h, unsigned char *buf, int size)
unsigned char *buf,
int size)
{ {
GstProtocolInfo *info; GstProtocolInfo *info;
GstBuffer *outbuf; GstBuffer *outbuf;
...@@ -174,9 +168,7 @@ gst_ffmpegdata_write (URLContext *h, ...@@ -174,9 +168,7 @@ gst_ffmpegdata_write (URLContext *h,
} }
static offset_t static offset_t
gst_ffmpegdata_seek (URLContext *h, gst_ffmpegdata_seek (URLContext * h, offset_t pos, int whence)
offset_t pos,
int whence)
{ {
GstSeekType seek_type = 0; GstSeekType seek_type = 0;
GstProtocolInfo *info; GstProtocolInfo *info;
...@@ -216,16 +208,17 @@ gst_ffmpegdata_seek (URLContext *h, ...@@ -216,16 +208,17 @@ gst_ffmpegdata_seek (URLContext *h,
} }
static int static int
gst_ffmpegdata_close (URLContext *h) gst_ffmpegdata_close (URLContext * h)
{ {
GstProtocolInfo *info; GstProtocolInfo *info;
info = (GstProtocolInfo *) h->priv_data; info = (GstProtocolInfo *) h->priv_data;
switch (info->flags) { switch (info->flags) {
case URL_WRONLY: { case URL_WRONLY:{
/* send EOS - that closes down the stream */ /* send EOS - that closes down the stream */
GstEvent *event = gst_event_new (GST_EVENT_EOS); GstEvent *event = gst_event_new (GST_EVENT_EOS);
gst_pad_push (info->pad, GST_DATA (event)); gst_pad_push (info->pad, GST_DATA (event));
} }
break; break;
...@@ -250,4 +243,3 @@ URLProtocol gstreamer_protocol = { ...@@ -250,4 +243,3 @@ URLProtocol gstreamer_protocol = {
.url_seek = gst_ffmpegdata_seek, .url_seek = gst_ffmpegdata_seek,
.url_close = gst_ffmpegdata_close, .url_close = gst_ffmpegdata_close,
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment