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

Function read_file_to_string

fftools/cmdutils.c:1571–1594  ·  view source on GitHub ↗

read file contents into a string */

Source from the content-addressed store, hash-verified

1569
1570/* read file contents into a string */
1571char *read_file_to_string(const char *filename)
1572{
1573 AVIOContext *pb = NULL;
1574 int ret = avio_open(&pb, filename, AVIO_FLAG_READ);
1575 AVBPrint bprint;
1576 char *str;
1577
1578 if (ret < 0) {
1579 av_log(NULL, AV_LOG_ERROR, "Error opening file %s.\n", filename);
1580 return NULL;
1581 }
1582
1583 av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED);
1584 ret = avio_read_to_bprint(pb, &bprint, SIZE_MAX);
1585 avio_closep(&pb);
1586 if (ret < 0) {
1587 av_bprint_finalize(&bprint, NULL);
1588 return NULL;
1589 }
1590 ret = av_bprint_finalize(&bprint, &str);
1591 if (ret < 0)
1592 return NULL;
1593 return str;
1594}
1595
1596void remove_avoptions(AVDictionary **a, AVDictionary *b)
1597{

Callers 5

filter_opt_applyFunction · 0.85
ffmpeg_mux_init.cFile · 0.85
new_stream_videoFunction · 0.85
write_optionFunction · 0.85

Calls 6

avio_openFunction · 0.85
av_logFunction · 0.85
av_bprint_initFunction · 0.85
avio_read_to_bprintFunction · 0.85
avio_closepFunction · 0.85
av_bprint_finalizeFunction · 0.85

Tested by

no test coverage detected