1
0
mirror of http://mpg123.de/trunk/.git synced 2025-08-06 10:02:38 +03:00

doc: more doxygen in examples, less warning

git-svn-id: svn://scm.orgis.org/mpg123/trunk@4841 35dc7657-300d-0410-a2e5-dc2837fedb53
This commit is contained in:
thor
2021-04-16 12:03:40 +00:00
parent 704bda6ace
commit 19dfcf6a33
4 changed files with 17 additions and 9 deletions

View File

@@ -10,7 +10,7 @@
#include "stdio.h" #include "stdio.h"
#include "sys/types.h" #include "sys/types.h"
/* Helper for v1 printing, get these strings their zero byte. */ /** Helper for v1 printing, get these strings their zero byte. */
void safe_print(char* name, char *data, size_t size) void safe_print(char* name, char *data, size_t size)
{ {
char safe[31]; char safe[31];
@@ -21,7 +21,7 @@ void safe_print(char* name, char *data, size_t size)
printf("%s: %s\n", name, safe); printf("%s: %s\n", name, safe);
} }
/* Print out ID3v1 info. */ /** Print out ID3v1 info. */
void print_v1(mpg123_id3v1 *v1) void print_v1(mpg123_id3v1 *v1)
{ {
safe_print("Title", v1->title, sizeof(v1->title)); safe_print("Title", v1->title, sizeof(v1->title));
@@ -32,7 +32,7 @@ void print_v1(mpg123_id3v1 *v1)
printf("Genre: %i", v1->genre); printf("Genre: %i", v1->genre);
} }
/* Split up a number of lines separated by \n, \r, both or just zero byte /** Split up a number of lines separated by \\n, \\r, both or just zero byte
and print out each line with specified prefix. */ and print out each line with specified prefix. */
void print_lines(const char* prefix, mpg123_string *inlines) void print_lines(const char* prefix, mpg123_string *inlines)
{ {
@@ -75,7 +75,7 @@ void print_lines(const char* prefix, mpg123_string *inlines)
} }
} }
/* Print out the named ID3v2 fields. */ /** Print out the named ID3v2 fields. */
void print_v2(mpg123_id3v2 *v2) void print_v2(mpg123_id3v2 *v2)
{ {
print_lines("Title: ", v2->title); print_lines("Title: ", v2->title);
@@ -86,7 +86,7 @@ void print_v2(mpg123_id3v2 *v2)
print_lines("Genre: ", v2->genre); print_lines("Genre: ", v2->genre);
} }
/* Print out all stored ID3v2 fields with their 4-character IDs. */ /** Print out all stored ID3v2 fields with their 4-character IDs. */
void print_raw_v2(mpg123_id3v2 *v2) void print_raw_v2(mpg123_id3v2 *v2)
{ {
size_t i; size_t i;
@@ -130,6 +130,7 @@ void print_raw_v2(mpg123_id3v2 *v2)
} }
} }
/** The whole operation. */
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int i; int i;

View File

@@ -13,6 +13,7 @@
#include <stdio.h> #include <stdio.h>
#include <strings.h> #include <strings.h>
/** Print usage info. */
void usage(const char *cmd) void usage(const char *cmd)
{ {
printf("Usage: %s <input> [<driver> [<output> [encoding [buffersize]]]]\n" printf("Usage: %s <input> [<driver> [<output> [encoding [buffersize]]]]\n"
@@ -22,6 +23,7 @@ void usage(const char *cmd)
exit(99); exit(99);
} }
/** Free handles. */
void cleanup(mpg123_handle *mh, out123_handle *ao) void cleanup(mpg123_handle *mh, out123_handle *ao)
{ {
out123_del(ao); out123_del(ao);
@@ -30,6 +32,7 @@ void cleanup(mpg123_handle *mh, out123_handle *ao)
mpg123_delete(mh); mpg123_delete(mh);
} }
/** The whole operation. */
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
mpg123_handle *mh = NULL; mpg123_handle *mh = NULL;

View File

@@ -21,9 +21,10 @@
#include <stdio.h> #include <stdio.h>
#define INBUFF 16384 #define INBUFF 16384 /**< input buffer size */
#define OUTBUFF 32768 #define OUTBUFF 32768 /**< output buffer size */
/** The whole operation. */
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
size_t size; size_t size;
@@ -76,12 +77,14 @@ _setmode(_fileno(stdout),_O_BINARY);
mpg123_getformat(m, &rate, &channels, &enc); mpg123_getformat(m, &rate, &channels, &enc);
fprintf(stderr, "New format: %li Hz, %i channels, encoding value %i\n", rate, channels, enc); fprintf(stderr, "New format: %li Hz, %i channels, encoding value %i\n", rate, channels, enc);
} }
write(1,out,size); if(write(1,out,size) != size)
fprintf(stderr, "Output truncated.\n");
outc += size; outc += size;
while(ret != MPG123_ERR && ret != MPG123_NEED_MORE) while(ret != MPG123_ERR && ret != MPG123_NEED_MORE)
{ /* Get all decoded audio that is available now before feeding more input. */ { /* Get all decoded audio that is available now before feeding more input. */
ret = mpg123_decode(m,NULL,0,out,OUTBUFF,&size); ret = mpg123_decode(m,NULL,0,out,OUTBUFF,&size);
write(1,out,size); if(write(1,out,size) != size)
fprintf(stderr, "Output truncated.\n");
outc += size; outc += size;
} }
if(ret == MPG123_ERR){ fprintf(stderr, "some error: %s", mpg123_strerror(m)); break; } if(ret == MPG123_ERR){ fprintf(stderr, "some error: %s", mpg123_strerror(m)); break; }

View File

@@ -12,6 +12,7 @@
#include <mpg123.h> #include <mpg123.h>
#include <stdio.h> #include <stdio.h>
/** The whole operation. */
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
mpg123_handle *m; mpg123_handle *m;