| 1189 | } |
| 1190 | |
| 1191 | static 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 | } |
no test coverage detected