Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan Persson committed Aug 1, 2015
1 parent 5d2715a commit a8ead9f
Show file tree
Hide file tree
Showing 24 changed files with 2,458 additions and 0 deletions.
87 changes: 87 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
0.6.3 (2004/05/06)
- Fixed some cuesheet errors ( cdirip.c/.h )
- changed version info in cdirip.c
- removed buggy endianess code ( prevents some .cdi from being ripped )

0.6.2 (2002/06/08)

- Support for DiscJuggler 4.0 CDI images
- CDIrip now opens CDR-WIN 5.x (*.cdr) images, too
- CDIrip sources are now much more portable (removed endian-dependant stuff)
- Added "Mac" ISO output support (new option -mac)
- Added CDA/AIFF audio output support (options -cda, -aiff)

0.6c (2001/12/27)

- Added support for CDI 3.5.826+ images

0.6b (2001/12/07)

- Fixed bug in 0.6a causing some old images (3.0, 2.0) not being recognized

0.6a (2001/11/29)

- Fixed bug with some DiscJuggler 3.5 images (extracted 1st session only)

0.6 (2001/09/07)

- Support for new DiscJuggler 3.00.780+ CDI images
- Destination path dialog (when double-clicked)
- Destination path can now be entered in command-line
- MAJOR speedup (now uses two 1024 Kb buffers for read and write)
- New "/pregap" option to extract pregaps, instead of discarding them
- New "/speed" option to show ripping speed in Kb/s
- All options can now start with "-" character (un*x-like)
- Fixed 0-length pregap handling in cuesheet
- Fixed negative track size handling (must add /pregap option)
- Fixed default track cutting misbehaviour (cutted last track by default)
- Fixed Mode1/2352 (raw) to 2048 (ISO) conversion bug (sorry :)
- Switched to Bloodshed Dev-C++ free compiler (tiny executable size!)

0.5a (2001/02/13)

- Fixed stupid bug in audio swap routine

0.5 (2001/02/05)

- Support for CDI v3.0 images
- Support for raw data tracks (2352 bytes/sector) either Mode1 and Mode2
- Audio tracks can now be byte-swapped with "/swap" option (for cdrecord)
- Tracks in second cuesheet now starts at no.1 (for multisession CDs)
- Truncated tracks are now detected and skipped
- Better error handling
- Windows Open File dialog and error Message Boxes for easier usage
- Options can now be written without an image filename (will ask for it)
- New preset options for burning apps: /cdrecord, /winoncd, /fireburner
- New progress counter (faster, bigger and better ;)
- Big internal cleanup
- Small bugfixes

0.4 (2000/10/12)

- No need to use DOS-prompt for basic usage: just do double click to it
- Support for Mixed-mode (Mode1/2048) and CD-XA Multisession (Mode2/2336)
data tracks in cuesheet
- Data tracks in first session are now automatically cutted by 2 sectors
- Data tracks in CD-XA Multisession discs are now saved in BIN/2336 format
- Audio tracks are now saved in WAV format
- Added "/raw" option to force RAW format to audio tracks
- Added "/iso" option to force ISO/2048 conversion to all data tracks
- Added "/bin" option to force BIN/2336 format + 2 cuesheets
- Added "/full" option to avoid cutting data tracks
- Added "/cut" and "/cutall" options to cut tracks
- Added "/info" option
- Added progress counter (wow!)
- Small bugfixes

0.3 (2000/09/06)

- Automatic cuesheet generation

0.2 (2000/09/04)

- Support added for Mode1/2048 tracks

0.1 (2000/09/03)

- First, internal release
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#####################################
#
# Custom-written for making Debian package for CDIRip
#
#####################################

CC=gcc

# Output filename
OUTPUT="cdirip"

# Source files
SRCS=cdirip.c buffer.c cdi.c common.c audio.c
# Output object files (*.o)
OBJECTS = ${SRCS:.c=.o}
# Headers (*.h)
HEADERS= ${SRCS:.c=.h}

RM = rm -f
MV = mv -f
CP = cp -f

.c.o:
${CC} -c ${CFLAGS} $<

cdirip: ${OBJECTS}
${CC} -o $@ ${OBJECTS} -lm

all: cdirip

