repositories
/
deb_ffmpeg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Debian version 2.5.2~trusty
[deb_ffmpeg.git]
/
ffmpeg
/
libavformat
/
flvdec.c
diff --git
a/ffmpeg/libavformat/flvdec.c
b/ffmpeg/libavformat/flvdec.c
index 12d25b20ae1e7e694945e69ad819b9334d6505c3..54f2f56dba2bf644617ef986f776a6d4450f0453 100644
(file)
--- a/
ffmpeg/libavformat/flvdec.c
+++ b/
ffmpeg/libavformat/flvdec.c
@@
-459,11
+459,11
@@
static int amf_parse_object(AVFormatContext *s, AVStream *astream,
}
if (key) {
}
if (key) {
+ acodec = astream ? astream->codec : NULL;
+ vcodec = vstream ? vstream->codec : NULL;
+
// stream info doesn't live any deeper than the first object
if (depth == 1) {
// stream info doesn't live any deeper than the first object
if (depth == 1) {
- acodec = astream ? astream->codec : NULL;
- vcodec = vstream ? vstream->codec : NULL;
-
if (amf_type == AMF_DATA_TYPE_NUMBER ||
amf_type == AMF_DATA_TYPE_BOOL) {
if (!strcmp(key, "duration"))
if (amf_type == AMF_DATA_TYPE_NUMBER ||
amf_type == AMF_DATA_TYPE_BOOL) {
if (!strcmp(key, "duration"))
@@
-623,7
+623,7
@@
static int flv_read_close(AVFormatContext *s)
static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size)
{
static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size)
{
- av_free
(
st->codec->extradata);
+ av_free
p(&
st->codec->extradata);
if (ff_get_extradata(st->codec, s->pb, size) < 0)
return AVERROR(ENOMEM);
return 0;
if (ff_get_extradata(st->codec, s->pb, size) < 0)
return AVERROR(ENOMEM);
return 0;
@@
-746,7
+746,7
@@
static int flv_data_packet(AVFormatContext *s, AVPacket *pkt,
if (i == s->nb_streams) {
st = create_stream(s, AVMEDIA_TYPE_DATA);
if (!st)
if (i == s->nb_streams) {
st = create_stream(s, AVMEDIA_TYPE_DATA);
if (!st)
- return AVERROR
_INVALIDDATA
;
+ return AVERROR
(ENOMEM)
;
st->codec->codec_id = AV_CODEC_ID_TEXT;
}
st->codec->codec_id = AV_CODEC_ID_TEXT;
}
@@
-885,10
+885,14
@@
skip:
if (s->pb->seekable && (!s->duration || s->duration == AV_NOPTS_VALUE) && !flv->searched_for_end) {
int size;
const int64_t pos = avio_tell(s->pb);
if (s->pb->seekable && (!s->duration || s->duration == AV_NOPTS_VALUE) && !flv->searched_for_end) {
int size;
const int64_t pos = avio_tell(s->pb);
+ // Read the last 4 bytes of the file, this should be the size of the
+ // previous FLV tag. Use the timestamp of its payload as duration.
int64_t fsize = avio_size(s->pb);
retry_duration:
avio_seek(s->pb, fsize - 4, SEEK_SET);
size = avio_rb32(s->pb);
int64_t fsize = avio_size(s->pb);
retry_duration:
avio_seek(s->pb, fsize - 4, SEEK_SET);
size = avio_rb32(s->pb);
+ // Seek to the start of the last FLV tag at position (fsize - 4 - size)
+ // but skip the byte indicating the type.
avio_seek(s->pb, fsize - 3 - size, SEEK_SET);
if (size == avio_rb24(s->pb) + 11) {
uint32_t ts = avio_rb24(s->pb);
avio_seek(s->pb, fsize - 3 - size, SEEK_SET);
if (size == avio_rb24(s->pb) + 11) {
uint32_t ts = avio_rb24(s->pb);
@@
-930,6
+934,7
@@
retry_duration:
} else {
AVCodecContext ctx = {0};
ctx.sample_rate = sample_rate;
} else {
AVCodecContext ctx = {0};
ctx.sample_rate = sample_rate;
+ ctx.bits_per_coded_sample = bits_per_coded_sample;
flv_set_audio_codec(s, st, &ctx, flags & FLV_AUDIO_CODECID_MASK);
sample_rate = ctx.sample_rate;
}
flv_set_audio_codec(s, st, &ctx, flags & FLV_AUDIO_CODECID_MASK);
sample_rate = ctx.sample_rate;
}