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

Function init_subtitle_context

libavformat/hls.c:1803–1836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1801}
1802
1803static 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
1838static int read_subtitle_packet(struct playlist *v, AVPacket *pkt)
1839{

Callers 1

read_subtitle_packetFunction · 0.85

Calls 10

avformat_alloc_contextFunction · 0.85
avformat_free_contextFunction · 0.85
ffio_init_contextFunction · 0.85
ff_copy_whiteblacklistsFunction · 0.85
av_find_input_formatFunction · 0.85
av_dict_copyFunction · 0.85
avformat_open_inputFunction · 0.85
current_segmentFunction · 0.85
av_dict_freeFunction · 0.85
av_mallocFunction · 0.50

Tested by

no test coverage detected