]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/idcin.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavformat / idcin.c
index 9d28043572166bab43e13c6f590d77971b784db1..fd4504a5661b048911a45185cc5789ece707c0c7 100644 (file)
@@ -70,6 +70,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "internal.h"
 
 #define HUFFMAN_TABLE_SIZE (64 * 1024)
 #define IDCIN_FPS 14
@@ -137,8 +138,7 @@ static int idcin_probe(AVProbeData *p)
     return AVPROBE_SCORE_MAX / 2;
 }
 
-static int idcin_read_header(AVFormatContext *s,
-                             AVFormatParameters *ap)
+static int idcin_read_header(AVFormatContext *s)
 {
     AVIOContext *pb = s->pb;
     IdcinDemuxContext *idcin = s->priv_data;
@@ -156,7 +156,7 @@ static int idcin_read_header(AVFormatContext *s,
     st = avformat_new_stream(s, NULL);
     if (!st)
         return AVERROR(ENOMEM);
-    av_set_pts_info(st, 33, 1, IDCIN_FPS);
+    avpriv_set_pts_info(st, 33, 1, IDCIN_FPS);
     idcin->video_stream_index = st->index;
     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     st->codec->codec_id = CODEC_ID_IDCIN;
@@ -177,7 +177,7 @@ static int idcin_read_header(AVFormatContext *s,
         st = avformat_new_stream(s, NULL);
         if (!st)
             return AVERROR(ENOMEM);
-        av_set_pts_info(st, 33, 1, IDCIN_FPS);
+        avpriv_set_pts_info(st, 33, 1, IDCIN_FPS);
         idcin->audio_stream_index = st->index;
         st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
         st->codec->codec_tag = 1;
@@ -247,7 +247,9 @@ static int idcin_read_packet(AVFormatContext *s,
                 r = palette_buffer[i * 3    ] << palette_scale;
                 g = palette_buffer[i * 3 + 1] << palette_scale;
                 b = palette_buffer[i * 3 + 2] << palette_scale;
-                palette[i] = (r << 16) | (g << 8) | (b);
+                palette[i] = (0xFFU << 24) | (r << 16) | (g << 8) | (b);
+                if (palette_scale == 2)
+                    palette[i] |= palette[i] >> 6 & 0x30303;
             }
         }
 
@@ -263,8 +265,8 @@ static int idcin_read_packet(AVFormatContext *s,
 
             pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
                                           AVPALETTE_SIZE);
-            if (ret < 0)
-                return ret;
+            if (!pal)
+                return AVERROR(ENOMEM);
             memcpy(pal, palette, AVPALETTE_SIZE);
         }
         pkt->stream_index = idcin->video_stream_index;