mirror of https://github.com/mpv-player/mpv
demux_lavf: report program_id
This can be useful in stream selection.
This commit is contained in:
parent
362256edbc
commit
c39e332e50
|
@ -978,6 +978,7 @@ struct sh_stream *demux_alloc_sh_stream(enum stream_type type)
|
||||||
.index = -1,
|
.index = -1,
|
||||||
.ff_index = -1, // may be overwritten by demuxer
|
.ff_index = -1, // may be overwritten by demuxer
|
||||||
.demuxer_id = -1, // ... same
|
.demuxer_id = -1, // ... same
|
||||||
|
.program_id = -1, // ... same
|
||||||
.codec = talloc_zero(sh, struct mp_codec_params),
|
.codec = talloc_zero(sh, struct mp_codec_params),
|
||||||
.tags = talloc_zero(sh, struct mp_tags),
|
.tags = talloc_zero(sh, struct mp_tags),
|
||||||
};
|
};
|
||||||
|
|
|
@ -832,6 +832,9 @@ static void handle_new_stream(demuxer_t *demuxer, int i)
|
||||||
if (lang && lang->value && strcmp(lang->value, "und") != 0)
|
if (lang && lang->value && strcmp(lang->value, "und") != 0)
|
||||||
sh->lang = talloc_strdup(sh, lang->value);
|
sh->lang = talloc_strdup(sh, lang->value);
|
||||||
sh->hls_bitrate = dict_get_decimal(st->metadata, "variant_bitrate", 0);
|
sh->hls_bitrate = dict_get_decimal(st->metadata, "variant_bitrate", 0);
|
||||||
|
AVProgram *prog = av_find_program_from_stream(avfc, NULL, i);
|
||||||
|
if (prog)
|
||||||
|
sh->program_id = prog->id;
|
||||||
sh->missing_timestamps = !!(priv->avif_flags & AVFMT_NOTIMESTAMPS);
|
sh->missing_timestamps = !!(priv->avif_flags & AVFMT_NOTIMESTAMPS);
|
||||||
mp_tags_copy_from_av_dictionary(sh->tags, st->metadata);
|
mp_tags_copy_from_av_dictionary(sh->tags, st->metadata);
|
||||||
demux_add_sh_stream(demuxer, sh);
|
demux_add_sh_stream(demuxer, sh);
|
||||||
|
|
|
@ -51,6 +51,7 @@ struct sh_stream {
|
||||||
bool image; // video stream is an image
|
bool image; // video stream is an image
|
||||||
bool still_image; // video stream contains still images
|
bool still_image; // video stream contains still images
|
||||||
int hls_bitrate;
|
int hls_bitrate;
|
||||||
|
int program_id;
|
||||||
|
|
||||||
struct mp_tags *tags;
|
struct mp_tags *tags;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue