summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/asfenc.c4
-rw-r--r--libavformat/mov.c23
-rw-r--r--libavformat/riff.c6
3 files changed, 17 insertions, 16 deletions
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 0996b7912c..5c6a81fb71 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -434,10 +434,6 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
/* WAVEFORMATEX header */
int wavsize = ff_put_wav_header(pb, enc);
- if ((enc->codec_id != CODEC_ID_MP3) && (enc->codec_id != CODEC_ID_MP2) && (enc->codec_id != CODEC_ID_ADPCM_IMA_WAV) && (enc->extradata_size==0)) {
- wavsize += 2;
- avio_wl16(pb, 0);
- }
if (wavsize < 0)
return -1;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 87b6a4905a..936ec18570 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2433,14 +2433,21 @@ static void mov_read_chapters(AVFormatContext *s)
// The samples could theoretically be in any encoding if there's an encd
// atom following, but in practice are only utf-8 or utf-16, distinguished
// instead by the presence of a BOM
- ch = avio_rb16(sc->pb);
- if (ch == 0xfeff)
- avio_get_str16be(sc->pb, len, title, title_len);
- else if (ch == 0xfffe)
- avio_get_str16le(sc->pb, len, title, title_len);
- else {
- AV_WB16(title, ch);
- get_strz(sc->pb, title + 2, len - 1);
+ if (!len) {
+ title[0] = 0;
+ } else {
+ ch = avio_rb16(sc->pb);
+ if (ch == 0xfeff)
+ avio_get_str16be(sc->pb, len, title, title_len);
+ else if (ch == 0xfffe)
+ avio_get_str16le(sc->pb, len, title, title_len);
+ else {
+ AV_WB16(title, ch);
+ if (len == 1 || len == 2)
+ title[len] = 0;
+ else
+ get_strz(sc->pb, title + 2, len - 1);
+ }
}
ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title);
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 2995e0dd82..a6cf8b4197 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -452,8 +452,6 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
riff_extradata_start= enc->extradata;
riff_extradata= enc->extradata + enc->extradata_size;
hdrsize += enc->extradata_size;
- } else if (!waveformatextensible){
- hdrsize -= 2;
}
if(waveformatextensible) { /* write WAVEFORMATEXTENSIBLE extensions */
hdrsize += 22;
@@ -464,8 +462,8 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
avio_wl32(pb, 0x00100000);
avio_wl32(pb, 0xAA000080);
avio_wl32(pb, 0x719B3800);
- } else if(riff_extradata - riff_extradata_start) {
- avio_wl16(pb, riff_extradata - riff_extradata_start);
+ } else {
+ avio_wl16(pb, riff_extradata - riff_extradata_start); /* cbSize */
}
avio_write(pb, riff_extradata_start, riff_extradata - riff_extradata_start);
if(hdrsize&1){