if (ist->next_dts == AV_NOPTS_VALUE)
ist->next_dts = ist->last_dts;
- if (pkt == NULL) {
+ if (!pkt) {
/* EOF handling */
av_init_packet(&avpkt);
avpkt.data = NULL;
}
if (!file_overwrite &&
- (strchr(filename, ':') == NULL || filename[1] == ':' ||
+ (!strchr(filename, ':') || filename[1] == ':' ||
av_strstart(filename, "file:", NULL))) {
if (avio_check(filename, 0) == 0) {
if (!using_stdin && !file_skip) {
is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx,
vp->width, vp->height, vp->pix_fmt, vp->width, vp->height,
dst_pix_fmt, sws_flags, NULL, NULL, NULL);
- if (is->img_convert_ctx == NULL) {
+ if (!is->img_convert_ctx) {
fprintf(stderr, "Cannot initialize the conversion context\n");
exit(1);
}
win32_argv_utf8 = av_mallocz(sizeof(char *) * (win32_argc + 1) + buffsize);
argstr_flat = (char *)win32_argv_utf8 + sizeof(char *) * (win32_argc + 1);
- if (win32_argv_utf8 == NULL) {
+ if (!win32_argv_utf8) {
LocalFree(argv_w);
return;
}
const char *long_name = NULL;
while ((ofmt = av_oformat_next(ofmt))) {
- if ((name == NULL || strcmp(ofmt->name, name) < 0) &&
+ if ((!name || strcmp(ofmt->name, name) < 0) &&
strcmp(ofmt->name, last_name) > 0) {
name = ofmt->name;
long_name = ofmt->long_name;
}
}
while ((ifmt = av_iformat_next(ifmt))) {
- if ((name == NULL || strcmp(ifmt->name, name) < 0) &&
+ if ((!name || strcmp(ifmt->name, name) < 0) &&
strcmp(ifmt->name, last_name) > 0) {
name = ifmt->name;
long_name = ifmt->long_name;
if (name && strcmp(ifmt->name, name) == 0)
decode = 1;
}
- if (name == NULL)
+ if (!name)
break;
last_name = name;
return EOF;
}
optopt = c = argv[optind][sp];
- if (c == ':' || (cp = strchr(opts, c)) == NULL) {
+ if (c == ':' || !(cp = strchr(opts, c))) {
fprintf(stderr, ": illegal option -- %c\n", c);
if (argv[optind][++sp] == '\0') {
optind++;
q->decoded_bytes_buffer = av_mallocz(FFALIGN(avctx->block_align, 4) +
FF_INPUT_BUFFER_PADDING_SIZE);
- if (q->decoded_bytes_buffer == NULL)
+ if (!q->decoded_bytes_buffer)
return AVERROR(ENOMEM);
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
av_mallocz(avctx->block_align
+ DECODE_BYTES_PAD1(avctx->block_align)
+ FF_INPUT_BUFFER_PADDING_SIZE);
- if (q->decoded_bytes_buffer == NULL)
+ if (!q->decoded_bytes_buffer)
return AVERROR(ENOMEM);
/* Initialize transform. */
page_id = 1;
- if (h->num_rects == 0 || h->rects == NULL)
+ if (h->num_rects == 0 || !h->rects)
return -1;
*q++ = 0x00; /* subtitle_stream_id */
if (sub_header->num_rects > 0)
return is_menu;
fail:
- if (sub_header->rects != NULL) {
+ if (!sub_header->rects) {
for (i = 0; i < sub_header->num_rects; i++) {
av_freep(&sub_header->rects[i]->pict.data[0]);
av_freep(&sub_header->rects[i]->pict.data[1]);
int y1, y2, x1, x2, y, w, h, i;
uint8_t *bitmap;
- if (s->num_rects == 0 || s->rects == NULL || s->rects[0]->w <= 0 || s->rects[0]->h <= 0)
+ if (s->num_rects == 0 || !s->rects || s->rects[0]->w <= 0 || s->rects[0]->h <= 0)
return 0;
for(i = 0; i < s->rects[0]->nb_colors; i++) {
unsigned long hist[256];
int cmap[256];
- if (rects == 0 || h->rects == NULL)
+ if (rects == 0 || !h->rects)
return -1;
if (rects > 20)
rects = 20;
avctx->pix_fmt = AV_PIX_FMT_PAL8;
c->dsize = avctx->width * avctx->height * 2;
- if((c->decomp_buf = av_malloc(c->dsize)) == NULL) {
+ if (!(c->decomp_buf = av_malloc(c->dsize))) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
return AVERROR(ENOMEM);
}
if ((ret = ff_mpv_common_init(s)) < 0)
return ret;
- if (s->current_picture_ptr == NULL || s->current_picture_ptr->f->data[0]) {
+ if (!s->current_picture_ptr || s->current_picture_ptr->f->data[0]) {
int i = ff_find_unused_picture(s, 0);
if (i < 0)
return i;
s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
/* skip B-frames if we don't have reference frames */
- if (s->last_picture_ptr == NULL &&
+ if (!s->last_picture_ptr &&
(s->pict_type == AV_PICTURE_TYPE_B || s->droppable))
return get_consumed_bytes(s, buf_size);
if ((avctx->skip_frame >= AVDISCARD_NONREF &&
length + FF_INPUT_BUFFER_PADDING_SIZE);
dst = h->rbsp_buffer[bufidx];
- if (dst == NULL)
+ if (!dst)
return NULL;
memcpy(dst, src, i);
ptr = ff_h264_decode_nal(h, buf + buf_index, &dst_length, &consumed,
next_avc - buf_index);
- if (ptr == NULL || dst_length < 0)
+ if (!ptr || dst_length < 0)
return AVERROR_INVALIDDATA;
buf_index += consumed;
ptr = ff_h264_decode_nal(hx, buf + buf_index, &dst_length,
&consumed, next_avc - buf_index);
- if (ptr == NULL || dst_length < 0) {
+ if (!ptr || dst_length < 0) {
ret = -1;
goto end;
}
break;
}
ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length);
- if (ptr == NULL || dst_length < 0)
+ if (!ptr || dst_length < 0)
break;
init_get_bits(&h->gb, ptr, 8 * dst_length);
return AVERROR(ENOMEM);
pps->sps_id = get_ue_golomb_31(&h->gb);
if ((unsigned)pps->sps_id >= MAX_SPS_COUNT ||
- h->sps_buffers[pps->sps_id] == NULL) {
+ !h->sps_buffers[pps->sps_id]) {
av_log(h->avctx, AV_LOG_ERROR, "sps_id %u out of range\n", pps->sps_id);
goto fail;
}
(h->max_pic_num - 1);
#if 0
if (mmco[i].short_pic_num >= h->short_ref_count ||
- h->short_ref[ mmco[i].short_pic_num ] == NULL){
+ !h->short_ref[ mmco[i].short_pic_num ]) {
av_log(s->avctx, AV_LOG_ERROR,
"illegal short ref in memory management control "
"operation %d\n", mmco);
int h, cy, i;
int offset[AV_NUM_DATA_POINTERS];
- if (s->avctx->draw_horiz_band == NULL)
+ if (!s->avctx->draw_horiz_band)
return;
h = y - s->last_slice_end;
motion_offset, s->upper_motion_limit_offset);
return AVERROR_INVALIDDATA;
}
- if (src->data[0] == NULL) {
+ if (!src->data[0]) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid decode type, corrupted header?\n");
return AVERROR(EINVAL);
}
/* Allocate decompression buffer */
if (c->decomp_size) {
- if ((c->decomp_buf = av_malloc(max_decomp_size)) == NULL) {
+ if (!(c->decomp_buf = av_malloc(max_decomp_size))) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
return AVERROR(ENOMEM);
}
s->avctx = avctx;
/* initialize LAME and get defaults */
- if ((s->gfp = lame_init()) == NULL)
+ if (!(s->gfp = lame_init()))
return AVERROR(ENOMEM);
lame_set_num_channels(s->gfp, avctx->channels);
char *log = x->context->twopassbuffer;
/* Do a quick bounds check */
- if( log == NULL )
+ if (!log)
return XVID_ERR_FAIL;
/* We use snprintf() */
char frame_type;
/* Quick bounds check */
- if( log == NULL )
+ if (!log)
return XVID_ERR_FAIL;
/* Convert the type given to us into a character */
if( vo_len > 0 ) {
/* We need to store the header, so extract it */
- if( avctx->extradata == NULL ) {
+ if (!avctx->extradata) {
avctx->extradata = av_malloc(vo_len);
memcpy(avctx->extradata, pkt->data, vo_len);
avctx->extradata_size = vo_len;
rc2pass1.context = x;
x->twopassbuffer = av_malloc(BUFFER_SIZE);
x->old_twopassbuffer = av_malloc(BUFFER_SIZE);
- if( x->twopassbuffer == NULL || x->old_twopassbuffer == NULL ) {
+ if (!x->twopassbuffer || !x->old_twopassbuffer) {
av_log(avctx, AV_LOG_ERROR,
"Xvid: Cannot allocate 2-pass log buffers\n");
return -1;
return -1;
}
- if( avctx->stats_in == NULL ) {
+ if (!avctx->stats_in) {
av_log(avctx, AV_LOG_ERROR,
"Xvid: No 2-pass information loaded for second pass\n");
return -1;
*filename = av_malloc(len);
#endif
/* -----common section-----*/
- if (*filename == NULL) {
+ if (!(*filename)) {
av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n");
return -1;
}
int xy= y*s->mb_stride;
for(x=0; x<s->mb_width; x++){
if (s->mb_type[xy] & type){ // RAL: "type" test added...
- if(field_select_table==NULL || field_select_table[xy] == field_select){
+ if (!field_select_table || field_select_table[xy] == field_select) {
if( mv_table[xy][0] >=h_range || mv_table[xy][0] <-h_range
|| mv_table[xy][1] >=v_range || mv_table[xy][1] <-v_range){
return -1;
}
- if (s2->last_picture_ptr == NULL) {
+ if (!s2->last_picture_ptr) {
/* Skip B-frames if we do not have reference frames and
* GOP is not closed. */
if (s2->pict_type == AV_PICTURE_TYPE_B) {
}
if (s2->pict_type == AV_PICTURE_TYPE_I)
s->sync = 1;
- if (s2->next_picture_ptr == NULL) {
+ if (!s2->next_picture_ptr) {
/* Skip P-frames if we do not have a reference frame or
* we have an invalid header. */
if (s2->pict_type == AV_PICTURE_TYPE_P && !s->sync) {
MPEG4AudioConfig cfg;
int i;
- if ((avctx->extradata_size < 2) || (avctx->extradata == NULL)) {
+ if ((avctx->extradata_size < 2) || !avctx->extradata) {
av_log(avctx, AV_LOG_ERROR, "Codec extradata missing or too short.\n");
return AVERROR_INVALIDDATA;
}
static void free_duplicate_context(MpegEncContext *s)
{
- if (s == NULL)
+ if (!s)
return;
av_freep(&s->edge_emu_buffer);
static inline int pic_is_unused(MpegEncContext *s, Picture *pic)
{
- if (pic->f->buf[0] == NULL)
+ if (!pic->f->buf[0])
return 1;
if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF))
return 1;
if (shared) {
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
- if (s->picture[i].f->buf[0] == NULL)
+ if (!s->picture[i].f->buf[0])
return i;
}
} else {
release_unused_pictures(s);
- if (s->current_picture_ptr &&
- s->current_picture_ptr->f->buf[0] == NULL) {
+ if (s->current_picture_ptr && !s->current_picture_ptr->f->buf[0]) {
// we already have a unused image
// (maybe it was set before reading the header)
pic = s->current_picture_ptr;
s->current_picture_ptr ? s->current_picture_ptr->f->data[0] : NULL,
s->pict_type, s->droppable);
- if ((s->last_picture_ptr == NULL ||
- s->last_picture_ptr->f->buf[0] == NULL) &&
+ if ((!s->last_picture_ptr || !s->last_picture_ptr->f->buf[0]) &&
(s->pict_type != AV_PICTURE_TYPE_I ||
s->picture_structure != PICT_FRAME)) {
int h_chroma_shift, v_chroma_shift;
ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 0);
ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 1);
}
- if ((s->next_picture_ptr == NULL ||
- s->next_picture_ptr->f->buf[0] == NULL) &&
+ if ((!s->next_picture_ptr || !s->next_picture_ptr->f->buf[0]) &&
s->pict_type == AV_PICTURE_TYPE_B) {
/* Allocate a dummy frame */
i = ff_find_unused_picture(s, 0);
int i;
MpegEncContext *s = avctx->priv_data;
- if(s==NULL || s->picture==NULL)
+ if (!s || !s->picture)
return;
for (i = 0; i < MAX_PICTURE_COUNT; i++)
s->reordered_input_picture[MAX_PICTURE_COUNT - 1] = NULL;
/* set next picture type & ordering */
- if (s->reordered_input_picture[0] == NULL && s->input_picture[0]) {
+ if (!s->reordered_input_picture[0] && s->input_picture[0]) {
if (/*s->picture_in_gop_number >= s->gop_size ||*/
- s->next_picture_ptr == NULL || s->intra_only) {
+ !s->next_picture_ptr || s->intra_only) {
s->reordered_input_picture[0] = s->input_picture[0];
s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_I;
s->reordered_input_picture[0]->f->coded_picture_number =
}
}
for (i = 0; i < s->max_b_frames + 1; i++) {
- if (s->input_picture[i] == NULL ||
+ if (!s->input_picture[i] ||
s->input_picture[i]->b_frame_score - 1 >
s->mb_num / s->avctx->b_sensitivity)
break;
{
AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
- if(avctx==NULL) return NULL;
+ if (!avctx)
+ return NULL;
if(avcodec_get_context_defaults3(avctx, codec) < 0){
av_free(avctx);
for (j = 0; j < N; j++)
X[j] = 0.0f;
} else {
- if (lowband == NULL) {
+ if (!lowband) {
/* Noise */
for (j = 0; j < N; j++)
X[j] = (((int32_t)celt_rng(s)) >> 20);
int i, j, min, max, value, type, unknown_flag;
GetBitContext gb;
- if (q->sub_packet_list_B[0].packet == NULL)
+ if (!q->sub_packet_list_B[0].packet)
return;
/* reset minimum indexes for FFT coefficients */
return;
}
- if (ri->last_frame->data[0] == NULL) {
+ if (!ri->last_frame->data[0]) {
av_log(ri->avctx, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n");
return;
}
return AVERROR_INVALIDDATA;
}
- if (s->last_picture_ptr == NULL && s->pict_type == AV_PICTURE_TYPE_B) {
+ if (!s->last_picture_ptr && s->pict_type == AV_PICTURE_TYPE_B) {
av_log(s->avctx, AV_LOG_ERROR, "early B-frame\n");
return AVERROR_INVALIDDATA;
}
return AVERROR_INVALIDDATA;
}
- if ((s->mb_x == 0 && s->mb_y == 0) || s->current_picture_ptr == NULL) {
+ if ((s->mb_x == 0 && s->mb_y == 0) || !s->current_picture_ptr) {
// FIXME write parser so we always have complete frames?
if (s->current_picture_ptr) {
ff_er_frame_end(&s->er);
s->subsampling[0] * s->subsampling[1] + 7) >> 3;
if (is_yuv) {
yuv_line = av_malloc(bytes_per_row);
- if (yuv_line == NULL) {
+ if (!yuv_line) {
av_log(s->avctx, AV_LOG_ERROR, "Not enough memory\n");
ret = AVERROR(ENOMEM);
goto fail;
/* Allocate decompression buffer */
if (c->decomp_size) {
- if ((c->decomp_buf = av_malloc(c->decomp_size)) == NULL) {
+ if (!(c->decomp_buf = av_malloc(c->decomp_size))) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
return AVERROR(ENOMEM);
}
{
AVFrame *frame = av_mallocz(sizeof(AVFrame));
- if (frame == NULL)
+ if (!frame)
return NULL;
FF_DISABLE_DEPRECATION_WARNINGS
s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
/* skip B-frames if we don't have reference frames */
- if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) {
+ if (!s->last_picture_ptr && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) {
goto end;
}
if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) ||
0);
}
- if (s->avctx->draw_horiz_band == NULL)
+ if (!s->avctx->draw_horiz_band)
return;
h = y - s->last_slice_end;
int pos = (mb_y << 16) | (mb_x & 0xFFFF); \
int sliced_threading = (avctx->active_thread_type == FF_THREAD_SLICE) && \
(num_jobs > 1); \
- int is_null = (next_td == NULL) || (prev_td == NULL); \
+ int is_null = !next_td || !prev_td; \
int pos_check = (is_null) ? 1 \
: (next_td != td && \
pos >= next_td->wait_mb_pos) || \
c->by = (c->height + c->bh - 1) / c->bh;
}
- if (c->decode_intra == NULL) {
+ if (!c->decode_intra) {
av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");
return AVERROR_INVALIDDATA;
}
/* Allocate decompression buffer */
if (c->decomp_size) {
- if ((c->decomp_buf = av_malloc(c->decomp_size)) == NULL) {
+ if (!(c->decomp_buf = av_malloc(c->decomp_size))) {
av_log(avctx, AV_LOG_ERROR,
"Can't allocate decompression buffer.\n");
return AVERROR(ENOMEM);
memset(&c->zstream, 0, sizeof(z_stream));
c->comp_size = avctx->width * avctx->height + 1024 +
((avctx->width + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * ((avctx->height + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * 2 + 4;
- if ((c->work_buf = av_malloc(c->comp_size)) == NULL) {
+ if (!(c->work_buf = av_malloc(c->comp_size))) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate work buffer.\n");
return AVERROR(ENOMEM);
}
((c->comp_size + 63) >> 6) + 11;
/* Allocate compression buffer */
- if ((c->comp_buf = av_malloc(c->comp_size)) == NULL) {
+ if (!(c->comp_buf = av_malloc(c->comp_size))) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate compression buffer.\n");
return AVERROR(ENOMEM);
}
c->pstride = FFALIGN(avctx->width, 16);
- if ((c->prev = av_malloc(c->pstride * avctx->height)) == NULL) {
+ if (!(c->prev = av_malloc(c->pstride * avctx->height))) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate picture.\n");
return AVERROR(ENOMEM);
}
}
s->buffers = req.count;
s->buf_start = av_malloc(sizeof(void *) * s->buffers);
- if (s->buf_start == NULL) {
+ if (!s->buf_start) {
av_log(ctx, AV_LOG_ERROR, "Cannot allocate buffer pointers\n");
return AVERROR(ENOMEM);
}
s->buf_len = av_malloc(sizeof(unsigned int) * s->buffers);
- if (s->buf_len == NULL) {
+ if (!s->buf_len) {
av_log(ctx, AV_LOG_ERROR, "Cannot allocate buffer sizes\n");
av_free(s->buf_start);
#endif
buf_descriptor = av_malloc(sizeof(struct buff_data));
- if (buf_descriptor == NULL) {
+ if (!buf_descriptor) {
/* Something went wrong... Since av_malloc() failed, we cannot even
* allocate a buffer for memcpying into it
*/
case AVS_VIDEO:
if (!avs->st_video) {
avs->st_video = avformat_new_stream(s, NULL);
- if (avs->st_video == NULL)
+ if (!avs->st_video)
return AVERROR(ENOMEM);
avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
avs->st_video->codec->codec_id = AV_CODEC_ID_AVS;
case AVS_AUDIO:
if (!avs->st_audio) {
avs->st_audio = avformat_new_stream(s, NULL);
- if (avs->st_audio == NULL)
+ if (!avs->st_audio)
return AVERROR(ENOMEM);
avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
}
track->type);
continue;
}
- if (track->codec_id == NULL)
+ if (!track->codec_id)
continue;
if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
}
st = track->stream = avformat_new_stream(s, NULL);
- if (st == NULL)
+ if (!st)
return AVERROR(ENOMEM);
if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") &&
int profile = matroska_aac_profile(track->codec_id);
int sri = matroska_aac_sri(track->audio.samplerate);
extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE);
- if (extradata == NULL)
+ if (!extradata)
return AVERROR(ENOMEM);
extradata[0] = (profile << 3) | ((sri & 0x0E) >> 1);
extradata[1] = ((sri & 0x01) << 7) | (track->audio.channels << 3);
extradata_size = 12 + track->codec_priv.size;
extradata = av_mallocz(extradata_size +
FF_INPUT_BUFFER_PADDING_SIZE);
- if (extradata == NULL)
+ if (!extradata)
return AVERROR(ENOMEM);
AV_WB32(extradata, extradata_size);
memcpy(&extradata[4], "alac", 4);
} else if (codec_id == AV_CODEC_ID_TTA) {
extradata_size = 30;
extradata = av_mallocz(extradata_size);
- if (extradata == NULL)
+ if (!extradata)
return AVERROR(ENOMEM);
ffio_init_context(&b, extradata, extradata_size, 1,
NULL, NULL, NULL, NULL);
} else if (track->codec_priv.data && track->codec_priv.size > 0) {
st->codec->extradata = av_mallocz(track->codec_priv.size +
FF_INPUT_BUFFER_PADDING_SIZE);
- if (st->codec->extradata == NULL)
+ if (!st->codec->extradata)
return AVERROR(ENOMEM);
st->codec->extradata_size = track->codec_priv.size;
memcpy(st->codec->extradata,
av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n");
} else {
AVStream *st = avformat_new_stream(s, NULL);
- if (st == NULL)
+ if (!st)
break;
av_dict_set(&st->metadata, "filename", attachments[j].filename, 0);
av_dict_set(&st->metadata, "mimetype", attachments[j].mime, 0);
st->codec->codec_id = AV_CODEC_ID_NONE;
st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;
st->codec->extradata = av_malloc(attachments[j].bin.size);
- if (st->codec->extradata == NULL)
+ if (!st->codec->extradata)
break;
st->codec->extradata_size = attachments[j].bin.size;
memcpy(st->codec->extradata, attachments[j].bin.data,
int numelements)
{
mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead));
- if (new_seekhead == NULL)
+ if (!new_seekhead)
return NULL;
new_seekhead->segment_offset = segment_offset;
static mkv_cues *mkv_start_cues(int64_t segment_offset)
{
mkv_cues *cues = av_mallocz(sizeof(mkv_cues));
- if (cues == NULL)
+ if (!cues)
return NULL;
cues->segment_offset = segment_offset;
mkv_write_seekhead(pb, mkv->main_seekhead);
mkv->cues = mkv_start_cues(mkv->segment_offset);
- if (mkv->cues == NULL)
+ if (!mkv->cues)
return AVERROR(ENOMEM);
if (pb->seekable && mkv->reserve_cues_space) {
int ret, size;
uint8_t *buf;
- if (st == NULL || mov->fc->flags & AVFMT_FLAG_BITEXACT)
+ if (!st || mov->fc->flags & AVFMT_FLAG_BITEXACT)
return 0;
ret = avio_open_dyn_buf(&pb_buf);
return AVERROR(ENOMEM);
track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
track->enc->extradata = av_malloc(sizeof(chapter_properties));
- if (track->enc->extradata == NULL)
+ if (!track->enc->extradata)
return AVERROR(ENOMEM);
track->enc->extradata_size = sizeof(chapter_properties);
memcpy(track->enc->extradata, chapter_properties, sizeof(chapter_properties));
return 0;
is_start = packet[1] & 0x40;
tss = ts->pids[pid];
- if (ts->auto_guess && tss == NULL && is_start) {
+ if (ts->auto_guess && !tss && is_start) {
add_pes_stream(ts, pid, -1);
tss = ts->pids[pid];
}
av_dlog(s, "%s()\n", __FUNCTION__);
/* in case we don't already have something to eat ... */
- if (nsv->ahead[0].data == NULL && nsv->ahead[1].data == NULL)
+ if (!nsv->ahead[0].data && !nsv->ahead[1].data)
err = nsv_read_chunk(s, 0);
if (err < 0)
return err;
return AVERROR(EIO);
}
s->buf = av_malloc(s1->packet_size);
- if (s->buf == NULL) {
+ if (!s->buf) {
return AVERROR(ENOMEM);
}
s->max_payload_size = s1->packet_size - 12;
}
searchlinept = strchr(linept, ' ');
- if (searchlinept == NULL) {
+ if (!searchlinept) {
av_log(s, AV_LOG_ERROR, "Error parsing message URI\n");
return AVERROR_INVALIDDATA;
}
/* Announce the stream */
sdp = av_mallocz(SDP_MAX_SIZE);
- if (sdp == NULL)
+ if (!sdp)
return AVERROR(ENOMEM);
/* We create the SDP based on the RTSP AVFormatContext where we
* aren't allowed to change the filename field. (We create the SDP
}
psets = av_mallocz(MAX_PSET_SIZE);
- if (psets == NULL) {
+ if (!psets) {
av_log(c, AV_LOG_ERROR, "Cannot allocate memory for the parameter sets.\n");
av_free(orig_extradata);
return NULL;
sps = r;
sps_end = r1;
}
- if (av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r) == NULL) {
+ if (!av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r)) {
av_log(c, AV_LOG_ERROR, "Cannot Base64-encode %td %td!\n", MAX_PSET_SIZE - (p - psets), r1 - r);
av_free(psets);
return NULL;
}
config = av_malloc(10 + c->extradata_size * 2);
- if (config == NULL) {
+ if (!config) {
av_log(c, AV_LOG_ERROR, "Cannot allocate memory for the config info.\n");
return NULL;
}
av_log(c, AV_LOG_ERROR, "AAC with no global headers is currently not supported.\n");
return NULL;
}
- if (config == NULL) {
+ if (!config) {
return NULL;
}
av_strlcatf(buff, size, "a=rtpmap:%d MPEG4-GENERIC/%d/%d\r\n"
}
p->s= strchr(p->s, '(');
- if (p->s==NULL) {
+ if (!p->s) {
av_log(p, AV_LOG_ERROR, "Undefined constant or missing '(' in '%s'\n", s0);
p->s= next;
av_expr_free(d);
#define FF_ALLOC_OR_GOTO(ctx, p, size, label)\
{\
p = av_malloc(size);\
- if (p == NULL && (size) != 0) {\
+ if (!(p) && (size) != 0) {\
av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
goto label;\
}\
#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)\
{\
p = av_mallocz(size);\
- if (p == NULL && (size) != 0) {\
+ if (!(p) && (size) != 0) {\
av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
goto label;\
}\