You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
fftools/textformat: Introduce common header and deduplicate code
Also change writer_printf signature in AVTextWriter to use va_list, so that it can be called by the new function writer_printf() in tf_internal.h. Reviewed-by: Stefano Sabatini <stefasab@gmail.com> Signed-off-by: softworkz <softworkz@hotmail.com>
This commit is contained in:
@ -36,7 +36,7 @@ typedef struct AVTextWriter {
|
||||
void (*uninit)(AVTextWriterContext *wctx);
|
||||
void (*writer_w8)(AVTextWriterContext *wctx, int b);
|
||||
void (*writer_put_str)(AVTextWriterContext *wctx, const char *str);
|
||||
void (*writer_printf)(AVTextWriterContext *wctx, const char *fmt, ...);
|
||||
void (*writer_vprintf)(AVTextWriterContext *wctx, const char *fmt, va_list vl);
|
||||
} AVTextWriter;
|
||||
|
||||
typedef struct AVTextWriterContext {
|
||||
|
@ -28,23 +28,7 @@
|
||||
#include "libavutil/bprint.h"
|
||||
#include "libavutil/error.h"
|
||||
#include "libavutil/opt.h"
|
||||
|
||||
|
||||
#define writer_w8(wctx_, b_) (wctx_)->writer->writer->writer_w8((wctx_)->writer, b_)
|
||||
#define writer_put_str(wctx_, str_) (wctx_)->writer->writer->writer_put_str((wctx_)->writer, str_)
|
||||
#define writer_printf(wctx_, fmt_, ...) (wctx_)->writer->writer->writer_printf((wctx_)->writer, fmt_, __VA_ARGS__)
|
||||
|
||||
|
||||
#define DEFINE_FORMATTER_CLASS(name) \
|
||||
static const char *name##_get_name(void *ctx) \
|
||||
{ \
|
||||
return #name ; \
|
||||
} \
|
||||
static const AVClass name##_class = { \
|
||||
.class_name = #name, \
|
||||
.item_name = name##_get_name, \
|
||||
.option = name##_options \
|
||||
}
|
||||
#include "tf_internal.h"
|
||||
|
||||
|
||||
/* Compact output */
|
||||
@ -157,9 +141,12 @@ static av_cold int compact_init(AVTextFormatContext *wctx)
|
||||
static void compact_print_section_header(AVTextFormatContext *wctx, const void *data)
|
||||
{
|
||||
CompactContext *compact = wctx->priv;
|
||||
const struct AVTextFormatSection *section = wctx->section[wctx->level];
|
||||
const struct AVTextFormatSection *parent_section = wctx->level ?
|
||||
wctx->section[wctx->level-1] : NULL;
|
||||
const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
|
||||
const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
|
||||
|
||||
if (!section)
|
||||
return;
|
||||
|
||||
compact->terminate_line[wctx->level] = 1;
|
||||
compact->has_nested_elems[wctx->level] = 0;
|
||||
|
||||
@ -208,8 +195,11 @@ static void compact_print_section_header(AVTextFormatContext *wctx, const void *
|
||||
|
||||
static void compact_print_section_footer(AVTextFormatContext *wctx)
|
||||
{
|
||||
const struct AVTextFormatSection *section = wctx->section[wctx->level];
|
||||
CompactContext *compact = wctx->priv;
|
||||
const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
|
||||
|
||||
if (!section)
|
||||
return;
|
||||
|
||||
if (!compact->nested_section[wctx->level] &&
|
||||
compact->terminate_line[wctx->level] &&
|
||||
|
@ -27,21 +27,7 @@
|
||||
#include "avtextformat.h"
|
||||
#include "libavutil/bprint.h"
|
||||
#include "libavutil/opt.h"
|
||||
|
||||
#define writer_w8(wctx_, b_) (wctx_)->writer->writer->writer_w8((wctx_)->writer, b_)
|
||||
#define writer_put_str(wctx_, str_) (wctx_)->writer->writer->writer_put_str((wctx_)->writer, str_)
|
||||
#define writer_printf(wctx_, fmt_, ...) (wctx_)->writer->writer->writer_printf((wctx_)->writer, fmt_, __VA_ARGS__)
|
||||
|
||||
#define DEFINE_FORMATTER_CLASS(name) \
|
||||
static const char *name##_get_name(void *ctx) \
|
||||
{ \
|
||||
return #name ; \
|
||||
} \
|
||||
static const AVClass name##_class = { \
|
||||
.class_name = #name, \
|
||||
.item_name = name##_get_name, \
|
||||
.option = name##_options \
|
||||
}
|
||||
#include "tf_internal.h"
|
||||
|
||||
/* Default output */
|
||||
|
||||
@ -80,9 +66,11 @@ static void default_print_section_header(AVTextFormatContext *wctx, const void *
|
||||
{
|
||||
DefaultContext *def = wctx->priv;
|
||||
char buf[32];
|
||||
const struct AVTextFormatSection *section = wctx->section[wctx->level];
|
||||
const struct AVTextFormatSection *parent_section = wctx->level ?
|
||||
wctx->section[wctx->level-1] : NULL;
|
||||
const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
|
||||
const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
|
||||
|
||||
if (!section)
|
||||
return;
|
||||
|
||||
av_bprint_clear(&wctx->section_pbuf[wctx->level]);
|
||||
if (parent_section &&
|
||||
@ -104,7 +92,8 @@ static void default_print_section_header(AVTextFormatContext *wctx, const void *
|
||||
static void default_print_section_footer(AVTextFormatContext *wctx)
|
||||
{
|
||||
DefaultContext *def = wctx->priv;
|
||||
const struct AVTextFormatSection *section = wctx->section[wctx->level];
|
||||
const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
|
||||
|
||||
char buf[32];
|
||||
|
||||
if (!section)
|
||||
|
@ -28,22 +28,7 @@
|
||||
#include "libavutil/bprint.h"
|
||||
#include "libavutil/error.h"
|
||||
#include "libavutil/opt.h"
|
||||
|
||||
#define writer_w8(wctx_, b_) (wctx_)->writer->writer->writer_w8((wctx_)->writer, b_)
|
||||
#define writer_put_str(wctx_, str_) (wctx_)->writer->writer->writer_put_str((wctx_)->writer, str_)
|
||||
#define writer_printf(wctx_, fmt_, ...) (wctx_)->writer->writer->writer_printf((wctx_)->writer, fmt_, __VA_ARGS__)
|
||||
|
||||
#define DEFINE_FORMATTER_CLASS(name) \
|
||||
static const char *name##_get_name(void *ctx) \
|
||||
{ \
|
||||
return #name ; \
|
||||
} \
|
||||
static const AVClass name##_class = { \
|
||||
.class_name = #name, \
|
||||
.item_name = name##_get_name, \
|
||||
.option = name##_options \
|
||||
}
|
||||
|
||||
#include "tf_internal.h"
|
||||
|
||||
/* Flat output */
|
||||
|
||||
@ -118,9 +103,11 @@ static void flat_print_section_header(AVTextFormatContext *wctx, const void *dat
|
||||
{
|
||||
FlatContext *flat = wctx->priv;
|
||||
AVBPrint *buf = &wctx->section_pbuf[wctx->level];
|
||||
const struct AVTextFormatSection *section = wctx->section[wctx->level];
|
||||
const struct AVTextFormatSection *parent_section = wctx->level ?
|
||||
wctx->section[wctx->level-1] : NULL;
|
||||
const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
|
||||
const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
|
||||
|
||||
if (!section)
|
||||
return;
|
||||
|
||||
/* build section header */
|
||||
av_bprint_clear(buf);
|
||||
|
@ -28,21 +28,7 @@
|
||||
|
||||
#include "libavutil/bprint.h"
|
||||
#include "libavutil/opt.h"
|
||||
|
||||
#define writer_w8(wctx_, b_) (wctx_)->writer->writer->writer_w8((wctx_)->writer, b_)
|
||||
#define writer_put_str(wctx_, str_) (wctx_)->writer->writer->writer_put_str((wctx_)->writer, str_)
|
||||
#define writer_printf(wctx_, fmt_, ...) (wctx_)->writer->writer->writer_printf((wctx_)->writer, fmt_, __VA_ARGS__)
|
||||
|
||||
#define DEFINE_FORMATTER_CLASS(name) \
|
||||
static const char *name##_get_name(void *ctx) \
|
||||
{ \
|
||||
return #name ; \
|
||||
} \
|
||||
static const AVClass name##_class = { \
|
||||
.class_name = #name, \
|
||||
.item_name = name##_get_name, \
|
||||
.option = name##_options \
|
||||
}
|
||||
#include "tf_internal.h"
|
||||
|
||||
/* Default output */
|
||||
|
||||
@ -104,9 +90,11 @@ static void ini_print_section_header(AVTextFormatContext *wctx, const void *data
|
||||
{
|
||||
INIContext *ini = wctx->priv;
|
||||
AVBPrint *buf = &wctx->section_pbuf[wctx->level];
|
||||
const struct AVTextFormatSection *section = wctx->section[wctx->level];
|
||||
const struct AVTextFormatSection *parent_section = wctx->level ?
|
||||
wctx->section[wctx->level-1] : NULL;
|
||||
const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
|
||||
const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
|
||||
|
||||
if (!section)
|
||||
return;
|
||||
|
||||
av_bprint_clear(buf);
|
||||
if (!parent_section) {
|
||||
|
85
fftools/textformat/tf_internal.h
Normal file
85
fftools/textformat/tf_internal.h
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) The FFmpeg developers
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Internal utilities for text formatters.
|
||||
*/
|
||||
|
||||
#ifndef FFTOOLS_TEXTFORMAT_TF_INTERNAL_H
|
||||
#define FFTOOLS_TEXTFORMAT_TF_INTERNAL_H
|
||||
|
||||
#include "avtextformat.h"
|
||||
|
||||
#define DEFINE_FORMATTER_CLASS(name) \
|
||||
static const char *name##_get_name(void *ctx) \
|
||||
{ \
|
||||
return #name ; \
|
||||
} \
|
||||
static const AVClass name##_class = { \
|
||||
.class_name = #name, \
|
||||
.item_name = name##_get_name, \
|
||||
.option = name##_options \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Safely validate and access a section at a given level
|
||||
*/
|
||||
static inline const AVTextFormatSection *tf_get_section(AVTextFormatContext *tfc, int level)
|
||||
{
|
||||
if (!tfc || level < 0 || level >= SECTION_MAX_NB_LEVELS || !tfc->section[level]) {
|
||||
if (tfc)
|
||||
av_log(tfc, AV_LOG_ERROR, "Invalid section access at level %d\n", level);
|
||||
return NULL;
|
||||
}
|
||||
return tfc->section[level];
|
||||
}
|
||||
|
||||
/**
|
||||
* Safely access the parent section
|
||||
*/
|
||||
static inline const AVTextFormatSection *tf_get_parent_section(AVTextFormatContext *tfc, int level)
|
||||
{
|
||||
if (level <= 0)
|
||||
return NULL;
|
||||
|
||||
return tf_get_section(tfc, level - 1);
|
||||
}
|
||||
|
||||
static inline void writer_w8(AVTextFormatContext *wctx, int b)
|
||||
{
|
||||
wctx->writer->writer->writer_w8(wctx->writer, b);
|
||||
}
|
||||
|
||||
static inline void writer_put_str(AVTextFormatContext *wctx, const char *str)
|
||||
{
|
||||
wctx->writer->writer->writer_put_str(wctx->writer, str);
|
||||
}
|
||||
|
||||
static inline void writer_printf(AVTextFormatContext *wctx, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
wctx->writer->writer->writer_vprintf(wctx->writer, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#endif /* FFTOOLS_TEXTFORMAT_TF_INTERNAL_H */
|
@ -27,22 +27,7 @@
|
||||
#include "avtextformat.h"
|
||||
#include "libavutil/bprint.h"
|
||||
#include "libavutil/opt.h"
|
||||
|
||||
#define writer_w8(wctx_, b_) (wctx_)->writer->writer->writer_w8((wctx_)->writer, b_)
|
||||
#define writer_put_str(wctx_, str_) (wctx_)->writer->writer->writer_put_str((wctx_)->writer, str_)
|
||||
#define writer_printf(wctx_, fmt_, ...) (wctx_)->writer->writer->writer_printf((wctx_)->writer, fmt_, __VA_ARGS__)
|
||||
|
||||
#define DEFINE_FORMATTER_CLASS(name) \
|
||||
static const char *name##_get_name(void *ctx) \
|
||||
{ \
|
||||
return #name ; \
|
||||
} \
|
||||
static const AVClass name##_class = { \
|
||||
.class_name = #name, \
|
||||
.item_name = name##_get_name, \
|
||||
.option = name##_options \
|
||||
}
|
||||
|
||||
#include "tf_internal.h"
|
||||
|
||||
/* JSON output */
|
||||
|
||||
@ -103,10 +88,13 @@ static const char *json_escape_str(AVBPrint *dst, const char *src, void *log_ctx
|
||||
|
||||
static void json_print_section_header(AVTextFormatContext *wctx, const void *data)
|
||||
{
|
||||
const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
|
||||
const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
|
||||
JSONContext *json = wctx->priv;
|
||||
AVBPrint buf;
|
||||
const AVTextFormatSection *section = wctx->section[wctx->level];
|
||||
const AVTextFormatSection *parent_section = wctx->level ? wctx->section[wctx->level - 1] : NULL;
|
||||
|
||||
if (!section)
|
||||
return;
|
||||
|
||||
if (wctx->level && wctx->nb_item[wctx->level - 1])
|
||||
writer_put_str(wctx, ",\n");
|
||||
@ -141,8 +129,11 @@ static void json_print_section_header(AVTextFormatContext *wctx, const void *dat
|
||||
|
||||
static void json_print_section_footer(AVTextFormatContext *wctx)
|
||||
{
|
||||
const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
|
||||
JSONContext *json = wctx->priv;
|
||||
const struct AVTextFormatSection *section = wctx->section[wctx->level];
|
||||
|
||||
if (!section)
|
||||
return;
|
||||
|
||||
if (wctx->level == 0) {
|
||||
json->indent_level--;
|
||||
@ -175,9 +166,12 @@ static inline void json_print_item_str(AVTextFormatContext *wctx,
|
||||
|
||||
static void json_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
|
||||
{
|
||||
const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
|
||||
const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
|
||||
JSONContext *json = wctx->priv;
|
||||
const struct AVTextFormatSection *parent_section = wctx->level ?
|
||||
wctx->section[wctx->level-1] : NULL;
|
||||
|
||||
if (!section)
|
||||
return;
|
||||
|
||||
if (wctx->nb_item[wctx->level] || (parent_section && parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE))
|
||||
writer_put_str(wctx, json->item_sep);
|
||||
@ -188,10 +182,14 @@ static void json_print_str(AVTextFormatContext *wctx, const char *key, const cha
|
||||
|
||||
static void json_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
|
||||
{
|
||||
const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
|
||||
const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
|
||||
JSONContext *json = wctx->priv;
|
||||
const AVTextFormatSection *parent_section = wctx->level ? wctx->section[wctx->level - 1] : NULL;
|
||||
AVBPrint buf;
|
||||
|
||||
if (!section)
|
||||
return;
|
||||
|
||||
if (wctx->nb_item[wctx->level] || (parent_section && parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE))
|
||||
writer_put_str(wctx, json->item_sep);
|
||||
if (!json->compact)
|
||||
@ -213,4 +211,3 @@ const AVTextFormatter avtextformatter_json = {
|
||||
.flags = AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT,
|
||||
.priv_class = &json_class,
|
||||
};
|
||||
|
||||
|
@ -25,21 +25,7 @@
|
||||
#include "libavutil/bprint.h"
|
||||
#include "libavutil/error.h"
|
||||
#include "libavutil/opt.h"
|
||||
|
||||
#define writer_w8(wctx_, b_) (wctx_)->writer->writer->writer_w8((wctx_)->writer, b_)
|
||||
#define writer_put_str(wctx_, str_) (wctx_)->writer->writer->writer_put_str((wctx_)->writer, str_)
|
||||
#define writer_printf(wctx_, fmt_, ...) (wctx_)->writer->writer->writer_printf((wctx_)->writer, fmt_, __VA_ARGS__)
|
||||
|
||||
#define DEFINE_FORMATTER_CLASS(name) \
|
||||
static const char *name##_get_name(void *ctx) \
|
||||
{ \
|
||||
return #name ; \
|
||||
} \
|
||||
static const AVClass name##_class = { \
|
||||
.class_name = #name, \
|
||||
.item_name = name##_get_name, \
|
||||
.option = name##_options \
|
||||
}
|
||||
#include "tf_internal.h"
|
||||
|
||||
/* XML output */
|
||||
|
||||
@ -90,9 +76,11 @@ static av_cold int xml_init(AVTextFormatContext *wctx)
|
||||
static void xml_print_section_header(AVTextFormatContext *wctx, const void *data)
|
||||
{
|
||||
XMLContext *xml = wctx->priv;
|
||||
const struct AVTextFormatSection *section = wctx->section[wctx->level];
|
||||
const struct AVTextFormatSection *parent_section = wctx->level ?
|
||||
wctx->section[wctx->level-1] : NULL;
|
||||
const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
|
||||
const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
|
||||
|
||||
if (!section)
|
||||
return;
|
||||
|
||||
if (wctx->level == 0) {
|
||||
const char *qual = " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
|
||||
@ -138,7 +126,10 @@ static void xml_print_section_header(AVTextFormatContext *wctx, const void *data
|
||||
static void xml_print_section_footer(AVTextFormatContext *wctx)
|
||||
{
|
||||
XMLContext *xml = wctx->priv;
|
||||
const struct AVTextFormatSection *section = wctx->section[wctx->level];
|
||||
const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
|
||||
|
||||
if (!section)
|
||||
return;
|
||||
|
||||
if (wctx->level == 0) {
|
||||
writer_printf(wctx, "</%sffprobe>\n", xml->fully_qualified ? "ffprobe:" : "");
|
||||
@ -158,7 +149,10 @@ static void xml_print_value(AVTextFormatContext *wctx, const char *key,
|
||||
{
|
||||
AVBPrint buf;
|
||||
XMLContext *xml = wctx->priv;
|
||||
const struct AVTextFormatSection *section = wctx->section[wctx->level];
|
||||
const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
|
||||
|
||||
if (!section)
|
||||
return;
|
||||
|
||||
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||
|
||||
@ -216,4 +210,3 @@ const AVTextFormatter avtextformatter_xml = {
|
||||
.flags = AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT,
|
||||
.priv_class = &xml_class,
|
||||
};
|
||||
|
||||
|
@ -57,14 +57,11 @@ static void io_put_str(AVTextWriterContext *wctx, const char *str)
|
||||
avio_write(ctx->avio_context, (const unsigned char *)str, (int)strlen(str));
|
||||
}
|
||||
|
||||
static void io_printf(AVTextWriterContext *wctx, const char *fmt, ...)
|
||||
static void io_vprintf(AVTextWriterContext *wctx, const char *fmt, va_list vl)
|
||||
{
|
||||
IOWriterContext *ctx = wctx->priv;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
avio_vprintf(ctx->avio_context, fmt, ap);
|
||||
va_end(ap);
|
||||
avio_vprintf(ctx->avio_context, fmt, vl);
|
||||
}
|
||||
|
||||
|
||||
@ -73,7 +70,7 @@ const AVTextWriter avtextwriter_avio = {
|
||||
.priv_size = sizeof(IOWriterContext),
|
||||
.uninit = iowriter_uninit,
|
||||
.writer_put_str = io_put_str,
|
||||
.writer_printf = io_printf,
|
||||
.writer_vprintf = io_vprintf,
|
||||
.writer_w8 = io_w8
|
||||
};
|
||||
|
||||
|
@ -56,14 +56,11 @@ static void buffer_put_str(AVTextWriterContext *wctx, const char *str)
|
||||
av_bprintf(ctx->buffer, "%s", str);
|
||||
}
|
||||
|
||||
static void buffer_printf(AVTextWriterContext *wctx, const char *fmt, ...)
|
||||
static void buffer_vprintf(AVTextWriterContext *wctx, const char *fmt, va_list vl)
|
||||
{
|
||||
BufferWriterContext *ctx = wctx->priv;
|
||||
|
||||
va_list vargs;
|
||||
va_start(vargs, fmt);
|
||||
av_vbprintf(ctx->buffer, fmt, vargs);
|
||||
va_end(vargs);
|
||||
av_vbprintf(ctx->buffer, fmt, vl);
|
||||
}
|
||||
|
||||
|
||||
@ -72,7 +69,7 @@ const AVTextWriter avtextwriter_buffer = {
|
||||
.priv_size = sizeof(BufferWriterContext),
|
||||
.priv_class = &bufferwriter_class,
|
||||
.writer_put_str = buffer_put_str,
|
||||
.writer_printf = buffer_printf,
|
||||
.writer_vprintf = buffer_vprintf,
|
||||
.writer_w8 = buffer_w8
|
||||
};
|
||||
|
||||
|
@ -53,13 +53,9 @@ static inline void stdout_put_str(AVTextWriterContext *wctx, const char *str)
|
||||
printf("%s", str);
|
||||
}
|
||||
|
||||
static inline void stdout_printf(AVTextWriterContext *wctx, const char *fmt, ...)
|
||||
static inline void stdout_vprintf(AVTextWriterContext *wctx, const char *fmt, va_list vl)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
vprintf(fmt, vl);
|
||||
}
|
||||
|
||||
|
||||
@ -68,7 +64,7 @@ static const AVTextWriter avtextwriter_stdout = {
|
||||
.priv_size = sizeof(StdOutWriterContext),
|
||||
.priv_class = &stdoutwriter_class,
|
||||
.writer_put_str = stdout_put_str,
|
||||
.writer_printf = stdout_printf,
|
||||
.writer_vprintf = stdout_vprintf,
|
||||
.writer_w8 = stdout_w8
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user