mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
jv demuxer: define JV_PREAMBLE_SIZE instead of hard coding the number
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
This commit is contained in:
parent
20c1281fe3
commit
772cb06281
@ -28,6 +28,8 @@
|
|||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
|
|
||||||
|
#define JV_PREAMBLE_SIZE 5
|
||||||
|
|
||||||
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) */
|
||||||
@ -154,15 +156,15 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
jv->state++;
|
jv->state++;
|
||||||
if (jvf->video_size || jvf->palette_size) {
|
if (jvf->video_size || jvf->palette_size) {
|
||||||
int size = 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);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
AV_WL32(pkt->data, jvf->video_size);
|
AV_WL32(pkt->data, jvf->video_size);
|
||||||
pkt->data[4] = jvf->video_type;
|
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);
|
return AVERROR(EIO);
|
||||||
|
|
||||||
pkt->size = size + 5;
|
pkt->size = size + JV_PREAMBLE_SIZE;
|
||||||
pkt->stream_index = 1;
|
pkt->stream_index = 1;
|
||||||
pkt->pts = jv->pts;
|
pkt->pts = jv->pts;
|
||||||
if (jvf->video_type != 1)
|
if (jvf->video_type != 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user