Commit 769e10f0 authored by Panagiotis Issaris's avatar Panagiotis Issaris

Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).

Originally committed as revision 9759 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 390d5a7c
......@@ -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:
......
......@@ -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);
......
......@@ -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 */
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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;
......
......@@ -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){
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 */
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
}
......
......@@ -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++;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -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,
......
......@@ -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];
......
......@@ -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;
......
......@@ -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;