[vlc-commits] demux: heif: add preliminary support for AVIF

Francois Cartegnie git at videolan.org
Fri Nov 9 17:05:39 CET 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Nov  9 16:59:39 2018 +0100| [2f3675ebd867b9a23152fa38674e8dbffccbeabb] | committer: Francois Cartegnie

demux: heif: add preliminary support for AVIF

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2f3675ebd867b9a23152fa38674e8dbffccbeabb
---

 modules/demux/mp4/heif.c   | 28 +++++++++++++++++++++++++---
 modules/demux/mp4/libmp4.h |  2 ++
 modules/demux/mp4/mp4.c    |  1 +
 3 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mp4/heif.c b/modules/demux/mp4/heif.c
index a2cefecdc8..aa99f9e24c 100644
--- a/modules/demux/mp4/heif.c
+++ b/modules/demux/mp4/heif.c
@@ -269,13 +269,19 @@ static int DemuxHEIF( demux_t *p_demux )
         case VLC_FOURCC('a','v','c','1'):
             es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_H264 );
             break;
+        case ATOM_av01:
+            es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_AV1 );
+            break;
         case VLC_FOURCC('j','p','e','g'):
             es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_JPEG );
             break;
         default:
-            if( psz_mime && !strcasecmp( "image/jpeg", psz_mime ) )
+            if( psz_mime )
             {
-                es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_JPEG );
+                if( !strcasecmp( "image/jpeg", psz_mime ) )
+                    es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_JPEG );
+                else if( !strcasecmp( "image/avif", psz_mime ) )
+                    es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_AV1 );
                 break;
             }
             return VLC_DEMUXER_SUCCESS; /* Unsupported picture, goto next */
@@ -300,9 +306,11 @@ static int DemuxHEIF( demux_t *p_demux )
             {
                 case ATOM_hvcC:
                 case ATOM_avcC:
+                case ATOM_av1C:
                     if( !fmt.p_extra &&
                        ((fmt.i_codec == VLC_CODEC_HEVC && p_prop->i_type == ATOM_hvcC) ||
-                        (fmt.i_codec == VLC_CODEC_H264 && p_prop->i_type == ATOM_avcC)) )
+                        (fmt.i_codec == VLC_CODEC_H264 && p_prop->i_type == ATOM_avcC) ||
+                        (fmt.i_codec == VLC_CODEC_AV1  && p_prop->i_type == ATOM_av1C)) )
                     {
                         fmt.p_extra = malloc( p_prop->data.p_binary->i_blob );
                         if( fmt.p_extra )
@@ -347,6 +355,18 @@ static int DemuxHEIF( demux_t *p_demux )
                                         p_prop->data.p_colr->nclc.i_matrix_idx );
                     fmt.video.b_color_range_full = p_prop->data.p_colr->nclc.i_full_range;
                     break;
+                case ATOM_clli:
+                    fmt.video.lighting.MaxCLL = p_prop->data.p_CoLL->i_maxCLL;
+                    fmt.video.lighting.MaxFALL = p_prop->data.p_CoLL->i_maxFALL;
+                    break;
+                case ATOM_mdcv:
+                    memcpy( fmt.video.mastering.primaries,
+                            p_prop->data.p_SmDm->primaries, sizeof(uint16_t) * 6 );
+                    memcpy( fmt.video.mastering.white_point,
+                            p_prop->data.p_SmDm->white_point, sizeof(uint16_t) * 2 );
+                    fmt.video.mastering.max_luminance = p_prop->data.p_SmDm->i_luminanceMax;
+                    fmt.video.mastering.min_luminance = p_prop->data.p_SmDm->i_luminanceMin;
+                    break;
             }
         }
     }
@@ -451,11 +471,13 @@ int OpenHEIF( vlc_object_t * p_this )
         case BRAND_heix:
         case BRAND_jpeg:
         case BRAND_avci:
+        case BRAND_avif:
             break;
         case BRAND_msf1:
         case BRAND_hevc:
         case BRAND_hevx:
         case BRAND_avcs:
+        case BRAND_avis:
         default:
             return VLC_EGENERIC;
     }
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 18d0473f00..69ed1a60a4 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -57,6 +57,8 @@ typedef int64_t stime_t;
 #define BRAND_jpgs VLC_FOURCC( 'j', 'p', 'g', 's' ) /* heif */
 #define BRAND_avci VLC_FOURCC( 'a', 'v', 'c', 'i' ) /* heif */
 #define BRAND_avcs VLC_FOURCC( 'a', 'v', 'c', 's' ) /* heif */
+#define BRAND_avif VLC_FOURCC( 'a', 'v', 'i', 'f' ) /* heif AV1 AVIF */
+#define BRAND_avis VLC_FOURCC( 'a', 'v', 'i', 's' ) /* heig AV1 AVIF */
 
 #define ATOM_root VLC_FOURCC( 'r', 'o', 'o', 't' )
 #define ATOM_uuid VLC_FOURCC( 'u', 'u', 'i', 'd' )
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 556700f06a..0619f8ab74 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -749,6 +749,7 @@ static int Open( vlc_object_t * p_this )
                 case BRAND_mif1:
                 case BRAND_jpeg:
                 case BRAND_avci:
+                case BRAND_avif:
                 /* We don't yet support f4v, but avformat does. */
                 case BRAND_f4v:
                     return VLC_EGENERIC;



More information about the vlc-commits mailing list