clean:
-${RM} ${OUTPUT} ${OBJECTS}

mrproper: clean

install: all
${CP} ${OUTPUT} ${DESTDIR}/usr/bin # Line 25
${CP} ${HEADERS} ${DESTDIR}/usr/include/cdirip # Line 26
37 changes: 37 additions & 0 deletions Makefile.linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#####################################
# #
# Makefile for CDIrip
# Generated by Bloodshed Dev-C++ #
# #
#####################################


# Compiler
CC=gcc
# Parameters given to the compiler
CFLAGS=-s -O1 -I/usr/include -I/include
# Output filename (*.exe)
OUTPUT=cdirip

# Source files
SRCS=cdirip.c buffer.c cdi.c common.c audio.c
# Output object files (*.o)
OBJS=cdirip.o buffer.o cdi.o common.o audio.o

# Standard targets

all: compile_res
$(CC) -c $(SRCS) $(CFLAGS)
$(CC) -o $(OUTPUT) $(OBJS) $(CFLAGS)

compile_res:


test: all
./$(OUTPUT)

clean:
del *.o

mrproper: clean

36 changes: 36 additions & 0 deletions Makefile.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Project: CDIrip
# Makefile created by Dev-C++ 4.9.3.0

CC = gcc.exe
WINDRES = windres.exe
RES =
OBJ = cdirip.o buffer.o cdi.o common.o audio.o $(RES)
LIBS = -L"d:\archiv~1\Dev-C++\lib" -lcomdlg32 -lshell32
INCS = -I"d:\archiv~1\Dev-C++\include"
BIN = cdirip.exe
CFLAGS = $(INCS) -s -O2

.PHONY: clean

all: cdirip.exe

clean:
rm -f $(OBJ) $(BIN)

$(BIN): $(OBJ)
$(CC) $(OBJ) -o $(BIN) $(RES) $(LIBS) $(CFLAGS)

cdirip.o: cdirip.c
$(CC) -c cdirip.c -o cdirip.o $(CFLAGS)

buffer.o: buffer.c
$(CC) -c buffer.c -o buffer.o $(CFLAGS)

cdi.o: cdi.c
$(CC) -c cdi.c -o cdi.o $(CFLAGS)

common.o: common.c
$(CC) -c common.c -o common.o $(CFLAGS)

audio.o: audio.c
$(CC) -c audio.c -o audio.o $(CFLAGS)
186 changes: 186 additions & 0 deletions audio.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "audio.h"



void writewavheader(FILE *fdest, long track_length)
{
unsigned long wTotal_length;
unsigned long wData_length;
unsigned long wHeaderLength = 16;
unsigned short wFormat = 1;
unsigned short wChannels = 2;
unsigned long wSampleRate = 44100;
unsigned long wBitRate = 176400;
unsigned short wBlockAlign = 4;
unsigned short wBitsPerSample = 16;

wData_length = track_length*2352;
wTotal_length = wData_length + 8 + 16 + 12;

fwrite("RIFF", 4, 1, fdest);
fwrite(&wTotal_length, 4, 1, fdest);
fwrite("WAVE", 4, 1, fdest);
fwrite("fmt ", 4, 1, fdest);
fwrite(&wHeaderLength, 4, 1, fdest);
fwrite(&wFormat, 2, 1, fdest);
fwrite(&wChannels, 2, 1, fdest);
fwrite(&wSampleRate, 4, 1, fdest);
fwrite(&wBitRate, 4, 1, fdest);
fwrite(&wBlockAlign, 2, 1, fdest);
fwrite(&wBitsPerSample, 2, 1, fdest);
fwrite("data", 4, 1, fdest);
fwrite(&wData_length, 4, 1, fdest);
}


