FFmpeg
Loading...
Searching...
No Matches
tw_stdout.c
Go to the documentation of this file.
1/*
2 * Copyright (c) The FFmpeg developers
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <stdarg.h>
22#include <stdio.h>
23#include <string.h>
24
25#include "avtextwriters.h"
26#include "libavutil/opt.h"
27
28/* STDOUT Writer */
29
30# define WRITER_NAME "stdoutwriter"
31
32typedef struct StdOutWriterContext {
33 const AVClass *class;
35
36static const char *stdoutwriter_get_name(void *ctx)
37{
38 return WRITER_NAME;
39}
40
42 .class_name = WRITER_NAME,
43 .item_name = stdoutwriter_get_name,
44};
45
46static inline void stdout_w8(AVTextWriterContext *wctx, int b)
47{
48 printf("%c", b);
49}
50
51static inline void stdout_put_str(AVTextWriterContext *wctx, const char *str)
52{
53 printf("%s", str);
54}
55
56static inline void stdout_vprintf(AVTextWriterContext *wctx, const char *fmt, va_list vl)
57{
58 vprintf(fmt, vl);
59}
60
61
63 .name = WRITER_NAME,
64 .priv_size = sizeof(StdOutWriterContext),
65 .priv_class = &stdoutwriter_class,
67 .writer_vprintf = stdout_vprintf,
69};
70
72{
73 int ret;
74
76
77 return ret;
78}
static AVFormatContext * ctx
int avtextwriter_context_open(AVTextWriterContext **pwctx, const AVTextWriter *writer)
__device__ int printf(const char *,...)
#define b
Definition input.c:43
AVOptions.
Describe the class of an AVClass context structure.
Definition log.h:76
static void writer_w8(AVTextFormatContext *wctx, int b)
Definition tf_internal.h:63
static void writer_put_str(AVTextFormatContext *wctx, const char *str)
Definition tf_internal.h:68
#define WRITER_NAME
Definition tw_avio.c:32
static const char * stdoutwriter_get_name(void *ctx)
Definition tw_stdout.c:36
static void stdout_put_str(AVTextWriterContext *wctx, const char *str)
Definition tw_stdout.c:51
static void stdout_w8(AVTextWriterContext *wctx, int b)
Definition tw_stdout.c:46
int avtextwriter_create_stdout(AVTextWriterContext **pwctx)
Definition tw_stdout.c:71
static void stdout_vprintf(AVTextWriterContext *wctx, const char *fmt, va_list vl)
Definition tw_stdout.c:56
static const AVClass stdoutwriter_class
Definition tw_stdout.c:41
static const AVTextWriter avtextwriter_stdout
Definition tw_stdout.c:62