| 1801 | } |
| 1802 | |
| 1803 | static int init_subtitle_context(struct playlist *pls) |
| 1804 | { |
| 1805 | HLSContext *c = pls->parent->priv_data; |
| 1806 | const AVInputFormat *in_fmt; |
| 1807 | AVDictionary *opts = NULL; |
| 1808 | int ret; |
| 1809 | |
| 1810 | if (!(pls->ctx = avformat_alloc_context())) |
| 1811 | return AVERROR(ENOMEM); |
| 1812 | |
| 1813 | pls->read_buffer = av_malloc(INITIAL_BUFFER_SIZE); |
| 1814 | if (!pls->read_buffer) { |
| 1815 | avformat_free_context(pls->ctx); |
| 1816 | pls->ctx = NULL; |
| 1817 | return AVERROR(ENOMEM); |
| 1818 | } |
| 1819 | |
| 1820 | ffio_init_context(&pls->pb, pls->read_buffer, INITIAL_BUFFER_SIZE, 0, pls, |
| 1821 | read_data_subtitle_segment, NULL, NULL); |
| 1822 | pls->pb.pub.seekable = 0; |
| 1823 | pls->ctx->pb = &pls->pb.pub; |
| 1824 | pls->ctx->io_open = nested_io_open; |
| 1825 | |
| 1826 | ret = ff_copy_whiteblacklists(pls->ctx, pls->parent); |
| 1827 | if (ret < 0) |
| 1828 | return ret; |
| 1829 | |
| 1830 | in_fmt = av_find_input_format("webvtt"); |
| 1831 | av_dict_copy(&opts, c->seg_format_opts, 0); |
| 1832 | ret = avformat_open_input(&pls->ctx, current_segment(pls)->url, in_fmt, &opts); |
| 1833 | av_dict_free(&opts); |
| 1834 | |
| 1835 | return ret; |
| 1836 | } |
| 1837 | |
| 1838 | static int read_subtitle_packet(struct playlist *v, AVPacket *pkt) |
| 1839 | { |
no test coverage detected