Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
flac
Commits
aa07a760
Commit
aa07a760
authored
Nov 11, 2001
by
Josh Coalson
Browse files
minor cosmetics with Ogg defines
parent
123f1e94
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/flac/decode.c
View file @
aa07a760
...
...
@@ -28,11 +28,11 @@
#include
"FLAC/all.h"
#include
"decode.h"
#include
"file.h"
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
#include
"ogg/ogg.h"
#endif
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
typedef
struct
{
ogg_sync_state
oy
;
ogg_stream_state
os
;
...
...
@@ -41,7 +41,7 @@ typedef struct {
typedef
struct
{
const
char
*
inbasefilename
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
FILE
*
fin
;
#endif
FILE
*
fout
;
...
...
@@ -61,14 +61,14 @@ typedef struct {
FLAC__bool
skip_count_too_high
;
FLAC__uint64
samples_processed
;
unsigned
frame_counter
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
FLAC__bool
is_ogg
;
#endif
union
{
FLAC__FileDecoder
*
file
;
FLAC__StreamDecoder
*
stream
;
}
decoder
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
ogg_info_struct
ogg
;
#endif
}
stream_info_struct
;
...
...
@@ -79,7 +79,7 @@ static FLAC__bool is_big_endian_host;
static
FLAC__bool
init
(
const
char
*
infilename
,
stream_info_struct
*
stream_info
);
static
FLAC__bool
write_little_endian_uint16
(
FILE
*
f
,
FLAC__uint16
val
);
static
FLAC__bool
write_little_endian_uint32
(
FILE
*
f
,
FLAC__uint32
val
);
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
static
FLAC__StreamDecoderReadStatus
read_callback
(
const
FLAC__StreamDecoder
*
decoder
,
FLAC__byte
buffer
[],
unsigned
*
bytes
,
void
*
client_data
);
#endif
/*
...
...
@@ -108,7 +108,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool
stream_info
.
skip_count_too_high
=
false
;
stream_info
.
samples_processed
=
0
;
stream_info
.
frame_counter
=
0
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
stream_info
.
is_ogg
=
options
.
common
.
is_ogg
;
#endif
stream_info
.
decoder
.
file
=
0
;
/* this zeroes stream_info.decoder.stream also */
...
...
@@ -129,7 +129,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool
}
}
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
.
is_ogg
)
{
if
(
0
==
strcmp
(
infilename
,
"-"
))
{
stream_info
.
fin
=
stdin
;
...
...
@@ -151,7 +151,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool
goto
wav_abort_
;
if
(
stream_info
.
skip
>
0
)
{
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
.
is_ogg
)
{
//@@@ (move this check into main.c)
fprintf
(
stderr
,
"%s: ERROR, can't skip when decoding Ogg-FLAC yet; convert to native-FLAC first
\n
"
,
stream_info
.
inbasefilename
);
goto
wav_abort_
;
...
...
@@ -181,7 +181,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool
}
}
else
{
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
.
is_ogg
)
{
if
(
!
FLAC__stream_decoder_process_whole_stream
(
stream_info
.
decoder
.
stream
))
{
if
(
stream_info
.
verbose
)
fprintf
(
stderr
,
"
\n
"
);
...
...
@@ -210,7 +210,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool
}
}
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
.
is_ogg
)
{
if
(
stream_info
.
decoder
.
stream
)
{
if
(
FLAC__stream_decoder_get_state
(
stream_info
.
decoder
.
stream
)
!=
FLAC__STREAM_DECODER_UNINITIALIZED
)
...
...
@@ -232,7 +232,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool
}
if
(
0
!=
stream_info
.
fout
&&
stream_info
.
fout
!=
stdout
)
fclose
(
stream_info
.
fout
);
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
.
is_ogg
)
{
if
(
0
!=
stream_info
.
fin
&&
stream_info
.
fin
!=
stdin
)
fclose
(
stream_info
.
fin
);
...
...
@@ -249,7 +249,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool
}
return
0
;
wav_abort_:
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
.
is_ogg
)
{
if
(
stream_info
.
decoder
.
stream
)
{
if
(
FLAC__stream_decoder_get_state
(
stream_info
.
decoder
.
stream
)
!=
FLAC__STREAM_DECODER_UNINITIALIZED
)
...
...
@@ -270,7 +270,7 @@ wav_abort_:
fclose
(
stream_info
.
fout
);
unlink
(
outfilename
);
}
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
.
is_ogg
)
{
if
(
0
!=
stream_info
.
fin
&&
stream_info
.
fin
!=
stdin
)
fclose
(
stream_info
.
fin
);
...
...
@@ -298,7 +298,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
stream_info
.
skip_count_too_high
=
false
;
stream_info
.
samples_processed
=
0
;
stream_info
.
frame_counter
=
0
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
stream_info
.
is_ogg
=
options
.
common
.
is_ogg
;
#endif
stream_info
.
decoder
.
file
=
0
;
/* this zeroes stream_info.decoder.stream also */
...
...
@@ -319,7 +319,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
}
}
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
.
is_ogg
)
{
if
(
0
==
strcmp
(
infilename
,
"-"
))
{
stream_info
.
fin
=
stdin
;
...
...
@@ -341,7 +341,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
goto
raw_abort_
;
if
(
stream_info
.
skip
>
0
)
{
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
.
is_ogg
)
{
//@@@ (move this check into main.c)
fprintf
(
stderr
,
"%s: ERROR, can't skip when decoding Ogg-FLAC yet; convert to native-FLAC first
\n
"
,
stream_info
.
inbasefilename
);
goto
raw_abort_
;
...
...
@@ -371,7 +371,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
}
}
else
{
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
.
is_ogg
)
{
if
(
!
FLAC__stream_decoder_process_whole_stream
(
stream_info
.
decoder
.
stream
))
{
if
(
stream_info
.
verbose
)
fprintf
(
stderr
,
"
\n
"
);
...
...
@@ -400,7 +400,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
}
}
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
.
is_ogg
)
{
if
(
stream_info
.
decoder
.
stream
)
{
if
(
FLAC__stream_decoder_get_state
(
stream_info
.
decoder
.
stream
)
!=
FLAC__STREAM_DECODER_UNINITIALIZED
)
...
...
@@ -422,7 +422,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
}
if
(
0
!=
stream_info
.
fout
&&
stream_info
.
fout
!=
stdout
)
fclose
(
stream_info
.
fout
);
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
.
is_ogg
)
{
if
(
0
!=
stream_info
.
fin
&&
stream_info
.
fin
!=
stdin
)
fclose
(
stream_info
.
fin
);
...
...
@@ -439,7 +439,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
}
return
0
;
raw_abort_:
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
.
is_ogg
)
{
if
(
stream_info
.
decoder
.
stream
)
{
if
(
FLAC__stream_decoder_get_state
(
stream_info
.
decoder
.
stream
)
!=
FLAC__STREAM_DECODER_UNINITIALIZED
)
...
...
@@ -460,7 +460,7 @@ raw_abort_:
fclose
(
stream_info
.
fout
);
unlink
(
outfilename
);
}
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
.
is_ogg
)
{
if
(
0
!=
stream_info
.
fin
&&
stream_info
.
fin
!=
stdin
)
fclose
(
stream_info
.
fin
);
...
...
@@ -477,7 +477,7 @@ FLAC__bool init(const char *infilename, stream_info_struct *stream_info)
is_big_endian_host
=
(
*
((
FLAC__byte
*
)(
&
test
)))
?
false
:
true
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
stream_info
->
is_ogg
)
{
stream_info
->
decoder
.
stream
=
FLAC__stream_decoder_new
();
...
...
@@ -557,7 +557,7 @@ FLAC__bool write_little_endian_uint32(FILE *f, FLAC__uint32 val)
return
fwrite
(
b
,
1
,
4
,
f
)
==
4
;
}
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
#define OGG_READ_BUFFER_SIZE 4096
FLAC__StreamDecoderReadStatus
read_callback
(
const
FLAC__StreamDecoder
*
decoder
,
FLAC__byte
buffer
[],
unsigned
*
bytes
,
void
*
client_data
)
{
...
...
src/flac/decode.h
View file @
aa07a760
...
...
@@ -23,7 +23,7 @@
typedef
struct
{
FLAC__bool
verbose
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
FLAC__bool
is_ogg
;
#endif
FLAC__uint64
skip
;
...
...
src/flac/encode.c
View file @
aa07a760
...
...
@@ -29,7 +29,7 @@
#include
"FLAC/all.h"
#include
"encode.h"
#include
"file.h"
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
#include
"ogg/ogg.h"
#endif
...
...
@@ -65,7 +65,7 @@ typedef struct {
FLAC__StreamDecoder
*
decoder
;
}
verify_fifo_struct
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
typedef
struct
{
ogg_stream_state
os
;
ogg_page
og
;
...
...
@@ -89,7 +89,7 @@ typedef struct {
FLAC__StreamMetaData_SeekTable
seek_table
;
unsigned
first_seek_point_to_check
;
FLAC__bool
use_ogg
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
ogg_info_struct
ogg
;
#endif
}
encoder_wrapper_struct
;
...
...
@@ -148,7 +148,7 @@ int flac__encode_wav(FILE *infile, long infilesize, const char *infilename, cons
encoder_wrapper
.
outfilename
=
outfilename
;
encoder_wrapper
.
seek_table
.
points
=
0
;
encoder_wrapper
.
first_seek_point_to_check
=
0
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
encoder_wrapper
.
use_ogg
=
options
.
common
.
use_ogg
;
#endif
(
void
)
infilesize
;
...
...
@@ -448,7 +448,7 @@ int flac__encode_wav(FILE *infile, long infilesize, const char *infilename, cons
if
(
FLAC__stream_encoder_get_state
(
encoder_wrapper
.
encoder
)
==
FLAC__STREAM_ENCODER_OK
)
FLAC__stream_encoder_finish
(
encoder_wrapper
.
encoder
);
FLAC__stream_encoder_delete
(
encoder_wrapper
.
encoder
);
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
encoder_wrapper
.
use_ogg
)
ogg_stream_clear
(
&
encoder_wrapper
.
ogg
.
os
);
#endif
...
...
@@ -481,7 +481,7 @@ wav_abort_:
if
(
FLAC__stream_encoder_get_state
(
encoder_wrapper
.
encoder
)
==
FLAC__STREAM_ENCODER_OK
)
FLAC__stream_encoder_finish
(
encoder_wrapper
.
encoder
);
FLAC__stream_encoder_delete
(
encoder_wrapper
.
encoder
);
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
encoder_wrapper
.
use_ogg
)
ogg_stream_clear
(
&
encoder_wrapper
.
ogg
.
os
);
#endif
...
...
@@ -518,7 +518,7 @@ int flac__encode_raw(FILE *infile, long infilesize, const char *infilename, cons
encoder_wrapper
.
outfilename
=
outfilename
;
encoder_wrapper
.
seek_table
.
points
=
0
;
encoder_wrapper
.
first_seek_point_to_check
=
0
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
encoder_wrapper
.
use_ogg
=
options
.
common
.
use_ogg
;
#endif
...
...
@@ -623,7 +623,7 @@ int flac__encode_raw(FILE *infile, long infilesize, const char *infilename, cons
if
(
FLAC__stream_encoder_get_state
(
encoder_wrapper
.
encoder
)
==
FLAC__STREAM_ENCODER_OK
)
FLAC__stream_encoder_finish
(
encoder_wrapper
.
encoder
);
FLAC__stream_encoder_delete
(
encoder_wrapper
.
encoder
);
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
encoder_wrapper
.
use_ogg
)
ogg_stream_clear
(
&
encoder_wrapper
.
ogg
.
os
);
#endif
...
...
@@ -652,7 +652,7 @@ raw_abort_:
if
(
FLAC__stream_encoder_get_state
(
encoder_wrapper
.
encoder
)
==
FLAC__STREAM_ENCODER_OK
)
FLAC__stream_encoder_finish
(
encoder_wrapper
.
encoder
);
FLAC__stream_encoder_delete
(
encoder_wrapper
.
encoder
);
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
encoder_wrapper
.
use_ogg
)
ogg_stream_clear
(
&
encoder_wrapper
.
ogg
.
os
);
#endif
...
...
@@ -689,7 +689,7 @@ FLAC__bool init(encoder_wrapper_struct *encoder_wrapper)
return
false
;
}
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
encoder_wrapper
->
use_ogg
)
{
if
(
ogg_stream_init
(
&
encoder_wrapper
->
ogg
.
os
,
0
)
!=
0
)
{
fprintf
(
stderr
,
"%s: ERROR initializing the Ogg stream
\n
"
,
encoder_wrapper
->
inbasefilename
);
...
...
@@ -1027,7 +1027,7 @@ FLAC__StreamEncoderWriteStatus write_callback(const FLAC__StreamEncoder *encoder
}
}
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
if
(
encoder_wrapper
->
use_ogg
)
{
ogg_packet
op
;
...
...
src/flac/encode.h
View file @
aa07a760
...
...
@@ -25,7 +25,7 @@ typedef struct {
FLAC__bool
verbose
;
FLAC__uint64
skip
;
FLAC__bool
verify
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
FLAC__bool
use_ogg
;
#endif
FLAC__bool
lax
;
...
...
src/flac/main.c
View file @
aa07a760
...
...
@@ -115,7 +115,7 @@ int main(int argc, char *argv[])
lax
=
true
;
else
if
(
0
==
strcmp
(
argv
[
i
],
"--lax-"
))
lax
=
false
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
else
if
(
0
==
strcmp
(
argv
[
i
],
"--ogg"
))
use_ogg
=
true
;
else
if
(
0
==
strcmp
(
argv
[
i
],
"--ogg-"
))
...
...
@@ -382,12 +382,12 @@ int main(int argc, char *argv[])
if
(
!
mode_decode
)
{
fprintf
(
stderr
,
"options:%s%s"
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
"%s"
#endif
"%s -P %u -b %u%s -l %u%s%s%s -q %u -r %u,%u -R %u%s
\n
"
,
delete_input
?
" --delete-input-file"
:
""
,
sector_align
?
" --sector-align"
:
""
,
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
use_ogg
?
" --ogg"
:
""
,
#endif
lax
?
" --lax"
:
""
,
...
...
@@ -540,7 +540,7 @@ int long_usage(const char *message, ...)
fprintf
(
out
,
" --a-rtext : include residual signal in text output
\n
"
);
fprintf
(
out
,
" --a-rgp : generate gnuplot files of residual distribution of each subframe
\n
"
);
fprintf
(
out
,
"encoding options:
\n
"
);
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
fprintf
(
out
,
" --ogg : output Ogg-FLAC stream instead of native FLAC
\n
"
);
#endif
fprintf
(
out
,
" --lax : allow encoder to generate non-Subset files
\n
"
);
...
...
@@ -589,7 +589,7 @@ int long_usage(const char *message, ...)
fprintf
(
out
,
" -V : verify a correct encoding by decoding the output in parallel and
\n
"
);
fprintf
(
out
,
" comparing to the original
\n
"
);
fprintf
(
out
,
" -S-, -m-, -M-, -e-, -E-, -p-, -V-, --delete-input-file-,%s --lax-, --sector-align-
\n
"
,
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
" --ogg-,"
#else
""
...
...
@@ -690,7 +690,7 @@ int encode_file(const char *infilename, const char *forced_outfilename, FLAC__bo
common_options
.
verbose
=
verbose
;
common_options
.
skip
=
skip
;
common_options
.
verify
=
verify
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
common_options
.
use_ogg
=
use_ogg
;
#endif
common_options
.
lax
=
lax
;
...
...
@@ -786,7 +786,7 @@ int decode_file(const char *infilename, const char *forced_outfilename)
else
treat_as_ogg
=
false
;
#ifndef FL
a
C__HAS_OGG
#ifndef FL
A
C__HAS_OGG
if
(
treat_as_ogg
)
{
fprintf
(
stderr
,
"%s: Ogg support has not been built into this copy of flac
\n
"
,
infilename
);
return
1
;
...
...
@@ -794,7 +794,7 @@ int decode_file(const char *infilename, const char *forced_outfilename)
#endif
common_options
.
verbose
=
verbose
;
#ifdef FL
a
C__HAS_OGG
#ifdef FL
A
C__HAS_OGG
common_options
.
is_ogg
=
treat_as_ogg
;
#endif
common_options
.
skip
=
skip
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment