]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/pjsdec.c
avcodec/packet_internal: move the next pointer in PacketList to the top of the struct
[ffmpeg] / libavformat / pjsdec.c
index 8a5cc04f8411e4370b64de842497c92deaeab8b5..40d820a8d667afa69b0c8e63431daa52bf51e094 100644 (file)
@@ -67,7 +67,6 @@ static int pjs_read_header(AVFormatContext *s)
 {
     PJSContext *pjs = s->priv_data;
     AVStream *st = avformat_new_stream(s, NULL);
-    int res = 0;
 
     if (!st)
         return AVERROR(ENOMEM);
@@ -94,8 +93,10 @@ static int pjs_read_header(AVFormatContext *s)
 
             p[strcspn(p, "\"")] = 0;
             sub = ff_subtitles_queue_insert(&pjs->q, p, strlen(p), 0);
-            if (!sub)
+            if (!sub) {
+                ff_subtitles_queue_clean(&pjs->q);
                 return AVERROR(ENOMEM);
+            }
             sub->pos = pos;
             sub->pts = pts_start;
             sub->duration = duration;
@@ -103,7 +104,7 @@ static int pjs_read_header(AVFormatContext *s)
     }
 
     ff_subtitles_queue_finalize(s, &pjs->q);
-    return res;
+    return 0;
 }
 
 static int pjs_read_packet(AVFormatContext *s, AVPacket *pkt)
@@ -127,7 +128,7 @@ static int pjs_read_close(AVFormatContext *s)
     return 0;
 }
 
-AVInputFormat ff_pjs_demuxer = {
+const AVInputFormat ff_pjs_demuxer = {
     .name           = "pjs",
     .long_name      = NULL_IF_CONFIG_SMALL("PJS (Phoenix Japanimation Society) subtitles"),
     .priv_data_size = sizeof(PJSContext),