summaryrefslogtreecommitdiff
path: root/contrib/ffmpeg/libavformat/mm.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ffmpeg/libavformat/mm.c')
-rw-r--r--contrib/ffmpeg/libavformat/mm.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/contrib/ffmpeg/libavformat/mm.c b/contrib/ffmpeg/libavformat/mm.c
index 443b70929..4e6bac027 100644
--- a/contrib/ffmpeg/libavformat/mm.c
+++ b/contrib/ffmpeg/libavformat/mm.c
@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
@@ -59,8 +59,6 @@ typedef struct {
static int mm_probe(AVProbeData *p)
{
/* the first chunk is always the header */
- if (p->buf_size < MM_PREAMBLE_SIZE)
- return 0;
if (AV_RL16(&p->buf[0]) != MM_TYPE_HEADER)
return 0;
if (AV_RL32(&p->buf[2]) != MM_HEADER_LEN_V && AV_RL32(&p->buf[2]) != MM_HEADER_LEN_AV)
@@ -73,8 +71,8 @@ static int mm_probe(AVProbeData *p)
static int mm_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
- MmDemuxContext *mm = (MmDemuxContext *)s->priv_data;
- ByteIOContext *pb = &s->pb;
+ MmDemuxContext *mm = s->priv_data;
+ ByteIOContext *pb = s->pb;
AVStream *st;
unsigned int type, length;
@@ -97,7 +95,7 @@ static int mm_read_header(AVFormatContext *s,
/* video stream */
st = av_new_stream(s, 0);
if (!st)
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_MMVIDEO;
st->codec->codec_tag = 0; /* no fourcc */
@@ -110,7 +108,7 @@ static int mm_read_header(AVFormatContext *s,
if (length == MM_HEADER_LEN_AV) {
st = av_new_stream(s, 0);
if (!st)
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->codec_id = CODEC_ID_PCM_U8;
@@ -128,8 +126,8 @@ static int mm_read_header(AVFormatContext *s,
static int mm_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
- MmDemuxContext *mm = (MmDemuxContext *)s->priv_data;
- ByteIOContext *pb = &s->pb;
+ MmDemuxContext *mm = s->priv_data;
+ ByteIOContext *pb = s->pb;
unsigned char preamble[MM_PREAMBLE_SIZE];
unsigned char pal[MM_PALETTE_SIZE];
unsigned int type, length;
@@ -138,7 +136,7 @@ static int mm_read_packet(AVFormatContext *s,
while(1) {
if (get_buffer(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) {
- return AVERROR_IO;
+ return AVERROR(EIO);
}
type = AV_RL16(&preamble[0]);
@@ -148,7 +146,7 @@ static int mm_read_packet(AVFormatContext *s,
case MM_TYPE_PALETTE :
url_fseek(pb, 4, SEEK_CUR); /* unknown data */
if (get_buffer(pb, pal, MM_PALETTE_SIZE) != MM_PALETTE_SIZE)
- return AVERROR_IO;
+ return AVERROR(EIO);
url_fseek(pb, length - (4 + MM_PALETTE_SIZE), SEEK_CUR);
for (i=0; i<MM_PALETTE_COUNT; i++) {
@@ -170,18 +168,18 @@ static int mm_read_packet(AVFormatContext *s,
case MM_TYPE_INTER_HHV :
/* output preamble + data */
if (av_new_packet(pkt, length + MM_PREAMBLE_SIZE))
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
memcpy(pkt->data, preamble, MM_PREAMBLE_SIZE);
if (get_buffer(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length)
- return AVERROR_IO;
+ return AVERROR(EIO);
pkt->size = length + MM_PREAMBLE_SIZE;
pkt->stream_index = 0;
pkt->pts = mm->video_pts++;
return 0;
case MM_TYPE_AUDIO :
- if (av_get_packet(&s->pb, pkt, length)<0)
- return AVERROR_NOMEM;
+ if (av_get_packet(s->pb, pkt, length)<0)
+ return AVERROR(ENOMEM);
pkt->size = length;
pkt->stream_index = 1;
pkt->pts = mm->audio_pts++;