aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-08-15 20:33:21 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-15 21:00:50 +0200
commitfb33bff990a8327f59d4c7c509bba1f62bbd6c5a (patch)
treec6f3ad232bed67c703999d78b3fcff66daa8c91d /libavformat
parent3bb22973518cbef28504e4d5b9fd74453cc3339c (diff)
parentf929ab0569ff31ed5a59b0b0adb7ce09df3fca39 (diff)
downloadffmpeg-fb33bff990a8327f59d4c7c509bba1f62bbd6c5a.tar.gz
Merge commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39'
* commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39': cosmetics: Write NULL pointer equality checks more compactly Conflicts: cmdutils.c ffmpeg_opt.c ffplay.c libavcodec/dvbsub.c libavcodec/dvdsubdec.c libavcodec/dvdsubenc.c libavcodec/dxa.c libavcodec/libxvid_rc.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/rv10.c libavcodec/tiffenc.c libavcodec/utils.c libavcodec/vc1dec.c libavcodec/zmbv.c libavdevice/v4l2.c libavformat/matroskadec.c libavformat/movenc.c libavformat/sdp.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avs.c4
-rw-r--r--libavformat/matroskadec.c22
-rw-r--r--libavformat/matroskaenc.c10
-rw-r--r--libavformat/movenc.c2
-rw-r--r--libavformat/mpegts.c2
-rw-r--r--libavformat/mpegtsenc.c2
-rw-r--r--libavformat/nsvdec.c2
-rw-r--r--libavformat/oggdec.c4
-rw-r--r--libavformat/rtpenc.c2
-rw-r--r--libavformat/rtspdec.c2
-rw-r--r--libavformat/rtspenc.c2
-rw-r--r--libavformat/sdp.c8
-rw-r--r--libavformat/webmdashenc.c18
13 files changed, 40 insertions, 40 deletions
diff --git a/libavformat/avs.c b/libavformat/avs.c
index 7814301244..b699dbf9ba 100644
--- a/libavformat/avs.c
+++ b/libavformat/avs.c
@@ -182,7 +182,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
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;
@@ -201,7 +201,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
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;
}
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 31ee4567aa..2dda729bab 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1658,7 +1658,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
track->type);
continue;
}
- if (track->codec_id == NULL)
+ if (!track->codec_id)
continue;
if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
@@ -1735,7 +1735,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
}
st = track->stream = avformat_new_stream(s, NULL);
- if (st == NULL) {
+ if (!st) {
av_free(key_id_base64);
return AVERROR(ENOMEM);
}
@@ -1821,7 +1821,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
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);
@@ -1840,7 +1840,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
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);
@@ -1850,7 +1850,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
} else if (codec_id == AV_CODEC_ID_TTA) {
extradata_size = 30;
extradata = av_mallocz(extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
- if (extradata == NULL)
+ if (!extradata)
return AVERROR(ENOMEM);
ffio_init_context(&b, extradata, extradata_size, 1,
NULL, NULL, NULL, NULL);
@@ -2130,7 +2130,7 @@ static int matroska_read_header(AVFormatContext *s)
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);
@@ -2561,7 +2561,7 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska,
buf = av_packet_new_side_data(pkt,
AV_PKT_DATA_WEBVTT_IDENTIFIER,
id_len);
- if (buf == NULL) {
+ if (!buf) {
av_free(pkt);
return AVERROR(ENOMEM);
}
@@ -2572,7 +2572,7 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska,
buf = av_packet_new_side_data(pkt,
AV_PKT_DATA_WEBVTT_SETTINGS,
settings_len);
- if (buf == NULL) {
+ if (!buf) {
av_free(pkt);
return AVERROR(ENOMEM);
}
@@ -2659,7 +2659,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska,
uint8_t *side_data = av_packet_new_side_data(pkt,
AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
additional_size + 8);
- if (side_data == NULL) {
+ if (!side_data) {
av_free_packet(pkt);
av_free(pkt);
return AVERROR(ENOMEM);
@@ -2672,7 +2672,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska,
uint8_t *side_data = av_packet_new_side_data(pkt,
AV_PKT_DATA_SKIP_SAMPLES,
10);
- if (side_data == NULL) {
+ if (!side_data) {
av_free_packet(pkt);
av_free(pkt);
return AVERROR(ENOMEM);
@@ -3406,7 +3406,7 @@ static int webm_dash_manifest_read_header(AVFormatContext *s)
// basename of the file
buf = strrchr(s->filename, '/');
- if (buf == NULL) return -1;
+ if (!buf) return -1;
av_dict_set(&s->streams[0]->metadata, FILENAME, ++buf, 0);
// duration
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 3ec8ef27a9..7123ec6c96 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -309,7 +309,7 @@ static mkv_seekhead *mkv_start_seekhead(AVIOContext *pb, int64_t segment_offset,
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;
@@ -335,7 +335,7 @@ static int mkv_add_seekhead_entry(mkv_seekhead *seekhead, unsigned int elementid
return -1;
entries = av_realloc_array(entries, seekhead->num_entries + 1, sizeof(mkv_seekhead_entry));
- if (entries == NULL)
+ if (!entries)
return AVERROR(ENOMEM);
seekhead->entries = entries;
@@ -401,7 +401,7 @@ fail:
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;
@@ -417,7 +417,7 @@ static int mkv_add_cuepoint(mkv_cues *cues, int stream, int tracknum, int64_t ts
return 0;
entries = av_realloc_array(entries, cues->num_entries + 1, sizeof(mkv_cuepoint));
- if (entries == NULL)
+ if (!entries)
return AVERROR(ENOMEM);
cues->entries = entries;
@@ -1336,7 +1336,7 @@ static int mkv_write_header(AVFormatContext *s)
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) {
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 20710be41c..5d7682c293 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2065,7 +2065,7 @@ static int mov_write_track_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
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);
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index d2a25317d9..2d15a6a036 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2037,7 +2037,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
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];
}
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index c925afbe1a..208360f465 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -481,7 +481,7 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
return 0;
}
-/* NOTE: str == NULL is accepted for an empty string */
+/* NOTE: !str is accepted for an empty string */
static void putstr8(uint8_t **q_ptr, const char *str)
{
uint8_t *q;
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 926e88ec8a..8200e4defa 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -665,7 +665,7 @@ static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt)
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;
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index dcead1c227..f17393bfa8 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -796,7 +796,7 @@ retry:
uint8_t *side_data = av_packet_new_side_data(pkt,
AV_PKT_DATA_SKIP_SAMPLES,
10);
- if(side_data == NULL)
+ if(!side_data)
goto fail;
AV_WL32(side_data + 4, os->end_trimming);
os->end_trimming = 0;
@@ -806,7 +806,7 @@ retry:
uint8_t *side_data = av_packet_new_side_data(pkt,
AV_PKT_DATA_METADATA_UPDATE,
os->new_metadata_size);
- if(side_data == NULL)
+ if(!side_data)
goto fail;
memcpy(side_data, os->new_metadata, os->new_metadata_size);
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index e7527c774a..4f9edef0cc 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -145,7 +145,7 @@ static int rtp_write_header(AVFormatContext *s1)
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;
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index 51c80c61eb..b4b4f12556 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -412,7 +412,7 @@ static inline int parse_command_line(AVFormatContext *s, const char *line,
}
searchlinept = strchr(linept, ' ');
- if (searchlinept == NULL) {
+ if (!searchlinept) {
av_log(s, AV_LOG_ERROR, "Error parsing message URI\n");
return AVERROR_INVALIDDATA;
}
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
index af6f7996dc..12fb4102dc 100644
--- a/libavformat/rtspenc.c
+++ b/libavformat/rtspenc.c
@@ -56,7 +56,7 @@ int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
/* 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
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index c53de90517..8c831f3607 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -189,7 +189,7 @@ static char *extradata2psets(AVCodecContext *c)
}
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;
@@ -216,7 +216,7 @@ static char *extradata2psets(AVCodecContext *c)
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 %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"!\n", MAX_PSET_SIZE - (p - psets), r1 - r);
av_free(psets);
@@ -250,7 +250,7 @@ static char *extradata2config(AVCodecContext *c)
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;
}
@@ -457,7 +457,7 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
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"
diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index 381efb7888..9cc8d1928c 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -70,7 +70,7 @@ static double get_duration(AVFormatContext *s)
for (i = 0; i < s->nb_streams; i++) {
AVDictionaryEntry *duration = av_dict_get(s->streams[i]->metadata,
DURATION, NULL, 0);
- if (duration == NULL || atof(duration->value) < 0) continue;
+ if (!duration || atof(duration->value) < 0) continue;
if (atof(duration->value) > max) max = atof(duration->value);
}
return max / 1000;
@@ -102,11 +102,11 @@ static int subsegment_alignment(AVFormatContext *s, AdaptationSet *as) {
int i;
AVDictionaryEntry *gold = av_dict_get(s->streams[as->streams[0]]->metadata,
CUE_TIMESTAMPS, NULL, 0);
- if (gold == NULL) return 0;
+ if (!gold) return 0;
for (i = 1; i < as->nb_streams; i++) {
AVDictionaryEntry *ts = av_dict_get(s->streams[as->streams[i]]->metadata,
CUE_TIMESTAMPS, NULL, 0);
- if (ts == NULL || strncmp(gold->value, ts->value, strlen(gold->value))) return 0;
+ if (!ts || strncmp(gold->value, ts->value, strlen(gold->value))) return 0;
}
return 1;
}
@@ -116,12 +116,12 @@ static int bitstream_switching(AVFormatContext *s, AdaptationSet *as) {
AVDictionaryEntry *gold_track_num = av_dict_get(s->streams[as->streams[0]]->metadata,
TRACK_NUMBER, NULL, 0);
AVCodecContext *gold_codec = s->streams[as->streams[0]]->codec;
- if (gold_track_num == NULL) return 0;
+ if (!gold_track_num) return 0;
for (i = 1; i < as->nb_streams; i++) {
AVDictionaryEntry *track_num = av_dict_get(s->streams[as->streams[i]]->metadata,
TRACK_NUMBER, NULL, 0);
AVCodecContext *codec = s->streams[as->streams[i]]->codec;
- if (track_num == NULL ||
+ if (!track_num ||
strncmp(gold_track_num->value, track_num->value, strlen(gold_track_num->value)) ||
gold_codec->codec_id != codec->codec_id ||
gold_codec->extradata_size != codec->extradata_size ||
@@ -167,7 +167,7 @@ static int write_adaptation_set(AVFormatContext *s, int as_index)
for (i = 0; i < as->nb_streams; i++) {
AVDictionaryEntry *kf = av_dict_get(s->streams[as->streams[i]]->metadata,
CLUSTER_KEYFRAME, NULL, 0);
- if (kf == NULL || !strncmp(kf->value, "0", 1)) subsegmentStartsWithSAP = 0;
+ if (!kf || !strncmp(kf->value, "0", 1)) subsegmentStartsWithSAP = 0;
}
avio_printf(s->pb, " subsegmentStartsWithSAP=\"%d\"", subsegmentStartsWithSAP);
avio_printf(s->pb, ">\n");
@@ -179,8 +179,8 @@ static int write_adaptation_set(AVFormatContext *s, int as_index)
AVDictionaryEntry *cues_end = av_dict_get(stream->metadata, CUES_END, NULL, 0);
AVDictionaryEntry *filename = av_dict_get(stream->metadata, FILENAME, NULL, 0);
AVDictionaryEntry *bandwidth = av_dict_get(stream->metadata, BANDWIDTH, NULL, 0);
- if (irange == NULL || cues_start == NULL || cues_end == NULL || filename == NULL ||
- bandwidth == NULL) {
+ if (!irange || cues_start == NULL || cues_end == NULL || filename == NULL ||
+ !bandwidth) {
return -1;
}
avio_printf(s->pb, "<Representation id=\"%d\"", i);
@@ -202,7 +202,7 @@ static int to_integer(char *p, int len)
{
int ret;
char *q = av_malloc(sizeof(char) * len);
- if (q == NULL) return -1;
+ if (!q) return -1;
strncpy(q, p, len);
ret = atoi(q);
av_free(q);