read file contents into a string */
| 1569 | |
| 1570 | /* read file contents into a string */ |
| 1571 | char *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 | |
| 1596 | void remove_avoptions(AVDictionary **a, AVDictionary *b) |
| 1597 | { |
no test coverage detected