summaryrefslogtreecommitdiff
path: root/contrib/ffmpeg/libavformat/dxa.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ffmpeg/libavformat/dxa.c')
-rw-r--r--contrib/ffmpeg/libavformat/dxa.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/contrib/ffmpeg/libavformat/dxa.c b/contrib/ffmpeg/libavformat/dxa.c
index f49d3d4ac..2df73c7dd 100644
--- a/contrib/ffmpeg/libavformat/dxa.c
+++ b/contrib/ffmpeg/libavformat/dxa.c
@@ -36,8 +36,6 @@ typedef struct{
static int dxa_probe(AVProbeData *p)
{
/* check file header */
- if (p->buf_size <= 4)
- return 0;
if (p->buf[0] == 'D' && p->buf[1] == 'E' &&
p->buf[2] == 'X' && p->buf[3] == 'A')
return AVPROBE_SCORE_MAX;
@@ -47,7 +45,7 @@ static int dxa_probe(AVProbeData *p)
static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
DXAContext *c = s->priv_data;
AVStream *st, *ast;
uint32_t tag;
@@ -146,54 +144,54 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
if(!c->readvid && c->has_sound && c->bytes_left){
c->readvid = 1;
- url_fseek(&s->pb, c->wavpos, SEEK_SET);
+ url_fseek(s->pb, c->wavpos, SEEK_SET);
size = FFMIN(c->bytes_left, c->bpc);
- ret = av_get_packet(&s->pb, pkt, size);
+ ret = av_get_packet(s->pb, pkt, size);
pkt->stream_index = 1;
if(ret != size)
- return AVERROR_IO;
+ return AVERROR(EIO);
c->bytes_left -= size;
- c->wavpos = url_ftell(&s->pb);
+ c->wavpos = url_ftell(s->pb);
return 0;
}
- url_fseek(&s->pb, c->vidpos, SEEK_SET);
- while(!url_feof(&s->pb) && c->frames){
- get_buffer(&s->pb, buf, 4);
+ url_fseek(s->pb, c->vidpos, SEEK_SET);
+ while(!url_feof(s->pb) && c->frames){
+ get_buffer(s->pb, buf, 4);
switch(AV_RL32(buf)){
case MKTAG('N', 'U', 'L', 'L'):
if(av_new_packet(pkt, 4 + pal_size) < 0)
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
pkt->stream_index = 0;
if(pal_size) memcpy(pkt->data, pal, pal_size);
memcpy(pkt->data + pal_size, buf, 4);
c->frames--;
- c->vidpos = url_ftell(&s->pb);
+ c->vidpos = url_ftell(s->pb);
c->readvid = 0;
return 0;
case MKTAG('C', 'M', 'A', 'P'):
pal_size = 768+4;
memcpy(pal, buf, 4);
- get_buffer(&s->pb, pal + 4, 768);
+ get_buffer(s->pb, pal + 4, 768);
break;
case MKTAG('F', 'R', 'A', 'M'):
- get_buffer(&s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
+ get_buffer(s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
size = AV_RB32(buf + 5);
if(size > 0xFFFFFF){
av_log(s, AV_LOG_ERROR, "Frame size is too big: %d\n", size);
return -1;
}
if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0)
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
memcpy(pkt->data + pal_size, buf, DXA_EXTRA_SIZE);
- ret = get_buffer(&s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
+ ret = get_buffer(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
if(ret != size){
av_free_packet(pkt);
- return AVERROR_IO;
+ return AVERROR(EIO);
}
if(pal_size) memcpy(pkt->data, pal, pal_size);
pkt->stream_index = 0;
c->frames--;
- c->vidpos = url_ftell(&s->pb);
+ c->vidpos = url_ftell(s->pb);
c->readvid = 0;
return 0;
default: