]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/apetag.c
threads: always call thread_finish_setup for intra codecs
[ffmpeg] / libavformat / apetag.c
index dd746313b5640355a6f701f0ce0687e741a56495..0d2cb973fb11784dd8de86bfca47fa4c3769ba73 100644 (file)
@@ -57,7 +57,7 @@ static int ape_tag_read_field(AVFormatContext *s)
         return -1;
     if (flags & APE_TAG_FLAG_IS_BINARY) {
         uint8_t filename[1024];
-        enum CodecID id;
+        enum AVCodecID id;
         AVStream *st = avformat_new_stream(s, NULL);
         if (!st)
             return AVERROR(ENOMEM);
@@ -70,7 +70,7 @@ static int ape_tag_read_field(AVFormatContext *s)
 
         av_dict_set(&st->metadata, key, filename, 0);
 
-        if ((id = ff_guess_image2_codec(filename)) != CODEC_ID_NONE) {
+        if ((id = ff_guess_image2_codec(filename)) != AV_CODEC_ID_NONE) {
             AVPacket pkt;
             int ret;
 
@@ -144,11 +144,11 @@ int64_t ff_ape_parse_tag(AVFormatContext *s)
         return 0;
     }
 
-    tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES;
-    if (tag_start < 0) {
+    if (tag_bytes > file_size - APE_TAG_FOOTER_BYTES) {
         av_log(s, AV_LOG_ERROR, "Invalid tag size %u.\n", tag_bytes);
         return 0;
     }
+    tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES;
 
     fields = avio_rl32(pb);    /* number of fields */
     if (fields > 65536) {
@@ -159,7 +159,7 @@ int64_t ff_ape_parse_tag(AVFormatContext *s)
     val = avio_rl32(pb);       /* flags */
     if (val & APE_TAG_FLAG_IS_HEADER) {
         av_log(s, AV_LOG_ERROR, "APE Tag is a header\n");
-        return;
+        return 0;
     }
 
     avio_seek(pb, file_size - tag_bytes, SEEK_SET);