On 6/21/2023 9:43 PM, Leo Izen wrote:
+static int jpegxl_parse(AVCodecParserContext *s, AVCodecContext *avctx,
+                        const uint8_t **poutbuf, int *poutbuf_size,
+                        const uint8_t *buf, int buf_size)
+{
+    JXLParseContext *ctx = s->priv_data;
+    int ret;
+
+    *poutbuf_size = 0;
+    *poutbuf = NULL;
+
+    if (!ctx->parsed_header) {
+        if (AV_RL64(buf) == FF_JPEGXL_CONTAINER_SIGNATURE_LE) {
+            int copied;
+            uint8_t codestream_header[4096];
+            ret = ff_jpegxl_collect_codestream_header(buf, buf_size, 
codestream_header,
+                                                      sizeof(codestream_header), 
&copied);
+            if (ret < 0)
+                return ret;
+            /* copied may be larger than the bufsize if stuff was skipped */
+            copied = FFMIN(copied, sizeof(codestream_header));
+            ret = ff_jpegxl_parse_codestream_header(codestream_header, copied, 0, 
&ctx->meta);
+            if (ret < 0)
+                return ret;
+        } else {
+            ret = ff_jpegxl_parse_codestream_header(buf, buf_size, 1, 
&ctx->meta);
+            if (ret < 0)
+                return ret;
+        }
+        avctx->width = ctx->meta.width;
+        avctx->height = ctx->meta.height;

Set s->width and s->height instead. The generic code will set the avctx fields if required.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to