[FFmpeg-cvslog] ffprobe: add "nokey" option to default writer
Stefano Sabatini
git at videolan.org
Mon May 14 13:01:37 CEST 2012
ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Thu May 10 01:28:07 2012 +0200| [3946187d60b87163b17cc5ca6d63ce0ddf4111af] | committer: Stefano Sabatini
ffprobe: add "nokey" option to default writer
Help simplifying parsing in certain cases.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3946187d60b87163b17cc5ca6d63ce0ddf4111af
---
doc/ffprobe.texi | 5 ++++-
ffprobe.c | 14 ++++++++++++--
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi
index a1af680..2d87c9a 100644
--- a/doc/ffprobe.texi
+++ b/doc/ffprobe.texi
@@ -202,10 +202,13 @@ A description of the accepted options follows.
@table @option
+ at item nokey, nk
+If set to 1 specify not to print the key of each field. Default value
+is 0.
+
@item noprint_wrappers, nw
If set to 1 specify not to print the section header and footer.
Default value is 0.
-
@end table
@section compact
diff --git a/ffprobe.c b/ffprobe.c
index 5a8c9e8..d3cad33 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -403,6 +403,7 @@ fail:
typedef struct DefaultContext {
const AVClass *class;
+ int nokey;
int noprint_wrappers;
} DefaultContext;
@@ -411,6 +412,8 @@ typedef struct DefaultContext {
static const AVOption default_options[] = {
{ "noprint_wrappers", "do not print headers and footers", OFFSET(noprint_wrappers), AV_OPT_TYPE_INT, {.dbl=0}, 0, 1 },
{ "nw", "do not print headers and footers", OFFSET(noprint_wrappers), AV_OPT_TYPE_INT, {.dbl=0}, 0, 1 },
+ { "nokey", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_INT, {.dbl=0}, 0, 1 },
+ { "nk", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_INT, {.dbl=0}, 0, 1 },
{NULL},
};
@@ -490,12 +493,19 @@ static void default_print_section_footer(WriterContext *wctx, const char *sectio
static void default_print_str(WriterContext *wctx, const char *key, const char *value)
{
- printf("%s=%s\n", key, value);
+ DefaultContext *def = wctx->priv;
+ if (!def->nokey)
+ printf("%s=", key);
+ printf("%s\n", value);
}
static void default_print_int(WriterContext *wctx, const char *key, long long int value)
{
- printf("%s=%lld\n", key, value);
+ DefaultContext *def = wctx->priv;
+
+ if (!def->nokey)
+ printf("%s=", key);
+ printf("%lld\n", value);
}
static void default_show_tags(WriterContext *wctx, AVDictionary *dict)
More information about the ffmpeg-cvslog
mailing list