#include "avformat.h"
#include "internal.h"
+#include "libavutil/dict.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/tea.h"
#include "libavutil/opt.h"
avio_skip(pb, 1); // unidentified integer
nkey = avio_rb32(pb); // key string length
nval = avio_rb32(pb); // value string length
- if (nkey > sizeof(key)) {
- avio_skip(pb, nkey);
- } else {
- avio_read(pb, key, nkey); // key string
- }
- if (nval > sizeof(val)) {
- avio_skip(pb, nval);
- } else {
- avio_read(pb, val, nval); // value string
- }
+ avio_get_str(pb, nkey, key, sizeof(key));
+ avio_get_str(pb, nval, val, sizeof(val));
if (!strcmp(key, "codec")) {
av_log(s, AV_LOG_DEBUG, "Codec is <%s>\n", val);
strncpy(codec_name, val, sizeof(codec_name) - 1);
- }
- if (!strcmp(key, "HeaderSeed")) {
+ } else if (!strcmp(key, "HeaderSeed")) {
av_log(s, AV_LOG_DEBUG, "HeaderSeed is <%s>\n", val);
header_seed = atoi(val);
- }
- if (!strcmp(key, "HeaderKey")) { // this looks like "1234567890 1234567890 1234567890 1234567890"
+ } else if (!strcmp(key, "HeaderKey")) { // this looks like "1234567890 1234567890 1234567890 1234567890"
av_log(s, AV_LOG_DEBUG, "HeaderKey is <%s>\n", val);
sscanf(val, "%u%u%u%u", &header_key_part[0], &header_key_part[1], &header_key_part[2], &header_key_part[3]);
for (idx = 0; idx < 4; idx++) {
for (i = 0; i < 16; i++)
av_log(s, AV_LOG_DEBUG, "%02x", header_key[i]);
av_log(s, AV_LOG_DEBUG, "\n");
+ } else {
+ av_dict_set(&s->metadata, key, val, 0);
}
}
st->codecpar->block_align = 19;
st->codecpar->channels = 1;
st->codecpar->sample_rate = 8500;
+ st->need_parsing = AVSTREAM_PARSE_FULL_RAW;
} else if (!strcmp(codec_name, "acelp16")) {
st->codecpar->codec_id = AV_CODEC_ID_SIPR;
st->codecpar->block_align = 20;
st->codecpar->channels = 1;
st->codecpar->sample_rate = 16000;
+ st->need_parsing = AVSTREAM_PARSE_FULL_RAW;
}
/* determine, and jump to audio start offset */