read file contents into a string */
| 1449 | |
| 1450 | /* read file contents into a string */ |
| 1451 | static 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 | |
| 1479 | static char *get_ost_filters(OptionsContext *o, AVFormatContext *oc, |
| 1480 | OutputStream *ost) |
no outgoing calls
no test coverage detected