Changeset 138


Ignore:
Timestamp:
11/15/06 13:29:00 (18 years ago)
Author:
r2d
Message:
  • added CRC check in libmpcdec
Location:
libmpc/branches/r2d
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • libmpc/branches/r2d/Makefile.am

    r137 r138  
    11AUTOMAKE_OPTIONS = foreign
    2 SUBDIRS = libwavformat libmpcpsy libmpcenc libmpcdec mppenc mpcdec
     2SUBDIRS = common libwavformat libmpcpsy libmpcenc libmpcdec mppenc mpcdec
  • libmpc/branches/r2d/configure.in

    r137 r138  
    88AM_PROG_LIBTOOL
    99
    10 AC_OUTPUT(Makefile libmpcenc/Makefile libmpcpsy/Makefile mppenc/Makefile libwavformat/Makefile libmpcdec/Makefile mpcdec/Makefile)
     10AC_OUTPUT(Makefile libmpcenc/Makefile libmpcpsy/Makefile mppenc/Makefile libwavformat/Makefile libmpcdec/Makefile mpcdec/Makefile common/Makefile)
  • libmpc/branches/r2d/libmpc.kdevelop

    r137 r138  
    33  <general>
    44    <author>Nicolas Botti</author>
    5     <email/>
     5    <email></email>
    66    <version>0.1</version>
    77    <projectmanagement>KDevAutoProject</projectmanagement>
     
    1414    <projectdirectory>.</projectdirectory>
    1515    <absoluteprojectpath>false</absoluteprojectpath>
    16     <description/>
     16    <description></description>
    1717  </general>
    1818  <kdevautoproject>
    1919    <general>
    20       <activetarget>libmpcpsy/libmpcpsy.a</activetarget>
     20      <activetarget>libmpcdec/libmpcdec.la</activetarget>
    2121      <useconfiguration>debug</useconfiguration>
    2222    </general>
    2323    <run>
    24       <mainprogram>src/mppenc</mainprogram>
     24      <mainprogram>/usr/bin/xmms</mainprogram>
    2525      <terminal>true</terminal>
    26       <directoryradio>executable</directoryradio>
     26      <directoryradio>custom</directoryradio>
    2727      <runarguments>
    28         <mppenc/>
     28        <mppenc></mppenc>
    2929      </runarguments>
    3030      <customdirectory>/</customdirectory>
    31       <programargs/>
     31      <programargs></programargs>
    3232      <autocompile>true</autocompile>
    3333      <envvars/>
     
    184184    </codecompletion>
    185185    <creategettersetter>
    186       <prefixGet/>
     186      <prefixGet></prefixGet>
    187187      <prefixSet>set</prefixSet>
    188188      <prefixVariable>m_,_</prefixVariable>
     
    200200  <kdevdebugger>
    201201    <general>
    202       <programargs>--overwrite ~/mdv-startup.wav</programargs>
    203       <gdbpath/>
     202      <programargs>~/mdv-startup.mpc</programargs>
     203      <gdbpath></gdbpath>
    204204      <dbgshell>libtool</dbgshell>
    205       <configGdbScript/>
    206       <runShellScript/>
    207       <runGdbScript/>
     205      <configGdbScript></configGdbScript>
     206      <runShellScript></runShellScript>
     207      <runGdbScript></runGdbScript>
    208208      <breakonloadinglibs>true</breakonloadinglibs>
    209209      <separatetty>false</separatetty>
  • libmpc/branches/r2d/libmpcdec/Makefile.am

    r137 r138  
    1010AM_CFLAGS = -DMPC_LITTLE_ENDIAN
    1111
     12libmpcdec_la_LIBADD = $(top_builddir)/common/libcommon.a
  • libmpc/branches/r2d/libmpcdec/mpc_demux.c

    r126 r138  
    4343
    4444// streaminfo.c
    45 mpc_status streaminfo_read_header_sv8(mpc_streaminfo* si, const mpc_bits_reader * r_in);
     45mpc_status streaminfo_read_header_sv8(mpc_streaminfo* si,
     46                                                                          const mpc_bits_reader * r_in,
     47                                                                          mpc_size_t block_size);
    4648mpc_status streaminfo_read_header_sv7(mpc_streaminfo* si, mpc_bits_reader * r_in);
    4749void  streaminfo_encoder_info(mpc_streaminfo* si, const mpc_bits_reader * r_in);
     
    134136                while( memcmp(b.key, "AD", 2) != 0 ){ // scan all blocks until audio
    135137                        mpc_demux_fill(d, 11 + b.size, 0);
    136                         if (memcmp(b.key, "SI", 2) == 0)
    137                                 streaminfo_read_header_sv8(&d->si, &d->bits_reader);
    138                         else if (memcmp(b.key, "EI", 2) == 0)
     138                        if (memcmp(b.key, "SI", 2) == 0){
     139                                int ret = streaminfo_read_header_sv8(&d->si, &d->bits_reader, b.size);
     140                                if (ret != MPC_STATUS_OK)
     141                                        return ret;
     142                        } else if (memcmp(b.key, "EI", 2) == 0)
    139143                                streaminfo_encoder_info(&d->si, &d->bits_reader);
    140144                        else if (memcmp(b.key, "RG", 2) == 0)
     
    161165                p_tmp->block_bits = 0;
    162166                // lire entête
    163                 mpc_demux_header(p_tmp);
    164                 // initialisation decodeur
    165                 p_tmp->d = mpc_decoder_init(&p_tmp->si);
     167                if (mpc_demux_header(p_tmp) == MPC_STATUS_OK) {
     168                        // initialisation decodeur
     169                        p_tmp->d = mpc_decoder_init(&p_tmp->si);
     170                } else {
     171                        free(p_tmp);
     172                        p_tmp = 0;
     173                }
    166174        }
    167175
  • libmpc/branches/r2d/libmpcdec/streaminfo.c

    r126 r138  
    3939#include <stdio.h>
    4040#include "internal.h"
     41
     42unsigned long crc32(unsigned char *buf, int len);
    4143
    4244mpc_uint32_t mpc_bits_read(mpc_bits_reader * r, const unsigned int nb_bits);
     
    139141/// Reads streaminfo from SV8 header.
    140142mpc_status
    141 streaminfo_read_header_sv8(mpc_streaminfo* si, const mpc_bits_reader * r_in)
    142 {
    143         mpc_uint32_t CRC;
     143streaminfo_read_header_sv8(mpc_streaminfo* si, const mpc_bits_reader * r_in,
     144                                                   mpc_size_t block_size)
     145{
     146        mpc_uint32_t CRC, CRC_tmp;
    144147        mpc_bits_reader r = *r_in;
    145148
    146         // FIXME : add CRC check
    147149        CRC = mpc_bits_read(&r, 32);
     150        CRC_tmp = crc32(r.buff + 1 - (r.count >> 3), block_size - 4);
     151        if (CRC != CRC_tmp)
     152                return MPC_STATUS_FILE;
     153
    148154        si->stream_version = mpc_bits_read(&r, 8);
    149155        mpc_bits_get_size(&r, &si->samples);
  • libmpc/branches/r2d/libmpcenc/Makefile.am

    r137 r138  
    22METASOURCES = AUTO
    33lib_LIBRARIES = libmpcenc.a
    4 libmpcenc_a_SOURCES = analy_filter.c bitstream.c encode_sv7.c huffsv7.c quant.c \
    5         crc32.c
     4libmpcenc_a_SOURCES = analy_filter.c bitstream.c encode_sv7.c huffsv7.c quant.c
    65
    76
    87noinst_HEADERS = libmpcenc.h
     8
     9
  • libmpc/branches/r2d/mppenc/Makefile.am

    r137 r138  
    1111        winmsg.c
    1212mppenc_LDADD = $(top_builddir)/libmpcpsy/libmpcpsy.a \
    13         $(top_builddir)/libmpcenc/libmpcenc.a -lm
     13        $(top_builddir)/libmpcenc/libmpcenc.a $(top_builddir)/common/libcommon.a -lm
    1414AM_CFLAGS = -DMPP_ENCODER=1 -DTRUE=1 -DFALSE=0
Note: See TracChangeset for help on using the changeset viewer.