Line |
Branch |
Exec |
Source |
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; |
34 |
|
|
} StdOutWriterContext; |
35 |
|
|
|
36 |
|
✗ |
static const char *stdoutwriter_get_name(void *ctx) |
37 |
|
|
{ |
38 |
|
✗ |
return WRITER_NAME; |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
static const AVClass stdoutwriter_class = { |
42 |
|
|
.class_name = WRITER_NAME, |
43 |
|
|
.item_name = stdoutwriter_get_name, |
44 |
|
|
}; |
45 |
|
|
|
46 |
|
61066 |
static inline void stdout_w8(AVTextWriterContext *wctx, int b) |
47 |
|
|
{ |
48 |
|
61066 |
printf("%c", b); |
49 |
|
61066 |
} |
50 |
|
|
|
51 |
|
31474 |
static inline void stdout_put_str(AVTextWriterContext *wctx, const char *str) |
52 |
|
|
{ |
53 |
|
31474 |
printf("%s", str); |
54 |
|
31474 |
} |
55 |
|
|
|
56 |
|
136321 |
static inline void stdout_printf(AVTextWriterContext *wctx, const char *fmt, ...) |
57 |
|
|
{ |
58 |
|
|
va_list ap; |
59 |
|
|
|
60 |
|
136321 |
va_start(ap, fmt); |
61 |
|
136321 |
vprintf(fmt, ap); |
62 |
|
136321 |
va_end(ap); |
63 |
|
136321 |
} |
64 |
|
|
|
65 |
|
|
|
66 |
|
|
static const AVTextWriter avtextwriter_stdout = { |
67 |
|
|
.name = WRITER_NAME, |
68 |
|
|
.priv_size = sizeof(StdOutWriterContext), |
69 |
|
|
.priv_class = &stdoutwriter_class, |
70 |
|
|
.writer_put_str = stdout_put_str, |
71 |
|
|
.writer_printf = stdout_printf, |
72 |
|
|
.writer_w8 = stdout_w8 |
73 |
|
|
}; |
74 |
|
|
|
75 |
|
156 |
int avtextwriter_create_stdout(AVTextWriterContext **pwctx) |
76 |
|
|
{ |
77 |
|
|
int ret; |
78 |
|
|
|
79 |
|
156 |
ret = avtextwriter_context_open(pwctx, &avtextwriter_stdout); |
80 |
|
|
|
81 |
|
156 |
return ret; |
82 |
|
|
} |
83 |
|
|
|