mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/matroskadec: Use av_strstart instead of strncmp
It makes the intent clearer and avoids calculating the length separately. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
ea5bf12a9a
commit
0f906be430
|
@ -2470,8 +2470,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
|
||||||
encodings[0].compression.settings.size);
|
encodings[0].compression.settings.size);
|
||||||
|
|
||||||
for (j = 0; ff_mkv_codec_tags[j].id != AV_CODEC_ID_NONE; j++) {
|
for (j = 0; ff_mkv_codec_tags[j].id != AV_CODEC_ID_NONE; j++) {
|
||||||
if (!strncmp(ff_mkv_codec_tags[j].str, track->codec_id,
|
if (av_strstart(track->codec_id, ff_mkv_codec_tags[j].str, NULL)) {
|
||||||
strlen(ff_mkv_codec_tags[j].str))) {
|
|
||||||
codec_id = ff_mkv_codec_tags[j].id;
|
codec_id = ff_mkv_codec_tags[j].id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2986,8 +2985,7 @@ static int matroska_read_header(AVFormatContext *s)
|
||||||
st->codecpar->codec_id = AV_CODEC_ID_NONE;
|
st->codecpar->codec_id = AV_CODEC_ID_NONE;
|
||||||
|
|
||||||
for (i = 0; mkv_image_mime_tags[i].id != AV_CODEC_ID_NONE; i++) {
|
for (i = 0; mkv_image_mime_tags[i].id != AV_CODEC_ID_NONE; i++) {
|
||||||
if (!strncmp(mkv_image_mime_tags[i].str, attachments[j].mime,
|
if (av_strstart(attachments[j].mime, mkv_image_mime_tags[i].str, NULL)) {
|
||||||
strlen(mkv_image_mime_tags[i].str))) {
|
|
||||||
st->codecpar->codec_id = mkv_image_mime_tags[i].id;
|
st->codecpar->codec_id = mkv_image_mime_tags[i].id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3016,8 +3014,7 @@ static int matroska_read_header(AVFormatContext *s)
|
||||||
attachments[j].bin.size);
|
attachments[j].bin.size);
|
||||||
|
|
||||||
for (i = 0; mkv_mime_tags[i].id != AV_CODEC_ID_NONE; i++) {
|
for (i = 0; mkv_mime_tags[i].id != AV_CODEC_ID_NONE; i++) {
|
||||||
if (!strncmp(mkv_mime_tags[i].str, attachments[j].mime,
|
if (av_strstart(attachments[j].mime, mkv_mime_tags[i].str, NULL)) {
|
||||||
strlen(mkv_mime_tags[i].str))) {
|
|
||||||
st->codecpar->codec_id = mkv_mime_tags[i].id;
|
st->codecpar->codec_id = mkv_mime_tags[i].id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue