summaryrefslogtreecommitdiff
path: root/libavformat/jvdec.c
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2011-03-12 13:31:40 +1100
committerRonald S. Bultje <rsbultje@gmail.com>2011-03-14 08:05:54 -0400
commit772cb06281d9b82f283fc6c2ca7fb55a562d0ad9 (patch)
treed7515f2861f4a9e2bf8feabb2129b6c086488fde /libavformat/jvdec.c
parent20c1281fe3fb30a8583d3a56ab2978e4ac8e9ee6 (diff)
jv demuxer: define JV_PREAMBLE_SIZE instead of hard coding the number
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat/jvdec.c')
-rw-r--r--libavformat/jvdec.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index 98fa6e72b2..314a341ac6 100644
--- a/libavformat/jvdec.c
+++ b/libavformat/jvdec.c
@@ -28,6 +28,8 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#define JV_PREAMBLE_SIZE 5
+
typedef struct {
int audio_size; /** audio packet size (bytes) */
int video_size; /** video packet size (bytes) */
@@ -154,15 +156,15 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
jv->state++;
if (jvf->video_size || jvf->palette_size) {
int size = jvf->video_size + jvf->palette_size;
- if (av_new_packet(pkt, size + 5))
+ if (av_new_packet(pkt, size + JV_PREAMBLE_SIZE))
return AVERROR(ENOMEM);
AV_WL32(pkt->data, jvf->video_size);
pkt->data[4] = jvf->video_type;
- if (avio_read(pb, pkt->data + 5, size) < 0)
+ if (avio_read(pb, pkt->data + JV_PREAMBLE_SIZE, size) < 0)
return AVERROR(EIO);
- pkt->size = size + 5;
+ pkt->size = size + JV_PREAMBLE_SIZE;
pkt->stream_index = 1;
pkt->pts = jv->pts;
if (jvf->video_type != 1)