summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-29 01:41:04 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-03-29 04:11:10 +0200
commitd40ff29cacf9b8ffa1061392a0e9b3056c4882ea (patch)
tree3b59f4b9a74e209220f0b0dcb90c466e3e4a9b3d /libavformat
parent99bb88c588ea9a46a06b966b9014394385ebe1c3 (diff)
parent44257ef4267f01dd698c8ab8abf50fd77136a8ce (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: asf: only set index_read if the index contained entries. cabac: add overread protection to BRANCHLESS_GET_CABAC(). cabac: increment jump locations by one in callers of BRANCHLESS_GET_CABAC(). cabac: remove unused argument from BRANCHLESS_GET_CABAC_UPDATE(). cabac: use struct+offset instead of memory operand in BRANCHLESS_GET_CABAC(). h264: add overread protection to get_cabac_bypass_sign_x86(). h264: reindent get_cabac_bypass_sign_x86(). h264: use struct offsets in get_cabac_bypass_sign_x86(). h264: fix overreads in cabac reader. wmall: fix seeking. lagarith: fix buffer overreads. dvdec: drop unnecessary dv_tablegen.h #include build: fix doc generation errors in parallel builds Replace memset(0) by zero initializations. faandct: Remove FAAN_POSTSCALE define and related code. dvenc: print allowed profiles if the video doesn't conform to any of them. avcodec_encode_{audio,video}: only reallocate output packet when it has non-zero size. FATE: add a test for vp8 with changing frame size. fate: add kgv1 fate test. oggdec: calculate correct timestamps in Ogg/FLAC Conflicts: libavcodec/4xm.c libavcodec/cook.c libavcodec/dvdata.c libavcodec/dvdsubdec.c libavcodec/lagarith.c libavcodec/lagarithrac.c libavcodec/utils.c tests/fate/video.mak Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/asfcrypt.c3
-rw-r--r--libavformat/asfdec.c2
-rw-r--r--libavformat/movenc.c3
-rw-r--r--libavformat/oggparseflac.c1
-rw-r--r--libavformat/rtsp.c9
-rw-r--r--libavformat/sapenc.c3
-rw-r--r--libavformat/sdp.c6
-rw-r--r--libavformat/seek-test.c3
-rw-r--r--libavformat/tcp.c3
-rw-r--r--libavformat/udp.c3
-rw-r--r--libavformat/utils.c3
11 files changed, 14 insertions, 25 deletions
diff --git a/libavformat/asfcrypt.c b/libavformat/asfcrypt.c
index 750758d822..6a51c0426e 100644
--- a/libavformat/asfcrypt.c
+++ b/libavformat/asfcrypt.c
@@ -140,7 +140,7 @@ void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len) {
struct AVRC4 rc4;
int num_qwords = len >> 3;
uint8_t *qwords = data;
- uint64_t rc4buff[8];
+ uint64_t rc4buff[8] = { 0 };
uint64_t packetkey;
uint32_t ms_keys[12];
uint64_t ms_state;
@@ -151,7 +151,6 @@ void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len) {
return;
}
- memset(rc4buff, 0, sizeof(rc4buff));
av_rc4_init(&rc4, key, 12 * 8, 1);
av_rc4_crypt(&rc4, (uint8_t *)rc4buff, NULL, sizeof(rc4buff), NULL, 1);
multiswap_init((uint8_t *)rc4buff, ms_keys);
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 2adb1780c4..f447c38bf3 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1249,7 +1249,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
last_pos=pos;
}
}
- asf->index_read= 1;
+ asf->index_read= ict > 0;
}
avio_seek(s->pb, current_pos, SEEK_SET);
}
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index f0b606e0fc..7c1c559d7e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1021,7 +1021,7 @@ static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
{
int64_t pos = avio_tell(pb);
- char compressor_name[32];
+ char compressor_name[32] = { 0 };
avio_wb32(pb, 0); /* size */
avio_wl32(pb, track->tag); // store it byteswapped
@@ -1052,7 +1052,6 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, 0); /* Data size (= 0) */
avio_wb16(pb, 1); /* Frame count (= 1) */
- memset(compressor_name,0,32);
/* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */
if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name)
av_strlcpy(compressor_name,track->enc->codec->name,32);
diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c
index 015a376755..d852c26152 100644
--- a/libavformat/oggparseflac.c
+++ b/libavformat/oggparseflac.c
@@ -60,6 +60,7 @@ flac_header (AVFormatContext * s, int idx)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_FLAC;
+ st->need_parsing = AVSTREAM_PARSE_HEADERS;
st->codec->extradata =
av_malloc(FLAC_STREAMINFO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index a6cfd3af4a..9961b5a33c 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -157,8 +157,7 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end)
static int get_sockaddr(const char *buf, struct sockaddr_storage *sock)
{
- struct addrinfo hints, *ai = NULL;
- memset(&hints, 0, sizeof(hints));
+ struct addrinfo hints = { 0 }, *ai = NULL;
hints.ai_flags = AI_NUMERICHOST;
if (getaddrinfo(buf, NULL, &hints, &ai))
return -1;
@@ -497,9 +496,8 @@ int ff_sdp_parse(AVFormatContext *s, const char *content)
* The Vorbis FMTP line can be up to 16KB - see xiph_parse_sdp_line
* in rtpdec_xiph.c. */
char buf[16384], *q;
- SDPParseState sdp_parse_state, *s1 = &sdp_parse_state;
+ SDPParseState sdp_parse_state = { { 0 } }, *s1 = &sdp_parse_state;
- memset(s1, 0, sizeof(SDPParseState));
p = content;
for (;;) {
p += strspn(p, SPACE_CHARS);
@@ -1950,7 +1948,7 @@ static int rtp_read_header(AVFormatContext *s)
int ret, port;
URLContext* in = NULL;
int payload_type;
- AVCodecContext codec;
+ AVCodecContext codec = { 0 };
struct sockaddr_storage addr;
AVIOContext pb;
socklen_t addrlen = sizeof(addr);
@@ -1991,7 +1989,6 @@ static int rtp_read_header(AVFormatContext *s)
ffurl_close(in);
in = NULL;
- memset(&codec, 0, sizeof(codec));
if (ff_rtp_get_codec_info(&codec, payload_type)) {
av_log(s, AV_LOG_ERROR, "Unable to receive RTP payload type %d "
"without an SDP file describing it\n",
diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c
index 8a2a193b8e..cd7a46ef45 100644
--- a/libavformat/sapenc.c
+++ b/libavformat/sapenc.c
@@ -104,8 +104,7 @@ static int sap_write_header(AVFormatContext *s)
}
if (!announce_addr[0]) {
- struct addrinfo hints, *ai = NULL;
- memset(&hints, 0, sizeof(hints));
+ struct addrinfo hints = { 0 }, *ai = NULL;
hints.ai_family = AF_UNSPEC;
if (getaddrinfo(host, NULL, &hints, &ai)) {
av_log(s, AV_LOG_ERROR, "Unable to resolve %s\n", host);
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 77b8945a25..caa661bbc2 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -88,7 +88,7 @@ static void sdp_write_header(char *buff, int size, struct sdp_session_level *s)
static int resolve_destination(char *dest_addr, int size, char *type,
int type_size)
{
- struct addrinfo hints, *ai;
+ struct addrinfo hints = { 0 }, *ai;
int is_multicast;
av_strlcpy(type, "IP4", type_size);
@@ -98,7 +98,6 @@ static int resolve_destination(char *dest_addr, int size, char *type,
/* Resolve the destination, since it must be written
* as a numeric IP address in the SDP. */
- memset(&hints, 0, sizeof(hints));
if (getaddrinfo(dest_addr, NULL, &hints, &ai))
return 0;
getnameinfo(ai->ai_addr, ai->ai_addrlen, dest_addr, size,
@@ -581,12 +580,11 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
{
AVDictionaryEntry *title = av_dict_get(ac[0]->metadata, "title", NULL, 0);
- struct sdp_session_level s;
+ struct sdp_session_level s = { 0 };
int i, j, port, ttl, is_multicast;
char dst[32], dst_type[5];
memset(buf, 0, size);
- memset(&s, 0, sizeof(struct sdp_session_level));
s.user = "-";
s.src_addr = "127.0.0.1"; /* FIXME: Properly set this */
s.src_type = "IP4";
diff --git a/libavformat/seek-test.c b/libavformat/seek-test.c
index 9d7575d39e..2750836006 100644
--- a/libavformat/seek-test.c
+++ b/libavformat/seek-test.c
@@ -92,11 +92,10 @@ int main(int argc, char **argv)
}
for(i=0; ; i++){
- AVPacket pkt;
+ AVPacket pkt = { 0 };
AVStream *av_uninit(st);
char ts_buf[60];
- memset(&pkt, 0, sizeof(pkt));
if(ret>=0){
ret= av_read_frame(ic, &pkt);
if(ret>=0){
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 4eaf0a02b4..fa88467164 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -37,7 +37,7 @@ typedef struct TCPContext {
/* return non zero if error */
static int tcp_open(URLContext *h, const char *uri, int flags)
{
- struct addrinfo hints, *ai, *cur_ai;
+ struct addrinfo hints = { 0 }, *ai, *cur_ai;
int port, fd = -1;
TCPContext *s = h->priv_data;
int listen_socket = 0;
@@ -62,7 +62,6 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
timeout = strtol(buf, NULL, 10);
}
}
- memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
snprintf(portstr, sizeof(portstr), "%d", port);
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 5ab14f2230..9387e218d0 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -161,7 +161,7 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr)
static struct addrinfo* udp_resolve_host(const char *hostname, int port,
int type, int family, int flags)
{
- struct addrinfo hints, *res = 0;
+ struct addrinfo hints = { 0 }, *res = 0;
int error;
char sport[16];
const char *node = 0, *service = "0";
@@ -173,7 +173,6 @@ static struct addrinfo* udp_resolve_host(const char *hostname, int port,
if ((hostname) && (hostname[0] != '\0') && (hostname[0] != '?')) {
node = hostname;
}
- memset(&hints, 0, sizeof(hints));
hints.ai_socktype = type;
hints.ai_family = family;
hints.ai_flags = flags;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 0f8b940566..7e64cf6a9f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4073,7 +4073,7 @@ int ff_url_join(char *str, int size, const char *proto,
int port, const char *fmt, ...)
{
#if CONFIG_NETWORK
- struct addrinfo hints, *ai;
+ struct addrinfo hints = { 0 }, *ai;
#endif
str[0] = '\0';
@@ -4084,7 +4084,6 @@ int ff_url_join(char *str, int size, const char *proto,
#if CONFIG_NETWORK && defined(AF_INET6)
/* Determine if hostname is a numerical IPv6 address,
* properly escape it within [] in that case. */
- memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST;
if (!getaddrinfo(hostname, NULL, &hints, &ai)) {
if (ai->ai_family == AF_INET6) {