diff --git a/cmdutils.c b/cmdutils.c index 4d153b79ba..32cc41ad18 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -138,7 +138,7 @@ void print_error(const char *filename, int err) "Usually that means that input file is truncated and/or corrupted.\n", filename); break; - case AVERROR_NOMEM: + case AVERROR(ENOMEM): fprintf(stderr, "%s: memory allocation error occured\n", filename); break; case AVERROR_NOENT: diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 2e23e18746..d377167264 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -116,7 +116,7 @@ static int fourxm_read_header(AVFormatContext *s, /* allocate space for the header and load the whole thing */ header = av_malloc(header_size); if (!header) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); if (get_buffer(pb, header, header_size) != header_size) return AVERROR_IO; @@ -140,7 +140,7 @@ static int fourxm_read_header(AVFormatContext *s, /* allocate a new AVStream */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 60, 1, fourxm->fps); fourxm->video_stream_index = st->index; @@ -166,7 +166,7 @@ static int fourxm_read_header(AVFormatContext *s, fourxm->track_count * sizeof(AudioTrack)); if (!fourxm->tracks) { av_free(header); - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } } fourxm->tracks[current_track].adpcm = AV_RL32(&header[i + 12]); @@ -178,7 +178,7 @@ static int fourxm_read_header(AVFormatContext *s, /* allocate a new AVStream */ st = av_new_stream(s, current_track); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate); diff --git a/libavformat/aiff.c b/libavformat/aiff.c index 19443bb206..9f476cb142 100644 --- a/libavformat/aiff.c +++ b/libavformat/aiff.c @@ -312,7 +312,7 @@ static int aiff_read_header(AVFormatContext *s, st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); while (filesize > 0) { /* parse different chunks */ diff --git a/libavformat/amr.c b/libavformat/amr.c index 6d70aad490..4d1a40604c 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -87,7 +87,7 @@ static int amr_read_header(AVFormatContext *s, st = av_new_stream(s, 0); if (!st) { - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } if(memcmp(header,AMR_header,6)!=0) { diff --git a/libavformat/apc.c b/libavformat/apc.c index 94ee28072e..ef62606d3e 100644 --- a/libavformat/apc.c +++ b/libavformat/apc.c @@ -41,7 +41,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS; @@ -53,7 +53,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->extradata = av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); /* initial predictor values for adpcm decoder */ get_buffer(pb, st->codec->extradata, 2 * 4); diff --git a/libavformat/avs.c b/libavformat/avs.c index 79a2ed8237..74cf5038f3 100644 --- a/libavformat/avs.c +++ b/libavformat/avs.c @@ -176,7 +176,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) if (!avs->st_video) { avs->st_video = av_new_stream(s, AVS_VIDEO); if (avs->st_video == NULL) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); avs->st_video->codec->codec_type = CODEC_TYPE_VIDEO; avs->st_video->codec->codec_id = CODEC_ID_AVS; avs->st_video->codec->width = avs->width; @@ -193,7 +193,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) if (!avs->st_audio) { avs->st_audio = av_new_stream(s, AVS_AUDIO); if (avs->st_audio == NULL) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); avs->st_audio->codec->codec_type = CODEC_TYPE_AUDIO; } avs->remaining_audio_size = size - 4; diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index fd54fd3143..4406659d8b 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -71,7 +71,7 @@ static int vid_read_header(AVFormatContext *s, stream = av_new_stream(s, 0); if (!stream) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps stream->codec->codec_type = CODEC_TYPE_VIDEO; stream->codec->codec_id = CODEC_ID_BETHSOFTVID; @@ -84,7 +84,7 @@ static int vid_read_header(AVFormatContext *s, // done with video codec, set up audio codec stream = av_new_stream(s, 0); if (!stream) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); stream->codec->codec_type = CODEC_TYPE_AUDIO; stream->codec->codec_id = CODEC_ID_PCM_U8; stream->codec->channels = 1; @@ -108,7 +108,7 @@ static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt, vidbuf_start = av_malloc(vidbuf_capacity = BUFFER_PADDING_SIZE); if(!vidbuf_start) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); // save the file position for the packet, include block type position = url_ftell(pb) - 1; @@ -128,7 +128,7 @@ static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt, do{ vidbuf_start = av_fast_realloc(vidbuf_start, &vidbuf_capacity, vidbuf_nbytes + BUFFER_PADDING_SIZE); if(!vidbuf_start) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); code = get_byte(pb); vidbuf_start[vidbuf_nbytes++] = code; diff --git a/libavformat/c93.c b/libavformat/c93.c index 369ae8e01e..419f28e42c 100644 --- a/libavformat/c93.c +++ b/libavformat/c93.c @@ -77,7 +77,7 @@ static int read_header(AVFormatContext *s, video = av_new_stream(s, 0); if (!video) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); video->codec->codec_type = CODEC_TYPE_VIDEO; video->codec->codec_id = CODEC_ID_C93; @@ -115,7 +115,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) if (!c93->audio) { c93->audio = av_new_stream(s, 1); if (!c93->audio) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); c93->audio->codec->codec_type = CODEC_TYPE_AUDIO; } url_fskip(pb, 26); /* VOC header */ diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c index 4a66c45b2e..32f4ac2729 100644 --- a/libavformat/dsicin.c +++ b/libavformat/dsicin.c @@ -108,7 +108,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) /* initialize the video decoder stream */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 32, 1, 12); cin->video_stream_index = st->index; @@ -121,7 +121,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) /* initialize the audio decoder stream */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 32, 1, 22050); cin->audio_stream_index = st->index; @@ -178,7 +178,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) pkt_size = (palette_type + 3) * hdr->pal_colors_count + hdr->video_frame_size; if (av_new_packet(pkt, 4 + pkt_size)) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); pkt->stream_index = cin->video_stream_index; pkt->pts = cin->video_stream_pts++; @@ -198,7 +198,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) /* audio packet */ if (av_new_packet(pkt, cin->audio_buffer_size)) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); pkt->stream_index = cin->audio_stream_index; pkt->pts = cin->audio_stream_pts; diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 81dbd2e713..0acf1b81dd 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -160,7 +160,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) 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); @@ -181,7 +181,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) 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); if(ret != size){ diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 2b66c739c0..f8bd4d8ed8 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -184,7 +184,7 @@ static int ea_read_header(AVFormatContext *s, /* initialize the video decoder stream */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, 90000); ea->video_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_VIDEO; @@ -195,7 +195,7 @@ static int ea_read_header(AVFormatContext *s, /* initialize the audio decoder stream */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, EA_SAMPLE_RATE); st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_ADPCM_EA; diff --git a/libavformat/flic.c b/libavformat/flic.c index 2c3754f0ff..69259fe72d 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -86,7 +86,7 @@ static int flic_read_header(AVFormatContext *s, /* initialize the decoder streams */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); flic->video_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_FLIC; diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 676bb27169..e60257f8e5 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -237,14 +237,14 @@ static int flv_read_header(AVFormatContext *s, if(flags & FLV_HEADER_FLAG_HASVIDEO){ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_VIDEO; av_set_pts_info(st, 24, 1, 1000); /* 24 bit pts in ms */ } if(flags & FLV_HEADER_FLAG_HASAUDIO){ st = av_new_stream(s, 1); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_AUDIO; av_set_pts_info(st, 24, 1, 1000); /* 24 bit pts in ms */ } diff --git a/libavformat/idcin.c b/libavformat/idcin.c index 5f2c9cffd8..3b76627669 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -151,7 +151,7 @@ static int idcin_read_header(AVFormatContext *s, st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, 90000); idcin->video_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_VIDEO; @@ -174,7 +174,7 @@ static int idcin_read_header(AVFormatContext *s, idcin->audio_present = 1; st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, 90000); idcin->audio_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_AUDIO; diff --git a/libavformat/idroq.c b/libavformat/idroq.c index 27dc081668..de28d1ef4b 100644 --- a/libavformat/idroq.c +++ b/libavformat/idroq.c @@ -140,7 +140,7 @@ static int roq_read_header(AVFormatContext *s, /* initialize the decoders */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); /* set the pts reference (1 pts = 1/90000) */ av_set_pts_info(st, 33, 1, 90000); roq->video_stream_index = st->index; @@ -153,7 +153,7 @@ static int roq_read_header(AVFormatContext *s, if (roq->audio_channels) { st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, 90000); roq->audio_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_AUDIO; diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index cd1f98abd4..f2dbb9ae1e 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -551,7 +551,7 @@ static int ipmovie_read_header(AVFormatContext *s, /* initialize the stream decoders */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, 90000); ipmovie->video_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_VIDEO; @@ -566,7 +566,7 @@ static int ipmovie_read_header(AVFormatContext *s, if (ipmovie->audio_type) { st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, 90000); ipmovie->audio_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_AUDIO; @@ -598,7 +598,7 @@ static int ipmovie_read_packet(AVFormatContext *s, else if (ret == CHUNK_EOF) ret = AVERROR_IO; else if (ret == CHUNK_NOMEM) - ret = AVERROR_NOMEM; + ret = AVERROR(ENOMEM); else if (ret == CHUNK_VIDEO) ret = 0; else diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 532ccd8c83..b6fc4bd149 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -485,7 +485,7 @@ ebml_read_ascii (MatroskaDemuxContext *matroska, * byte more, read the string and NULL-terminate it ourselves. */ if (size < 0 || !(*str = av_malloc(size + 1))) { av_log(matroska->ctx, AV_LOG_ERROR, "Memory allocation failed\n"); - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } if (get_buffer(pb, (uint8_t *) *str, size) != size) { offset_t pos = url_ftell(pb); @@ -581,7 +581,7 @@ ebml_read_binary (MatroskaDemuxContext *matroska, if (!(*binary = av_malloc(*size))) { av_log(matroska->ctx, AV_LOG_ERROR, "Memory allocation error\n"); - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } if (get_buffer(pb, *binary, *size) != *size) { @@ -2074,7 +2074,7 @@ matroska_read_header (AVFormatContext *s, int sri = matroska_aac_sri(audiotrack->internal_samplerate); extradata = av_malloc(5); if (extradata == NULL) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); extradata[0] = (profile << 3) | ((sri&0x0E) >> 1); extradata[1] = ((sri&0x01) << 7) | (audiotrack->channels<<3); if (strstr(track->codec_id, "SBR")) { @@ -2095,7 +2095,7 @@ matroska_read_header (AVFormatContext *s, extradata_size = 30; extradata = av_mallocz(extradata_size); if (extradata == NULL) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); init_put_byte(&b, extradata, extradata_size, 1, NULL, NULL, NULL, NULL); put_buffer(&b, (uint8_t *) "TTA1", 4); @@ -2164,7 +2164,7 @@ matroska_read_header (AVFormatContext *s, matroska->num_streams++; st = av_new_stream(s, track->stream_index); if (st == NULL) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 64, matroska->time_scale, 1000*1000*1000); /* 64 bit pts in ns */ st->codec->codec_id = codec_id; @@ -2182,7 +2182,7 @@ matroska_read_header (AVFormatContext *s, } else if(track->codec_priv && track->codec_priv_size > 0){ st->codec->extradata = av_malloc(track->codec_priv_size); if(st->codec->extradata == NULL) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); st->codec->extradata_size = track->codec_priv_size; memcpy(st->codec->extradata,track->codec_priv+extradata_offset, track->codec_priv_size); @@ -2451,7 +2451,7 @@ matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size, pkt = av_mallocz(sizeof(AVPacket)); /* XXX: prevent data copy... */ if (av_new_packet(pkt, slice_size-offset) < 0) { - res = AVERROR_NOMEM; + res = AVERROR(ENOMEM); n = laces-1; break; } diff --git a/libavformat/mm.c b/libavformat/mm.c index a2c8a0c10f..366259b807 100644 --- a/libavformat/mm.c +++ b/libavformat/mm.c @@ -95,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 */ @@ -108,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; @@ -168,7 +168,7 @@ 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; @@ -179,7 +179,7 @@ static int mm_read_packet(AVFormatContext *s, case MM_TYPE_AUDIO : if (av_get_packet(&s->pb, pkt, length)<0) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); pkt->size = length; pkt->stream_index = 1; pkt->pts = mm->audio_pts++; diff --git a/libavformat/mmf.c b/libavformat/mmf.c index e395587002..4dce8881f7 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -242,7 +242,7 @@ static int mmf_read_header(AVFormatContext *s, st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_ADPCM_YAMAHA; diff --git a/libavformat/mp3.c b/libavformat/mp3.c index 2f3fba8fce..3acdfa5c7f 100644 --- a/libavformat/mp3.c +++ b/libavformat/mp3.c @@ -433,7 +433,7 @@ static int mp3_read_header(AVFormatContext *s, st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_MP3; diff --git a/libavformat/mpc.c b/libavformat/mpc.c index 0c73b4e082..886eb3e468 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -92,7 +92,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_MUSEPACK7; st->codec->channels = 2; diff --git a/libavformat/mtv.c b/libavformat/mtv.c index fca8f76580..2d4832c2cd 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -96,7 +96,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) st = av_new_stream(s, VIDEO_SID); if(!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 64, 1, mtv->video_fps); st->codec->codec_type = CODEC_TYPE_VIDEO; @@ -111,7 +111,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) st = av_new_stream(s, AUDIO_SID); if(!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 64, 1, AUDIO_SAMPLING_RATE); st->codec->codec_type = CODEC_TYPE_AUDIO; diff --git a/libavformat/nut.c b/libavformat/nut.c index 31114c5f6e..4a531dbae4 100644 --- a/libavformat/nut.c +++ b/libavformat/nut.c @@ -952,7 +952,7 @@ static int decode_stream_header(NUTContext *nut){ st = av_new_stream(s, stream_id); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); class = get_v(bc); tmp = get_vb(bc); diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index b32bcaaa8c..8eb727b257 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -293,7 +293,7 @@ static int decode_stream_header(NUTContext *nut){ st = s->streams[stream_id]; if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); class = get_v(bc); tmp = get_fourcc(bc); diff --git a/libavformat/ogg.c b/libavformat/ogg.c index 9a5f11d09c..f6f67c06b9 100644 --- a/libavformat/ogg.c +++ b/libavformat/ogg.c @@ -216,7 +216,7 @@ static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap) ast = av_new_stream(avfcontext, 0) ; if(!ast) - return AVERROR_NOMEM ; + return AVERROR(ENOMEM) ; av_set_pts_info(ast, 60, 1, AV_TIME_BASE); codec= &ast->codec; diff --git a/libavformat/ogg2.c b/libavformat/ogg2.c index a3739556e4..ca8c2c31d7 100644 --- a/libavformat/ogg2.c +++ b/libavformat/ogg2.c @@ -200,7 +200,7 @@ ogg_new_stream (AVFormatContext * s, uint32_t serial) st = av_new_stream (s, idx); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 64, 1, 1000000); diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c index d6f1db1d04..ce54fb1a0e 100644 --- a/libavformat/psxstr.c +++ b/libavformat/psxstr.c @@ -178,7 +178,7 @@ static int str_read_header(AVFormatContext *s, /* allocate a new AVStream */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 64, 1, 15); str->channels[channel].video_stream_index = st->index; @@ -207,7 +207,7 @@ static int str_read_header(AVFormatContext *s, /* allocate a new AVStream */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 64, 128, str->channels[channel].sample_rate); str->channels[channel].audio_stream_index = st->index; diff --git a/libavformat/raw.c b/libavformat/raw.c index 7d1fafda81..7637fd15a6 100644 --- a/libavformat/raw.c +++ b/libavformat/raw.c @@ -72,7 +72,7 @@ static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap) st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); id = s->iformat->value; if (id == CODEC_ID_RAWVIDEO) { @@ -222,7 +222,7 @@ static int ac3_read_header(AVFormatContext *s, st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_AC3; @@ -238,7 +238,7 @@ static int shorten_read_header(AVFormatContext *s, st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_SHORTEN; st->need_parsing = AVSTREAM_PARSE_FULL; @@ -254,7 +254,7 @@ static int flac_read_header(AVFormatContext *s, st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_FLAC; st->need_parsing = AVSTREAM_PARSE_FULL; @@ -270,7 +270,7 @@ static int dts_read_header(AVFormatContext *s, st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_DTS; @@ -287,7 +287,7 @@ static int aac_read_header(AVFormatContext *s, st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_AAC; @@ -304,7 +304,7 @@ static int video_read_header(AVFormatContext *s, 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 = s->iformat->value; diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 0e91e92eb7..417c6be9be 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1044,7 +1044,7 @@ static int rtsp_read_header(AVFormatContext *s, rtsp_st->rtp_ctx = rtp_parse_open(s, st, rtsp_st->rtp_handle, rtsp_st->sdp_payload_type, &rtsp_st->rtp_payload_data); if (!rtsp_st->rtp_ctx) { - err = AVERROR_NOMEM; + err = AVERROR(ENOMEM); goto fail; } else { if(rtsp_st->dynamic_handler) { @@ -1384,7 +1384,7 @@ static int sdp_read_header(AVFormatContext *s, s->ctx_flags |= AVFMTCTX_NOHEADER; rtsp_st->rtp_ctx = rtp_parse_open(s, st, rtsp_st->rtp_handle, rtsp_st->sdp_payload_type, &rtsp_st->rtp_payload_data); if (!rtsp_st->rtp_ctx) { - err = AVERROR_NOMEM; + err = AVERROR(ENOMEM); goto fail; } else { if(rtsp_st->dynamic_handler) { diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 55fb9d9ad1..1ae29ee4e2 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -130,7 +130,7 @@ static int film_read_header(AVFormatContext *s, if (film->video_type) { st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); film->video_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = film->video_type; @@ -142,7 +142,7 @@ static int film_read_header(AVFormatContext *s, if (film->audio_type) { st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); film->audio_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = film->audio_type; @@ -223,14 +223,14 @@ static int film_read_packet(AVFormatContext *s, (film->video_type == CODEC_ID_CINEPAK)) { pkt->pos= url_ftell(pb); if (av_new_packet(pkt, sample->sample_size)) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); get_buffer(pb, pkt->data, sample->sample_size); } else if ((sample->stream == film->audio_stream_index) && (film->audio_channels == 2)) { /* stereo PCM needs to be interleaved */ if (av_new_packet(pkt, sample->sample_size)) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); /* make sure the interleave buffer is large enough */ if (sample->sample_size > film->stereo_buffer_size) { diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c index 15ce40f688..68fc685e48 100644 --- a/libavformat/sierravmd.c +++ b/libavformat/sierravmd.c @@ -94,7 +94,7 @@ static int vmd_read_header(AVFormatContext *s, /* start up the decoders */ vst = av_new_stream(s, 0); if (!vst) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(vst, 33, 1, 10); vmd->video_stream_index = vst->index; vst->codec->codec_type = CODEC_TYPE_VIDEO; @@ -111,7 +111,7 @@ static int vmd_read_header(AVFormatContext *s, if (vmd->sample_rate) { st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); vmd->audio_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_VMDAUDIO; @@ -155,7 +155,7 @@ static int vmd_read_header(AVFormatContext *s, if (!raw_frame_table || !vmd->frame_table) { av_free(raw_frame_table); av_free(vmd->frame_table); - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } if (get_buffer(pb, raw_frame_table, raw_frame_table_size) != raw_frame_table_size) { @@ -257,7 +257,7 @@ static int vmd_read_packet(AVFormatContext *s, url_fseek(pb, frame->frame_offset, SEEK_SET); if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD)) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); pkt->pos= url_ftell(pb); memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD); ret = get_buffer(pb, pkt->data + BYTES_PER_FRAME_RECORD, diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 9c98d311a0..de1685f55f 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -290,7 +290,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) flags >>= 1; } if (av_new_packet(pkt, frame_size + 768)) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); if(smk->frm_size[smk->cur_frame] & 1) palchange |= 2; pkt->data[0] = palchange; @@ -304,7 +304,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) smk->nextpos = url_ftell(&s->pb); } else { if (av_new_packet(pkt, smk->buf_sizes[smk->curstream])) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); memcpy(pkt->data, smk->bufs[smk->curstream], smk->buf_sizes[smk->curstream]); pkt->size = smk->buf_sizes[smk->curstream]; pkt->stream_index = smk->stream_id[smk->curstream]; diff --git a/libavformat/thp.c b/libavformat/thp.c index a7403a60bc..7f9a8881ca 100644 --- a/libavformat/thp.c +++ b/libavformat/thp.c @@ -96,7 +96,7 @@ static int thp_read_header(AVFormatContext *s, /* Video component. */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); /* The denominator and numerator are switched because 1/fps is required. */ @@ -119,7 +119,7 @@ static int thp_read_header(AVFormatContext *s, /* Audio component. */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_ADPCM_THP; diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c index 6a60da4dd9..6181577bae 100644 --- a/libavformat/tiertexseq.c +++ b/libavformat/tiertexseq.c @@ -95,7 +95,7 @@ static int seq_init_frame_buffers(SeqDemuxContext *seq, ByteIOContext *pb) seq_buffer->data_size = sz; seq_buffer->data = av_malloc(sz); if (!seq_buffer->data) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } } seq->frame_buffers_count = i; @@ -208,7 +208,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap) /* initialize the video decoder stream */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 32, 1, SEQ_FRAME_RATE); seq->video_stream_index = st->index; @@ -221,7 +221,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap) /* initialize the audio decoder stream */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 32, 1, SEQ_SAMPLE_RATE); seq->audio_stream_index = st->index; @@ -251,7 +251,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) /* video packet */ if (seq->current_pal_data_size + seq->current_video_data_size != 0) { if (av_new_packet(pkt, 1 + seq->current_pal_data_size + seq->current_video_data_size)) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); pkt->data[0] = 0; if (seq->current_pal_data_size != 0) { diff --git a/libavformat/tta.c b/libavformat/tta.c index b6b79a0f55..5799e5d727 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -71,7 +71,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 64, 1, samplerate); st->start_time = 0; diff --git a/libavformat/txd.c b/libavformat/txd.c index 19febd160c..8843226681 100644 --- a/libavformat/txd.c +++ b/libavformat/txd.c @@ -41,7 +41,7 @@ static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) { 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_TXD; st->codec->time_base.den = 5; diff --git a/libavformat/utils.c b/libavformat/utils.c index 5b054f6570..9d85518df2 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -195,10 +195,10 @@ int av_new_packet(AVPacket *pkt, int size) { uint8_t *data; if((unsigned)size > (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!data) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); av_init_packet(pkt); @@ -233,10 +233,10 @@ int av_dup_packet(AVPacket *pkt) /* we duplicate the packet and don't forget to put the padding again */ if((unsigned)pkt->size > (unsigned)pkt->size + FF_INPUT_BUFFER_PADDING_SIZE) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); data = av_malloc(pkt->size + FF_INPUT_BUFFER_PADDING_SIZE); if (!data) { - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } memcpy(data, pkt->data, pkt->size); memset(data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE); @@ -358,7 +358,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr, else ic = *ic_ptr; if (!ic) { - err = AVERROR_NOMEM; + err = AVERROR(ENOMEM); goto fail; } ic->iformat = fmt; @@ -372,7 +372,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr, if (fmt->priv_data_size > 0) { ic->priv_data = av_mallocz(fmt->priv_data_size); if (!ic->priv_data) { - err = AVERROR_NOMEM; + err = AVERROR(ENOMEM); goto fail; } } else { @@ -868,13 +868,13 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt) /* duplicate the packet */ if (av_dup_packet(pkt) < 0) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); while(*plast_pktl) plast_pktl= &(*plast_pktl)->next; //FIXME maybe maintain pointer to the last? pktl = av_mallocz(sizeof(AVPacketList)); if (!pktl) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); /* add the packet in the buffered packet list */ *plast_pktl = pktl; @@ -1727,7 +1727,7 @@ int av_find_stream_info(AVFormatContext *ic) int codec_identified[MAX_STREAMS]={0}; duration_error = av_mallocz(MAX_STREAMS * sizeof(*duration_error)); - if (!duration_error) return AVERROR_NOMEM; + if (!duration_error) return AVERROR(ENOMEM); for(i=0;inb_streams;i++) { st = ic->streams[i]; @@ -1807,7 +1807,7 @@ int av_find_stream_info(AVFormatContext *ic) pktl = av_mallocz(sizeof(AVPacketList)); if (!pktl) { - ret = AVERROR_NOMEM; + ret = AVERROR(ENOMEM); break; } @@ -1820,7 +1820,7 @@ int av_find_stream_info(AVFormatContext *ic) /* duplicate the packet */ if (av_dup_packet(pkt) < 0) { - ret = AVERROR_NOMEM; + ret = AVERROR(ENOMEM); break; } @@ -2088,7 +2088,7 @@ int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap) if (s->oformat->priv_data_size > 0) { s->priv_data = av_mallocz(s->oformat->priv_data_size); if (!s->priv_data) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } else s->priv_data = NULL; @@ -2143,7 +2143,7 @@ int av_write_header(AVFormatContext *s) if (!s->priv_data && s->oformat->priv_data_size > 0) { s->priv_data = av_mallocz(s->oformat->priv_data_size); if (!s->priv_data) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } if(s->oformat->write_header){ diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c index c33bfbd321..58f79d73c6 100644 --- a/libavformat/vocdec.c +++ b/libavformat/vocdec.c @@ -52,7 +52,7 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) url_fskip(pb, header_size); st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); st->codec->codec_type = CODEC_TYPE_AUDIO; voc->remaining_size = 0; diff --git a/libavformat/wav.c b/libavformat/wav.c index a6db698aa5..f16b52e96d 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -176,7 +176,7 @@ static int wav_read_header(AVFormatContext *s, return -1; st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); get_wav_header(pb, st->codec, size); st->need_parsing = AVSTREAM_PARSE_FULL; diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index c87007050a..2692de408b 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -238,7 +238,7 @@ static int wc3_read_header(AVFormatContext *s, /* initialize the decoder streams */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, 90000); wc3->video_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_VIDEO; @@ -252,7 +252,7 @@ static int wc3_read_header(AVFormatContext *s, st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, 90000); wc3->audio_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_AUDIO; diff --git a/libavformat/westwood.c b/libavformat/westwood.c index 2c546f66c8..7df258d178 100644 --- a/libavformat/westwood.c +++ b/libavformat/westwood.c @@ -138,7 +138,7 @@ static int wsaud_read_header(AVFormatContext *s, /* initialize the audio decoder stream */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, wsaud->audio_samplerate); st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = wsaud->audio_type; @@ -223,7 +223,7 @@ static int wsvqa_read_header(AVFormatContext *s, /* initialize the video decoder stream */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, VQA_FRAMERATE); wsvqa->video_stream_index = st->index; st->codec->codec_type = CODEC_TYPE_VIDEO; @@ -249,7 +249,7 @@ static int wsvqa_read_header(AVFormatContext *s, if (AV_RL16(&header[24]) || (AV_RL16(&header[0]) == 1 && AV_RL16(&header[2]) == 1)) { st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, VQA_FRAMERATE); st->codec->codec_type = CODEC_TYPE_AUDIO; if (AV_RL16(&header[0]) == 1) diff --git a/libavformat/wv.c b/libavformat/wv.c index ed1eefeea0..b3c7957248 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -177,7 +177,7 @@ static int wv_read_packet(AVFormatContext *s, } if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE) < 0) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); memcpy(pkt->data, wc->extra, WV_EXTRA_SIZE); ret = get_buffer(&s->pb, pkt->data + WV_EXTRA_SIZE, wc->blksize); if(ret != wc->blksize){