| 2029 | } |
| 2030 | |
| 2031 | static void add_stream_to_programs(AVFormatContext *s, struct playlist *pls, AVStream *stream) |
| 2032 | { |
| 2033 | HLSContext *c = s->priv_data; |
| 2034 | int i, j; |
| 2035 | int bandwidth = -1; |
| 2036 | |
| 2037 | for (i = 0; i < c->n_variants; i++) { |
| 2038 | struct variant *v = c->variants[i]; |
| 2039 | |
| 2040 | for (j = 0; j < v->n_playlists; j++) { |
| 2041 | if (v->playlists[j] != pls) |
| 2042 | continue; |
| 2043 | |
| 2044 | av_program_add_stream_index(s, i, stream->index); |
| 2045 | |
| 2046 | if (bandwidth < 0) |
| 2047 | bandwidth = v->bandwidth; |
| 2048 | else if (bandwidth != v->bandwidth) |
| 2049 | bandwidth = -1; /* stream in multiple variants with different bandwidths */ |
| 2050 | } |
| 2051 | } |
| 2052 | |
| 2053 | if (bandwidth >= 0) |
| 2054 | av_dict_set_int(&stream->metadata, "variant_bitrate", bandwidth, 0); |
| 2055 | } |
| 2056 | |
| 2057 | static int set_stream_info_from_input_stream(AVStream *st, struct playlist *pls, AVStream *ist) |
| 2058 | { |
no test coverage detected