Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 38 additions & 18 deletions fftools/resources/resman.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "resman.h"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the FFmpeg mailing list, Michael Niedermayer wrote (reply to this):


--===============8464981479943917701==
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="lNK9RXEfBTwZsqA6"
Content-Disposition: inline


--lNK9RXEfBTwZsqA6
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi softworkz

On Sat, May 31, 2025 at 03:58:44AM +0000, softworkz wrote:
> From: softworkz <[email protected]>
>=20
> Signed-off-by: softworkz <[email protected]>
> ---
>  fftools/resources/resman.c |  7 +++----
>  fftools/resources/resman.h | 10 +---------
>  2 files changed, 4 insertions(+), 13 deletions(-)

seems to breaks build

fftools/resources/resman.c:60:8: error: unknown type name =E2=80=98AVMutex=
=E2=80=99
   60 | static AVMutex mutex =3D AV_MUTEX_INITIALIZER;
      |        ^~~~~~~
fftools/resources/resman.c:60:24: error: =E2=80=98AV_MUTEX_INITIALIZER=E2=
=80=99 undeclared here (not in a function)
   60 | static AVMutex mutex =3D AV_MUTEX_INITIALIZER;
      |                        ^~~~~~~~~~~~~~~~~~~~
fftools/resources/resman.c: In function =E2=80=98get_resman_context=E2=80=
=99:
fftools/resources/resman.c:123:5: error: implicit declaration of function =
=E2=80=98ff_mutex_lock=E2=80=99 [-Werror=3Dimplicit-function-declaration]
  123 |     ff_mutex_lock(&mutex);
      |     ^~~~~~~~~~~~~
fftools/resources/resman.c:138:5: error: implicit declaration of function =
=E2=80=98ff_mutex_unlock=E2=80=99 [-Werror=3Dimplicit-function-declaration]
  138 |     ff_mutex_unlock(&mutex);
      |     ^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make: *** [ffbuild/common.mak:81: fftools/resources/resman.o] Error 1
make: *** Waiting for unfinished jobs....


[...]
--=20
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle

--lNK9RXEfBTwZsqA6
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCaDz+MwAKCRBhHseHBAsP
q3gSAJ9YHbZSYTJ2o7ORJRS6yBl/S5m5HQCbBbAJqgspS0O0gquGV/fyJwLkjrE=
=V/c5
-----END PGP SIGNATURE-----

--lNK9RXEfBTwZsqA6--

--===============8464981479943917701==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

--===============8464981479943917701==--

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the FFmpeg mailing list, "softworkz ." wrote (reply to this):



> -----Original Message-----
> From: ffmpeg-devel <[email protected]> On Behalf Of Michael
> Niedermayer
> Sent: Montag, 2. Juni 2025 03:28
> To: FFmpeg development discussions and patches <[email protected]>
> Subject: Re: [FFmpeg-devel] [PATCH v2 1/2] fftools/resman: remove unused
> includes, fix declaration
> 
> Hi softworkz
> 
> On Sat, May 31, 2025 at 03:58:44AM +0000, softworkz wrote:
> > From: softworkz <[email protected]>
> >
> > Signed-off-by: softworkz <[email protected]>
> > ---
> >  fftools/resources/resman.c |  7 +++----
> >  fftools/resources/resman.h | 10 +---------
> >  2 files changed, 4 insertions(+), 13 deletions(-)
> 
> seems to breaks build
> 
> fftools/resources/resman.c:60:8: error: unknown type name ‘AVMutex’
>    60 | static AVMutex mutex = AV_MUTEX_INITIALIZER;
>       |        ^~~~~~~
> fftools/resources/resman.c:60:24: error: ‘AV_MUTEX_INITIALIZER’ undeclared
> here (not in a function)
>    60 | static AVMutex mutex = AV_MUTEX_INITIALIZER;
>       |                        ^~~~~~~~~~~~~~~~~~~~
> fftools/resources/resman.c: In function ‘get_resman_context’:
> fftools/resources/resman.c:123:5: error: implicit declaration of function
> ‘ff_mutex_lock’ [-Werror=implicit-function-declaration]
>   123 |     ff_mutex_lock(&mutex);
>       |     ^~~~~~~~~~~~~
> fftools/resources/resman.c:138:5: error: implicit declaration of function
> ‘ff_mutex_unlock’ [-Werror=implicit-function-declaration]
>   138 |     ff_mutex_unlock(&mutex);
>       |     ^~~~~~~~~~~~~~~
> cc1: some warnings being treated as errors
> make: *** [ffbuild/common.mak:81: fftools/resources/resman.o] Error 1
> make: *** Waiting for unfinished jobs....
> 
> 
> [...]
> --

