Compare commits

..

4 Commits

Author SHA1 Message Date
087e488ae9 fix: likely update all deprecated fucntion calls
Signed-off-by: Alix von Schirp <github@avonschirp.bootmedia.de>
2026-02-19 10:04:35 +01:00
73cb05f572 fix: replace deprecated flag to supported version
Signed-off-by: Alix von Schirp <github@avonschirp.bootmedia.de>
2026-02-19 09:50:26 +01:00
3b2c5877ad fix: use versioned llvm binaries
Signed-off-by: Alix von Schirp <github@avonschirp.bootmedia.de>
2026-02-19 09:49:32 +01:00
1615115ea8 WIP: Fix build 2026-02-18 23:46:20 +01:00
3 changed files with 22 additions and 18 deletions

View File

@@ -1,13 +1,18 @@
FROM emscripten/emsdk:5.0.1 as build FROM emscripten/emsdk:5.0.1 AS build
ARG FFMPEG_VERSION=8.0.1 ARG FFMPEG_VERSION=8.0.1
ARG X264_COMMIT=b35605a ARG X264_COMMIT=b35605a
ARG LAME_VERSION=3.100 ARG LAME_VERSION=3.100
ARG PREFIX=/opt/ffmpeg ARG PREFIX=/opt/ffmpeg
ARG MAKEFLAGS="-j4" ARG MAKEFLAGS="-j4"
RUN apt-get update && apt-get install -y autoconf libtool build-essential RUN wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
RUN echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main\ndeb-src https://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" > /etc/apt/sources.list.d/llvm.list
RUN apt-get update
RUN apt-get install -y libllvm-20-ocaml-dev libllvm20 llvm-20 llvm-20-dev llvm-20-runtime
RUN apt-get install -y libclang-rt-20-dev-wasm32 libclang-rt-20-dev-wasm64 libc++-20-dev-wasm32 libc++abi-20-dev-wasm32 libclang-rt-20-dev-wasm32 libclang-rt-20-dev-wasm64
RUN apt-get update && apt-get install -y autoconf libtool build-essential pkgconf
# libx264 # libx264
WORKDIR /tmp/ WORKDIR /tmp/
@@ -32,15 +37,15 @@ WORKDIR /tmp/
RUN wget -O lame-${LAME_VERSION}.tar.gz https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download && \ RUN wget -O lame-${LAME_VERSION}.tar.gz https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download && \
tar zxf lame-${LAME_VERSION}.tar.gz && rm lame-${LAME_VERSION}.tar.gz tar zxf lame-${LAME_VERSION}.tar.gz && rm lame-${LAME_VERSION}.tar.gz
WORKDIR /tmp/lame-${LAME_VERSION} WORKDIR /tmp/lame-${LAME_VERSION}
RUN emconfigure ./configure \ RUN emconfigure ./configure \
--prefix=${PREFIX} \ --prefix=${PREFIX} \
--host=i686-gnu \ --host=i686-gnu \
--enable-static \ --enable-static \
--disable-frontend --disable-frontend
WORKDIR /tmp/lame-${LAME_VERSION} WORKDIR /tmp/lame-${LAME_VERSION}
RUN emmake make && emmake make install RUN emmake make && emmake make install
# Get ffmpeg source. # Get ffmpeg source.
WORKDIR /tmp/ WORKDIR /tmp/
@@ -49,6 +54,7 @@ RUN wget -O ffmpeg-${FFMPEG_VERSION}.tar.gz http://ffmpeg.org/releases/ffmpeg-${
ARG CFLAGS="-s USE_PTHREADS=1 -O3 -I${PREFIX}/include" ARG CFLAGS="-s USE_PTHREADS=1 -O3 -I${PREFIX}/include"
ARG LDFLAGS="$CFLAGS -L${PREFIX}/lib -s INITIAL_MEMORY=33554432" ARG LDFLAGS="$CFLAGS -L${PREFIX}/lib -s INITIAL_MEMORY=33554432"
ENV EM_PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
# Compile ffmpeg. # Compile ffmpeg.
WORKDIR /tmp/ffmpeg-${FFMPEG_VERSION} WORKDIR /tmp/ffmpeg-${FFMPEG_VERSION}
@@ -70,7 +76,6 @@ RUN emconfigure ./configure \
--enable-avdevice \ --enable-avdevice \
--enable-avutil \ --enable-avutil \
--enable-swresample \ --enable-swresample \
--enable-postproc \
--enable-swscale \ --enable-swscale \
--enable-protocol=file \ --enable-protocol=file \
--enable-decoder=h264,aac,pcm_s16le,mp3 \ --enable-decoder=h264,aac,pcm_s16le,mp3 \
@@ -82,10 +87,10 @@ RUN emconfigure ./configure \
--extra-cflags="$CFLAGS" \ --extra-cflags="$CFLAGS" \
--extra-cxxflags="$CFLAGS" \ --extra-cxxflags="$CFLAGS" \
--extra-ldflags="$LDFLAGS" \ --extra-ldflags="$LDFLAGS" \
--nm="llvm-nm -g" \ --nm="llvm-nm-20 -g" \
--ar=emar \ --ar=emar \
--as=llvm-as \ --as=llvm-as \
--ranlib=llvm-ranlib \ --ranlib=llvm-ranlib-20 \
--cc=emcc \ --cc=emcc \
--cxx=em++ \ --cxx=em++ \
--objcc=emcc \ --objcc=emcc \

