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_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 }
avtextwriter_stdout
static const AVTextWriter avtextwriter_stdout
Definition: tw_stdout.c:62
stdoutwriter_class
static const AVClass stdoutwriter_class
Definition: tw_stdout.c:41
printf
__device__ int printf(const char *,...)
opt.h
avtextwriter_create_stdout
int avtextwriter_create_stdout(AVTextWriterContext **pwctx)
Definition: tw_stdout.c:71
b
#define b
Definition: input.c:42
AVTextWriterContext
Definition: avtextwriters.h:42
stdoutwriter_get_name
static const char * stdoutwriter_get_name(void *ctx)
Definition: tw_stdout.c:36
stdout_vprintf
static void stdout_vprintf(AVTextWriterContext *wctx, const char *fmt, va_list vl)
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:76
writer_w8
static void writer_w8(AVTextFormatContext *wctx, int b)
Definition: tf_internal.h:63
AVTextWriter::name
const char * name
Definition: avtextwriters.h:33
WRITER_NAME
#define WRITER_NAME
Definition: tw_stdout.c:30
avtextwriter_context_open
int avtextwriter_context_open(AVTextWriterContext **pwctx, const AVTextWriter *writer)
Definition: avtextformat.c:640
AVTextWriter
Definition: avtextwriters.h:30
StdOutWriterContext
Definition: tw_stdout.c:32
writer_put_str
static void writer_put_str(AVTextFormatContext *wctx, const char *str)
Definition: tf_internal.h:68
stdout_put_str
static void stdout_put_str(AVTextWriterContext *wctx, const char *str)
Definition: tw_stdout.c:51
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:81
avtextwriters.h