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

Function add_av_stream

ffserver.c:3491–3531  ·  view source on GitHub ↗

return the stream number in the feed */

Source from the content-addressed store, hash-verified

3489
3490/* return the stream number in the feed */
3491static int add_av_stream(FFStream *feed, AVStream *st)
3492{
3493 AVStream *fst;
3494 AVCodecContext *av, *av1;
3495 int i;
3496
3497 av = st->codec;
3498 for(i=0;i<feed->nb_streams;i++) {
3499 st = feed->streams[i];
3500 av1 = st->codec;
3501 if (av1->codec_id == av->codec_id &&
3502 av1->codec_type == av->codec_type &&
3503 av1->bit_rate == av->bit_rate) {
3504
3505 switch(av->codec_type) {
3506 case AVMEDIA_TYPE_AUDIO:
3507 if (av1->channels == av->channels &&
3508 av1->sample_rate == av->sample_rate)
3509 goto found;
3510 break;
3511 case AVMEDIA_TYPE_VIDEO:
3512 if (av1->width == av->width &&
3513 av1->height == av->height &&
3514 av1->time_base.den == av->time_base.den &&
3515 av1->time_base.num == av->time_base.num &&
3516 av1->gop_size == av->gop_size)
3517 goto found;
3518 break;
3519 default:
3520 abort();
3521 }
3522 }
3523 }
3524
3525 fst = add_av_stream1(feed, av, 0);
3526 if (!fst)
3527 return -1;
3528 return feed->nb_streams - 1;
3529 found:
3530 return i;
3531}
3532
3533static void remove_stream(FFStream *stream)
3534{

Callers 1

build_feed_streamsFunction · 0.85

Calls 1

add_av_stream1Function · 0.85

Tested by

no test coverage detected