Thanks!

Seems it got broken due to changes in master. On submission,
all builds were successful:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/4d7af186ce9f8a8d3b12cdc2c979ea54320eed96.1748663925.git.ffmpegagent@gmail.com/

Will post an update.

Thanks
sw

_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the FFmpeg mailing list, "softworkz ." wrote (reply to this):



> -----Original Message-----
> From: ffmpeg-devel <[email protected]> On Behalf Of softworkz .
> Sent: Montag, 2. Juni 2025 03:43
> To: FFmpeg development discussions and patches <[email protected]>
> Subject: Re: [FFmpeg-devel] [PATCH v2 1/2] fftools/resman: remove unused
> includes, fix declaration
> 
> 
> 
> > -----Original Message-----
> > From: ffmpeg-devel <[email protected]> On Behalf Of Michael
> > Niedermayer
> > Sent: Montag, 2. Juni 2025 03:28
> > To: FFmpeg development discussions and patches <[email protected]>
> > Subject: Re: [FFmpeg-devel] [PATCH v2 1/2] fftools/resman: remove unused
> > includes, fix declaration
> >
> > Hi softworkz
> >
> > On Sat, May 31, 2025 at 03:58:44AM +0000, softworkz wrote:
> > > From: softworkz <[email protected]>
> > >
> > > Signed-off-by: softworkz <[email protected]>
> > > ---
> > >  fftools/resources/resman.c |  7 +++----
> > >  fftools/resources/resman.h | 10 +---------
> > >  2 files changed, 4 insertions(+), 13 deletions(-)
> >
> > seems to breaks build
> >
> > fftools/resources/resman.c:60:8: error: unknown type name ‘AVMutex’
> >    60 | static AVMutex mutex = AV_MUTEX_INITIALIZER;
> >       |        ^~~~~~~
> > fftools/resources/resman.c:60:24: error: ‘AV_MUTEX_INITIALIZER’ undeclared
> > here (not in a function)
> >    60 | static AVMutex mutex = AV_MUTEX_INITIALIZER;
> >       |                        ^~~~~~~~~~~~~~~~~~~~
> > fftools/resources/resman.c: In function ‘get_resman_context’:
> > fftools/resources/resman.c:123:5: error: implicit declaration of function
> > ‘ff_mutex_lock’ [-Werror=implicit-function-declaration]
> >   123 |     ff_mutex_lock(&mutex);
> >       |     ^~~~~~~~~~~~~
> > fftools/resources/resman.c:138:5: error: implicit declaration of function
> > ‘ff_mutex_unlock’ [-Werror=implicit-function-declaration]
> >   138 |     ff_mutex_unlock(&mutex);
> >       |     ^~~~~~~~~~~~~~~
> > cc1: some warnings being treated as errors
> > make: *** [ffbuild/common.mak:81: fftools/resources/resman.o] Error 1
> > make: *** Waiting for unfinished jobs....
> >
> >
> > [...]
> > --
> 
> Thanks!
> 
> Seems it got broken due to changes in master. On submission,
> all builds were successful:
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/4d7af186ce9f8a8d3b12cdc2c979
> [email protected]/
> 
> Will post an update.
> _______________________________________________

No I won't. This set is obsolete and superseded by
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=14663

sw
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

#include "fftools/ffmpeg_filter.h"
#include "libavutil/avassert.h"
#include "libavutil/pixdesc.h"
#include "libavutil/dict.h"
#include "libavutil/common.h"

