Merge commit '430a8168594b3cb29f44141d4da88f2c642de06f'

* commit '430a8168594b3cb29f44141d4da88f2c642de06f':
  oggdec: add support for VP8 demuxing

Conflicts:
	Changelog
	libavformat/oggparsevp8.c
	libavformat/version.h

See: d890db5f53
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-12-19 04:36:27 +01:00
commit 5a1cd796e2
2 changed files with 13 additions and 8 deletions

View File

@ -20,6 +20,7 @@
*/
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
#include "oggdec.h"
@ -45,7 +46,8 @@ static int vp8_header(AVFormatContext *s, int idx)
}
if (p[6] != 1) {
av_log(s, AV_LOG_WARNING, "Unknown OggVP8 version %d.%d\n", p[6], p[7]);
av_log(s, AV_LOG_WARNING,
"Unknown OggVP8 version %d.%d\n", p[6], p[7]);
return AVERROR_INVALIDDATA;
}
@ -53,10 +55,10 @@ static int vp8_header(AVFormatContext *s, int idx)
st->codec->height = AV_RB16(p + 10);
st->sample_aspect_ratio.num = AV_RB24(p + 12);
st->sample_aspect_ratio.den = AV_RB24(p + 15);
framerate.den = AV_RB32(p + 18);
framerate.num = AV_RB32(p + 22);
framerate.num = AV_RB32(p + 18);
framerate.den = AV_RB32(p + 22);
avpriv_set_pts_info(st, 64, framerate.num, framerate.den);
avpriv_set_pts_info(st, 64, framerate.den, framerate.num);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = AV_CODEC_ID_VP8;
st->need_parsing = AVSTREAM_PARSE_HEADERS;
@ -74,7 +76,8 @@ static int vp8_header(AVFormatContext *s, int idx)
return 1;
}
static uint64_t vp8_gptopts(AVFormatContext *s, int idx, uint64_t granule, int64_t *dts)
static uint64_t vp8_gptopts(AVFormatContext *s, int idx,
uint64_t granule, int64_t *dts)
{
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + idx;
@ -97,7 +100,8 @@ static int vp8_packet(AVFormatContext *s, int idx)
struct ogg_stream *os = ogg->streams + idx;
uint8_t *p = os->buf + os->pstart;
if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && !(os->flags & OGG_FLAG_EOS)) {
if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) &&
!(os->flags & OGG_FLAG_EOS)) {
int seg;
int duration;
uint8_t *last_pkt = p;
@ -113,7 +117,8 @@ static int vp8_packet(AVFormatContext *s, int idx)
}
next_pkt += os->segments[seg];
}
os->lastpts = os->lastdts = vp8_gptopts(s, idx, os->granule, NULL) - duration;
os->lastpts =
os->lastdts = vp8_gptopts(s, idx, os->granule, NULL) - duration;
if(s->streams[idx]->start_time == AV_NOPTS_VALUE) {
s->streams[idx]->start_time = os->lastpts;
if (s->streams[idx]->duration)

View File

@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 56
#define LIBAVFORMAT_VERSION_MINOR 16
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_MICRO 101
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \