[FFmpeg-devel] [PATCH 1/3] avcodec/sanm: ignore unknown codecs in FOBJs

Manuel Lauss manuel.lauss at gmail.com
Mon Feb 10 22:48:32 EET 2025


Hi Marton!


Marton Balint <cus at passwd.hu> schrieb am Mo., 10. Feb. 2025, 20:42:

>
>
> On Mon, 10 Feb 2025, Manuel Lauss wrote:
>
> > Don't error out, just ignore unknown codec numbers and pretend
> > decode succeeded.  This is useful for older LucasArts titles
> > which stack a lot of different FOBJs with different codecs into
> > a single frame.
> >
> > Signed-off-by: Manuel Lauss <manuel.lauss at gmail.com>
> > ---
> > libavcodec/sanm.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
> > index c30095ed32..37d2c915d4 100644
> > --- a/libavcodec/sanm.c
> > +++ b/libavcodec/sanm.c
> > @@ -1274,7 +1274,7 @@ static int process_frame_obj(SANMVideoContext *ctx)
> >         return old_codec48(ctx, w, h);
> >     default:
> >         avpriv_request_sample(ctx->avctx, "Subcodec %d", codec);
> > -        return AVERROR_PATCHWELCOME;
> > +        return 0;
>
> But if there is an unsupported FOBJ code that means that the frame might
> be only partially decoded, right?


Thats how the game engine works as well: A FRME can have >=0 FOBJs, all of
them skippable based on game state.
An unchanged image buffer from the previous FRME is absolutely posssible.

So you should set AV_FRAME_FLAG_CORRUPT
> flag in AVFrame->flags, and still log the error, not silently ignore it.
>

It's not corrupt per se.
While working on codec 23, the other unsupported codecs in the test videos
stop the decoding before getting to the c23 fobj.

For a lot of Rebel Assault 2  videos this patch improves playback; nothing
changes for the ones that were already supported by ffmpeg.


Regards,
> Marton
>
>
> >     }
> > }
> >
> > --
> > 2.48.1
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> >
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list