Expand All @@ -61,55 +60,76 @@ typedef struct ResourceManagerContext {

static AVMutex mutex = AV_MUTEX_INITIALIZER;

ResourceManagerContext *resman_ctx = NULL;
static ResourceManagerContext *resman_ctx = NULL;


#if CONFIG_RESOURCE_COMPRESSION

static int decompress_gzip(ResourceManagerContext *ctx, uint8_t *in, unsigned in_len, char **out, size_t *out_len)
{
z_stream strm;
unsigned chunk = 65534;
z_stream strm = { 0 };
uint8_t dummy[4096];
size_t uncompressed_size;
int ret;
uint8_t *buf;

*out = NULL;
memset(&strm, 0, sizeof(strm));

// 15 + 16 tells zlib to detect GZIP or zlib automatically
ret = inflateInit2(&strm, 15 + 16);
if (ret != Z_OK) {
av_log(ctx, AV_LOG_ERROR, "Error during zlib initialization: %s\n", strm.msg);
return AVERROR(ENOSYS);
}

strm.avail_in = in_len;
strm.next_in = in;

do {
strm.avail_out = sizeof(dummy);
strm.next_out = dummy;

ret = inflate(&strm, Z_NO_FLUSH);
if (ret != Z_OK && ret != Z_STREAM_END) {
av_log(ctx, AV_LOG_ERROR, "Inflate failed (1): %d, %s\n", ret, strm.msg);
inflateEnd(&strm);
return AVERROR(EINVAL);
}
} while (ret != Z_STREAM_END);

uncompressed_size = strm.total_out;

// Allocate output buffer with extra byte for null termination
buf = (uint8_t *)av_mallocz(chunk + 1);
buf = av_mallocz(uncompressed_size + 1);
if (!buf) {
av_log(ctx, AV_LOG_ERROR, "Failed to allocate decompression buffer\n");
inflateEnd(&strm);
return AVERROR(ENOMEM);
}

// 15 + 16 tells zlib to detect GZIP or zlib automatically
ret = inflateInit2(&strm, 15 + 16);
ret = inflateReset(&strm);
if (ret != Z_OK) {
av_log(ctx, AV_LOG_ERROR, "Error during zlib initialization: %s\n", strm.msg);
av_log(ctx, AV_LOG_ERROR, "inflateReset failed: %s\n", strm.msg);
av_free(buf);
return AVERROR(ENOSYS);
}

strm.avail_in = in_len;
strm.next_in = in;
strm.avail_out = chunk;
strm.avail_out = uncompressed_size;
strm.next_out = buf;

ret = inflate(&strm, Z_FINISH);
if (ret != Z_OK && ret != Z_STREAM_END) {
av_log(ctx, AV_LOG_ERROR, "Inflate failed: %d, %s\n", ret, strm.msg);
av_log(ctx, AV_LOG_ERROR, "Inflate failed (2): %d, %s\n", ret, strm.msg);
inflateEnd(&strm);
av_free(buf);
return (ret == Z_STREAM_END) ? Z_OK : ((ret == Z_OK) ? Z_BUF_ERROR : ret);
return AVERROR(EINVAL);
}

if (strm.avail_out == 0) {
// TODO: Error or loop decoding?
av_log(ctx, AV_LOG_WARNING, "Decompression buffer may be too small\n");
}
av_assert0(strm.avail_out == 0);

*out_len = chunk - strm.avail_out;
*out_len = uncompressed_size;
buf[*out_len] = 0; // Ensure null termination

inflateEnd(&strm);
Expand Down Expand Up @@ -156,7 +176,7 @@ void ff_resman_uninit(void)
}


char *ff_resman_get_string(FFResourceId resource_id)
const char *ff_resman_get_string(FFResourceId resource_id)
{
ResourceManagerContext *ctx = get_resman_context();
FFResourceDefinition resource_definition = { 0 };
Expand Down
10 changes: 1 addition & 9 deletions fftools/resources/resman.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@
#ifndef FFTOOLS_RESOURCES_RESMAN_H
#define FFTOOLS_RESOURCES_RESMAN_H

#include <stdint.h>

#include "config.h"
#include "fftools/ffmpeg.h"
#include "libavutil/avutil.h"
#include "libavutil/bprint.h"
#include "fftools/textformat/avtextformat.h"

typedef enum {
FF_RESOURCE_GRAPH_CSS,
FF_RESOURCE_GRAPH_HTML,
Expand All @@ -45,6 +37,6 @@ typedef struct FFResourceDefinition {

void ff_resman_uninit(void);

char *ff_resman_get_string(FFResourceId resource_id);
const char *ff_resman_get_string(FFResourceId resource_id);

#endif /* FFTOOLS_RESOURCES_RESMAN_H */