MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / avformat_alloc_output_context2

Function avformat_alloc_output_context2

libavformat/mux.c:95–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95int avformat_alloc_output_context2(AVFormatContext **avctx, const AVOutputFormat *oformat,
96 const char *format, const char *filename)
97{
98 AVFormatContext *s = avformat_alloc_context();
99 int ret = 0;
100
101 *avctx = NULL;
102 if (!s)
103 goto nomem;
104
105 if (!oformat) {
106 if (format) {
107 oformat = av_guess_format(format, NULL, NULL);
108 if (!oformat) {
109 av_log(s, AV_LOG_ERROR, "Requested output format '%s' is not known.\n", format);
110 ret = AVERROR(EINVAL);
111 goto error;
112 }
113 } else {
114 oformat = av_guess_format(NULL, filename, NULL);
115 if (!oformat) {
116 ret = AVERROR(EINVAL);
117 av_log(s, AV_LOG_ERROR,
118 "Unable to choose an output format for '%s'; "
119 "use a standard extension for the filename or specify "
120 "the format manually.\n", filename);
121 goto error;
122 }
123 }
124 }
125
126 s->oformat = oformat;
127 if (ffofmt(s->oformat)->priv_data_size > 0) {
128 s->priv_data = av_mallocz(ffofmt(s->oformat)->priv_data_size);
129 if (!s->priv_data)
130 goto nomem;
131 if (s->oformat->priv_class) {
132 *(const AVClass**)s->priv_data= s->oformat->priv_class;
133 av_opt_set_defaults(s->priv_data);
134 }
135 } else
136 s->priv_data = NULL;
137
138 if (filename) {
139 if (!(s->url = av_strdup(filename)))
140 goto nomem;
141
142 }
143 *avctx = s;
144 return 0;
145nomem:
146 av_log(s, AV_LOG_ERROR, "Out of memory\n");
147 ret = AVERROR(ENOMEM);
148error:
149 avformat_free_context(s);
150 return ret;
151}
152

Callers 15

mainFunction · 0.85
hls_mux_initFunction · 0.85
webm_chunk_initFunction · 0.85
open_slaveFunction · 0.85
write_muxed_fileFunction · 0.85
mov_init_ttml_writerFunction · 0.85
segment_mux_initFunction · 0.85
fifo_mux_initFunction · 0.85
of_openFunction · 0.85
mainFunction · 0.85

Calls 8

avformat_alloc_contextFunction · 0.85
av_guess_formatFunction · 0.85
av_logFunction · 0.85
ffofmtFunction · 0.85
av_opt_set_defaultsFunction · 0.85
av_strdupFunction · 0.85
avformat_free_contextFunction · 0.85
av_malloczFunction · 0.50

Tested by 1