diff options
author | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-14 22:34:33 +0000 |
---|---|---|
committer | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-14 22:34:33 +0000 |
commit | 7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2 (patch) | |
tree | f863b467dea9559a6ec9c48affbfae11f8104164 /ext/tarkin/gsttarkinenc.c | |
parent | a19db4bbdc4a15ea0d8f4d28e9a1302c9c3d1657 (diff) | |
download | gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.gz gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.bz2 gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.zip |
gst-indent
Original commit message from CVS:
gst-indent
Diffstat (limited to 'ext/tarkin/gsttarkinenc.c')
-rw-r--r-- | ext/tarkin/gsttarkinenc.c | 166 |
1 files changed, 79 insertions, 87 deletions
diff --git a/ext/tarkin/gsttarkinenc.c b/ext/tarkin/gsttarkinenc.c index 18947ea4..4c62303d 100644 --- a/ext/tarkin/gsttarkinenc.c +++ b/ext/tarkin/gsttarkinenc.c @@ -33,8 +33,7 @@ GstElementDetails tarkinenc_details = { "Ogg Tarkin encoder", "Filter/Video/Encoder", "Encodes video in OGG Tarkin format", - "Monty <monty@xiph.org>, " - "Wim Taymans <wim.taymans@chello.be>", + "Monty <monty@xiph.org>, " "Wim Taymans <wim.taymans@chello.be>", }; /* TarkinEnc signals and args */ @@ -52,19 +51,20 @@ enum ARG_A_MOMENTS, }; -static void gst_tarkinenc_base_init (gpointer g_class); -static void gst_tarkinenc_class_init (TarkinEncClass *klass); -static void gst_tarkinenc_init (TarkinEnc *arkinenc); +static void gst_tarkinenc_base_init (gpointer g_class); +static void gst_tarkinenc_class_init (TarkinEncClass * klass); +static void gst_tarkinenc_init (TarkinEnc * arkinenc); -static void gst_tarkinenc_chain (GstPad *pad, GstData *_data); -static void gst_tarkinenc_setup (TarkinEnc *tarkinenc); +static void gst_tarkinenc_chain (GstPad * pad, GstData * _data); +static void gst_tarkinenc_setup (TarkinEnc * tarkinenc); -static void gst_tarkinenc_get_property (GObject *object, guint prop_id, GValue *value, - GParamSpec *pspec); -static void gst_tarkinenc_set_property (GObject *object, guint prop_id, const GValue *value, - GParamSpec *pspec); +static void gst_tarkinenc_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); +static void gst_tarkinenc_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); static GstElementClass *parent_class = NULL; + /*static guint gst_tarkinenc_signals[LAST_SIGNAL] = { 0 }; */ GType @@ -74,7 +74,7 @@ tarkinenc_get_type (void) if (!tarkinenc_type) { static const GTypeInfo tarkinenc_info = { - sizeof (TarkinEncClass), + sizeof (TarkinEncClass), gst_tarkinenc_base_init, NULL, (GClassInitFunc) gst_tarkinenc_class_init, @@ -85,38 +85,35 @@ tarkinenc_get_type (void) (GInstanceInitFunc) gst_tarkinenc_init, }; - tarkinenc_type = g_type_register_static (GST_TYPE_ELEMENT, "TarkinEnc", &tarkinenc_info, 0); + tarkinenc_type = + g_type_register_static (GST_TYPE_ELEMENT, "TarkinEnc", &tarkinenc_info, + 0); } return tarkinenc_type; } -static GstCaps* +static GstCaps * tarkin_caps_factory (void) { - return - gst_caps_new ( - "tarkin_tarkin", - "application/ogg", - NULL); + return gst_caps_new ("tarkin_tarkin", "application/ogg", NULL); } -static GstCaps* +static GstCaps * raw_caps_factory (void) { return - GST_CAPS_NEW ( - "tarkin_raw", - "video/x-raw-rgb", - "bpp", GST_PROPS_INT (24), - "depth", GST_PROPS_INT (24), + GST_CAPS_NEW ("tarkin_raw", + "video/x-raw-rgb", + "bpp", GST_PROPS_INT (24), + "depth", GST_PROPS_INT (24), "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "red_mask", GST_PROPS_INT (0xff0000), + "red_mask", GST_PROPS_INT (0xff0000), "green_mask", GST_PROPS_INT (0xff00), - "blue_mask", GST_PROPS_INT (0xff), - "width", GST_PROPS_INT_RANGE (0, G_MAXINT), - "height", GST_PROPS_INT_RANGE (0, G_MAXINT), - "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT) - ); + "blue_mask", GST_PROPS_INT (0xff), + "width", GST_PROPS_INT_RANGE (0, G_MAXINT), + "height", GST_PROPS_INT_RANGE (0, G_MAXINT), + "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT) + ); } static void @@ -124,20 +121,14 @@ gst_tarkinenc_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); GstCaps *raw_caps, *tarkin_caps; - + raw_caps = raw_caps_factory (); tarkin_caps = tarkin_caps_factory (); - enc_sink_template = gst_pad_template_new ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - raw_caps, - NULL); - enc_src_template = gst_pad_template_new ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - tarkin_caps, - NULL); + enc_sink_template = gst_pad_template_new ("sink", + GST_PAD_SINK, GST_PAD_ALWAYS, raw_caps, NULL); + enc_src_template = gst_pad_template_new ("src", + GST_PAD_SRC, GST_PAD_ALWAYS, tarkin_caps, NULL); gst_element_class_add_pad_template (element_class, enc_sink_template); gst_element_class_add_pad_template (element_class, enc_src_template); @@ -145,7 +136,7 @@ gst_tarkinenc_base_init (gpointer g_class) } static void -gst_tarkinenc_class_init (TarkinEncClass *klass) +gst_tarkinenc_class_init (TarkinEncClass * klass) { GObjectClass *gobject_class; GstElementClass *gstelement_class; @@ -153,17 +144,17 @@ gst_tarkinenc_class_init (TarkinEncClass *klass) gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, - g_param_spec_int ("bitrate", "bitrate", "bitrate", - G_MININT, G_MAXINT, 3000, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_S_MOMENTS, - g_param_spec_int ("s_moments", "Synthesis Moments", - "Number of vanishing moments for the synthesis filter", - 1, 4, 2, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_A_MOMENTS, - g_param_spec_int ("a_moments", "Analysis Moments", - "Number of vanishing moments for the analysis filter", - 1, 4, 2, G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, + g_param_spec_int ("bitrate", "bitrate", "bitrate", + G_MININT, G_MAXINT, 3000, G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_S_MOMENTS, + g_param_spec_int ("s_moments", "Synthesis Moments", + "Number of vanishing moments for the synthesis filter", + 1, 4, 2, G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_A_MOMENTS, + g_param_spec_int ("a_moments", "Analysis Moments", + "Number of vanishing moments for the analysis filter", + 1, 4, 2, G_PARAM_READWRITE)); parent_class = g_type_class_ref (GST_TYPE_ELEMENT); @@ -172,7 +163,7 @@ gst_tarkinenc_class_init (TarkinEncClass *klass) } static GstPadLinkReturn -gst_tarkinenc_sinkconnect (GstPad *pad, GstCaps *caps) +gst_tarkinenc_sinkconnect (GstPad * pad, GstCaps * caps) { TarkinEnc *tarkinenc; @@ -216,12 +207,14 @@ gst_tarkinenc_init (TarkinEnc * tarkinenc) tarkinenc->setup = FALSE; } -TarkinError free_frame (void *s, void *ptr) +TarkinError +free_frame (void *s, void *ptr) { - return(TARKIN_OK); + return (TARKIN_OK); } -TarkinError packet_out (void *stream, ogg_packet *op) +TarkinError +packet_out (void *stream, ogg_packet * op) { ogg_page og; TarkinStream *s = stream; @@ -230,7 +223,7 @@ TarkinError packet_out (void *stream, ogg_packet *op) ogg_stream_packetin (&te->os, op); - if(op->e_o_s){ + if (op->e_o_s) { ogg_stream_flush (&te->os, &og); outbuf = gst_buffer_new (); GST_BUFFER_DATA (outbuf) = og.header; @@ -243,7 +236,7 @@ TarkinError packet_out (void *stream, ogg_packet *op) GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE); gst_pad_push (te->srcpad, GST_DATA (outbuf)); } else { - while (ogg_stream_pageout (&te->os, &og)){ + while (ogg_stream_pageout (&te->os, &og)) { outbuf = gst_buffer_new (); GST_BUFFER_DATA (outbuf) = og.header; GST_BUFFER_SIZE (outbuf) = og.header_len; @@ -261,7 +254,7 @@ TarkinError packet_out (void *stream, ogg_packet *op) static void -gst_tarkinenc_setup (TarkinEnc *tarkinenc) +gst_tarkinenc_setup (TarkinEnc * tarkinenc) { gint i; GstBuffer *outbuf; @@ -271,20 +264,20 @@ gst_tarkinenc_setup (TarkinEnc *tarkinenc) tarkinenc->ti.inter.numerator = 1; tarkinenc->ti.inter.denominator = 1; - + tarkin_comment_init (&tarkinenc->tc); tarkin_comment_add_tag (&tarkinenc->tc, "TITLE", "GStreamer produced file"); tarkin_comment_add_tag (&tarkinenc->tc, "ARTIST", "C coders ;)"); tarkinenc->tarkin_stream = tarkin_stream_new (); - tarkin_analysis_init (tarkinenc->tarkin_stream, - &tarkinenc->ti, free_frame, packet_out, (void*)tarkinenc); - tarkin_analysis_add_layer(tarkinenc->tarkin_stream, &tarkinenc->layer[0]); - - tarkin_analysis_headerout (tarkinenc->tarkin_stream, &tarkinenc->tc, - tarkinenc->op, &tarkinenc->op[1], &tarkinenc->op[2]); - for(i = 0; i < 3; i++){ - ogg_stream_packetin(&tarkinenc->os, &tarkinenc->op[i]); + tarkin_analysis_init (tarkinenc->tarkin_stream, + &tarkinenc->ti, free_frame, packet_out, (void *) tarkinenc); + tarkin_analysis_add_layer (tarkinenc->tarkin_stream, &tarkinenc->layer[0]); + + tarkin_analysis_headerout (tarkinenc->tarkin_stream, &tarkinenc->tc, + tarkinenc->op, &tarkinenc->op[1], &tarkinenc->op[2]); + for (i = 0; i < 3; i++) { + ogg_stream_packetin (&tarkinenc->os, &tarkinenc->op[i]); } ogg_stream_flush (&tarkinenc->os, &tarkinenc->og); @@ -307,7 +300,7 @@ gst_tarkinenc_setup (TarkinEnc *tarkinenc) } static void -gst_tarkinenc_chain (GstPad *pad, GstData *_data) +gst_tarkinenc_chain (GstPad * pad, GstData * _data) { GstBuffer *buf = GST_BUFFER (_data); TarkinEnc *tarkinenc; @@ -319,7 +312,8 @@ gst_tarkinenc_chain (GstPad *pad, GstData *_data) tarkinenc = GST_TARKINENC (gst_pad_get_parent (pad)); if (!tarkinenc->setup) { - GST_ELEMENT_ERROR (tarkinenc, CORE, NEGOTIATION, (NULL), ("encoder not initialized (input is not tarkin?)")); + GST_ELEMENT_ERROR (tarkinenc, CORE, NEGOTIATION, (NULL), + ("encoder not initialized (input is not tarkin?)")); if (GST_IS_BUFFER (buf)) gst_buffer_unref (buf); else @@ -330,19 +324,18 @@ gst_tarkinenc_chain (GstPad *pad, GstData *_data) if (GST_IS_EVENT (buf)) { switch (GST_EVENT_TYPE (buf)) { case GST_EVENT_EOS: - tarkin_analysis_framein (tarkinenc->tarkin_stream, NULL, 0, NULL); /* EOS */ - tarkin_comment_clear (&tarkinenc->tc); - tarkin_stream_destroy (tarkinenc->tarkin_stream); + tarkin_analysis_framein (tarkinenc->tarkin_stream, NULL, 0, NULL); /* EOS */ + tarkin_comment_clear (&tarkinenc->tc); + tarkin_stream_destroy (tarkinenc->tarkin_stream); default: gst_pad_event_default (pad, GST_EVENT (buf)); break; } - } - else { + } else { gchar *data; gulong size; TarkinTime date; - + /* data to encode */ data = GST_BUFFER_DATA (buf); size = GST_BUFFER_SIZE (buf); @@ -357,7 +350,8 @@ gst_tarkinenc_chain (GstPad *pad, GstData *_data) } static void -gst_tarkinenc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) +gst_tarkinenc_get_property (GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec) { TarkinEnc *tarkinenc; @@ -382,8 +376,8 @@ gst_tarkinenc_get_property (GObject *object, guint prop_id, GValue *value, GPara } static void -gst_tarkinenc_set_property (GObject *object, guint prop_id, const GValue *value, - GParamSpec *pspec) +gst_tarkinenc_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) { TarkinEnc *tarkinenc; @@ -403,9 +397,8 @@ gst_tarkinenc_set_property (GObject *object, guint prop_id, const GValue *value, s_moments = g_value_get_int (value); if (s_moments != 1 || s_moments != 2 || s_moments != 4) { g_warning ("tarkinenc: s_moments must be 1, 2 or 4"); - } - else { - tarkinenc->s_moments = s_moments; + } else { + tarkinenc->s_moments = s_moments; } break; } @@ -416,9 +409,8 @@ gst_tarkinenc_set_property (GObject *object, guint prop_id, const GValue *value, a_moments = g_value_get_int (value); if (a_moments != 1 || a_moments != 2 || a_moments != 4) { g_warning ("tarkinenc: a_moments must be 1, 2 or 4"); - } - else { - tarkinenc->a_moments = a_moments; + } else { + tarkinenc->a_moments = a_moments; } break; } |