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

Function ost_add

fftools/ffmpeg_mux_init.c:1191–1601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1189}
1190
1191static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type,
1192 InputStream *ist, OutputFilter *ofilter, const ViewSpecifier *vs,
1193 OutputStream **post)
1194{
1195 AVFormatContext *oc = mux->fc;
1196 MuxStream *ms;
1197 OutputStream *ost;
1198 const AVCodec *enc;
1199 AVStream *st;
1200 SchedulerNode src = { .type = SCH_NODE_TYPE_NONE };
1201 AVDictionary *encoder_opts = NULL;
1202 int ret = 0, keep_pix_fmt = 0, autoscale = 1;
1203 int threads_manual = 0;
1204 AVRational enc_tb = { 0, 0 };
1205 enum VideoSyncMethod vsync_method = VSYNC_AUTO;
1206 const char *bsfs = NULL, *time_base = NULL, *codec_tag = NULL;
1207 char *next;
1208 double qscale = -1;
1209
1210 st = avformat_new_stream(oc, NULL);
1211 if (!st)
1212 return AVERROR(ENOMEM);
1213
1214 ms = mux_stream_alloc(mux, type);
1215 if (!ms)
1216 return AVERROR(ENOMEM);
1217
1218 // only streams with sources (i.e. not attachments)
1219 // are handled by the scheduler
1220 if (ist || ofilter) {
1221 ret = GROW_ARRAY(mux->sch_stream_idx, mux->nb_sch_stream_idx);
1222 if (ret < 0)
1223 return ret;
1224
1225 ret = sch_add_mux_stream(mux->sch, mux->sch_idx);
1226 if (ret < 0)
1227 return ret;
1228
1229 av_assert0(ret == mux->nb_sch_stream_idx - 1);
1230 mux->sch_stream_idx[ret] = ms->ost.index;
1231 ms->sch_idx = ret;
1232 }
1233
1234 ost = &ms->ost;
1235
1236 if (o->streamid) {
1237 AVDictionaryEntry *e;
1238 char idx[16], *p;
1239 snprintf(idx, sizeof(idx), "%d", ost->index);
1240
1241 e = av_dict_get(o->streamid, idx, NULL, 0);
1242 if (e) {
1243 st->id = strtol(e->value, &p, 0);
1244 if (!e->value[0] || *p) {
1245 av_log(ost, AV_LOG_FATAL, "Invalid stream id: %s\n", e->value);
1246 return AVERROR(EINVAL);
1247 }
1248 }

Callers 7

map_auto_videoFunction · 0.85
map_auto_audioFunction · 0.85
map_auto_subtitleFunction · 0.85
map_auto_dataFunction · 0.85
map_manualFunction · 0.85
of_add_attachmentsFunction · 0.85
create_streamsFunction · 0.85

Calls 15

avformat_new_streamFunction · 0.85
mux_stream_allocFunction · 0.85
sch_add_mux_streamFunction · 0.85
av_dict_getFunction · 0.85
av_logFunction · 0.85
avcodec_parameters_allocFunction · 0.85
choose_encoderFunction · 0.85
sch_add_encFunction · 0.85
enc_allocFunction · 0.85
av_strlcatFunction · 0.85
av_get_media_type_stringFunction · 0.85
av_packet_allocFunction · 0.85

Tested by

no test coverage detected