MCPcopy Create free account
hub / github.com/byhook/ffmpeg4android / read_file

Function read_file

ffmpeg-single-cmd/src/main/cpp/ffmpeg_opt.c:1451–1477  ·  view source on GitHub ↗

read file contents into a string */

Source from the content-addressed store, hash-verified

1449
1450/* read file contents into a string */
1451static uint8_t *read_file(const char *filename)
1452{
1453 AVIOContext *pb = NULL;
1454 AVIOContext *dyn_buf = NULL;
1455 int ret = avio_open(&pb, filename, AVIO_FLAG_READ);
1456 uint8_t buf[1024], *str;
1457
1458 if (ret < 0) {
1459 av_log(NULL, AV_LOG_ERROR, "Error opening file %s.\n", filename);
1460 return NULL;
1461 }
1462
1463 ret = avio_open_dyn_buf(&dyn_buf);
1464 if (ret < 0) {
1465 avio_closep(&pb);
1466 return NULL;
1467 }
1468 while ((ret = avio_read(pb, buf, sizeof(buf))) > 0)
1469 avio_write(dyn_buf, buf, ret);
1470 avio_w8(dyn_buf, 0);
1471 avio_closep(&pb);
1472
1473 ret = avio_close_dyn_buf(dyn_buf, &str);
1474 if (ret < 0)
1475 return NULL;
1476 return str;
1477}
1478
1479static char *get_ost_filters(OptionsContext *o, AVFormatContext *oc,
1480 OutputStream *ost)

Callers 3

get_ost_filtersFunction · 0.85
new_video_streamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected