deps/media-playback: Add support for FFmpeg options for media playback
This commit is contained in:
parent
b98ce32670
commit
3215189c97
14
deps/media-playback/media-playback/media.c
vendored
14
deps/media-playback/media-playback/media.c
vendored
@ -680,6 +680,19 @@ static bool init_avformat(mp_media_t *m)
|
||||
if (m->buffering && !m->is_local_file && !is_rist)
|
||||
av_dict_set_int(&opts, "buffer_size", m->buffering, 0);
|
||||
|
||||
if (m->ffmpeg_options) {
|
||||
int ret = av_dict_parse_string(&opts, m->ffmpeg_options, "=",
|
||||
" ", 0);
|
||||
if (ret) {
|
||||
blog(LOG_WARNING,
|
||||
"Failed to parse FFmpeg options: %s\n%s",
|
||||
av_err2str(ret), m->ffmpeg_options);
|
||||
} else {
|
||||
blog(LOG_INFO, "Set FFmpeg options: %s",
|
||||
m->ffmpeg_options);
|
||||
}
|
||||
}
|
||||
|
||||
m->fmt = avformat_alloc_context();
|
||||
if (m->buffering == 0) {
|
||||
m->fmt->flags |= AVFMT_FLAG_NOBUFFER;
|
||||
@ -863,6 +876,7 @@ bool mp_media_init(mp_media_t *media, const struct mp_media_info *info)
|
||||
media->v_cb = info->v_cb;
|
||||
media->a_cb = info->a_cb;
|
||||
media->stop_cb = info->stop_cb;
|
||||
media->ffmpeg_options = info->ffmpeg_options;
|
||||
media->v_seek_cb = info->v_seek_cb;
|
||||
media->v_preload_cb = info->v_preload_cb;
|
||||
media->force_range = info->force_range;
|
||||
|
2
deps/media-playback/media-playback/media.h
vendored
2
deps/media-playback/media-playback/media.h
vendored
@ -54,6 +54,7 @@ struct mp_media {
|
||||
|
||||
char *path;
|
||||
char *format_name;
|
||||
char *ffmpeg_options;
|
||||
int buffering;
|
||||
int speed;
|
||||
|
||||
@ -118,6 +119,7 @@ struct mp_media_info {
|
||||
|
||||
const char *path;
|
||||
const char *format;
|
||||
char *ffmpeg_options;
|
||||
int buffering;
|
||||
int speed;
|
||||
enum video_range_type force_range;
|
||||
|
Loading…
x
Reference in New Issue
Block a user