void writeaiffheader(FILE *fdest, long track_length)
{
unsigned long source_length, total_length;
unsigned char buf[4];
unsigned long aCommSize = 18;
unsigned short aChannels = 2;
unsigned long aNumFrames;
unsigned short aBitsPerSample = 16;
unsigned long aSampleRate = 44100;
unsigned long aSsndSize;
unsigned long aOffset = 0;
unsigned long aBlockSize = 0;


source_length = track_length*2352;
total_length = source_length + 8 + 18 + 8 + 12; // COMM + SSND
aNumFrames = source_length/4;
aSsndSize = source_length + 8;

fwrite("FORM", 4, 1, fdest);

fwrite(&total_length, 4, 1, fdest);

fwrite("AIFF", 4, 1, fdest);
fwrite("COMM", 4, 1, fdest);

fwrite(&aCommSize, 4, 1, fdest);
fwrite(&aChannels, 2, 1, fdest);
fwrite(&aNumFrames, 4, 1, fdest);
fwrite(&aBitsPerSample, 2, 1, fdest);

write_ieee_extended(fdest, (double)aSampleRate);

fwrite("SSND", 4, 1, fdest);

fwrite(&aSsndSize, 4, 1, fdest);
fwrite(&aOffset, 4, 1, fdest);
fwrite(&aBlockSize, 4, 1, fdest);
}


void write_ieee_extended(FILE *fdest, double x)
{
char buf[10];
ConvertToIeeeExtended(x, buf);
/*
report("converted %g to %o %o %o %o %o %o %o %o %o %o",
x,
buf[0], buf[1], buf[2], buf[3], buf[4],
buf[5], buf[6], buf[7], buf[8], buf[9]);
*/
(void) fwrite(buf, 1, 10, fdest);
}



/*
* C O N V E R T T O I E E E E X T E N D E D
*/

/* Copyright (C) 1988-1991 Apple Computer, Inc.
* All rights reserved.
*
* Machine-independent I/O routines for IEEE floating-point numbers.
*
* NaN's and infinities are converted to HUGE_VAL or HUGE, which
* happens to be infinity on IEEE machines. Unfortunately, it is
* impossible to preserve NaN's in a machine-independent way.
* Infinities are, however, preserved on IEEE machines.
*
* These routines have been tested on the following machines:
* Apple Macintosh, MPW 3.1 C compiler
* Apple Macintosh, THINK C compiler
* Silicon Graphics IRIS, MIPS compiler
* Cray X/MP and Y/MP
* Digital Equipment VAX
*
*
* Implemented by Malcolm Slaney and Ken Turkowski.
*
* Malcolm Slaney contributions during 1988-1990 include big- and little-
* endian file I/O, conversion to and from Motorola's extended 80-bit
* floating-point format, and conversions to and from IEEE single-
* precision floating-point format.
*
* In 1991, Ken Turkowski implemented the conversions to and from
* IEEE double-precision format, added more precision to the extended
* conversions, and accommodated conversions involving +/- infinity,
* NaN's, and denormalized numbers.
*/

#ifndef HUGE_VAL
# define HUGE_VAL HUGE
#endif /*HUGE_VAL*/

# define FloatToUnsigned(f) ((unsigned long)(((long)(f - 2147483648.0)) + 2147483647L) + 1)

void ConvertToIeeeExtended(double num, char *bytes)
{
int sign;
int expon;
double fMant, fsMant;
unsigned long hiMant, loMant;

if (num < 0) {
sign = 0x8000;
num *= -1;
} else {
sign = 0;
}

if (num == 0) {
expon = 0; hiMant = 0; loMant = 0;
}
else {
fMant = frexp(num, &expon);
if ((expon > 16384) || !(fMant < 1)) { /* Infinity or NaN */
expon = sign|0x7FFF; hiMant = 0; loMant = 0; /* infinity */
}
else { /* Finite */
expon += 16382;
if (expon < 0) { /* denormalized */
fMant = ldexp(fMant, expon);
expon = 0;
}
expon |= sign;
fMant = ldexp(fMant, 32);
fsMant = floor(fMant);
hiMant = FloatToUnsigned(fsMant);
fMant = ldexp(fMant - fsMant, 32);
fsMant = floor(fMant);
loMant = FloatToUnsigned(fsMant);
}
}

bytes[0] = expon >> 8;
bytes[1] = expon;
bytes[2] = hiMant >> 24;
bytes[3] = hiMant >> 16;
bytes[4] = hiMant >> 8;
bytes[5] = hiMant;
bytes[6] = loMant >> 24;
bytes[7] = loMant >> 16;
bytes[8] = loMant >> 8;
bytes[9] = loMant;
}

Loading

0 comments on commit a8ead9f

Please sign in to comment.