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

Function read_key

libavformat/hls.c:1360–1389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1358}
1359
1360static int read_key(HLSContext *c, struct playlist *pls, struct segment *seg)
1361{
1362 AVIOContext *pb = NULL;
1363
1364 int ret = open_url(pls->parent, &pb, seg->key, &c->avio_opts, NULL, NULL);
1365 if (ret < 0) {
1366 av_log(pls->parent, AV_LOG_ERROR, "Unable to open key file %s, %s\n",
1367 seg->key, av_err2str(ret));
1368 return ret;
1369 }
1370
1371 ret = avio_read(pb, pls->key, sizeof(pls->key));
1372 ff_format_io_close(pls->parent, &pb);
1373 if (ret != sizeof(pls->key)) {
1374 if (ret < 0) {
1375 av_log(pls->parent, AV_LOG_ERROR, "Unable to read key file %s, %s\n",
1376 seg->key, av_err2str(ret));
1377 } else {
1378 av_log(pls->parent, AV_LOG_ERROR, "Unable to read key file %s, read bytes %d != %zu\n",
1379 seg->key, ret, sizeof(pls->key));
1380 ret = AVERROR_INVALIDDATA;
1381 }
1382
1383 return ret;
1384 }
1385
1386 av_strlcpy(pls->key_url, seg->key, sizeof(pls->key_url));
1387
1388 return 0;
1389}
1390
1391static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg, AVIOContext **in)
1392{

Callers 1

open_inputFunction · 0.70

Calls 5

av_logFunction · 0.85
avio_readFunction · 0.85
ff_format_io_closeFunction · 0.85
av_strlcpyFunction · 0.85
open_urlFunction · 0.70

Tested by

no test coverage detected