]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/jvdec.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavformat / jvdec.c
index 3977594f8bd34bdbf10d6eff8fdff68d63a6c309..2eac265de7d5499e9fe12131d1a462611a5f7ac3 100644 (file)
@@ -75,7 +75,7 @@ static int read_header(AVFormatContext *s)
         return AVERROR(ENOMEM);
 
     vst->codec->codec_type  = AVMEDIA_TYPE_VIDEO;
-    vst->codec->codec_id    = CODEC_ID_JV;
+    vst->codec->codec_id    = AV_CODEC_ID_JV;
     vst->codec->codec_tag   = 0; /* no fourcc */
     vst->codec->width       = avio_rl16(pb);
     vst->codec->height      = avio_rl16(pb);
@@ -87,7 +87,7 @@ static int read_header(AVFormatContext *s)
     avio_skip(pb, 4);
 
     ast->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
-    ast->codec->codec_id    = CODEC_ID_PCM_U8;
+    ast->codec->codec_id    = AV_CODEC_ID_PCM_U8;
     ast->codec->codec_tag   = 0; /* no fourcc */
     ast->codec->sample_rate = avio_rl16(pb);
     ast->codec->channels    = 1;
@@ -164,7 +164,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
 
                 AV_WL32(pkt->data, jvf->video_size);
                 pkt->data[4]      = jvf->video_type;
-                if (avio_read(pb, pkt->data + JV_PREAMBLE_SIZE, size) < 0)
+                if ((size = avio_read(pb, pkt->data + JV_PREAMBLE_SIZE, size)) < 0)
                     return AVERROR(EIO);
 
                 pkt->size         = size + JV_PREAMBLE_SIZE;
@@ -216,6 +216,15 @@ static int read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
+static int read_close(AVFormatContext *s)
+{
+    JVDemuxContext *jv = s->priv_data;
+
+    av_freep(&jv->frames);
+
+    return 0;
+}
+
 AVInputFormat ff_jv_demuxer = {
     .name           = "jv",
     .long_name      = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV"),
@@ -224,4 +233,5 @@ AVInputFormat ff_jv_demuxer = {
     .read_header    = read_header,
     .read_packet    = read_packet,
     .read_seek      = read_seek,
+    .read_close     = read_close,
 };