Change year in copyright message to 2012.
[paraslash.git] / aft.c
diff --git a/aft.c b/aft.c
index f6d0c4b35a22160317d6d3bac20556208ac2669d..9d87c748b4456ad61b260446b56def0e5acbaf12 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2011 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2007-2012 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -107,6 +107,8 @@ struct ls_widths {
        unsigned short num_played_width;
        /** size of the amp field. */
        unsigned short amp_width;
+       /** size of the audio format field. */
+       unsigned short audio_format_width;
 };
 
 /** Data passed from the ls command handler to its callback function. */
@@ -902,7 +904,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                        "%*d "  /* image_id  */
                        "%*d "  /* lyrics_id */
                        "%*d "  /* bitrate */
-                       "%s "   /* audio format */
+                       "%*s "  /* audio format */
                        "%*d "  /* frequency */
                        "%d "   /* channels */
                        "%s "   /* duration */
@@ -914,6 +916,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                        w->image_id_width, afsi->image_id,
                        w->lyrics_id_width, afsi->lyrics_id,
                        w->bitrate_width, afhi->bitrate,
+                       w->audio_format_width,
                        audio_format_name(afsi->audio_format_id),
                        w->frequency_width, afhi->frequency,
                        afhi->channels,
@@ -1328,6 +1331,8 @@ static int prepare_ls_row(struct osl_row *row, void *ls_opts)
        w->duration_width = PARA_MAX(w->duration_width, num_digits);
        GET_NUM_DIGITS(d->afsi.amp, &num_digits);
        w->amp_width = PARA_MAX(w->amp_width, num_digits);
+       num_digits = strlen(audio_format_name(d->afsi.audio_format_id));
+       w->audio_format_width = PARA_MAX(w->audio_format_width, num_digits);
        if (options->flags & LS_FLAG_ADMISSIBLE_ONLY) {
                GET_NUM_DIGITS(score, &num_digits);
                num_digits++; /* add one for the sign (space or "-") */