[1/5] av1: Add codec_id and basic demuxing support

Message ID 1472056128-7656-2-git-send-email-diego@biurrun.de
State New
Headers show

Commit Message

Diego Biurrun Aug. 24, 2016, 4:28 p.m.
From: Luca Barbato <lu_zero@gentoo.org>

Signed-off-by: Diego Biurrun <diego@biurrun.de>
---

I feel like I'm missing a version bump somewhere..

 libavcodec/avcodec.h    | 1 +
 libavcodec/codec_desc.c | 7 +++++++
 libavformat/matroska.c  | 1 +
 libavformat/riff.c      | 1 +
 4 files changed, 10 insertions(+)

Comments

James Almer Aug. 24, 2016, 6:31 p.m. | #1
On 8/24/2016 1:28 PM, Diego Biurrun wrote:
> From: Luca Barbato <lu_zero@gentoo.org>
> 
> Signed-off-by: Diego Biurrun <diego@biurrun.de>
> ---
> 
> I feel like I'm missing a version bump somewhere..
> 
>  libavcodec/avcodec.h    | 1 +
>  libavcodec/codec_desc.c | 7 +++++++
>  libavformat/matroska.c  | 1 +
>  libavformat/riff.c      | 1 +
>  4 files changed, 10 insertions(+)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index ace761d..7a5f10f 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -391,6 +391,7 @@ enum AVCodecID {
>      AV_CODEC_ID_RSCC,
>      AV_CODEC_ID_MAGICYUV,
>      AV_CODEC_ID_TRUEMOTION2RT,
> +    AV_CODEC_ID_AV1,
>  
>      /* various PCM "codecs" */
>      AV_CODEC_ID_FIRST_AUDIO = 0x10000,     ///< A dummy id pointing at the start of audio codecs
> diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> index 78d2cbc..18568c9 100644
> --- a/libavcodec/codec_desc.c
> +++ b/libavcodec/codec_desc.c
> @@ -1205,6 +1205,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
>          .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0 Real Time"),
>          .props     = AV_CODEC_PROP_LOSSY,
>      },
> +    {
> +        .id        = AV_CODEC_ID_AV1,
> +        .type      = AVMEDIA_TYPE_VIDEO,
> +        .name      = "av1",
> +        .long_name = NULL_IF_CONFIG_SMALL("Alliance for Open Media AV1"),
> +        .props     = AV_CODEC_PROP_LOSSY,
> +    },
>  
>      /* image codecs */
>      {
> diff --git a/libavformat/matroska.c b/libavformat/matroska.c
> index c25c962..8842d7c 100644
> --- a/libavformat/matroska.c
> +++ b/libavformat/matroska.c
> @@ -66,6 +66,7 @@ const CodecTags ff_mkv_codec_tags[]={
>      {"S_DVBSUB"         , AV_CODEC_ID_DVB_SUBTITLE},
>      {"S_HDMV/PGS"       , AV_CODEC_ID_HDMV_PGS_SUBTITLE},
>  
> +    {"V_AV1"            , AV_CODEC_ID_AV1},

Was this tag added to the Matroska spec? Or was it at least suggested
somewhere?

Also, wouldn't adding this here also allow matroskaenc to mux AV1 using
stream copy? If so, there should be a line in that muxer to either
require -strict experimental or to directly refuse to mux the stream.

>      {"V_DIRAC"          , AV_CODEC_ID_DIRAC},
>      {"V_MJPEG"          , AV_CODEC_ID_MJPEG},
>      {"V_MPEG1"          , AV_CODEC_ID_MPEG1VIDEO},
> diff --git a/libavformat/riff.c b/libavformat/riff.c
> index 1e1e4d8..54bef83 100644
> --- a/libavformat/riff.c
> +++ b/libavformat/riff.c
> @@ -367,6 +367,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
>      { AV_CODEC_ID_RSCC,         MKTAG('R', 'S', 'C', 'C') },
>      { AV_CODEC_ID_RSCC,         MKTAG('I', 'S', 'C', 'C') },
>      { AV_CODEC_ID_MAGICYUV,     MKTAG('M', 'A', 'G', 'Y') },
> +    { AV_CODEC_ID_AV1,          MKTAG('A', 'V', '0', '1') },
>      { AV_CODEC_ID_NONE,         0 }
>  };
>  
>
Luca Barbato Aug. 24, 2016, 6:52 p.m. | #2
On 24/08/16 20:31, James Almer wrote:
> Was this tag added to the Matroska spec? Or was it at least suggested
> somewhere?

The libaom sources.

> Also, wouldn't adding this here also allow matroskaenc to mux AV1 using
> stream copy? If so, there should be a line in that muxer to either
> require -strict experimental or to directly refuse to mux the stream.

I do not see why, libaom produces mkv/webm out of box.

lu
James Almer Aug. 24, 2016, 7:22 p.m. | #3
On 8/24/2016 3:52 PM, Luca Barbato wrote:
> On 24/08/16 20:31, James Almer wrote:
>> Was this tag added to the Matroska spec? Or was it at least suggested
>> somewhere?
> 
> The libaom sources.

Fair enough. Doubt Matroska will end up going with something else if
WebM already uses that.

> 
>> Also, wouldn't adding this here also allow matroskaenc to mux AV1 using
>> stream copy? If so, there should be a line in that muxer to either
>> require -strict experimental or to directly refuse to mux the stream.
> 
> I do not see why, libaom produces mkv/webm out of box.

Not unexpected, given that libaom is libvpx fork of sorts.

In any case, since much like VP8/VP9 AV1 evidently doesn't need any
kind of extradata stored in the track's codecprivate, i guess the only
"experimental" thing out of this kind of file would be the actual AV1
stream and not any of the container's bits.

Should be ok, then.

Patch

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index ace761d..7a5f10f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -391,6 +391,7 @@  enum AVCodecID {
     AV_CODEC_ID_RSCC,
     AV_CODEC_ID_MAGICYUV,
     AV_CODEC_ID_TRUEMOTION2RT,
+    AV_CODEC_ID_AV1,
 
     /* various PCM "codecs" */
     AV_CODEC_ID_FIRST_AUDIO = 0x10000,     ///< A dummy id pointing at the start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 78d2cbc..18568c9 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1205,6 +1205,13 @@  static const AVCodecDescriptor codec_descriptors[] = {
         .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0 Real Time"),
         .props     = AV_CODEC_PROP_LOSSY,
     },
+    {
+        .id        = AV_CODEC_ID_AV1,
+        .type      = AVMEDIA_TYPE_VIDEO,
+        .name      = "av1",
+        .long_name = NULL_IF_CONFIG_SMALL("Alliance for Open Media AV1"),
+        .props     = AV_CODEC_PROP_LOSSY,
+    },
 
     /* image codecs */
     {
diff --git a/libavformat/matroska.c b/libavformat/matroska.c
index c25c962..8842d7c 100644
--- a/libavformat/matroska.c
+++ b/libavformat/matroska.c
@@ -66,6 +66,7 @@  const CodecTags ff_mkv_codec_tags[]={
     {"S_DVBSUB"         , AV_CODEC_ID_DVB_SUBTITLE},
     {"S_HDMV/PGS"       , AV_CODEC_ID_HDMV_PGS_SUBTITLE},
 
+    {"V_AV1"            , AV_CODEC_ID_AV1},
     {"V_DIRAC"          , AV_CODEC_ID_DIRAC},
     {"V_MJPEG"          , AV_CODEC_ID_MJPEG},
     {"V_MPEG1"          , AV_CODEC_ID_MPEG1VIDEO},
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 1e1e4d8..54bef83 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -367,6 +367,7 @@  const AVCodecTag ff_codec_bmp_tags[] = {
     { AV_CODEC_ID_RSCC,         MKTAG('R', 'S', 'C', 'C') },
     { AV_CODEC_ID_RSCC,         MKTAG('I', 'S', 'C', 'C') },
     { AV_CODEC_ID_MAGICYUV,     MKTAG('M', 'A', 'G', 'Y') },
+    { AV_CODEC_ID_AV1,          MKTAG('A', 'V', '0', '1') },
     { AV_CODEC_ID_NONE,         0 }
 };