Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flac
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Strogin
flac
Commits
e6c93ddf
Commit
e6c93ddf
authored
Sep 24, 2006
by
Josh Coalson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for --picture command to import PICTURE metadata
parent
5f427b3f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
src/flac/encode.c
src/flac/encode.c
+6
-2
src/flac/encode.h
src/flac/encode.h
+2
-0
src/flac/main.c
src/flac/main.c
+18
-0
No files found.
src/flac/encode.c
View file @
e6c93ddf
...
...
@@ -1441,13 +1441,15 @@ int EncoderSession_finish_error(EncoderSession *e)
FLAC__bool
EncoderSession_init_encoder
(
EncoderSession
*
e
,
encode_options_t
options
,
unsigned
channels
,
unsigned
bps
,
unsigned
sample_rate
,
FLACDecoderData
*
flac_decoder_data
)
{
unsigned
num_metadata
;
unsigned
num_metadata
,
i
;
FLAC__StreamMetadata
padding
,
*
cuesheet
=
0
;
FLAC__StreamMetadata
*
static_metadata
[
4
];
FLAC__StreamMetadata
*
static_metadata
[
4
+
64
];
/* MAGIC +64 is for pictures metadata in options.pictures */
FLAC__StreamMetadata
**
metadata
=
static_metadata
;
FLAC__StreamEncoderInitStatus
init_status
;
const
FLAC__bool
is_cdda
=
(
channels
==
1
||
channels
==
2
)
&&
(
bps
==
16
)
&&
(
sample_rate
==
44100
);
FLAC__ASSERT
(
sizeof
(
options
.
pictures
)
/
sizeof
(
options
.
pictures
[
0
])
<=
64
);
e
->
replay_gain
=
options
.
replay_gain
;
e
->
channels
=
channels
;
e
->
bits_per_sample
=
bps
;
...
...
@@ -1677,6 +1679,8 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio
if
(
0
!=
cuesheet
)
metadata
[
num_metadata
++
]
=
cuesheet
;
metadata
[
num_metadata
++
]
=
options
.
vorbis_comment
;
for
(
i
=
0
;
i
<
options
.
num_pictures
;
i
++
)
metadata
[
num_metadata
++
]
=
options
.
pictures
[
i
];
if
(
options
.
padding
!=
0
)
{
padding
.
is_last
=
false
;
/* the encoder will set this for us */
padding
.
type
=
FLAC__METADATA_TYPE_PADDING
;
...
...
src/flac/encode.h
View file @
e6c93ddf
...
...
@@ -69,6 +69,8 @@ typedef struct {
FLAC__bool
sector_align
;
FLAC__StreamMetadata
*
vorbis_comment
;
FLAC__StreamMetadata
*
pictures
[
64
];
unsigned
num_pictures
;
struct
{
FLAC__bool
disable_constant_subframes
;
...
...
src/flac/main.c
View file @
e6c93ddf
...
...
@@ -119,6 +119,7 @@ static struct share__option long_options_[] = {
*/
{
"cuesheet"
,
share__required_argument
,
0
,
0
},
{
"no-cued-seekpoints"
,
share__no_argument
,
0
,
0
},
{
"picture"
,
share__required_argument
,
0
,
0
},
{
"tag"
,
share__required_argument
,
0
,
'T'
},
{
"tag-from-file"
,
share__required_argument
,
0
,
0
},
{
"compression-level-0"
,
share__no_argument
,
0
,
'0'
},
...
...
@@ -260,6 +261,8 @@ static struct {
char
**
filenames
;
FLAC__StreamMetadata
*
vorbis_comment
;
FLAC__StreamMetadata
*
pictures
[
64
];
unsigned
num_pictures
;
struct
{
FLAC__bool
disable_constant_subframes
;
...
...
@@ -608,6 +611,7 @@ FLAC__bool init_options()
if
(
0
==
(
option_values
.
vorbis_comment
=
FLAC__metadata_object_new
(
FLAC__METADATA_TYPE_VORBIS_COMMENT
)))
return
false
;
option_values
.
num_pictures
=
0
;
option_values
.
debug
.
disable_constant_subframes
=
false
;
option_values
.
debug
.
disable_fixed_subframes
=
false
;
...
...
@@ -735,6 +739,15 @@ int parse_option(int short_option, const char *long_option, const char *option_a
FLAC__ASSERT
(
0
!=
option_argument
);
option_values
.
cuesheet_filename
=
option_argument
;
}
else
if
(
0
==
strcmp
(
long_option
,
"picture"
))
{
const
unsigned
max_pictures
=
sizeof
(
option_values
.
pictures
)
/
sizeof
(
option_values
.
pictures
[
0
]);
FLAC__ASSERT
(
0
!=
option_argument
);
if
(
option_values
.
num_pictures
>=
max_pictures
)
return
usage_error
(
"ERROR: too many --picture arguments, only %u allowed
\n
"
,
max_pictures
);
if
(
0
==
(
option_values
.
pictures
[
option_values
.
num_pictures
]
=
grabbag__picture_parse_specification
(
option_argument
,
&
violation
)))
return
usage_error
(
"ERROR: (--picture) %s
\n
"
,
violation
);
option_values
.
num_pictures
++
;
}
else
if
(
0
==
strcmp
(
long_option
,
"tag-from-file"
))
{
FLAC__ASSERT
(
0
!=
option_argument
);
if
(
!
flac__vorbiscomment_add
(
option_values
.
vorbis_comment
,
option_argument
,
/*value_from_file=*/
true
,
&
violation
))
...
...
@@ -1123,6 +1136,8 @@ void free_options()
}
if
(
0
!=
option_values
.
vorbis_comment
)
FLAC__metadata_object_delete
(
option_values
.
vorbis_comment
);
for
(
i
=
0
;
i
<
option_values
.
num_pictures
;
i
++
)
FLAC__metadata_object_delete
(
option_values
.
pictures
[
i
]);
}
int
usage_error
(
const
char
*
message
,
...)
...
...
@@ -1710,6 +1725,9 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
common_options
.
replay_gain
=
option_values
.
replay_gain
;
common_options
.
sector_align
=
option_values
.
sector_align
;
common_options
.
vorbis_comment
=
option_values
.
vorbis_comment
;
FLAC__ASSERT
(
sizeof
(
common_options
.
pictures
)
>=
sizeof
(
option_values
.
pictures
));
memcpy
(
common_options
.
pictures
,
option_values
.
pictures
,
sizeof
(
option_values
.
pictures
));
common_options
.
num_pictures
=
option_values
.
num_pictures
;
common_options
.
debug
.
disable_constant_subframes
=
option_values
.
debug
.
disable_constant_subframes
;
common_options
.
debug
.
disable_fixed_subframes
=
option_values
.
debug
.
disable_fixed_subframes
;
common_options
.
debug
.
disable_verbatim_subframes
=
option_values
.
debug
.
disable_verbatim_subframes
;
...
...
Write
Preview
Markdown
is supported
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