mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
v4l2: use codec descriptors for mapping a codec name to id
This mapping has nothing to do with decoder implementations, so using decoder names is wrong.
This commit is contained in:
parent
ee480790c7
commit
0fea8555ae
@ -771,16 +771,16 @@ static int v4l2_read_header(AVFormatContext *s1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s->pixel_format) {
|
if (s->pixel_format) {
|
||||||
AVCodec *codec = avcodec_find_decoder_by_name(s->pixel_format);
|
const AVCodecDescriptor *desc = avcodec_descriptor_get_by_name(s->pixel_format);
|
||||||
|
|
||||||
if (codec) {
|
if (desc) {
|
||||||
s1->video_codec_id = codec->id;
|
s1->video_codec_id = desc->id;
|
||||||
st->need_parsing = AVSTREAM_PARSE_HEADERS;
|
st->need_parsing = AVSTREAM_PARSE_HEADERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
pix_fmt = av_get_pix_fmt(s->pixel_format);
|
pix_fmt = av_get_pix_fmt(s->pixel_format);
|
||||||
|
|
||||||
if (pix_fmt == AV_PIX_FMT_NONE && !codec) {
|
if (pix_fmt == AV_PIX_FMT_NONE && !desc) {
|
||||||
av_log(s1, AV_LOG_ERROR, "No such input format: %s.\n",
|
av_log(s1, AV_LOG_ERROR, "No such input format: %s.\n",
|
||||||
s->pixel_format);
|
s->pixel_format);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user