demux_lavf: get codec info from AVCodecParameters
This allows displaying codec info for all tracks without selecting the track.
This commit is contained in:
1 parent
4e2f3ce4b9
commit
3eb8f9a1de
3 files changed
+18
-1
No files matched your search
@@ -421,3 +421,19 @@ void mp_codec_info_from_av(const AVCodecContext *avctx, struct mp_codec_params *
|
||||
c->decoder = avctx->codec->name;
|
||||
c->decoder_desc = avctx->codec->long_name;
|
||||
}
|
||||
|
||||
void mp_codec_info_from_avcodecpar(const AVCodecParameters *avcodecpar, struct mp_codec_params *c)
|
||||
{
|
||||
const AVCodec *codec = avcodec_find_decoder(avcodecpar->codec_id);
|
||||
const AVCodecDescriptor *desc = avcodec_descriptor_get(avcodecpar->codec_id);
|
||||
c->codec = mp_codec_from_av_codec_id(avcodecpar->codec_id);
|
||||
if (desc)
|
||||
c->codec_desc = desc->long_name;
|
||||
if (codec) {
|
||||
c->decoder = codec->name;
|
||||
c->decoder_desc = codec->long_name;
|
||||
c->codec_profile = av_get_profile_name(codec, avcodecpar->profile);
|
||||
}
|
||||
if (!c->codec_profile)
|
||||
c->codec_profile = avcodec_profile_name(avcodecpar->codec_id, avcodecpar->profile);
|
||||
}
|
||||
@@ -52,5 +52,6 @@ int mp_set_avopts(struct mp_log *log, void *avobj, char **kv);
|
||||
int mp_set_avopts_pos(struct mp_log *log, void *avobj, void *posargs, char **kv);
|
||||
void mp_free_av_packet(AVPacket **pkt);
|
||||
void mp_codec_info_from_av(const AVCodecContext *avctx, struct mp_codec_params *c);
|
||||
void mp_codec_info_from_avcodecpar(const AVCodecParameters *avcodecpar, struct mp_codec_params *c);
|
||||
|
||||
#endif
|
||||
+1
-1
@@ -820,7 +820,7 @@ static void handle_new_stream(demuxer_t *demuxer, int i)
|
||||
|
||||
if (sh) {
|
||||
sh->ff_index = st->index;
|
||||
sh->codec->codec = mp_codec_from_av_codec_id(codec->codec_id);
|
||||
mp_codec_info_from_avcodecpar(codec, sh->codec);
|
||||
sh->codec->codec_tag = codec->codec_tag;
|
||||
sh->codec->lav_codecpar = avcodec_parameters_alloc();
|
||||
if (sh->codec->lav_codecpar)
|
||||
|
||||
Reference in new issue
Block a user