vp9: add superframe merging bitstream filter.
[libav.git] / libavformat / ivfenc.c
index 484d87d..490b0a9 100644 (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,
 };