Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
liboggz
Commits
af527ca4
Commit
af527ca4
authored
May 12, 2009
by
ogg.k.ogg.k
Committed by
conrad
May 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
codecs can be displayed by their name or MIME type, and on separate lines or on a single line.
parent
ec1ff860
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
doc/oggz-codecs.1
doc/oggz-codecs.1
+3
-1
src/tools/oggz-codecs.c
src/tools/oggz-codecs.c
+18
-5
No files found.
doc/oggz-codecs.1
View file @
af527ca4
...
...
@@ -4,7 +4,7 @@ oggz-info \(em Display a list of codecs found in one or more Ogg files and their
.SH "SYNOPSIS"
.PP
\fBoggz-codecs\fR [\-a | \-\-all ] [\-m | \-\-mime ] filename \&...
\fBoggz-codecs\fR [\-a | \-\-all ] [\-m | \-\-mime ]
[\-1 | \-\-one\-per\-line]
filename \&...
.PP
\fBoggz-codecs\fR [\-h | \-\-help ] [\-v | \-\-version ]
.SH "Description"
...
...
@@ -21,6 +21,8 @@ Ogg files and their bitstreams.
Display an entry for every bitstream, rather than displaying each codec once, even if present more than once.
.IP "\-m, \-\-mime" 10
Display each codec's MIME type, instead of its name.
.IP "\-1, \-\-one\-per\-line" 10
Display each entries on a separate line.
.SS "Miscellaneous options"
.IP "\-h, \-\-help" 10
Display usage information and exit.
...
...
src/tools/oggz-codecs.c
View file @
af527ca4
...
...
@@ -35,6 +35,7 @@
#include <string.h>
#include <limits.h>
/* LONG_MAX */
#include <math.h>
#include <ctype.h>
#include <getopt.h>
#include <errno.h>
...
...
@@ -53,6 +54,7 @@
static
int
show_all
=
0
;
static
int
show_as_mime
=
0
;
static
int
show_one_per_line
=
0
;
/* Assumes UNKNOWN is last - fair assumption I think */
static
int
codecs_count
[
OGGZ_CONTENT_UNKNOWN
+
1
]
=
{
0
};
...
...
@@ -64,7 +66,8 @@ usage (const char * progname)
printf
(
"Display codecs used in one or more Ogg files and their bitstreams
\n
"
);
printf
(
"
\n
Display options
\n
"
);
printf
(
" -a, --all Display an entry for all bitstreams, rather than collapsing codecs used more than once
\n
"
);
printf
(
" -m, --mime Displays entries on a single line, separated by commas
\n
"
);
printf
(
" -m, --mime Displays MIME types rather than codec names
\n
"
);
printf
(
" -1, --one-per-line Displays one entry per line
\n
"
);
printf
(
"
\n
Miscellaneous options
\n
"
);
printf
(
" -h, --help Display this help and exit
\n
"
);
printf
(
" -v, --version Output version information and exit
\n
"
);
...
...
@@ -100,20 +103,26 @@ oggz_info_apply (OI_TrackFunc func, OI_Info * info)
static
void
print_codec_name
(
OI_Info
*
info
,
long
serialno
)
{
static
int
displayed_once
=
0
;
OggzStreamContent
content
=
oggz_stream_get_content
(
info
->
oggz
,
serialno
);
if
(
!
codecs_count
[
content
]
++
||
show_all
)
{
if
(
displayed_once
&&
!
show_one_per_line
)
{
printf
(
", "
);
}
if
(
show_as_mime
)
{
const
char
*
mime_type
=
NULL
;
if
(
content
>=
0
&&
content
<
OGGZ_CONTENT_UNKNOWN
)
mime_type
=
mime_type_names
[
content
];
if
(
!
mime_type
)
mime_type
=
"application/octet-stream"
;
printf
(
"%s
\n
"
,
mime_type
);
printf
(
"%s
%s
"
,
mime_type
,
show_one_per_line
?
"
\n
"
:
""
);
}
else
{
const
char
*
codec_name
=
oggz_content_type
(
content
);
const
char
*
codec_name
=
oggz_content_type
(
content
)
,
*
ptr
;
if
(
!
codec_name
)
codec_name
=
"unknown"
;
printf
(
"%s
\n
"
,
codec_name
);
for
(
ptr
=
codec_name
;
*
ptr
;
++
ptr
)
putchar
(
tolower
(
*
ptr
));
if
(
show_one_per_line
)
putchar
(
'\n'
);
}
displayed_once
=
1
;
}
}
...
...
@@ -159,7 +168,7 @@ main (int argc, char ** argv)
OGGZ
*
oggz
;
OI_Info
info
;
char
*
optstring
=
"hvam"
;
char
*
optstring
=
"hvam
1
"
;
#ifdef HAVE_GETOPT_LONG
static
struct
option
long_options
[]
=
{
...
...
@@ -167,6 +176,7 @@ main (int argc, char ** argv)
{
"version"
,
no_argument
,
0
,
'v'
},
{
"all"
,
no_argument
,
0
,
'a'
},
{
"mime"
,
no_argument
,
0
,
'm'
},
{
"one-line"
,
no_argument
,
0
,
'1'
},
{
NULL
,
0
,
0
,
0
}
};
#endif
...
...
@@ -212,6 +222,9 @@ main (int argc, char ** argv)
case
'm'
:
show_as_mime
=
1
;
break
;
case
'1'
:
show_one_per_line
=
1
;
break
;
default:
break
;
}
...
...
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