View File

@@ -4,10 +4,10 @@ dist/ffprobe-wasm.js:
-O3 \ -O3 \
-L/opt/ffmpeg/lib \ -L/opt/ffmpeg/lib \
-I/opt/ffmpeg/include/ \ -I/opt/ffmpeg/include/ \
-s EXTRA_EXPORTED_RUNTIME_METHODS="[FS, cwrap, ccall, getValue, setValue, writeAsciiToMemory]" \ -s EXPORTED_RUNTIME_METHODS="[FS, cwrap, ccall, getValue, setValue, writeAsciiToMemory]" \
-s INITIAL_MEMORY=268435456 \ -s INITIAL_MEMORY=268435456 \
-lavcodec -lavformat -lavfilter -lavdevice -lswresample -lswscale -lavutil -lm -lx264 \ -lavcodec -lavformat -lavfilter -lavdevice -lswresample -lswscale -lavutil -lm -lx264 \
-pthread \ -pthread \
-lworkerfs.js \ -lworkerfs.js \
-o dist/ffprobe-wasm.js \ -o dist/ffprobe-wasm.js \
src/ffprobe-wasm-wrapper.cpp src/ffprobe-wasm-wrapper.cpp

View File

@@ -149,7 +149,7 @@ FileInfoResponse get_file_info(std::string filename) {
.level = (int)pLocalCodecParameters->level, .level = (int)pLocalCodecParameters->level,
.width = (int)pLocalCodecParameters->width, .width = (int)pLocalCodecParameters->width,
.height = (int)pLocalCodecParameters->height, .height = (int)pLocalCodecParameters->height,
.channels = (int)pLocalCodecParameters->channels, .channels = (int)pLocalCodecParameters->ch_layout.nb_channels,
.sample_rate = (int)pLocalCodecParameters->sample_rate, .sample_rate = (int)pLocalCodecParameters->sample_rate,
.frame_size = (int)pLocalCodecParameters->frame_size, .frame_size = (int)pLocalCodecParameters->frame_size,
}; };
@@ -165,7 +165,6 @@ FileInfoResponse get_file_info(std::string filename) {
} }
r.streams.push_back(stream); r.streams.push_back(stream);
free(fourcc);
} }
// Loop through the chapters (if any). // Loop through the chapters (if any).
@@ -227,7 +226,7 @@ FramesResponse get_frames(std::string filename, int timestamp) {
} }
// Get streams data. // Get streams data.
AVCodec *pCodec = NULL; const AVCodec *pCodec = NULL;
AVCodecParameters *pCodecParameters = NULL; AVCodecParameters *pCodecParameters = NULL;
int video_stream_index = -1; int video_stream_index = -1;
int nb_frames = 0; int nb_frames = 0;
@@ -238,7 +237,7 @@ FramesResponse get_frames(std::string filename, int timestamp) {
pLocalCodecParameters = pFormatContext->streams[i]->codecpar; pLocalCodecParameters = pFormatContext->streams[i]->codecpar;
// Print out the decoded frame info. // Print out the decoded frame info.
AVCodec *pLocalCodec = avcodec_find_decoder(pLocalCodecParameters->codec_id); const AVCodec *pLocalCodec = avcodec_find_decoder(pLocalCodecParameters->codec_id);
if (pLocalCodecParameters->codec_type == AVMEDIA_TYPE_VIDEO) { if (pLocalCodecParameters->codec_type == AVMEDIA_TYPE_VIDEO) {
if (video_stream_index == -1) { if (video_stream_index == -1) {
video_stream_index = i; video_stream_index = i;
@@ -296,7 +295,7 @@ FramesResponse get_frames(std::string filename, int timestamp) {
} }
// Track keyframes so we paginate by each GOP. // Track keyframes so we paginate by each GOP.
if (pFrame->key_frame == 1) key_frames++; if (pFrame->flags & AV_FRAME_FLAG_KEY) key_frames++;
// Break at the next keyframe found. // Break at the next keyframe found.
if (key_frames > 1) break; if (key_frames > 1) break;
@@ -307,7 +306,7 @@ FramesResponse get_frames(std::string filename, int timestamp) {
.pts = (int) pPacket->pts, .pts = (int) pPacket->pts,
.dts = (int) pPacket->dts, .dts = (int) pPacket->dts,
.pos = (int) pPacket->pos, .pos = (int) pPacket->pos,
.pkt_size = pFrame->pkt_size, .pkt_size = pPacket->size,
}; };
r.frames.push_back(f); r.frames.push_back(f);
@@ -399,4 +398,4 @@ EMSCRIPTEN_BINDINGS(structs) {
.field("avg_frame_rate", &FramesResponse::avg_frame_rate) .field("avg_frame_rate", &FramesResponse::avg_frame_rate)
; ;
function("get_frames", &get_frames); function("get_frames", &get_frames);
} }