| 1 |
Description: <short summary of the patch> |
| 2 |
TODO: Put a short summary on the line above and replace this paragraph |
| 3 |
with a longer explanation of this change. Complete the meta-information |
| 4 |
with other relevant fields (see below for details). To make it easier, the |
| 5 |
information below has been extracted from the changelog. Adjust it or drop |
| 6 |
it. |
| 7 |
. |
| 8 |
bchunk (1.2.2+git20220715+ds-1) unstable; urgency=medium |
| 9 |
. |
| 10 |
* New upstream version from fork. (Closes: #261278, #271285) |
| 11 |
* Bump standards version to 4.6.1. |
| 12 |
* Bump debhelper version to 13, drop d/compat. |
| 13 |
* Update maintainer address. |
| 14 |
Author: Gürkan Myczko <[email protected]> |
| 15 |
Bug-Debian: https://bugs.debian.org/261278 |
| 16 |
Bug-Debian: https://bugs.debian.org/271285 |
| 17 |
|
| 18 |
--- |
| 19 |
The information above should follow the Patch Tagging Guidelines, please |
| 20 |
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here |
| 21 |
are templates for supplementary fields that you might want to add: |
| 22 |
|
| 23 |
Origin: <vendor|upstream|other>, <url of original patch> |
| 24 |
Bug: <url in upstream bugtracker> |
| 25 |
Bug-Debian: https://bugs.debian.org/<bugnumber> |
| 26 |
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber> |
| 27 |
Forwarded: <no|not-needed|url proving that it has been forwarded> |
| 28 |
Reviewed-By: <name and email of someone who approved the patch> |
| 29 |
Last-Update: 2022-07-15 |
| 30 |
|
| 31 |
--- bchunk-1.2.2+git20220715+ds.orig/COPYING |
| 32 |
+++ bchunk-1.2.2+git20220715+ds/COPYING |
| 33 |
@@ -1,12 +1,13 @@ |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
+ GNU GENERAL PUBLIC LICENSE |
| 40 |
+ Version 2, June 1991 |
| 41 |
+ |
| 42 |
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc. |
| 43 |
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 44 |
Everyone is permitted to copy and distribute verbatim copies |
| 45 |
of this license document, but changing it is not allowed. |
| 46 |
|
| 47 |
|
| 48 |
+ Preamble |
| 49 |
|
| 50 |
The licenses for most software are designed to take away your |
| 51 |
freedom to share and change it. By contrast, the GNU General Public |
| 52 |
@@ -15,7 +16,7 @@ software--to make sure the software is f |
| 53 |
General Public License applies to most of the Free Software |
| 54 |
Foundation's software and to any other program whose authors commit to |
| 55 |
using it. (Some other Free Software Foundation software is covered by |
| 56 |
|
| 57 |
+the GNU Library General Public License instead.) You can apply it to |
| 58 |
your programs, too. |
| 59 |
|
| 60 |
When we speak of free software, we are referring to freedom, not |
| 61 |
@@ -55,8 +56,8 @@ patent must be licensed for everyone's f |
| 62 |
|
| 63 |
The precise terms and conditions for copying, distribution and |
| 64 |
modification follow. |
| 65 |
|
| 66 |
|
| 67 |
+ |
| 68 |
+ GNU GENERAL PUBLIC LICENSE |
| 69 |
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
| 70 |
|
| 71 |
0. This License applies to any program or other work which contains |
| 72 |
@@ -110,7 +111,7 @@ above, provided that you also meet all o |
| 73 |
License. (Exception: if the Program itself is interactive but |
| 74 |
does not normally print such an announcement, your work based on |
| 75 |
the Program is not required to print an announcement.) |
| 76 |
|
| 77 |
+ |
| 78 |
These requirements apply to the modified work as a whole. If |
| 79 |
identifiable sections of that work are not derived from the Program, |
| 80 |
and can be reasonably considered independent and separate works in |
| 81 |
@@ -168,7 +169,7 @@ access to copy from a designated place, |
| 82 |
access to copy the source code from the same place counts as |
| 83 |
distribution of the source code, even though third parties are not |
| 84 |
compelled to copy the source along with the object code. |
| 85 |
|
| 86 |
+ |
| 87 |
4. You may not copy, modify, sublicense, or distribute the Program |
| 88 |
except as expressly provided under this License. Any attempt |
| 89 |
otherwise to copy, modify, sublicense or distribute the Program is |
| 90 |
@@ -225,7 +226,7 @@ impose that choice. |
| 91 |
|
| 92 |
This section is intended to make thoroughly clear what is believed to |
| 93 |
be a consequence of the rest of this License. |
| 94 |
|
| 95 |
+ |
| 96 |
8. If the distribution and/or use of the Program is restricted in |
| 97 |
certain countries either by patents or by copyrighted interfaces, the |
| 98 |
original copyright holder who places the Program under this License |
| 99 |
@@ -255,7 +256,7 @@ make exceptions for this. Our decision |
| 100 |
of preserving the free status of all derivatives of our free software and |
| 101 |
of promoting the sharing and reuse of software generally. |
| 102 |
|
| 103 |
|
| 104 |
+ NO WARRANTY |
| 105 |
|
| 106 |
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
| 107 |
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
| 108 |
@@ -277,9 +278,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE |
| 109 |
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
| 110 |
POSSIBILITY OF SUCH DAMAGES. |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
+ END OF TERMS AND CONDITIONS |
| 116 |
+ |
| 117 |
+ How to Apply These Terms to Your New Programs |
| 118 |
|
| 119 |
If you develop a new program, and you want it to be of the greatest |
| 120 |
possible use to the public, the best way to achieve this is to make it |
| 121 |
@@ -291,7 +292,7 @@ convey the exclusion of warranty; and ea |
| 122 |
the "copyright" line and a pointer to where the full notice is found. |
| 123 |
|
| 124 |
<one line to give the program's name and a brief idea of what it does.> |
| 125 |
|
| 126 |
+ Copyright (C) 19yy <name of author> |
| 127 |
|
| 128 |
This program is free software; you can redistribute it and/or modify |
| 129 |
it under the terms of the GNU General Public License as published by |
| 130 |
@@ -303,16 +304,17 @@ the "copyright" line and a pointer to wh |
| 131 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 132 |
GNU General Public License for more details. |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
+ You should have received a copy of the GNU General Public License |
| 138 |
+ along with this program; if not, write to the Free Software |
| 139 |
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 140 |
+ |
| 141 |
|
| 142 |
Also add information on how to contact you by electronic and paper mail. |
| 143 |
|
| 144 |
If the program is interactive, make it output a short notice like this |
| 145 |
when it starts in an interactive mode: |
| 146 |
|
| 147 |
|
| 148 |
+ Gnomovision version 69, Copyright (C) 19yy name of author |
| 149 |
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
| 150 |
This is free software, and you are welcome to redistribute it |
| 151 |
under certain conditions; type `show c' for details. |
| 152 |
@@ -335,5 +337,5 @@ necessary. Here is a sample; alter the |
| 153 |
This General Public License does not permit incorporating your program into |
| 154 |
proprietary programs. If your program is a subroutine library, you may |
| 155 |
consider it more useful to permit linking proprietary applications with the |
| 156 |
|
| 157 |
+library. If this is what you want to do, use the GNU Library General |
| 158 |
Public License instead of this License. |
| 159 |
--- bchunk-1.2.2+git20220715+ds.orig/ChangeLog |
| 160 |
+++ bchunk-1.2.2+git20220715+ds/ChangeLog |
| 161 |
@@ -63,19 +63,3 @@ |
| 162 |
Clarify manual page for input/output file types |
| 163 |
Improvement from Reuben Thomas, debian bug: #503151 |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
--- bchunk-1.2.2+git20220715+ds.orig/Makefile |
| 182 |
+++ bchunk-1.2.2+git20220715+ds/Makefile |
| 183 |
@@ -12,9 +12,6 @@ CFLAGS = -Wall -Wstrict-prototypes -O2 |
| 184 |
|
| 185 |
# For BSD install: Which install to use and where to put the files |
| 186 |
INSTALL = install |
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
PREFIX = /usr/local |
| 191 |
BIN_DIR = $(PREFIX)/bin |
| 192 |
MAN_DIR = $(PREFIX)/man |
| 193 |
@@ -29,16 +26,14 @@ distclean: clean |
| 194 |
|
| 195 |
install: installbin installman |
| 196 |
installbin: |
| 197 |
|
| 198 |
|
| 199 |
+ $(INSTALL) -m 755 -s bchunk $(BIN_DIR) |
| 200 |
installman: |
| 201 |
|
| 202 |
|
| 203 |
+ $(INSTALL) -m 644 bchunk.1 $(MAN_DIR)/man1 |
| 204 |
|
| 205 |
BITS = bchunk.o |
| 206 |
|
| 207 |
bchunk: $(BITS) |
| 208 |
|
| 209 |
+ $(LD) $(LDFLAGS) -o bchunk $(BITS) |
| 210 |
|
| 211 |
bchunk.o: bchunk.c |
| 212 |
|
| 213 |
--- bchunk-1.2.2+git20220715+ds.orig/README |
| 214 |
+++ bchunk-1.2.2+git20220715+ds/README |
| 215 |
@@ -1,5 +1,5 @@ |
| 216 |
|
| 217 |
|
| 218 |
+ binchunker for Unix, version 1.2.2 |
| 219 |
Copyright (C) 1998-2004 Heikki Hannikainen <[email protected]> |
| 220 |
|
| 221 |
Enhancements provided by: |
| 222 |
@@ -9,7 +9,6 @@ |
| 223 |
Piotr Kaczuba <[email protected]>, 2009 |
| 224 |
Reuben Thomas <[email protected]>, 2008 |
| 225 |
Yegor Timoshenko <[email protected]>, 2017 |
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
http://he.fi/bchunk/ |
| 230 |
@@ -53,7 +52,7 @@ |
| 231 |
Colas Nahaboo <[email protected]> and Godmar Back <[email protected]> |
| 232 |
added support for MODE2/2352 ISO data tracks in bchunk 1.1.0. |
| 233 |
Matthew Green implemented the -r option for raw MODE2/2352 |
| 234 |
|
| 235 |
+ exctraction for bchunk 1.2.0. |
| 236 |
|
| 237 |
--- |
| 238 |
|
| 239 |
@@ -62,9 +61,6 @@ |
| 240 |
binchunker converts a CD image in a ".bin / .cue" format |
| 241 |
(sometimes ".raw / .cue") to a set of .iso and .cdr tracks. |
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
The bin/cue format is used by some non-Unix cd-writing |
| 247 |
software, but is not supported on most other cd-writing |
| 248 |
programs. |
| 249 |
@@ -89,8 +85,8 @@ |
| 250 |
|
| 251 |
How to install this stuff: |
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
+ $ gzip -d -c bchunk-1.2.2.tar.gz | tar xvf - |
| 256 |
+ $ cd bchunk-1.2.2 |
| 257 |
$ make |
| 258 |
# make install |
| 259 |
|
| 260 |
@@ -120,23 +116,13 @@ |
| 261 |
|
| 262 |
How to use this stuff: |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
+ bchunk [-v] [-p (PSX)] [-r (raw)] [-w (wav)] [-s (swabaudio)] |
| 267 |
+ <image.bin> <image.cue> <basename> |
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
+ image.bin is the raw cd image file. image.cue is the |
| 284 |
+ track index file containing track types and offsets. |
| 285 |
+ basename is used for the beginning part of the created |
| 286 |
+ track files. |
| 287 |
|
| 288 |
The -v flag makes binchunker print some more unnecessary |
| 289 |
messages, which should not be of interest for anyone. |
| 290 |
@@ -151,7 +137,7 @@ |
| 291 |
The -p and -r flags works only with MODE2/2352 input (if input |
| 292 |
is in PSX mode pass -p flag or if it is in raw format pass |
| 293 |
-r flag). |
| 294 |
|
| 295 |
+ |
| 296 |
The -w flag makes binchunker write audio tracks in WAV format. |
| 297 |
|
| 298 |
The -s flag makes binchunker swap byte order in the samples of |
| 299 |
--- bchunk-1.2.2+git20220715+ds.orig/bchunk.1 |
| 300 |
+++ bchunk-1.2.2+git20220715+ds/bchunk.1 |
| 301 |
@@ -1,10 +1,8 @@ |
| 302 |
|
| 303 |
+.TH BCHUNK 1 "v1.2.2 14 Nov 2017" "Heikki Hannikainen" |
| 304 |
.SH NAME |
| 305 |
bchunk \- CD image format conversion from bin/cue to iso/cdr |
| 306 |
|
| 307 |
.SH SYNOPSIS |
| 308 |
|
| 309 |
|
| 310 |
+.B bchunk [-v] [-p] [-r] [-w] [-s] <image.bin> <image.cue> <basename> |
| 311 |
.SH DESCRIPTION |
| 312 |
.LP |
| 313 |
.B bchunk |
| 314 |
@@ -15,19 +13,10 @@ The bin/cue format is used by some non-U |
| 315 |
software, but is not supported on most other cd-writing |
| 316 |
programs. |
| 317 |
.LP |
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
+image.bin is the raw cd image file. image.cue is the |
| 332 |
+track index file containing track types and offsets. |
| 333 |
+basename is used for the beginning part of the created |
| 334 |
+track files. |
| 335 |
.LP |
| 336 |
The produced .iso track contains an ISO file system, which can be |
| 337 |
mounted through a loop device on Linux systems, or |
| 338 |
@@ -49,12 +38,6 @@ The format itself does not contain this |
| 339 |
case it can only guess. |
| 340 |
.SH OPTIONS |
| 341 |
.TP 10 |
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
.BI \-v |
| 349 |
Makes binchunker print some more unnecessary messages, which should |
| 350 |
not be of interest for anyone. |
| 351 |
@@ -78,14 +61,10 @@ raw format. |
| 352 |
.LP |
| 353 |
.TP 5 |
| 354 |
.B image.bin |
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
+Raw CD image file |
| 361 |
.TP 5 |
| 362 |
.B image.cue |
| 363 |
|
| 364 |
+TOC (Track index, Table Of Contents) file |
| 365 |
.TP 5 |
| 366 |
.B *.iso |
| 367 |
Tracks in ISO9660 CD filesystem format. Can be either written on a |
| 368 |
@@ -116,5 +95,3 @@ Godmar Back <[email protected]> |
| 369 |
.br |
| 370 |
Matthew Green <[email protected]> |
| 371 |
.br |
| 372 |
|
| 373 |
|
| 374 |
--- bchunk-1.2.2+git20220715+ds.orig/bchunk.c |
| 375 |
+++ bchunk-1.2.2+git20220715+ds/bchunk.c |
| 376 |
@@ -19,22 +19,17 @@ |
| 377 |
*/ |
| 378 |
|
| 379 |
#define _GNU_SOURCE |
| 380 |
|
| 381 |
#include <stdio.h> |
| 382 |
#include <stdlib.h> |
| 383 |
#include <string.h> |
| 384 |
#include <errno.h> |
| 385 |
#include <unistd.h> |
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
+#define VERSION "1.2.2" |
| 391 |
+#define USAGE "Usage: bchunk [-v] [-r] [-p (PSX)] [-w (wav)] [-s (swabaudio)]\n" \ |
| 392 |
+ " <image.bin> <image.cue> <basename>\n" \ |
| 393 |
"Example: bchunk foo.bin foo.cue foo\n" \ |
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
" -v Verbose mode\n" \ |
| 398 |
|
| 399 |
" -r Raw mode for MODE2/2352: write all 2352 bytes from offset 0 (VCD/MPEG)\n" \ |
| 400 |
" -p PSX mode for MODE2/2352: write 2336 bytes from offset 24\n" \ |
| 401 |
" (default MODE2/2352 mode writes 2048 bytes from offset 24)\n"\ |
| 402 |
@@ -46,11 +41,8 @@ |
| 403 |
"\tpartly based on his Pascal (Delphi) implementation.\n" \ |
| 404 |
"\tSupport for MODE2/2352 ISO tracks thanks to input from\n" \ |
| 405 |
"\tGodmar Back <[email protected]>, Colas Nahaboo <[email protected]>\n" \ |
| 406 |
|
| 407 |
+ "\tand Matthew Green <[email protected]>.\n" \ |
| 408 |
"\tReleased under the GNU GPL, version 2 or later (at your option).\n\n" |
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
#define CUELLEN 1024 |
| 414 |
#define SECTLEN 2352 |
| 415 |
@@ -58,12 +50,7 @@ |
| 416 |
#define WAV_RIFF_HLEN 12 |
| 417 |
#define WAV_FORMAT_HLEN 24 |
| 418 |
#define WAV_DATA_HLEN 8 |
| 419 |
|
| 420 |
|
| 421 |
#define WAV_HEADER_LEN WAV_RIFF_HLEN + WAV_FORMAT_HLEN + WAV_DATA_HLEN |
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
/* |
| 427 |
* Ugly way to convert integers to little-endian format. |
| 428 |
@@ -72,11 +59,7 @@ |
| 429 |
*/ |
| 430 |
|
| 431 |
#include <inttypes.h> |
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
#include <netinet/in.h> |
| 436 |
|
| 437 |
|
| 438 |
#define bswap_16(x) \ |
| 439 |
((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) |
| 440 |
@@ -93,13 +76,10 @@ struct track_t { |
| 441 |
int num; |
| 442 |
int mode; |
| 443 |
int audio; |
| 444 |
|
| 445 |
|
| 446 |
char *modes; |
| 447 |
char *extension; |
| 448 |
int bstart; |
| 449 |
int bsize; |
| 450 |
|
| 451 |
long startsect; |
| 452 |
long stopsect; |
| 453 |
long start; |
| 454 |
@@ -110,65 +90,11 @@ struct track_t { |
| 455 |
char *basefile = NULL; |
| 456 |
char *binfile = NULL; |
| 457 |
char *cuefile = NULL; |
| 458 |
|
| 459 |
|
| 460 |
int verbose = 0; |
| 461 |
|
| 462 |
int psxtruncate = 0; |
| 463 |
int raw = 0; |
| 464 |
int swabaudio = 0; |
| 465 |
int towav = 0; |
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
/* |
| 519 |
* Parse arguments |
| 520 |
@@ -178,7 +104,7 @@ void parse_args(int argc, char *argv[]) |
| 521 |
{ |
| 522 |
int s; |
| 523 |
|
| 524 |
|
| 525 |
+ while ((s = getopt(argc, argv, "swvp?hr")) != -1) { |
| 526 |
switch (s) { |
| 527 |
case 'r': |
| 528 |
raw = 1; |
| 529 |
@@ -186,9 +112,6 @@ void parse_args(int argc, char *argv[]) |
| 530 |
case 'v': |
| 531 |
verbose = 1; |
| 532 |
break; |
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
case 'w': |
| 537 |
towav = 1; |
| 538 |
break; |
| 539 |
@@ -198,32 +121,34 @@ void parse_args(int argc, char *argv[]) |
| 540 |
case 's': |
| 541 |
swabaudio = 1; |
| 542 |
break; |
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
case '?': |
| 547 |
case 'h': |
| 548 |
|
| 549 |
+ fprintf(stderr, "%s", USAGE); |
| 550 |
+ exit(0); |
| 551 |
} |
| 552 |
} |
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
+ if (argc - optind != 3) { |
| 557 |
+ fprintf(stderr, "%s", USAGE); |
| 558 |
+ exit(1); |
| 559 |
+ } |
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
+ while (optind < argc) { |
| 569 |
+ switch (argc - optind) { |
| 570 |
+ case 3: |
| 571 |
+ binfile = strdup(argv[optind]); |
| 572 |
break; |
| 573 |
case 2: |
| 574 |
|
| 575 |
+ cuefile = strdup(argv[optind]); |
| 576 |
+ break; |
| 577 |
+ case 1: |
| 578 |
+ basefile = strdup(argv[optind]); |
| 579 |
break; |
| 580 |
default: |
| 581 |
|
| 582 |
+ fprintf(stderr, "%s", USAGE); |
| 583 |
+ exit(1); |
| 584 |
} |
| 585 |
+ optind++; |
| 586 |
} |
| 587 |
} |
| 588 |
|
| 589 |
@@ -254,44 +179,6 @@ long time2frames(char *s) |
| 590 |
} |
| 591 |
|
| 592 |
/* |
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
|
| 628 |
|
| 629 |
|
| 630 |
|
| 631 |
* Parse the mode string |
| 632 |
*/ |
| 633 |
|
| 634 |
@@ -333,7 +220,7 @@ void gettrackmode(struct track_t *track, |
| 635 |
track->bsize = 2336; |
| 636 |
track->extension = ext_iso; |
| 637 |
|
| 638 |
|
| 639 |
+ } else if (!strcasecmp(modes, "AUDIO")) { |
| 640 |
track->bstart = 0; |
| 641 |
track->bsize = 2352; |
| 642 |
track->audio = 1; |
| 643 |
@@ -374,8 +261,9 @@ char *progressbar(float f, int l) |
| 644 |
* Write a track |
| 645 |
*/ |
| 646 |
|
| 647 |
|
| 648 |
+int writetrack(FILE *bf, struct track_t *track, char *bname) |
| 649 |
{ |
| 650 |
+ char *fname; |
| 651 |
FILE *f; |
| 652 |
char buf[SECTLEN+10]; |
| 653 |
long sz, sect, realsz, reallen; |
| 654 |
@@ -384,29 +272,30 @@ int writetrack(FILE *bf, struct track_t |
| 655 |
int16_t i; |
| 656 |
float fl; |
| 657 |
|
| 658 |
|
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
+ if (asprintf(&fname, "%s%2.2d.%s", bname, track->num, track->extension) == -1) { |
| 665 |
+ fprintf(stderr, "writetrack(): asprintf() failed, out of memory\n"); |
| 666 |
+ exit(4); |
| 667 |
} |
| 668 |
|
| 669 |
|
| 670 |
+ printf("%2d: %s ", track->num, fname); |
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
+ if (!(f = fopen(fname, "w"))) { |
| 675 |
+ fprintf(stderr, " Could not fopen track file: %s\n", strerror(errno)); |
| 676 |
+ exit(4); |
| 677 |
+ } |
| 678 |
+ |
| 679 |
+ if (fseek(bf, track->start, SEEK_SET)) { |
| 680 |
+ fprintf(stderr, " Could not fseek to track location: %s\n", strerror(errno)); |
| 681 |
+ exit(4); |
| 682 |
+ } |
| 683 |
|
| 684 |
reallen = (track->stopsect - track->startsect + 1) * track->bsize; |
| 685 |
if (verbose) { |
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
+ printf("\n mmc sectors %ld->%ld (%ld)", track->startsect, track->stopsect, track->stopsect - track->startsect + 1); |
| 695 |
+ printf("\n mmc bytes %ld->%ld (%ld)", track->start, track->stop, track->stop - track->start + 1); |
| 696 |
+ printf("\n sector data at %d, %d bytes per sector", track->bstart, track->bsize); |
| 697 |
+ printf("\n real data %ld bytes", (track->stopsect - track->startsect + 1) * track->bsize); |
| 698 |
+ printf("\n"); |
| 699 |
} |
| 700 |
|
| 701 |
printf(" "); |
| 702 |
@@ -434,7 +323,7 @@ int writetrack(FILE *bf, struct track_t |
| 703 |
i = htoles(2*8); // bits per channel |
| 704 |
fwrite(&i, 2, 1, f); |
| 705 |
// DATA header |
| 706 |
|
| 707 |
+ fputs("data", f); |
| 708 |
l = htolel(reallen); |
| 709 |
fwrite(&l, 4, 1, f); |
| 710 |
} |
| 711 |
@@ -443,7 +332,6 @@ int writetrack(FILE *bf, struct track_t |
| 712 |
sz = track->start; |
| 713 |
sect = track->startsect; |
| 714 |
fl = 0; |
| 715 |
|
| 716 |
while ((sect <= track->stopsect) && (fread(buf, SECTLEN, 1, bf) > 0)) { |
| 717 |
if (track->audio) { |
| 718 |
if (swabaudio) { |
| 719 |
@@ -459,8 +347,10 @@ int writetrack(FILE *bf, struct track_t |
| 720 |
} |
| 721 |
} |
| 722 |
} |
| 723 |
|
| 724 |
|
| 725 |
+ if (fwrite(&buf[track->bstart], track->bsize, 1, f) < 1) { |
| 726 |
+ fprintf(stderr, " Could not write to track: %s\n", strerror(errno)); |
| 727 |
+ exit(4); |
| 728 |
+ } |
| 729 |
sect++; |
| 730 |
sz += SECTLEN; |
| 731 |
realsz += track->bsize; |
| 732 |
@@ -475,131 +365,79 @@ int writetrack(FILE *bf, struct track_t |
| 733 |
printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b%4ld/%-4ld MB [%s] %3.0f %%", realsz/1024/1024, reallen/1024/1024, progressbar(1, 20), fl * 100); |
| 734 |
fflush(stdout); |
| 735 |
|
| 736 |
|
| 737 |
|
| 738 |
|
| 739 |
|
| 740 |
+ if (ferror(bf)) { |
| 741 |
+ fprintf(stderr, " Could not read from %s: %s\n", binfile, strerror(errno)); |
| 742 |
+ exit(4); |
| 743 |
+ } |
| 744 |
+ |
| 745 |
+ if (fclose(f)) { |
| 746 |
+ fprintf(stderr, " Could not fclose track file: %s\n", strerror(errno)); |
| 747 |
+ exit(4); |
| 748 |
+ } |
| 749 |
|
| 750 |
printf("\n"); |
| 751 |
return 0; |
| 752 |
} |
| 753 |
|
| 754 |
/* |
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
|
| 759 |
|
| 760 |
|
| 761 |
|
| 762 |
|
| 763 |
|
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
|
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
|
| 773 |
|
| 774 |
|
| 775 |
|
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
|
| 781 |
|
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
|
| 786 |
|
| 787 |
|
| 788 |
|
| 789 |
|
| 790 |
|
| 791 |
|
| 792 |
|
| 793 |
|
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
|
| 798 |
|
| 799 |
|
| 800 |
|
| 801 |
|
| 802 |
|
| 803 |
|
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
|
| 810 |
|
| 811 |
* Main |
| 812 |
*/ |
| 813 |
|
| 814 |
int main(int argc, char **argv) |
| 815 |
{ |
| 816 |
char s[CUELLEN+1]; |
| 817 |
|
| 818 |
+ char *p, *t; |
| 819 |
+ struct track_t *tracks = NULL; |
| 820 |
+ struct track_t *track = NULL; |
| 821 |
struct track_t *prevtrack = NULL; |
| 822 |
struct track_t **prevp = &tracks; |
| 823 |
|
| 824 |
+ FILE *binf, *cuef; |
| 825 |
+ |
| 826 |
printf("%s", VERSTR); |
| 827 |
|
| 828 |
parse_args(argc, argv); |
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
+ if (!((binf = fopen(binfile, "r")))) { |
| 833 |
+ fprintf(stderr, "Could not open BIN %s: %s\n", binfile, strerror(errno)); |
| 834 |
+ return 2; |
| 835 |
+ } |
| 836 |
|
| 837 |
|
| 838 |
|
| 839 |
+ if (!((cuef = fopen(cuefile, "r")))) { |
| 840 |
+ fprintf(stderr, "Could not open CUE %s: %s\n", cuefile, strerror(errno)); |
| 841 |
+ return 2; |
| 842 |
+ } |
| 843 |
|
| 844 |
printf("Reading the CUE file:\n"); |
| 845 |
|
| 846 |
+ /* We don't really care about the first line. */ |
| 847 |
+ if (!fgets(s, CUELLEN, cuef)) { |
| 848 |
+ fprintf(stderr, "Could not read first line from %s: %s\n", cuefile, strerror(errno)); |
| 849 |
+ return 3; |
| 850 |
+ } |
| 851 |
+ |
| 852 |
while (fgets(s, CUELLEN, cuef)) { |
| 853 |
while ((p = strchr(s, '\r')) || (p = strchr(s, '\n'))) |
| 854 |
*p = '\0'; |
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
|
| 862 |
|
| 863 |
|
| 864 |
|
| 865 |
|
| 866 |
|
| 867 |
|
| 868 |
|
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
|
| 877 |
if ((p = strstr(s, "TRACK"))) { |
| 878 |
printf("\nTrack "); |
| 879 |
|
| 880 |
|
| 881 |
+ if (!(p = strchr(p, ' '))) { |
| 882 |
+ fprintf(stderr, "... ouch, no space after TRACK.\n"); |
| 883 |
+ exit(3); |
| 884 |
+ } |
| 885 |
p++; |
| 886 |
|
| 887 |
|
| 888 |
+ if (!(t = strchr(p, ' '))) { |
| 889 |
+ fprintf(stderr, "... ouch, no space after track number.\n"); |
| 890 |
+ exit(3); |
| 891 |
+ } |
| 892 |
*t = '\0'; |
| 893 |
|
| 894 |
prevtrack = track; |
| 895 |
|
| 896 |
|
| 897 |
+ if (!(track = malloc(sizeof(struct track_t)))) { |
| 898 |
+ fprintf(stderr, "main(): malloc() failed, out of memory\n"); |
| 899 |
+ exit(4); |
| 900 |
+ } |
| 901 |
*prevp = track; |
| 902 |
prevp = &track->next; |
| 903 |
track->next = NULL; |
| 904 |
@@ -607,14 +445,10 @@ int main(int argc, char **argv) |
| 905 |
|
| 906 |
p = t + 1; |
| 907 |
printf("%2d: %-12.12s ", track->num, p); |
| 908 |
|
| 909 |
|
| 910 |
track->modes = strdup(p); |
| 911 |
track->extension = NULL; |
| 912 |
|
| 913 |
track->mode = 0; |
| 914 |
track->audio = 0; |
| 915 |
|
| 916 |
track->bsize = track->bstart = -1; |
| 917 |
track->bsize = -1; |
| 918 |
track->startsect = track->stopsect = -1; |
| 919 |
@@ -622,70 +456,45 @@ int main(int argc, char **argv) |
| 920 |
gettrackmode(track, p); |
| 921 |
|
| 922 |
} else if ((p = strstr(s, "INDEX"))) { |
| 923 |
|
| 924 |
|
| 925 |
+ if (!(p = strchr(p, ' '))) { |
| 926 |
+ printf("... ouch, no space after INDEX.\n"); |
| 927 |
+ exit(3); |
| 928 |
+ } |
| 929 |
p++; |
| 930 |
|
| 931 |
|
| 932 |
+ if (!(t = strchr(p, ' '))) { |
| 933 |
+ printf("... ouch, no space after index number.\n"); |
| 934 |
+ exit(3); |
| 935 |
+ } |
| 936 |
*t = '\0'; |
| 937 |
t++; |
| 938 |
printf(" %s %s", p, t); |
| 939 |
|
| 940 |
|
| 941 |
|
| 942 |
|
| 943 |
|
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
|
| 948 |
|
| 949 |
|
| 950 |
|
| 951 |
|
| 952 |
|
| 953 |
+ track->startsect = time2frames(t); |
| 954 |
+ track->start = track->startsect * SECTLEN; |
| 955 |
if (verbose) |
| 956 |
|
| 957 |
|
| 958 |
|
| 959 |
|
| 960 |
|
| 961 |
|
| 962 |
|
| 963 |
|
| 964 |
|
| 965 |
|
| 966 |
|
| 967 |
|
| 968 |
|
| 969 |
+ printf(" (startsect %ld ofs %ld)", track->startsect, track->start); |
| 970 |
+ if ((prevtrack) && (prevtrack->stopsect < 0)) { |
| 971 |
+ prevtrack->stopsect = track->startsect - 1; |
| 972 |
+ prevtrack->stop = track->start - 1; |
| 973 |
} |
| 974 |
} |
| 975 |
} |
| 976 |
|
| 977 |
|
| 978 |
|
| 979 |
|
| 980 |
|
| 981 |
|
| 982 |
|
| 983 |
|
| 984 |
|
| 985 |
|
| 986 |
|
| 987 |
|
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
|
| 996 |
|
| 997 |
|
| 998 |
+ if (track) { |
| 999 |
+ fseek(binf, 0, SEEK_END); |
| 1000 |
+ track->stop = ftell(binf) - 1; |
| 1001 |
+ track->stopsect = track->stop / SECTLEN; |
| 1002 |
} |
| 1003 |
|
| 1004 |
|
| 1005 |
+ printf("\n\n"); |
| 1006 |
+ |
| 1007 |
+ |
| 1008 |
+ printf("Writing tracks:\n\n"); |
| 1009 |
+ for (track = tracks; (track); track = track->next) |
| 1010 |
+ writetrack(binf, track, basefile); |
| 1011 |
+ |
| 1012 |
+ fclose(binf); |
| 1013 |
+ fclose(cuef); |
| 1014 |
+ |
| 1015 |
return 0; |
| 1016 |
} |
| 1017 |
|
| 1018 |
--- bchunk-1.2.2+git20220715+ds.orig/bchunk.spec |
| 1019 |
+++ bchunk-1.2.2+git20220715+ds/bchunk.spec |
| 1020 |
@@ -1,5 +1,5 @@ |
| 1021 |
%define name bchunk |
| 1022 |
|
| 1023 |
+%define version 1.2.2 |
| 1024 |
%define release 0 |
| 1025 |
|
| 1026 |
Summary: A CD image format converter from .bin/.cue to .iso/.cdr/.wav. |
| 1027 |
@@ -43,9 +43,6 @@ rm -r $RPM_BUILD_ROOT |
| 1028 |
%{_mandir}/man1/bchunk.1.gz |
| 1029 |
|
| 1030 |
%changelog |
| 1031 |
|
| 1032 |
|
| 1033 |
|
| 1034 |
* Tue Nov 14 2017 Hessu <[email protected]> |
| 1035 |
- updated to 1.2.2 |
| 1036 |
|