From bd903bbf18d133dc9add2149a2e921c392309451 Mon Sep 17 00:00:00 2001 From: izogfif Date: Fri, 30 Aug 2024 07:07:11 +0000 Subject: [PATCH] FFprobe is re-initialized on every ffprobe run. Emscripten's ENVIRONMENT variable was set to "WORKER". Node.js-related code should no longer be present in ffmpeg-core.js. --- build/ffmpeg-wasm.sh | 1 + src/fftools/ffprobe.c | 53 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/build/ffmpeg-wasm.sh b/build/ffmpeg-wasm.sh index de29671..d36b174 100755 --- a/build/ffmpeg-wasm.sh +++ b/build/ffmpeg-wasm.sh @@ -30,6 +30,7 @@ CONF_FLAGS=( -lswscale -Wno-deprecated-declarations $LDFLAGS + -sENVIRONMENT=worker -sWASM_BIGINT # enable big int support -sUSE_SDL=2 # use emscripten SDL2 lib port -sMODULARIZE # modularized to use as a library diff --git a/src/fftools/ffprobe.c b/src/fftools/ffprobe.c index 41c2b6f..53f2135 100644 --- a/src/fftools/ffprobe.c +++ b/src/fftools/ffprobe.c @@ -382,6 +382,58 @@ static void ffprobe_cleanup(int ret) #if HAVE_THREADS pthread_mutex_destroy(&log_mutex); #endif + + do_bitexact = 0; + do_count_frames = 0; + do_count_packets = 0; + do_read_frames = 0; + do_read_packets = 0; + do_show_chapters = 0; + do_show_error = 0; + do_show_format = 0; + do_show_frames = 0; + do_show_packets = 0; + do_show_programs = 0; + do_show_streams = 0; + do_show_stream_disposition = 0; + do_show_data = 0; + do_show_program_version = 0; + do_show_library_versions = 0; + do_show_pixel_formats = 0; + do_show_pixel_format_flags = 0; + do_show_pixel_format_components = 0; + do_show_log = 0; + do_show_chapter_tags = 0; + do_show_format_tags = 0; + do_show_frame_tags = 0; + do_show_program_tags = 0; + do_show_stream_tags = 0; + do_show_packet_tags = 0; + show_value_unit = 0; + use_value_prefix = 0; + use_byte_value_binary_prefix = 0; + use_value_sexagesimal_format = 0; + show_private_data = 1; + show_optional_fields = SHOW_OPTIONAL_FIELDS_AUTO; + print_format = NULL; + stream_specifier = NULL; + show_data_hash = NULL; + read_intervals = NULL; + read_intervals_nb = 0; + find_stream_info = 1; + input_filename = NULL; + print_input_filename = NULL; + iformat = NULL; + output_filename = NULL; + hash = NULL; + nb_streams = 0; + nb_streams_packets = NULL; + nb_streams_frames = NULL; + selected_streams = NULL; + log_buffer = NULL; + log_buffer_size = 0; + + av_log(NULL, AV_LOG_DEBUG, "FFprobe: Cleanup done.\n"); } struct unit_value { @@ -4037,6 +4089,7 @@ int ffprobe(int argc, char **argv) } #endif av_log_set_flags(AV_LOG_SKIP_REPEATED); + ffprobe_cleanup(0); register_exit(ffprobe_cleanup); options = real_options;