• Home
  • Raw
  • Download

Lines Matching refs:pls

252 static int64_t get_segment_start_time_based_on_timeline(struct representation *pls, int64_t cur_seq…  in get_segment_start_time_based_on_timeline()  argument
259 if (pls->n_timelines) { in get_segment_start_time_based_on_timeline()
260 for (i = 0; i < pls->n_timelines; i++) { in get_segment_start_time_based_on_timeline()
261 if (pls->timelines[i]->starttime > 0) { in get_segment_start_time_based_on_timeline()
262 start_time = pls->timelines[i]->starttime; in get_segment_start_time_based_on_timeline()
267 start_time += pls->timelines[i]->duration; in get_segment_start_time_based_on_timeline()
269 if (pls->timelines[i]->repeat == -1) { in get_segment_start_time_based_on_timeline()
270 start_time = pls->timelines[i]->duration * cur_seq_no; in get_segment_start_time_based_on_timeline()
274 for (j = 0; j < pls->timelines[i]->repeat; j++) { in get_segment_start_time_based_on_timeline()
278 start_time += pls->timelines[i]->duration; in get_segment_start_time_based_on_timeline()
287 static int64_t calc_next_seg_no_from_timelines(struct representation *pls, int64_t cur_time) in calc_next_seg_no_from_timelines() argument
294 for (i = 0; i < pls->n_timelines; i++) { in calc_next_seg_no_from_timelines()
295 if (pls->timelines[i]->starttime > 0) { in calc_next_seg_no_from_timelines()
296 start_time = pls->timelines[i]->starttime; in calc_next_seg_no_from_timelines()
301 start_time += pls->timelines[i]->duration; in calc_next_seg_no_from_timelines()
302 for (j = 0; j < pls->timelines[i]->repeat; j++) { in calc_next_seg_no_from_timelines()
306 start_time += pls->timelines[i]->duration; in calc_next_seg_no_from_timelines()
326 static void free_fragment_list(struct representation *pls) in free_fragment_list() argument
330 for (i = 0; i < pls->n_fragments; i++) { in free_fragment_list()
331 free_fragment(&pls->fragments[i]); in free_fragment_list()
333 av_freep(&pls->fragments); in free_fragment_list()
334 pls->n_fragments = 0; in free_fragment_list()
337 static void free_timelines_list(struct representation *pls) in free_timelines_list() argument
341 for (i = 0; i < pls->n_timelines; i++) { in free_timelines_list()
342 av_freep(&pls->timelines[i]); in free_timelines_list()
344 av_freep(&pls->timelines); in free_timelines_list()
345 pls->n_timelines = 0; in free_timelines_list()
348 static void free_representation(struct representation *pls) in free_representation() argument
350 free_fragment_list(pls); in free_representation()
351 free_timelines_list(pls); in free_representation()
352 free_fragment(&pls->cur_seg); in free_representation()
353 free_fragment(&pls->init_section); in free_representation()
354 av_freep(&pls->init_sec_buf); in free_representation()
355 av_freep(&pls->pb.buffer); in free_representation()
356 ff_format_io_close(pls->parent, &pls->input); in free_representation()
357 if (pls->ctx) { in free_representation()
358 pls->ctx->pb = NULL; in free_representation()
359 avformat_close_input(&pls->ctx); in free_representation()
362 av_freep(&pls->url_template); in free_representation()
363 av_freep(&pls->lang); in free_representation()
364 av_freep(&pls->id); in free_representation()
365 av_freep(&pls); in free_representation()
372 struct representation *pls = c->videos[i]; in free_video_list() local
373 free_representation(pls); in free_video_list()
383 struct representation *pls = c->audios[i]; in free_audio_list() local
384 free_representation(pls); in free_audio_list()
394 struct representation *pls = c->subtitles[i]; in free_subtitle_list() local
395 free_representation(pls); in free_subtitle_list()
1376 static int64_t calc_cur_seg_no(AVFormatContext *s, struct representation *pls) in calc_cur_seg_no() argument
1383 if (pls->n_fragments) { in calc_cur_seg_no()
1385 num = pls->first_seq_no; in calc_cur_seg_no()
1386 } else if (pls->n_timelines) { in calc_cur_seg_no()
1388 …start_time_offset = get_segment_start_time_based_on_timeline(pls, 0xFFFFFFFF) - 60 * pls->fragment… in calc_cur_seg_no()
1389 num = calc_next_seg_no_from_timelines(pls, start_time_offset); in calc_cur_seg_no()
1391 num = pls->first_seq_no; in calc_cur_seg_no()
1393 num += pls->first_seq_no; in calc_cur_seg_no()
1394 } else if (pls->fragment_duration){ in calc_cur_seg_no()
1395 …imescale = %"PRId64", presentation_timeoffset = %"PRId64"\n", pls->fragment_timescale, pls->presen… in calc_cur_seg_no()
1396 if (pls->presentation_timeoffset) { in calc_cur_seg_no()
1397 …num = pls->first_seq_no + (((get_current_time_in_sec() - c->availability_start_time) * pls->fragme… in calc_cur_seg_no()
1400 …num = pls->first_seq_no + (((c->publish_time + pls->fragment_duration) - c->suggested_presentation… in calc_cur_seg_no()
1402pls->first_seq_no + (((c->publish_time - c->time_shift_buffer_depth + pls->fragment_duration) - c-… in calc_cur_seg_no()
1405 … = pls->first_seq_no + (((get_current_time_in_sec() - c->availability_start_time) - c->suggested_p… in calc_cur_seg_no()
1409 num = pls->first_seq_no; in calc_cur_seg_no()
1414 static int64_t calc_min_seg_no(AVFormatContext *s, struct representation *pls) in calc_min_seg_no() argument
1419 if (c->is_live && pls->fragment_duration) { in calc_min_seg_no()
1421 …num = pls->first_seq_no + (((get_current_time_in_sec() - c->availability_start_time) - c->time_shi… in calc_min_seg_no()
1423 num = pls->first_seq_no; in calc_min_seg_no()
1428 static int64_t calc_max_seg_no(struct representation *pls, DASHContext *c) in calc_max_seg_no() argument
1432 if (pls->n_fragments) { in calc_max_seg_no()
1433 num = pls->first_seq_no + pls->n_fragments - 1; in calc_max_seg_no()
1434 } else if (pls->n_timelines) { in calc_max_seg_no()
1436 num = pls->first_seq_no + pls->n_timelines - 1; in calc_max_seg_no()
1437 for (i = 0; i < pls->n_timelines; i++) { in calc_max_seg_no()
1438 if (pls->timelines[i]->repeat == -1) { in calc_max_seg_no()
1439 int length_of_each_segment = pls->timelines[i]->duration / pls->fragment_timescale; in calc_max_seg_no()
1442 num += pls->timelines[i]->repeat; in calc_max_seg_no()
1445 } else if (c->is_live && pls->fragment_duration) { in calc_max_seg_no()
1446 …num = pls->first_seq_no + (((get_current_time_in_sec() - c->availability_start_time)) * pls->fragm… in calc_max_seg_no()
1447 } else if (pls->fragment_duration) { in calc_max_seg_no()
1448 …num = pls->first_seq_no + (c->media_presentation_duration * pls->fragment_timescale) / pls->fragme… in calc_max_seg_no()
1585 static struct fragment *get_current_fragment(struct representation *pls) in get_current_fragment() argument
1591 DASHContext *c = pls->parent->priv_data; in get_current_fragment()
1593 while (( !ff_check_interrupt(c->interrupt_callback)&& pls->n_fragments > 0)) { in get_current_fragment()
1594 if (pls->cur_seq_no < pls->n_fragments) { in get_current_fragment()
1595 seg_ptr = pls->fragments[pls->cur_seq_no]; in get_current_fragment()
1609 refresh_manifest(pls->parent); in get_current_fragment()
1615 min_seq_no = calc_min_seg_no(pls->parent, pls); in get_current_fragment()
1616 max_seq_no = calc_max_seg_no(pls, c); in get_current_fragment()
1618 if (pls->timelines || pls->fragments) { in get_current_fragment()
1619 refresh_manifest(pls->parent); in get_current_fragment()
1621 if (pls->cur_seq_no <= min_seq_no) { in get_current_fragment()
1622 …av_log(pls->parent, AV_LOG_VERBOSE, "old fragment: cur[%"PRId64"] min[%"PRId64"] max[%"PRId64"]\n"… in get_current_fragment()
1623 pls->cur_seq_no = calc_cur_seg_no(pls->parent, pls); in get_current_fragment()
1624 } else if (pls->cur_seq_no > max_seq_no) { in get_current_fragment()
1625 …av_log(pls->parent, AV_LOG_VERBOSE, "new fragment: min[%"PRId64"] max[%"PRId64"]\n", min_seq_no, m… in get_current_fragment()
1631 } else if (pls->cur_seq_no <= pls->last_seq_no) { in get_current_fragment()
1639 if (!pls->url_template) { in get_current_fragment()
1640 av_log(pls->parent, AV_LOG_ERROR, "Cannot get fragment, missing template URL\n"); in get_current_fragment()
1649 …(tmpfilename, c->max_url_size, pls->url_template, 0, pls->cur_seq_no, 0, get_segment_start_time_ba… in get_current_fragment()
1650 seg->url = av_strireplace(pls->url_template, pls->url_template, tmpfilename); in get_current_fragment()
1652 …av_log(pls->parent, AV_LOG_WARNING, "Unable to resolve template url '%s', try to use origin templa… in get_current_fragment()
1653 seg->url = av_strdup(pls->url_template); in get_current_fragment()
1655 … av_log(pls->parent, AV_LOG_ERROR, "Cannot resolve template url '%s'\n", pls->url_template); in get_current_fragment()
1668 static int read_from_url(struct representation *pls, struct fragment *seg, in read_from_url() argument
1675 buf_size = FFMIN(buf_size, pls->cur_seg_size - pls->cur_seg_offset); in read_from_url()
1677 ret = avio_read(pls->input, buf, buf_size); in read_from_url()
1679 pls->cur_seg_offset += ret; in read_from_url()
1684 static int open_input(DASHContext *c, struct representation *pls, struct fragment *seg) in open_input() argument
1704 av_log(pls->parent, AV_LOG_VERBOSE, "DASH request for url '%s', offset %"PRId64"\n", in open_input()
1706 ret = open_url(pls->parent, &pls->input, url, &c->avio_opts, opts, NULL); in open_input()
1711 pls->cur_seg_offset = 0; in open_input()
1712 pls->cur_seg_size = seg->size; in open_input()
1716 static int update_init_section(struct representation *pls) in update_init_section() argument
1719 DASHContext *c = pls->parent->priv_data; in update_init_section()
1724 if (!pls->init_section || pls->init_sec_buf) in update_init_section()
1727 ret = open_input(c, pls, pls->init_section); in update_init_section()
1729 av_log(pls->parent, AV_LOG_WARNING, in update_init_section()
1734 if (pls->init_section->size >= 0) in update_init_section()
1735 sec_size = pls->init_section->size; in update_init_section()
1736 else if ((urlsize = avio_size(pls->input)) >= 0) in update_init_section()
1741 av_log(pls->parent, AV_LOG_DEBUG, in update_init_section()
1747 av_fast_malloc(&pls->init_sec_buf, &pls->init_sec_buf_size, sec_size); in update_init_section()
1749 ret = read_from_url(pls, pls->init_section, pls->init_sec_buf, in update_init_section()
1750 pls->init_sec_buf_size); in update_init_section()
1751 ff_format_io_close(pls->parent, &pls->input); in update_init_section()
1756 pls->init_sec_data_len = ret; in update_init_section()
1757 pls->init_sec_buf_read_offset = 0; in update_init_section()
1870 static void close_demux_for_component(struct representation *pls) in close_demux_for_component() argument
1873 av_freep(&pls->pb.buffer); in close_demux_for_component()
1874 memset(&pls->pb, 0x00, sizeof(AVIOContext)); in close_demux_for_component()
1875 pls->ctx->pb = NULL; in close_demux_for_component()
1876 avformat_close_input(&pls->ctx); in close_demux_for_component()
1879 static int reopen_demux_for_component(AVFormatContext *s, struct representation *pls) in reopen_demux_for_component() argument
1887 if (pls->ctx) { in reopen_demux_for_component()
1888 close_demux_for_component(pls); in reopen_demux_for_component()
1896 if (!(pls->ctx = avformat_alloc_context())) { in reopen_demux_for_component()
1904 avformat_free_context(pls->ctx); in reopen_demux_for_component()
1905 pls->ctx = NULL; in reopen_demux_for_component()
1908 ffio_init_context(&pls->pb, avio_ctx_buffer, INITIAL_BUFFER_SIZE, 0, in reopen_demux_for_component()
1909 pls, read_data, NULL, c->is_live ? NULL : seek_data); in reopen_demux_for_component()
1910 pls->pb.seekable = 0; in reopen_demux_for_component()
1912 if ((ret = ff_copy_whiteblacklists(pls->ctx, s)) < 0) in reopen_demux_for_component()
1915 pls->ctx->flags = AVFMT_FLAG_CUSTOM_IO; in reopen_demux_for_component()
1916 pls->ctx->probesize = s->probesize > 0 ? s->probesize : 1024 * 4; in reopen_demux_for_component()
1917pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? s->max_analyze_duration : 4 * AV_TI… in reopen_demux_for_component()
1918 pls->ctx->interrupt_callback = s->interrupt_callback; in reopen_demux_for_component()
1919 ret = av_probe_input_buffer(&pls->pb, &in_fmt, "", NULL, 0, 0); in reopen_demux_for_component()
1922 avformat_free_context(pls->ctx); in reopen_demux_for_component()
1923 pls->ctx = NULL; in reopen_demux_for_component()
1927 pls->ctx->pb = &pls->pb; in reopen_demux_for_component()
1928 pls->ctx->io_open = nested_io_open; in reopen_demux_for_component()
1931 ret = avformat_open_input(&pls->ctx, "", in_fmt, &in_fmt_opts); //pls->init_section->url in reopen_demux_for_component()
1935 if (pls->n_fragments) { in reopen_demux_for_component()
1937 if (pls->framerate.den) { in reopen_demux_for_component()
1938 for (i = 0; i < pls->ctx->nb_streams; i++) in reopen_demux_for_component()
1939 pls->ctx->streams[i]->r_frame_rate = pls->framerate; in reopen_demux_for_component()
1942 ret = avformat_find_stream_info(pls->ctx, NULL); in reopen_demux_for_component()
1951 static int open_demux_for_component(AVFormatContext *s, struct representation *pls) in open_demux_for_component() argument
1956 pls->parent = s; in open_demux_for_component()
1957 pls->cur_seq_no = calc_cur_seg_no(s, pls); in open_demux_for_component()
1959 if (!pls->last_seq_no) { in open_demux_for_component()
1960 pls->last_seq_no = calc_max_seg_no(pls, s->priv_data); in open_demux_for_component()
1963 ret = reopen_demux_for_component(s, pls); in open_demux_for_component()
1967 for (i = 0; i < pls->ctx->nb_streams; i++) { in open_demux_for_component()
1969 AVStream *ist = pls->ctx->streams[i]; in open_demux_for_component()
1998 static int is_common_init_section_exist(struct representation **pls, int n_pls) in is_common_init_section_exist() argument
2000 struct fragment *first_init_section = pls[0]->init_section; in is_common_init_section_exist()
2011 size = pls[0]->init_section->size; in is_common_init_section_exist()
2013 if (!pls[i]->init_section) in is_common_init_section_exist()
2016 if (av_strcasecmp(pls[i]->init_section->url, url) || in is_common_init_section_exist()
2017 pls[i]->init_section->url_offset != url_offset || in is_common_init_section_exist()
2018 pls[i]->init_section->size != size) { in is_common_init_section_exist()
2178 struct representation *pls = p[i]; in recheck_discard_flags() local
2179 int needed = !pls->assoc_stream || pls->assoc_stream->discard < AVDISCARD_ALL; in recheck_discard_flags()
2181 if (needed && !pls->ctx) { in recheck_discard_flags()
2182 pls->cur_seg_offset = 0; in recheck_discard_flags()
2183 pls->init_sec_buf_read_offset = 0; in recheck_discard_flags()
2186 pls->cur_seq_no = FFMAX(pls->cur_seq_no, p[j]->cur_seq_no); in recheck_discard_flags()
2188 reopen_demux_for_component(s, pls); in recheck_discard_flags()
2189 av_log(s, AV_LOG_INFO, "Now receiving stream_index %d\n", pls->stream_index); in recheck_discard_flags()
2190 } else if (!needed && pls->ctx) { in recheck_discard_flags()
2191 close_demux_for_component(pls); in recheck_discard_flags()
2192 ff_format_io_close(pls->parent, &pls->input); in recheck_discard_flags()
2193 av_log(s, AV_LOG_INFO, "No longer receiving stream_index %d\n", pls->stream_index); in recheck_discard_flags()
2272 static int dash_seek(AVFormatContext *s, struct representation *pls, int64_t seek_pos_msec, int fla… in dash_seek() argument
2279 av_log(pls->parent, AV_LOG_VERBOSE, "DASH seek pos[%"PRId64"ms] %s\n", in dash_seek()
2283 if (pls->n_fragments == 1) { in dash_seek()
2284 pls->cur_timestamp = 0; in dash_seek()
2285 pls->cur_seg_offset = 0; in dash_seek()
2288 ff_read_frame_flush(pls->ctx); in dash_seek()
2289 return av_seek_frame(pls->ctx, -1, seek_pos_msec * 1000, flags); in dash_seek()
2292 ff_format_io_close(pls->parent, &pls->input); in dash_seek()
2295 if (pls->n_timelines > 0 && pls->fragment_timescale > 0) { in dash_seek()
2296 int64_t num = pls->first_seq_no; in dash_seek()
2297 av_log(pls->parent, AV_LOG_VERBOSE, "dash_seek with SegmentTimeline start n_timelines[%d] " in dash_seek()
2299 (int)pls->n_timelines, (int64_t)pls->last_seq_no); in dash_seek()
2300 for (i = 0; i < pls->n_timelines; i++) { in dash_seek()
2301 if (pls->timelines[i]->starttime > 0) { in dash_seek()
2302 duration = pls->timelines[i]->starttime; in dash_seek()
2304 duration += pls->timelines[i]->duration; in dash_seek()
2305 if (seek_pos_msec < ((duration * 1000) / pls->fragment_timescale)) { in dash_seek()
2308 for (j = 0; j < pls->timelines[i]->repeat; j++) { in dash_seek()
2309 duration += pls->timelines[i]->duration; in dash_seek()
2311 if (seek_pos_msec < ((duration * 1000) / pls->fragment_timescale)) { in dash_seek()
2319 pls->cur_seq_no = num > pls->last_seq_no ? pls->last_seq_no : num; in dash_seek()
2320 … av_log(pls->parent, AV_LOG_VERBOSE, "dash_seek with SegmentTimeline end cur_seq_no[%"PRId64"].\n", in dash_seek()
2321 (int64_t)pls->cur_seq_no); in dash_seek()
2322 } else if (pls->fragment_duration > 0) { in dash_seek()
2323pls->cur_seq_no = pls->first_seq_no + ((seek_pos_msec * pls->fragment_timescale) / pls->fragment_d… in dash_seek()
2325 av_log(pls->parent, AV_LOG_ERROR, "dash_seek missing timeline or fragment_duration\n"); in dash_seek()
2326 pls->cur_seq_no = pls->first_seq_no; in dash_seek()
2328 pls->cur_timestamp = 0; in dash_seek()
2329 pls->cur_seg_offset = 0; in dash_seek()
2330 pls->init_sec_buf_read_offset = 0; in dash_seek()
2331 ret = dry_run ? 0 : reopen_demux_for_component(s, pls); in dash_seek()