summaryrefslogtreecommitdiffstats
path: root/ext/mpeg2enc
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-03-14 23:20:41 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-03-14 23:20:41 +0000
commit87960e43ea268d999cbc3ed5a589f660fb3e3192 (patch)
tree48a676a58e4355eee64d3f14ea205d793809a323 /ext/mpeg2enc
parent7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2 (diff)
downloadgst-plugins-bad-87960e43ea268d999cbc3ed5a589f660fb3e3192.tar.gz
gst-plugins-bad-87960e43ea268d999cbc3ed5a589f660fb3e3192.tar.bz2
gst-plugins-bad-87960e43ea268d999cbc3ed5a589f660fb3e3192.zip
gst-indent c++ files
Original commit message from CVS: gst-indent c++ files
Diffstat (limited to 'ext/mpeg2enc')
-rw-r--r--ext/mpeg2enc/gstmpeg2enc.cc140
-rw-r--r--ext/mpeg2enc/gstmpeg2encoder.cc21
-rw-r--r--ext/mpeg2enc/gstmpeg2encoptions.cc407
-rw-r--r--ext/mpeg2enc/gstmpeg2encpicturereader.cc51
-rw-r--r--ext/mpeg2enc/gstmpeg2encstreamwriter.cc10
5 files changed, 302 insertions, 327 deletions
diff --git a/ext/mpeg2enc/gstmpeg2enc.cc b/ext/mpeg2enc/gstmpeg2enc.cc
index 7ee28bd9..1f6e582a 100644
--- a/ext/mpeg2enc/gstmpeg2enc.cc
+++ b/ext/mpeg2enc/gstmpeg2enc.cc
@@ -30,13 +30,15 @@
* we do something manual...
*/
static void
-add_fps (GstCaps *caps)
+add_fps (GstCaps * caps)
{
GstStructure *structure = gst_caps_get_structure (caps, 0);
- GValue list = { 0 }, fps = { 0 };
- gdouble fpss[] = { 24.0/1.001, 24.0, 25.0,
- 30.0/1.001, 30.0, 50.0,
- 60.0/1.001, 60.0, 0 };
+ GValue list = { 0 }, fps = {
+ 0};
+ gdouble fpss[] = { 24.0 / 1.001, 24.0, 25.0,
+ 30.0 / 1.001, 30.0, 50.0,
+ 60.0 / 1.001, 60.0, 0
+ };
guint n;
g_value_init (&list, GST_TYPE_LIST);
@@ -59,15 +61,13 @@ sink_templ (void)
GstCaps *caps;
caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC,
- GST_MAKE_FOURCC ('I','4','2','0'),
- "width", GST_TYPE_INT_RANGE, 16, 4096,
- "height", GST_TYPE_INT_RANGE, 16, 4096,
- NULL);
+ "format", GST_TYPE_FOURCC,
+ GST_MAKE_FOURCC ('I', '4', '2', '0'),
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
add_fps (caps);
- templ = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS, caps);
+ templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
}
return templ;
@@ -82,42 +82,34 @@ src_templ (void)
GstCaps *caps;
caps = gst_caps_new_simple ("video/mpeg",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
- "mpegversion", GST_TYPE_INT_RANGE, 1, 2,
- "width", GST_TYPE_INT_RANGE, 16, 4096,
- "height", GST_TYPE_INT_RANGE, 16, 4096,
- NULL);
+ "systemstream", G_TYPE_BOOLEAN, FALSE,
+ "mpegversion", GST_TYPE_INT_RANGE, 1, 2,
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
add_fps (caps);
- templ = gst_pad_template_new ("src", GST_PAD_SRC,
- GST_PAD_ALWAYS, caps);
+ templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
}
return templ;
}
-static void gst_mpeg2enc_base_init (GstMpeg2encClass *klass);
-static void gst_mpeg2enc_class_init (GstMpeg2encClass *klass);
-static void gst_mpeg2enc_init (GstMpeg2enc *enc);
-static void gst_mpeg2enc_dispose (GObject *object);
+static void gst_mpeg2enc_base_init (GstMpeg2encClass * klass);
+static void gst_mpeg2enc_class_init (GstMpeg2encClass * klass);
+static void gst_mpeg2enc_init (GstMpeg2enc * enc);
+static void gst_mpeg2enc_dispose (GObject * object);
-static void gst_mpeg2enc_loop (GstElement *element);
+static void gst_mpeg2enc_loop (GstElement * element);
static GstPadLinkReturn
- gst_mpeg2enc_sink_link (GstPad *pad,
- const GstCaps *caps);
+gst_mpeg2enc_sink_link (GstPad * pad, const GstCaps * caps);
-static GstElementStateReturn
- gst_mpeg2enc_change_state (GstElement *element);
+static GstElementStateReturn gst_mpeg2enc_change_state (GstElement * element);
-static void gst_mpeg2enc_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void gst_mpeg2enc_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
+static void gst_mpeg2enc_get_property (GObject * object,
+ guint prop_id, GValue * value, GParamSpec * pspec);
+static void gst_mpeg2enc_set_property (GObject * object,
+ guint prop_id, const GValue * value, GParamSpec * pspec);
static GstElementClass *parent_class = NULL;
@@ -128,7 +120,7 @@ gst_mpeg2enc_get_type (void)
if (!gst_mpeg2enc_type) {
static const GTypeInfo gst_mpeg2enc_info = {
- sizeof (GstMpeg2encClass),
+ sizeof (GstMpeg2encClass),
(GBaseInitFunc) gst_mpeg2enc_base_init,
NULL,
(GClassInitFunc) gst_mpeg2enc_class_init,
@@ -141,34 +133,31 @@ gst_mpeg2enc_get_type (void)
gst_mpeg2enc_type =
g_type_register_static (GST_TYPE_ELEMENT,
- "GstMpeg2enc",
- &gst_mpeg2enc_info,
- (GTypeFlags) 0);
+ "GstMpeg2enc", &gst_mpeg2enc_info, (GTypeFlags) 0);
}
return gst_mpeg2enc_type;
}
static void
-gst_mpeg2enc_base_init (GstMpeg2encClass *klass)
+gst_mpeg2enc_base_init (GstMpeg2encClass * klass)
{
static GstElementDetails gst_mpeg2enc_details = {
"mpeg2enc video encoder",
"Codec/Video/Encoder",
"High-quality MPEG-1/2 video encoder",
"Andrew Stevens <andrew.stevens@nexgo.de>\n"
- "Ronald Bultje <rbultje@ronald.bitfreak.net>"
+ "Ronald Bultje <rbultje@ronald.bitfreak.net>"
};
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class, src_templ ());
gst_element_class_add_pad_template (element_class, sink_templ ());
- gst_element_class_set_details (element_class,
- &gst_mpeg2enc_details);
+ gst_element_class_set_details (element_class, &gst_mpeg2enc_details);
}
static void
-gst_mpeg2enc_class_init (GstMpeg2encClass *klass)
+gst_mpeg2enc_class_init (GstMpeg2encClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@@ -188,32 +177,35 @@ gst_mpeg2enc_class_init (GstMpeg2encClass *klass)
}
static void
-gst_mpeg2enc_dispose (GObject *object)
+gst_mpeg2enc_dispose (GObject * object)
{
GstMpeg2enc *enc = GST_MPEG2ENC (object);
if (enc->encoder) {
delete enc->encoder;
+
enc->encoder = NULL;
}
delete enc->options;
}
static void
-gst_mpeg2enc_init (GstMpeg2enc *enc)
+gst_mpeg2enc_init (GstMpeg2enc * enc)
{
GstElement *element = GST_ELEMENT (enc);
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
GST_FLAG_SET (element, GST_ELEMENT_EVENT_AWARE);
- enc->sinkpad = gst_pad_new_from_template (
- gst_element_class_get_pad_template (klass, "sink"), "sink");
+ enc->sinkpad =
+ gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
+ "sink"), "sink");
gst_pad_set_link_function (enc->sinkpad, gst_mpeg2enc_sink_link);
gst_element_add_pad (element, enc->sinkpad);
- enc->srcpad = gst_pad_new_from_template (
- gst_element_class_get_pad_template (klass, "src"), "src");
+ enc->srcpad =
+ gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
+ "src"), "src");
gst_pad_use_explicit_caps (enc->srcpad);
gst_element_add_pad (element, enc->srcpad);
@@ -225,7 +217,7 @@ gst_mpeg2enc_init (GstMpeg2enc *enc)
}
static void
-gst_mpeg2enc_loop (GstElement *element)
+gst_mpeg2enc_loop (GstElement * element)
{
GstMpeg2enc *enc = GST_MPEG2ENC (element);
@@ -240,19 +232,20 @@ gst_mpeg2enc_loop (GstElement *element)
if (!(caps = GST_PAD_CAPS (enc->sinkpad))) {
GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, (NULL),
- ("format wasn't negotiated before loop function"));
+ ("format wasn't negotiated before loop function"));
return;
}
/* create new encoder with these settings */
enc->encoder = new GstMpeg2Encoder (enc->options, enc->sinkpad,
- caps, enc->srcpad);
+ caps, enc->srcpad);
/* and set caps on other side */
othercaps = enc->encoder->getFormat ();
if (gst_pad_set_explicit_caps (enc->srcpad, othercaps) <= 0) {
GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, (NULL), (NULL));
delete enc->encoder;
+
enc->encoder = NULL;
return;
}
@@ -263,8 +256,7 @@ gst_mpeg2enc_loop (GstElement *element)
}
static GstPadLinkReturn
-gst_mpeg2enc_sink_link (GstPad *pad,
- const GstCaps *caps)
+gst_mpeg2enc_sink_link (GstPad * pad, const GstCaps * caps)
{
GstMpeg2enc *enc = GST_MPEG2ENC (gst_pad_get_parent (pad));
@@ -273,6 +265,7 @@ gst_mpeg2enc_sink_link (GstPad *pad,
if (enc->encoder) {
delete enc->encoder;
+
enc->encoder = NULL;
}
@@ -280,25 +273,21 @@ gst_mpeg2enc_sink_link (GstPad *pad,
}
static void
-gst_mpeg2enc_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+gst_mpeg2enc_get_property (GObject * object,
+ guint prop_id, GValue * value, GParamSpec * pspec)
{
GST_MPEG2ENC (object)->options->getProperty (prop_id, value);
}
static void
-gst_mpeg2enc_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+gst_mpeg2enc_set_property (GObject * object,
+ guint prop_id, const GValue * value, GParamSpec * pspec)
{
GST_MPEG2ENC (object)->options->setProperty (prop_id, value);
}
static GstElementStateReturn
-gst_mpeg2enc_change_state (GstElement *element)
+gst_mpeg2enc_change_state (GstElement * element)
{
GstMpeg2enc *enc = GST_MPEG2ENC (element);
@@ -318,21 +307,14 @@ gst_mpeg2enc_change_state (GstElement *element)
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
return gst_element_register (plugin, "mpeg2enc",
- GST_RANK_NONE,
- GST_TYPE_MPEG2ENC);
+ GST_RANK_NONE, GST_TYPE_MPEG2ENC);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "mpeg2enc",
- "High-quality MPEG-1/2 video encoder",
- plugin_init,
- VERSION,
- "GPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "mpeg2enc",
+ "High-quality MPEG-1/2 video encoder",
+ plugin_init, VERSION, "GPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/ext/mpeg2enc/gstmpeg2encoder.cc b/ext/mpeg2enc/gstmpeg2encoder.cc
index f5b2ee4b..5a77b58b 100644
--- a/ext/mpeg2enc/gstmpeg2encoder.cc
+++ b/ext/mpeg2enc/gstmpeg2encoder.cc
@@ -35,11 +35,9 @@
* Class init stuff.
*/
-GstMpeg2Encoder::GstMpeg2Encoder (GstMpeg2EncOptions *options,
- GstPad *sinkpad,
- const GstCaps *caps,
- GstPad *srcpad) :
- MPEG2Encoder (*options)
+GstMpeg2Encoder::GstMpeg2Encoder (GstMpeg2EncOptions * options,
+ GstPad * sinkpad, const GstCaps * caps, GstPad * srcpad):
+MPEG2Encoder (*options)
{
MPEG2EncInVidParams strm;
@@ -58,7 +56,7 @@ GstMpeg2Encoder::GstMpeg2Encoder (GstMpeg2EncOptions *options,
/* sequencer */
seqencoder = new SeqEncoder (parms, *reader, *quantizer,
- *writer, *coder, *bitrate_controller);
+ *writer, *coder, *bitrate_controller);
parms.Init (*options);
reader->Init ();
@@ -86,10 +84,9 @@ GstMpeg2Encoder::getFormat ()
gdouble fps = Y4M_RATIO_DBL (mpeg_framerate (options.frame_rate));
return gst_caps_new_simple ("video/mpeg",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
- "mpegversion", G_TYPE_INT, options.mpeg,
- "width", G_TYPE_INT, options.in_img_width,
- "height", G_TYPE_INT, options.in_img_height,
- "framerate", G_TYPE_DOUBLE, fps,
- NULL);
+ "systemstream", G_TYPE_BOOLEAN, FALSE,
+ "mpegversion", G_TYPE_INT, options.mpeg,
+ "width", G_TYPE_INT, options.in_img_width,
+ "height", G_TYPE_INT, options.in_img_height,
+ "framerate", G_TYPE_DOUBLE, fps, NULL);
}
diff --git a/ext/mpeg2enc/gstmpeg2encoptions.cc b/ext/mpeg2enc/gstmpeg2encoptions.cc
index 5dbf9ac7..8b6e7765 100644
--- a/ext/mpeg2enc/gstmpeg2encoptions.cc
+++ b/ext/mpeg2enc/gstmpeg2encoptions.cc
@@ -29,7 +29,8 @@
* Property enumeration.
*/
-enum {
+enum
+{
ARG_0,
ARG_FORMAT,
ARG_FRAMERATE,
@@ -64,7 +65,7 @@ enum {
ARG_CORRECT_SVCD_HDS,
ARG_ALTSCAN_MPEG2,
ARG_CONSTRAINTS
- /* FILL ME */
+ /* FILL ME */
};
/*
@@ -81,22 +82,21 @@ gst_mpeg2enc_format_get_type (void)
if (!mpeg2enc_format_type) {
static const GEnumValue mpeg2enc_formats[] = {
- { 0, "0", "Generic MPEG-1" },
- { 1, "1", "Standard VCD" },
- { 2, "2", "User VCD" },
- { 3, "3", "Generic MPEG-2" },
- { 4, "4", "Standard SVCD" },
- { 5, "5", "User SVCD" },
- { 6, "6", "VCD Stills sequences" },
- { 7, "7", "SVCD Stills sequences" },
- { 8, "8", "DVD MPEG-2 for dvdauthor" },
- { 9, "9", "DVD MPEG-2" },
- { 0, NULL, NULL },
+ {0, "0", "Generic MPEG-1"},
+ {1, "1", "Standard VCD"},
+ {2, "2", "User VCD"},
+ {3, "3", "Generic MPEG-2"},
+ {4, "4", "Standard SVCD"},
+ {5, "5", "User SVCD"},
+ {6, "6", "VCD Stills sequences"},
+ {7, "7", "SVCD Stills sequences"},
+ {8, "8", "DVD MPEG-2 for dvdauthor"},
+ {9, "9", "DVD MPEG-2"},
+ {0, NULL, NULL},
};
mpeg2enc_format_type =
- g_enum_register_static ("GstMpeg2encFormat",
- mpeg2enc_formats);
+ g_enum_register_static ("GstMpeg2encFormat", mpeg2enc_formats);
}
return mpeg2enc_format_type;
@@ -112,21 +112,20 @@ gst_mpeg2enc_framerate_get_type (void)
if (!mpeg2enc_framerate_type) {
static const GEnumValue mpeg2enc_framerates[] = {
- { 0, "0", "Same as input" },
- { 1, "1", "24/1.001 (NTSC 3:2 pulldown converted film)" },
- { 2, "2", "24 (native film)" },
- { 3, "3", "25 (PAL/SECAM video)" },
- { 4, "4", "30/1.001 (NTSC video)" },
- { 5, "5", "30" },
- { 6, "6", "50 (PAL/SECAM fields)" },
- { 7, "7", "60/1.001 (NTSC fields)" },
- { 8, "8", "60" },
- { 0, NULL, NULL },
+ {0, "0", "Same as input"},
+ {1, "1", "24/1.001 (NTSC 3:2 pulldown converted film)"},
+ {2, "2", "24 (native film)"},
+ {3, "3", "25 (PAL/SECAM video)"},
+ {4, "4", "30/1.001 (NTSC video)"},
+ {5, "5", "30"},
+ {6, "6", "50 (PAL/SECAM fields)"},
+ {7, "7", "60/1.001 (NTSC fields)"},
+ {8, "8", "60"},
+ {0, NULL, NULL},
};
mpeg2enc_framerate_type =
- g_enum_register_static ("GstMpeg2encFramerate",
- mpeg2enc_framerates);
+ g_enum_register_static ("GstMpeg2encFramerate", mpeg2enc_framerates);
}
return mpeg2enc_framerate_type;
@@ -142,17 +141,16 @@ gst_mpeg2enc_aspect_get_type (void)
if (!mpeg2enc_aspect_type) {
static const GEnumValue mpeg2enc_aspects[] = {
- { 0, "0", "Deduce from input" },
- { 1, "1", "1:1" },
- { 2, "2", "4:3" },
- { 3, "3", "16:9" },
- { 4, "4", "2.21:1" },
- { 0, NULL, NULL },
+ {0, "0", "Deduce from input"},
+ {1, "1", "1:1"},
+ {2, "2", "4:3"},
+ {3, "3", "16:9"},
+ {4, "4", "2.21:1"},
+ {0, NULL, NULL},
};
mpeg2enc_aspect_type =
- g_enum_register_static ("GstMpeg2encAspect",
- mpeg2enc_aspects);
+ g_enum_register_static ("GstMpeg2encAspect", mpeg2enc_aspects);
}
return mpeg2enc_aspect_type;
@@ -168,16 +166,16 @@ gst_mpeg2enc_interlace_mode_get_type (void)
if (!mpeg2enc_interlace_mode_type) {
static const GEnumValue mpeg2enc_interlace_modes[] = {
- { -1, "-1", "Format default mode" },
- { 0, "0", "Progressive" },
- { 1, "1", "Interlaced, per-frame encoding" },
- { 2, "2", "Interlaced, per-field-encoding" },
- { 0, NULL, NULL },
+ {-1, "-1", "Format default mode"},
+ {0, "0", "Progressive"},
+ {1, "1", "Interlaced, per-frame encoding"},
+ {2, "2", "Interlaced, per-field-encoding"},
+ {0, NULL, NULL},
};
mpeg2enc_interlace_mode_type =
g_enum_register_static ("GstMpeg2encInterlaceMode",
- mpeg2enc_interlace_modes);
+ mpeg2enc_interlace_modes);
}
return mpeg2enc_interlace_mode_type;
@@ -198,20 +196,20 @@ gst_mpeg2enc_quantisation_matrix_get_type (void)
if (!mpeg2enc_quantisation_matrix_type) {
static const GEnumValue mpeg2enc_quantisation_matrixes[] = {
- { GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT,
- "0", "Default" },
- { GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES,
- "1", "High resolution" },
- { GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD,
- "2", "KVCD" },
- { GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC,
- "3", "TMPGEnc" },
- { 0, NULL, NULL },
+ {GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT,
+ "0", "Default"},
+ {GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES,
+ "1", "High resolution"},
+ {GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD,
+ "2", "KVCD"},
+ {GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC,
+ "3", "TMPGEnc"},
+ {0, NULL, NULL},
};
mpeg2enc_quantisation_matrix_type =
g_enum_register_static ("GstMpeg2encQuantisationMatrix",
- mpeg2enc_quantisation_matrixes);
+ mpeg2enc_quantisation_matrixes);
}
return mpeg2enc_quantisation_matrix_type;
@@ -227,16 +225,15 @@ gst_mpeg2enc_video_norm_get_type (void)
if (!mpeg2enc_video_norm_type) {
static const GEnumValue mpeg2enc_video_norms[] = {
- { 0, "0", "Unspecified" },
- { 'p', "p", "PAL" },
- { 'n', "n", "NTSC" },
- { 's', "s", "SECAM" },
- { 0, NULL, NULL },
+ {0, "0", "Unspecified"},
+ {'p', "p", "PAL"},
+ {'n', "n", "NTSC"},
+ {'s', "s", "SECAM"},
+ {0, NULL, NULL},
};
mpeg2enc_video_norm_type =
- g_enum_register_static ("GstMpeg2encVideoNorm",
- mpeg2enc_video_norms);
+ g_enum_register_static ("GstMpeg2encVideoNorm", mpeg2enc_video_norms);
}
return mpeg2enc_video_norm_type;
@@ -252,15 +249,15 @@ gst_mpeg2enc_playback_field_order_get_type (void)
if (!mpeg2enc_playback_field_order_type) {
static const GEnumValue mpeg2enc_playback_field_orders[] = {
- { Y4M_UNKNOWN, "0", "Unspecified" },
- { Y4M_ILACE_TOP_FIRST, "1", "Top-field first" },
- { Y4M_ILACE_BOTTOM_FIRST, "2", "Bottom-field first" },
- { 0, NULL, NULL },
+ {Y4M_UNKNOWN, "0", "Unspecified"},
+ {Y4M_ILACE_TOP_FIRST, "1", "Top-field first"},
+ {Y4M_ILACE_BOTTOM_FIRST, "2", "Bottom-field first"},
+ {0, NULL, NULL},
};
mpeg2enc_playback_field_order_type =
g_enum_register_static ("GstMpeg2encPlaybackFieldOrders",
- mpeg2enc_playback_field_orders);
+ mpeg2enc_playback_field_orders);
}
return mpeg2enc_playback_field_order_type;
@@ -270,8 +267,8 @@ gst_mpeg2enc_playback_field_order_get_type (void)
* Class init stuff.
*/
-GstMpeg2EncOptions::GstMpeg2EncOptions () :
- MPEG2EncOptions ()
+GstMpeg2EncOptions::GstMpeg2EncOptions ():
+MPEG2EncOptions ()
{
/* autodetect number of CPUs */
num_cpus = sysconf (_SC_NPROCESSORS_ONLN);
@@ -286,169 +283,165 @@ GstMpeg2EncOptions::GstMpeg2EncOptions () :
*/
void
-GstMpeg2EncOptions::initProperties (GObjectClass *klass)
+GstMpeg2EncOptions::initProperties (GObjectClass * klass)
{
/* encoding profile */
g_object_class_install_property (klass, ARG_FORMAT,
- g_param_spec_enum ("format", "Format", "Encoding profile format",
- GST_TYPE_MPEG2ENC_FORMAT, 0,
- (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_enum ("format", "Format", "Encoding profile format",
+ GST_TYPE_MPEG2ENC_FORMAT, 0, (GParamFlags) G_PARAM_READWRITE));
/* input/output stream overrides */
g_object_class_install_property (klass, ARG_FRAMERATE,
- g_param_spec_enum ("framerate", "Framerate", "Output framerate",
- GST_TYPE_MPEG2ENC_FRAMERATE, 0,
- (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_enum ("framerate", "Framerate", "Output framerate",
+ GST_TYPE_MPEG2ENC_FRAMERATE, 0, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_ASPECT,
- g_param_spec_enum ("aspect", "Aspect", "Display aspect ratio",
- GST_TYPE_MPEG2ENC_ASPECT, 0,
- (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_enum ("aspect", "Aspect", "Display aspect ratio",
+ GST_TYPE_MPEG2ENC_ASPECT, 0, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_INTERLACE_MODE,
- g_param_spec_enum ("interlace-mode", "Interlace mode",
- "MPEG-2 motion estimation and encoding modes",
- GST_TYPE_MPEG2ENC_INTERLACE_MODE, 0,
- (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_enum ("interlace-mode", "Interlace mode",
+ "MPEG-2 motion estimation and encoding modes",
+ GST_TYPE_MPEG2ENC_INTERLACE_MODE, 0,
+ (GParamFlags) G_PARAM_READWRITE));
/* general encoding stream options */
g_object_class_install_property (klass, ARG_BITRATE,
- g_param_spec_int ("bitrate", "Bitrate", "Compressed video bitrate (kbps)",
- 0, 10*1024, 1125, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_int ("bitrate", "Bitrate", "Compressed video bitrate (kbps)",
+ 0, 10 * 1024, 1125, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_NONVIDEO_BITRATE,
- g_param_spec_int ("non-video-bitrate", "Non-video bitrate",
- "Assumed bitrate of non-video for sequence splitting (kbps)",
- 0, 10*1024, 0, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_int ("non-video-bitrate", "Non-video bitrate",
+ "Assumed bitrate of non-video for sequence splitting (kbps)",
+ 0, 10 * 1024, 0, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_QUANTISATION,
- g_param_spec_int ("quantisation", "Quantisation",
- "Quantisation factor (0=default, 1=best, 31=worst)",
- 0, 31, 0, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_int ("quantisation", "Quantisation",
+ "Quantisation factor (0=default, 1=best, 31=worst)",
+ 0, 31, 0, (GParamFlags) G_PARAM_READWRITE));
/* stills options */
g_object_class_install_property (klass, ARG_VCD_STILL_SIZE,
- g_param_spec_int ("vcd-still-size", "VCD stills size",
- "Size of VCD stills (in kB)",
- 0, 512, 0, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_int ("vcd-still-size", "VCD stills size",
+ "Size of VCD stills (in kB)",
+ 0, 512, 0, (GParamFlags) G_PARAM_READWRITE));
/* motion estimation options */
g_object_class_install_property (klass, ARG_MOTION_SEARCH_RADIUS,
- g_param_spec_int ("motion-search-radius", "Motion search radius",
- "Motion compensation search radius",
- 0, 32, 16, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_int ("motion-search-radius", "Motion search radius",
+ "Motion compensation search radius",
+ 0, 32, 16, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_REDUCTION_4_4,
- g_param_spec_int ("reduction-4x4", "4x4 reduction",
- "Reduction factor for 4x4 subsampled candidate motion estimates"
- " (1=max. quality, 4=max. speed)",
- 1, 4, 2, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_int ("reduction-4x4", "4x4 reduction",
+ "Reduction factor for 4x4 subsampled candidate motion estimates"
+ " (1=max. quality, 4=max. speed)",
+ 1, 4, 2, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_REDUCTION_2_2,
- g_param_spec_int ("reduction-2x2", "2x2 reduction",
- "Reduction factor for 2x2 subsampled candidate motion estimates"
- " (1=max. quality, 4=max. speed)",
- 1, 4, 3, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_int ("reduction-2x2", "2x2 reduction",
+ "Reduction factor for 2x2 subsampled candidate motion estimates"
+ " (1=max. quality, 4=max. speed)",
+ 1, 4, 3, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_UNIT_COEFF_ELIM,
- g_param_spec_int ("unit-coeff-elim", "Unit coefficience elimination",
- "How agressively small-unit picture blocks should be skipped",
- -40, 40, 0, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_int ("unit-coeff-elim", "Unit coefficience elimination",
+ "How agressively small-unit picture blocks should be skipped",
+ -40, 40, 0, (GParamFlags) G_PARAM_READWRITE));
/* GOP options */
g_object_class_install_property (klass, ARG_MIN_GOP_SIZE,
- g_param_spec_int ("min-gop-size", "Min. GOP size",
- "Minimal size per Group-of-Pictures (-1=default)",
- -1, 250, 0, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_int ("min-gop-size", "Min. GOP size",
+ "Minimal size per Group-of-Pictures (-1=default)",
+ -1, 250, 0, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_MAX_GOP_SIZE,
- g_param_spec_int ("max-gop-size", "Max. GOP size",
- "Maximal size per Group-of-Pictures (-1=default)",
- -1, 250, 0, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_int ("max-gop-size", "Max. GOP size",
+ "Maximal size per Group-of-Pictures (-1=default)",
+ -1, 250, 0, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_CLOSED_GOP,
- g_param_spec_boolean ("closed-gop", "Closed GOP",
- "All Group-of-Pictures are closed (for multi-angle DVDs)",
- FALSE, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_boolean ("closed-gop", "Closed GOP",
+ "All Group-of-Pictures are closed (for multi-angle DVDs)",
+ FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_FORCE_B_B_P,
- g_param_spec_boolean ("force-b-b-p", "Force B-B-P",
- "Force two B frames between I/P frames when closing GOP boundaries",
- FALSE, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_boolean ("force-b-b-p", "Force B-B-P",
+ "Force two B frames between I/P frames when closing GOP boundaries",
+ FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_B_PER_REFFRAME,
- g_param_spec_int ("b-per-refframe", "B per ref. frame",
- "Number of B frames between each I/P frame",
- 0, 2, 2, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_int ("b-per-refframe", "B per ref. frame",
+ "Number of B frames between each I/P frame",
+ 0, 2, 2, (GParamFlags) G_PARAM_READWRITE));
/* quantisation options */
g_object_class_install_property (klass, ARG_QUANTISATION_REDUCTION,
- g_param_spec_float ("quantisation-reduction", "Quantisation reduction",
- "Max. quantisation reduction for highly active blocks",
- -4., 10., 0., (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_float ("quantisation-reduction", "Quantisation reduction",
+ "Max. quantisation reduction for highly active blocks",
+ -4., 10., 0., (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_QUANT_REDUCTION_MAX_VAR,
- g_param_spec_float ("quant-reduction-max-var", "Max. quant. reduction variance",
- "Maximal luma variance below which quantisation boost is used",
- 0., 2500., 0., (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_float ("quant-reduction-max-var",
+ "Max. quant. reduction variance",
+ "Maximal luma variance below which quantisation boost is used", 0.,
+ 2500., 0., (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_INTRA_DC_PRECISION,
- g_param_spec_int ("intra-dc-prec", "Intra. DC precision",
- "Number of bits precision for DC (base colour) in MPEG-2 blocks",
- 8, 11, 9, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_int ("intra-dc-prec", "Intra. DC precision",
+ "Number of bits precision for DC (base colour) in MPEG-2 blocks", 8,
+ 11, 9, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_REDUCE_HF,
- g_param_spec_float ("reduce-hf", "Reduce HF",
- "How much to reduce high-frequency resolution (by increasing quantisation)",
- 0., 2., 0., (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_float ("reduce-hf", "Reduce HF",
+ "How much to reduce high-frequency resolution (by increasing quantisation)",
+ 0., 2., 0., (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_KEEP_HF,
- g_param_spec_boolean ("keep-hf", "Keep HF",
- "Maximize high-frequency resolution (for high-quality sources)",
- FALSE, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_boolean ("keep-hf", "Keep HF",
+ "Maximize high-frequency resolution (for high-quality sources)",
+ FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_QUANTISATION_MATRIX,
- g_param_spec_enum ("quant-matrix", "Quant. matrix",
- "Quantisation matrix to use for encoding",
- GST_TYPE_MPEG2ENC_QUANTISATION_MATRIX, 0,
- (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_enum ("quant-matrix", "Quant. matrix",
+ "Quantisation matrix to use for encoding",
+ GST_TYPE_MPEG2ENC_QUANTISATION_MATRIX, 0,
+ (GParamFlags) G_PARAM_READWRITE));
/* general options */
g_object_class_install_property (klass, ARG_BUFSIZE,
- g_param_spec_int ("bufsize", "Decoder buf. size",
- "Target decoders video buffer size (kB)",
- 20, 4000, 46, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_int ("bufsize", "Decoder buf. size",
+ "Target decoders video buffer size (kB)",
+ 20, 4000, 46, (GParamFlags) G_PARAM_READWRITE));
/* header flag settings */
g_object_class_install_property (klass, ARG_VIDEO_NORM,
- g_param_spec_enum ("norm", "Norm",
- "Tag output for specific video norm",
- GST_TYPE_MPEG2ENC_VIDEO_NORM, 0,
- (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_enum ("norm", "Norm",
+ "Tag output for specific video norm",
+ GST_TYPE_MPEG2ENC_VIDEO_NORM, 0, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_SEQUENCE_LENGTH,
- g_param_spec_int ("sequence-length", "Sequence length",
- "Place a sequence boundary after each <num> MB (0=disable)",
- 0, 10*1024, 0, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_int ("sequence-length", "Sequence length",
+ "Place a sequence boundary after each <num> MB (0=disable)",
+ 0, 10 * 1024, 0, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_3_2_PULLDOWN,
- g_param_spec_boolean ("pulldown-3-2", "3-2 pull down",
- "Generate header flags for 3-2 pull down 24fps movies",
- FALSE, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_boolean ("pulldown-3-2", "3-2 pull down",
+ "Generate header flags for 3-2 pull down 24fps movies",
+ FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_SEQUENCE_HEADER_EVERY_GOP,
- g_param_spec_boolean ("sequence-header-every-gop",
- "Sequence hdr. every GOP",
- "Include a sequence header in every GOP",
- FALSE, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_boolean ("sequence-header-every-gop",
+ "Sequence hdr. every GOP",
+ "Include a sequence header in every GOP",
+ FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_DUMMY_SVCD_SOF,
- g_param_spec_boolean ("dummy-svcd-sof", "Dummy SVCD SOF",
- "Generate dummy SVCD scan-data (for vcdimager)",
- TRUE, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_boolean ("dummy-svcd-sof", "Dummy SVCD SOF",
+ "Generate dummy SVCD scan-data (for vcdimager)",
+ TRUE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_PLAYBACK_FIELD_ORDER,
- g_param_spec_enum ("playback-field-order", "Playback field order",
- "Force specific playback field order",
- GST_TYPE_MPEG2ENC_PLAYBACK_FIELD_ORDER, Y4M_UNKNOWN,
- (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_enum ("playback-field-order", "Playback field order",
+ "Force specific playback field order",
+ GST_TYPE_MPEG2ENC_PLAYBACK_FIELD_ORDER, Y4M_UNKNOWN,
+ (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_CORRECT_SVCD_HDS,
- g_param_spec_boolean ("correct-svcd-hds", "Correct SVCD hor. size",
- "Force SVCD width to 480 instead of 540/720",
- FALSE, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_boolean ("correct-svcd-hds", "Correct SVCD hor. size",
+ "Force SVCD width to 480 instead of 540/720",
+ FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_ALTSCAN_MPEG2,
- g_param_spec_boolean ("altscan-mpeg2", "Alt. MPEG-2 scan",
- "Alternate MPEG-2 block scanning. Disabling this might "
- "make buggy players play SVCD streams",
- TRUE, (GParamFlags) G_PARAM_READWRITE));
+ g_param_spec_boolean ("altscan-mpeg2", "Alt. MPEG-2 scan",
+ "Alternate MPEG-2 block scanning. Disabling this might "
+ "make buggy players play SVCD streams",
+ TRUE, (GParamFlags) G_PARAM_READWRITE));
#if 0
-"--dxr2-hack"
+ "--dxr2-hack"
#endif
-
- /* dangerous/experimental stuff */
- g_object_class_install_property (klass, ARG_CONSTRAINTS,
- g_param_spec_boolean ("constraints", "Constraints",
- "Use strict video resolution and bitrate checks",
- TRUE, (GParamFlags) G_PARAM_READWRITE));
+ /* dangerous/experimental stuff */
+ g_object_class_install_property (klass, ARG_CONSTRAINTS,
+ g_param_spec_boolean ("constraints", "Constraints",
+ "Use strict video resolution and bitrate checks",
+ TRUE, (GParamFlags) G_PARAM_READWRITE));
}
/*
@@ -456,8 +449,7 @@ GstMpeg2EncOptions::initProperties (GObjectClass *klass)
*/
void
-GstMpeg2EncOptions::getProperty (guint prop_id,
- GValue *value)
+GstMpeg2EncOptions::getProperty (guint prop_id, GValue * value)
{
switch (prop_id) {
case ARG_FORMAT:
@@ -473,10 +465,10 @@ GstMpeg2EncOptions::getProperty (guint prop_id,
g_value_set_enum (value, fieldenc);
break;
case ARG_BITRATE:
- g_value_set_int (value, bitrate/1024);
+ g_value_set_int (value, bitrate / 1024);
break;
case ARG_NONVIDEO_BITRATE:
- g_value_set_int (value, nonvid_bitrate/1024);
+ g_value_set_int (value, nonvid_bitrate / 1024);
break;
case ARG_QUANTISATION:
g_value_set_int (value, quant);
@@ -528,18 +520,18 @@ GstMpeg2EncOptions::getProperty (guint prop_id,
break;
case ARG_QUANTISATION_MATRIX:
switch (hf_quant) {
- case 0:
- g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT);
- break;
- case 2:
- g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES);
- break;
- case 3:
- g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD);
- break;
- case 4:
- g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC);
- break;
+ case 0:
+ g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT);
+ break;
+ case 2:
+ g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES);
+ break;
+ case 3:
+ g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD);
+ break;
+ case 4:
+ g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC);
+ break;
}
break;
case ARG_BUFSIZE:
@@ -578,8 +570,7 @@ GstMpeg2EncOptions::getProperty (guint prop_id,
}
void
-GstMpeg2EncOptions::setProperty (guint prop_id,
- const GValue *value)
+GstMpeg2EncOptions::setProperty (guint prop_id, const GValue * value)
{
switch (prop_id) {
case ARG_FORMAT:
@@ -645,26 +636,26 @@ GstMpeg2EncOptions::setProperty (guint prop_id,
case ARG_REDUCE_HF:
hf_q_boost = g_value_get_float (value);
if (hf_quant == 0 && hf_q_boost != 0.)
- hf_quant = 1;
+ hf_quant = 1;
break;
case ARG_KEEP_HF:
hf_quant = g_value_get_boolean (value) ? 2 : 0;
break;
case ARG_QUANTISATION_MATRIX:
switch (g_value_get_enum (value)) {
- case GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT:
- hf_quant = 0;
- hf_q_boost = 0;
- break;
- case GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES:
- hf_quant = 2;
- break;
- case GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD:
- hf_quant = 3;
- break;
- case GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC:
- hf_quant = 4;
- break;
+ case GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT:
+ hf_quant = 0;
+ hf_q_boost = 0;
+ break;
+ case GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES:
+ hf_quant = 2;
+ break;
+ case GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD:
+ hf_quant = 3;
+ break;
+ case GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC:
+ hf_quant = 4;
+ break;
}
break;
case ARG_BUFSIZE:
diff --git a/ext/mpeg2enc/gstmpeg2encpicturereader.cc b/ext/mpeg2enc/gstmpeg2encpicturereader.cc
index 439f4f10..be8789ee 100644
--- a/ext/mpeg2enc/gstmpeg2encpicturereader.cc
+++ b/ext/mpeg2enc/gstmpeg2encpicturereader.cc
@@ -31,10 +31,9 @@
* Class init stuff.
*/
-GstMpeg2EncPictureReader::GstMpeg2EncPictureReader (GstPad *in_pad,
- const GstCaps *in_caps,
- EncoderParams *params) :
- PictureReader (*params)
+GstMpeg2EncPictureReader::GstMpeg2EncPictureReader (GstPad * in_pad,
+ const GstCaps * in_caps, EncoderParams * params):
+PictureReader (*params)
{
pad = in_pad;
caps = gst_caps_copy (in_caps);
@@ -50,7 +49,7 @@ GstMpeg2EncPictureReader::~GstMpeg2EncPictureReader ()
*/
void
-GstMpeg2EncPictureReader::StreamPictureParams (MPEG2EncInVidParams &strm)
+GstMpeg2EncPictureReader::StreamPictureParams (MPEG2EncInVidParams & strm)
{
GstStructure *structure = gst_caps_get_structure (caps, 0);
gint width, height;
@@ -65,8 +64,7 @@ GstMpeg2EncPictureReader::StreamPictureParams (MPEG2EncInVidParams &strm)
strm.frame_rate_code = mpeg_framerate_code (mpeg_conform_framerate (fps));
strm.interlacing_code = Y4M_ILACE_NONE;
strm.aspect_ratio_code = mpeg_guess_mpeg_aspect_code (2, y4m_sar_SQUARE,
- strm.horizontal_size,
- strm.vertical_size);
+ strm.horizontal_size, strm.vertical_size);
/* FIXME:
* strm.interlacing_code = y4m_si_get_interlace(&si);
@@ -82,15 +80,24 @@ GstMpeg2EncPictureReader::StreamPictureParams (MPEG2EncInVidParams &strm)
* Read a frame. Return true means EOS or error.
*/
-bool
-GstMpeg2EncPictureReader::LoadFrame ()
+bool GstMpeg2EncPictureReader::LoadFrame ()
{
- GstData *data;
- GstBuffer *buf = NULL;
- gint i, x, y, n;
- guint8 *frame;
- GstFormat fmt = GST_FORMAT_DEFAULT;
- gint64 pos = 0, tot = 0;
+ GstData *
+ data;
+ GstBuffer *
+ buf = NULL;
+ gint
+ i,
+ x,
+ y,
+ n;
+ guint8 *
+ frame;
+ GstFormat
+ fmt = GST_FORMAT_DEFAULT;
+ gint64
+ pos = 0, tot = 0;
+
gst_pad_query (GST_PAD_PEER (pad), GST_QUERY_POSITION, &fmt, &pos);
gst_pad_query (GST_PAD_PEER (pad), GST_QUERY_TOTAL, &fmt, &tot);
@@ -99,16 +106,16 @@ GstMpeg2EncPictureReader::LoadFrame ()
gst_pad_set_element_private (pad, NULL);
} else if (!(data = gst_pad_pull (pad))) {
GST_ELEMENT_ERROR (gst_pad_get_parent (pad), RESOURCE, READ,
- (NULL), (NULL));
+ (NULL), (NULL));
return true;
}
if (GST_IS_EVENT (data)) {
if (GST_EVENT_TYPE (data) == GST_EVENT_EOS) {
- gst_event_unref (GST_EVENT (data));
- return true;
+ gst_event_unref (GST_EVENT (data));
+ return true;
} else {
- gst_pad_event_default (pad, GST_EVENT (data));
+ gst_pad_event_default (pad, GST_EVENT (data));
}
} else {
buf = GST_BUFFER (data);
@@ -121,18 +128,18 @@ GstMpeg2EncPictureReader::LoadFrame ()
y = encparams.vertical_size;
for (i = 0; i < y; i++) {
- memcpy (input_imgs_buf[n][0]+i*encparams.phy_width, frame, x);
+ memcpy (input_imgs_buf[n][0] + i * encparams.phy_width, frame, x);
frame += x;
}
lum_mean[n] = LumMean (input_imgs_buf[n][0]);
x >>= 1;
y >>= 1;
for (i = 0; i < y; i++) {
- memcpy (input_imgs_buf[n][1]+i*encparams.phy_chrom_width, frame, x);
+ memcpy (input_imgs_buf[n][1] + i * encparams.phy_chrom_width, frame, x);
frame += x;
}
for (i = 0; i < y; i++) {
- memcpy (input_imgs_buf[n][2]+i*encparams.phy_chrom_width, frame, x);
+ memcpy (input_imgs_buf[n][2] + i * encparams.phy_chrom_width, frame, x);
frame += x;
}
gst_buffer_unref (buf);
diff --git a/ext/mpeg2enc/gstmpeg2encstreamwriter.cc b/ext/mpeg2enc/gstmpeg2encstreamwriter.cc
index ba59f3d4..39c705ac 100644
--- a/ext/mpeg2enc/gstmpeg2encstreamwriter.cc
+++ b/ext/mpeg2enc/gstmpeg2encstreamwriter.cc
@@ -31,9 +31,8 @@
* Class init stuff.
*/
-GstMpeg2EncStreamWriter::GstMpeg2EncStreamWriter (GstPad *in_pad,
- EncoderParams *params) :
- ElemStrmWriter (*params)
+GstMpeg2EncStreamWriter::GstMpeg2EncStreamWriter (GstPad * in_pad, EncoderParams * params):
+ElemStrmWriter (*params)
{
pad = in_pad;
buf = NULL;
@@ -44,8 +43,7 @@ GstMpeg2EncStreamWriter::GstMpeg2EncStreamWriter (GstPad *in_pad,
*/
void
-GstMpeg2EncStreamWriter::PutBits (guint32 val,
- gint n)
+GstMpeg2EncStreamWriter::PutBits (guint32 val, gint n)
{
/* only relevant bits. Note that (according to Andrew),
* some CPUs do bitshifts modulo wordsize (32), which
@@ -62,7 +60,7 @@ GstMpeg2EncStreamWriter::PutBits (guint32 val,
GST_BUFFER_SIZE (buf) = 0;
}
- outbfr = (outbfr << outcnt ) | (val >> (n - outcnt));
+ outbfr = (outbfr << outcnt) | (val >> (n - outcnt));
GST_BUFFER_DATA (buf)[GST_BUFFER_SIZE (buf)++] = outbfr;
n -= outcnt;
outcnt = 8;