mirror of
https://github.com/fmang/opustags.git
synced 2025-01-16 05:03:13 +01:00
move print_tags in the main module
That's where it belongs. The other modules are not supposed to write anything to the console.
This commit is contained in:
parent
1744cab9ed
commit
cc5896b1a0
@ -134,11 +134,3 @@ int ot::add_tags(opus_tags *tags, const char **tags_to_add, uint32_t count)
|
||||
tags->comments.emplace_back(tags_to_add[i]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ot::print_tags(opus_tags *tags)
|
||||
{
|
||||
for (const string_view &comment : tags->comments) {
|
||||
fwrite(comment.data(), 1, comment.size(), stdout);
|
||||
puts("");
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,23 @@ struct option options[] = {
|
||||
{NULL, 0, 0, 0}
|
||||
};
|
||||
|
||||
/**
|
||||
* Display the tags on stdout.
|
||||
*
|
||||
* Print all the comments, separated by line breaks. Since a comment may
|
||||
* contain line breaks, this output is not completely reliable, but it fits
|
||||
* most cases.
|
||||
*
|
||||
* Only the comments are displayed.
|
||||
*/
|
||||
static void print_tags(ot::opus_tags &tags)
|
||||
{
|
||||
for (const ot::string_view &comment : tags.comments) {
|
||||
fwrite(comment.data(), 1, comment.size(), stdout);
|
||||
puts("");
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv){
|
||||
if(argc == 1){
|
||||
fputs(version, stdout);
|
||||
@ -299,7 +316,7 @@ int main(int argc, char **argv){
|
||||
free(packet.packet);
|
||||
}
|
||||
else
|
||||
ot::print_tags(&tags);
|
||||
print_tags(tags);
|
||||
if(raw_tags)
|
||||
free(raw_tags);
|
||||
if(error || !out)
|
||||
|
@ -87,7 +87,6 @@ int parse_tags(const char *data, long len, opus_tags *tags);
|
||||
int render_tags(opus_tags *tags, ogg_packet *op);
|
||||
void delete_tags(opus_tags *tags, const char *field);
|
||||
int add_tags(opus_tags *tags, const char **tags_to_add, uint32_t count);
|
||||
void print_tags(opus_tags *tags);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user