FFmpeg
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 
32 typedef struct StdOutWriterContext {
33  const AVClass *class;
35 
36 static const char *stdoutwriter_get_name(void *ctx)
37 {
38  return WRITER_NAME;
39 }
40 
41 static const AVClass stdoutwriter_class = {
43  .item_name = stdoutwriter_get_name,
44 };
45 
46 static inline void stdout_w8(AVTextWriterContext *wctx, int b)
47 {
48  printf("%c", b);
49 }
50 
51 static inline void stdout_put_str(AVTextWriterContext *wctx, const char *str)
52 {
53  printf("%s", str);
54 }
55 
56 static inline void stdout_printf(AVTextWriterContext *wctx, const char *fmt, ...)
57 {
58  va_list ap;
59 
60  va_start(ap, fmt);
61  vprintf(fmt, ap);
62  va_end(ap);
63 }
64 
65 
67  .name = WRITER_NAME,
68  .priv_size = sizeof(StdOutWriterContext),
69  .priv_class = &stdoutwriter_class,
73 };
74 
76 {
77  int ret;
78 
80 
81  return ret;
82 }
avtextwriter_stdout
static const AVTextWriter avtextwriter_stdout
Definition: tw_stdout.c:66
stdoutwriter_class
static const AVClass stdoutwriter_class
Definition: tw_stdout.c:41
opt.h
avtextwriter_create_stdout
int avtextwriter_create_stdout(AVTextWriterContext **pwctx)
Definition: tw_stdout.c:75
b
#define b
Definition: input.c:42
AVTextWriterContext
Definition: avtextwriters.h:47
stdoutwriter_get_name
static const char * stdoutwriter_get_name(void *ctx)
Definition: tw_stdout.c:36
stdout_printf
static void stdout_printf(AVTextWriterContext *wctx, const char *fmt,...)
Definition: tw_stdout.c:56
ctx
AVFormatContext * ctx
Definition: movenc.c:49
stdout_w8
static void stdout_w8(AVTextWriterContext *wctx, int b)
Definition: tw_stdout.c:46
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
AVTextWriter::name
const char * name
Definition: avtextwriters.h:38
WRITER_NAME
#define WRITER_NAME
Definition: tw_stdout.c:30
writer_w8
#define writer_w8(wctx_, b_)
Definition: tf_compact.c:36
avtextwriter_context_open
int avtextwriter_context_open(AVTextWriterContext **pwctx, const AVTextWriter *writer)
Definition: avtextformat.c:604
AVTextWriter
Definition: avtextwriters.h:35
StdOutWriterContext
Definition: tw_stdout.c:32
printf
printf("static const uint8_t my_array[100] = {\n")
stdout_put_str
static void stdout_put_str(AVTextWriterContext *wctx, const char *str)
Definition: tw_stdout.c:51
writer_put_str
#define writer_put_str(wctx_, str_)
Definition: tf_compact.c:37
ret
ret
Definition: filter_design.txt:187
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:80
avtextwriters.h
writer_printf
#define writer_printf(wctx_, fmt_,...)
Definition: tf_compact.c:38