summaryrefslogtreecommitdiffstats
path: root/examples/stats/mp2ogg.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/stats/mp2ogg.c')
-rw-r--r--examples/stats/mp2ogg.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/examples/stats/mp2ogg.c b/examples/stats/mp2ogg.c
index e5d3fbd9..55d79e90 100644
--- a/examples/stats/mp2ogg.c
+++ b/examples/stats/mp2ogg.c
@@ -24,8 +24,8 @@
* compression status of mpeg audio to ogg vorbis transcoding.
*/
-gint
-main (gint argc, gchar *argv[])
+gint
+main (gint argc, gchar * argv[])
{
GstElement *pipeline;
GError *error = NULL;
@@ -34,21 +34,22 @@ main (gint argc, gchar *argv[])
GstPad *dec_sink, *enc_src;
gst_init (&argc, &argv);
-
+
if (argc < 3) {
g_print ("usage: %s <inputfile> <outputfile>\n", argv[0]);
return -1;
}
description = g_strdup_printf ("filesrc location=\"%s\" ! mad name=decoder ! "
- "vorbisenc name=encoder ! filesink location=\"%s\"", argv[1], argv[2]);
+ "vorbisenc name=encoder ! filesink location=\"%s\"", argv[1], argv[2]);
pipeline = GST_ELEMENT (gst_parse_launch (description, &error));
if (!pipeline) {
if (error)
- g_print ("ERROR: pipeline could not be constructed: %s\n", error->message);
+ g_print ("ERROR: pipeline could not be constructed: %s\n",
+ error->message);
else
- g_print ("ERROR: pipeline could not be constructed\n");
+ g_print ("ERROR: pipeline could not be constructed\n");
return -1;
}
@@ -57,7 +58,7 @@ main (gint argc, gchar *argv[])
dec_sink = gst_element_get_pad (decoder, "sink");
enc_src = gst_element_get_pad (encoder, "src");
-
+
if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) {
g_print ("pipeline doesn't want to play\n");
return -1;
@@ -71,33 +72,29 @@ main (gint argc, gchar *argv[])
format = GST_FORMAT_TIME;
/* get the position */
- gst_pad_query (enc_src, GST_QUERY_POSITION,
- &format, &position);
+ gst_pad_query (enc_src, GST_QUERY_POSITION, &format, &position);
/* get the total duration */
- gst_pad_query (enc_src, GST_QUERY_TOTAL,
- &format, &duration);
+ gst_pad_query (enc_src, GST_QUERY_TOTAL, &format, &duration);
format = GST_FORMAT_BYTES;
/* see how many bytes are genereated per 8 seconds (== bitrate) */
gst_pad_convert (enc_src, GST_FORMAT_TIME, 8 * GST_SECOND,
- &format, &bitrate_enc);
+ &format, &bitrate_enc);
gst_pad_convert (dec_sink, GST_FORMAT_TIME, 8 * GST_SECOND,
- &format, &bitrate_dec);
+ &format, &bitrate_dec);
g_print ("[%2dm %.2ds] of [%2dm %.2ds], "
- "src avg bitrate: %lld, dest avg birate: %lld, ratio [%02.2f] \r",
- (gint)(position / (GST_SECOND * 60)),
- (gint)(position / (GST_SECOND)) % 60,
- (gint)(duration / (GST_SECOND * 60)),
- (gint)(duration / (GST_SECOND)) % 60,
- bitrate_dec,
- bitrate_enc,
- (gfloat)bitrate_dec/bitrate_enc);
+ "src avg bitrate: %lld, dest avg birate: %lld, ratio [%02.2f] \r",
+ (gint) (position / (GST_SECOND * 60)),
+ (gint) (position / (GST_SECOND)) % 60,
+ (gint) (duration / (GST_SECOND * 60)),
+ (gint) (duration / (GST_SECOND)) % 60,
+ bitrate_dec, bitrate_enc, (gfloat) bitrate_dec / bitrate_enc);
}
g_print ("\n");
-
+
return 0;
}