vp9: add superframe merging bitstream filter.

Fixes ticket 4313.
This commit is contained in:
Ronald S. Bultje
2016-02-29 09:43:07 -05:00
parent 6d8ab358a3
commit 2e6636aa87
6 changed files with 209 additions and 1 deletions

View File

@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
#include "internal.h"
#include "libavutil/intreadwrite.h"
typedef struct IVFEncContext {
@@ -85,6 +86,17 @@ static int ivf_write_trailer(AVFormatContext *s)
return 0;
}
static int ivf_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
{
int ret = 1;
AVStream *st = s->streams[pkt->stream_index];
if (st->codec->codec_id == AV_CODEC_ID_VP9)
ret = ff_stream_add_bitstream_filter(st, "vp9_superframe", NULL);
return ret;
}
AVOutputFormat ff_ivf_muxer = {
.priv_data_size = sizeof(IVFEncContext),
.name = "ivf",
@@ -95,4 +107,5 @@ AVOutputFormat ff_ivf_muxer = {
.write_header = ivf_write_header,
.write_packet = ivf_write_packet,
.write_trailer = ivf_write_trailer,
.check_bitstream = ivf_check_bitstream,
};

View File

@@ -2118,9 +2118,12 @@ static int mkv_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
int ret = 1;
AVStream *st = s->streams[pkt->stream_index];
if (st->codec->codec_id == AV_CODEC_ID_AAC)
if (st->codec->codec_id == AV_CODEC_ID_AAC) {
if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0)
ret = ff_stream_add_bitstream_filter(st, "aac_adtstoasc", NULL);
} else if (st->codec->codec_id == AV_CODEC_ID_VP9) {
ret = ff_stream_add_bitstream_filter(st, "vp9_superframe", NULL);
}
return ret;
}