]> git.tue.mpg.de Git - paraslash.git/commitdiff
Use an unused byte in struct afs_info to store the amplification value.
authorAndre Noll <maan@systemlinux.org>
Sun, 6 Jul 2008 17:25:40 +0000 (19:25 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 6 Jul 2008 17:25:40 +0000 (19:25 +0200)
afs.h
aft.c

diff --git a/afs.h b/afs.h
index d01f0cfb77cc17eaff5e5618cb734f54a6f9fa5e..a596317f957f2dabb8a7287d689810883f4270b6 100644 (file)
--- a/afs.h
+++ b/afs.h
@@ -24,6 +24,8 @@ struct afs_info {
        uint32_t lyrics_id;
        /** Mp3, ogg or aac. */
        uint8_t audio_format_id;
+       /** Amplification value. */
+       uint8_t amp;
 };
 
 /**
diff --git a/aft.c b/aft.c
index 3d10ced25949d61e370eae617950dd7ff316b7e6..8797bd8683ccf42909d3b771d030d5045d18bcda 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -142,8 +142,10 @@ enum afsi_offsets {
        AFSI_LYRICS_ID_OFFSET = 24,
        /** Storage position of the .audio_format_id field. */
        AFSI_AUDIO_FORMAT_ID_OFFSET = 28,
-       /** 3 bytes reserved space for future usage. */
-       AFSI_AUDIO_FORMAT_UNUSED_OFFSET = 29,
+       /** Storage position of the amplification field. */
+       AFSI_AMP_OFFSET = 29,
+       /** 2 bytes reserved space for future usage. */
+       AFSI_AUDIO_FORMAT_UNUSED_OFFSET = 30,
        /** On-disk storage space needed. */
        AFSI_SIZE = 32
 };
@@ -167,7 +169,8 @@ void save_afsi(struct afs_info *afsi, struct osl_object *obj)
        write_u32(buf + AFSI_LYRICS_ID_OFFSET, afsi->lyrics_id);
        write_u8(buf + AFSI_AUDIO_FORMAT_ID_OFFSET,
                afsi->audio_format_id);
-       memset(buf + AFSI_AUDIO_FORMAT_UNUSED_OFFSET, 0, 3);
+       write_u8(buf + AFSI_AMP_OFFSET, afsi->amp);
+       memset(buf + AFSI_AUDIO_FORMAT_UNUSED_OFFSET, 0, 2);
 }
 
 /**
@@ -192,6 +195,7 @@ int load_afsi(struct afs_info *afsi, struct osl_object *obj)
        afsi->lyrics_id = read_u32(buf + AFSI_LYRICS_ID_OFFSET);
        afsi->audio_format_id = read_u8(buf +
                AFSI_AUDIO_FORMAT_ID_OFFSET);
+       afsi->amp = read_u8(buf + AFSI_AMP_OFFSET);
        return 1;
 }