Commit 20c1281f authored by Peter Ross's avatar Peter Ross Committed by Ronald S. Bultje

jv demuxer: calculate palette_size for each frame in read_header

Signed-off-by: 's avatarRonald S. Bultje <rsbultje@gmail.com>
parent 402f9ad5
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
typedef struct { typedef struct {
int audio_size; /** audio packet size (bytes) */ int audio_size; /** audio packet size (bytes) */
int video_size; /** video packet size (bytes) */ int video_size; /** video packet size (bytes) */
int palette; /** frame contains palette change */ int palette_size; /** palette size (bytes) */
int video_type; /** per-frame video compression type */ int video_type; /** per-frame video compression type */
} JVFrame; } JVFrame;
...@@ -113,7 +113,7 @@ static int read_header(AVFormatContext *s, ...@@ -113,7 +113,7 @@ static int read_header(AVFormatContext *s,
jvf->audio_size = avio_rl32(pb); jvf->audio_size = avio_rl32(pb);
jvf->video_size = avio_rl32(pb); jvf->video_size = avio_rl32(pb);
jvf->palette = avio_r8(pb); jvf->palette_size = avio_r8(pb) ? 768 : 0;
if (avio_r8(pb)) if (avio_r8(pb))
av_log(s, AV_LOG_WARNING, "unsupported audio codec\n"); av_log(s, AV_LOG_WARNING, "unsupported audio codec\n");
jvf->video_type = avio_r8(pb); jvf->video_type = avio_r8(pb);
...@@ -152,8 +152,8 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -152,8 +152,8 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
} }
case JV_VIDEO: case JV_VIDEO:
jv->state++; jv->state++;
if (jvf->video_size || jvf->palette) { if (jvf->video_size || jvf->palette_size) {
int size = jvf->video_size + (jvf->palette ? 768 : 0); int size = jvf->video_size + jvf->palette_size;
if (av_new_packet(pkt, size + 5)) if (av_new_packet(pkt, size + 5))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
...@@ -171,7 +171,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -171,7 +171,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
} }
case JV_PADDING: case JV_PADDING:
avio_skip(pb, FFMAX(e->size - jvf->audio_size - jvf->video_size avio_skip(pb, FFMAX(e->size - jvf->audio_size - jvf->video_size
- (jvf->palette ? 768 : 0), 0)); - jvf->palette_size, 0));
jv->state = JV_AUDIO; jv->state = JV_AUDIO;
jv->pts++; jv->pts++;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment