[FFmpeg-cvslog] avformat/argo_brp: support MASK streams

Zane van Iperen git at videolan.org
Sun Sep 27 02:15:03 EEST 2020


ffmpeg | branch: master | Zane van Iperen <zane at zanevaniperen.com> | Fri Sep 25 22:39:46 2020 +1000| [2e7752affff242030edd016946289dc55eb0d617] | committer: Zane van Iperen

avformat/argo_brp: support MASK streams

We can't actually use them though.

Signed-off-by: Zane van Iperen <zane at zanevaniperen.com>

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

 libavformat/argo_brp.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/libavformat/argo_brp.c b/libavformat/argo_brp.c
index a60de59f64..613f04aef2 100644
--- a/libavformat/argo_brp.c
+++ b/libavformat/argo_brp.c
@@ -33,13 +33,16 @@
 #define BRP_STREAM_HEADER_SIZE  20
 #define BRP_MAX_STREAMS         32 /* Soft cap, but even this is overkill. */
 #define BVID_HEADER_SIZE        16
-#define BRP_MIN_BUFFER_SIZE     FFMAX(FFMAX3(BRP_FILE_HEADER_SIZE,    \
+#define MASK_HEADER_SIZE        12
+#define BRP_MIN_BUFFER_SIZE     FFMAX3(FFMAX3(BRP_FILE_HEADER_SIZE,    \
                                              BRP_BLOCK_HEADER_SIZE,   \
                                              BRP_STREAM_HEADER_SIZE), \
-                                      BVID_HEADER_SIZE)
+                                      BVID_HEADER_SIZE,                \
+                                      MASK_HEADER_SIZE)
 
 #define BRP_CODEC_ID_BVID       MKTAG('B', 'V', 'I', 'D')
 #define BRP_CODEC_ID_BASF       MKTAG('B', 'A', 'S', 'F')
+#define BRP_CODEC_ID_MASK       MKTAG('M', 'A', 'S', 'K')
 
 typedef struct ArgoBRPFileHeader {
     uint32_t magic;
@@ -60,6 +63,12 @@ typedef struct ArgoBVIDHeader {
     uint32_t depth;
 } ArgoBVIDHeader;
 
+typedef struct ArgoMASKHeader {
+    uint32_t num_frames;
+    uint32_t width;
+    uint32_t height;
+} ArgoMASKHeader;
+
 typedef struct ArgoBRPStreamHeader {
     uint32_t codec_id;
     uint32_t id;
@@ -72,6 +81,8 @@ typedef struct ArgoBRPStreamHeader {
         ArgoBVIDHeader    bvid;
         /* If codec_id == BRP_CODEC_ID_BASF */
         ArgoASFFileHeader basf;
+        /* If codec_id == BRP_CODEC_ID_MASK */
+        ArgoMASKHeader    mask;
     } extradata;
 } ArgoBRPStreamHeader;
 
@@ -106,6 +117,9 @@ static int read_extradata(AVFormatContext *s, const ArgoBRPStreamHeader *hdr,
     } else if (hdr->codec_id == BRP_CODEC_ID_BASF) {
         name = "BASF";
         size = ASF_FILE_HEADER_SIZE;
+    } else if (hdr->codec_id == BRP_CODEC_ID_MASK) {
+        name = "MASK";
+        size = MASK_HEADER_SIZE;
     } else {
         avpriv_request_sample(s, "BRP codec id 0x%x", hdr->codec_id);
 
@@ -240,7 +254,16 @@ static int argo_brp_read_header(AVFormatContext *s)
 
             if ((ret = ff_argo_asf_validate_file_header(s, &hdr->extradata.basf)) < 0)
                 return ret;
+        } else if (hdr->codec_id == BRP_CODEC_ID_MASK) {
+            ArgoMASKHeader *mask = &hdr->extradata.mask;
+
+            st->codecpar->codec_type = AVMEDIA_TYPE_DATA;
+
+            mask->num_frames = AV_RL32(buf + 0);
+            mask->width      = AV_RL32(buf + 4);
+            mask->height     = AV_RL32(buf + 8);
 
+            st->nb_frames    = mask->num_frames;
         } else {
             av_assert0(0); /* Caught above, should never happen. */
         }



More information about the ffmpeg-cvslog mailing list