使用*-sys 包 0x06 Discussion 0x01 背景 为mmDeploy加入Rust API,往往需要调用许多非Rust语言库,那么FFI(外部语言接口)绑定技术就是必备技能。 bindgen 就是一个主流的自动生成C/C++ FFI绑定的Rust库和工具,ffmpeg-next(也叫rust-ffmpeg) 和rust-ncnn都基于其实现。前者包装了最知名的开源音视频处理库FFmpeg,...
FFmpeg bindings for Rust. Contribute to Hyperion-Tech/ffmpeg-sys-next development by creating an account on GitHub.
ffmpeg-nextcrates.io/crates/ffmpeg-next 其中ffmpeg-sys-next 提供了对 FFmpeg 的 C 语言接口的 Rust 绑定,ffmpeg-next 则是在 ffmpeg-sys-next 基础上做的一层抽象和包装,使用上不必直接和底层的unsafe C 语言接口打交道,更加方便安全。 Rust开发环境搭建可以参考《Rust语言圣经(Rust Course)》,这里不再...
*/ int64_t dts; uint8_t *data; int size; int stream_index; int flags; /** * Duration of this packet in AVStream->time_base units, 0 if unknown. * Equals next_pts - this_pts in presentation order. */ int duration; void (*destruct)(struct AVPacket *); void *priv; int64_t ...
SYSROOT=$TOOLCHAIN/sysroot TOOL_PREFIX="$TOOLCHAIN/bin/$TOOL_CPU_NAME-linux-android" CC="$TOOL_PREFIX$API-clang" CXX="$TOOL_PREFIX$API-clang++" OPTIMIZE_CFLAGS="-march=$CPU" function build { ./configure \ --prefix=$OUTPUT \ --target-os=android \ ...
format: 这个参数用来告诉 SDL 音频的格式。S16SYS中的S表示signed,16表示每个采样占 16 bits。SYS表示大小端和系统保持一致。这个格式是avcodec_decode_audio4()会给我们的。 channels: 音频通道数。 silence: 是否静音。 samples: 音频缓存的大小。推荐值为 512~8192,ffplay 使用的是 1024。
wanted_spec.format = AUDIO_S16SYS; wanted_spec.channels = aCodecCtx->channels; wanted_spec.silence = 0; wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE; wanted_spec.callback = audio_callback; wanted_spec.userdata = aCodecCtx; if (SDL_OpenAudio(&wanted_spec, &spec) < 0) { ...
waterMark(ost->frame,frame_out,width,height,sys_time); //yuv420p,y表示亮度,uv表示像素颜色 ost->frame=frame_out; ost->frame->pts=ost->next_pts++; ret_frame=frame_out; } } av_packet_unref(input->in_packet); } return ret_frame; ...
by the container. * Packet can contain several types of side information. */ AVPacketSideData *side_data; int side_data_elems; /** * Duration of this packet in AVStream->time_base units, 0 if unknown. * Equals next_pts - this_pts in presentation order. */ int64_t duration; int64...
format: 这个参数用来告诉 SDL 音频的格式。S16SYS中的S表示signed,16表示每个采样占 16 bits。SYS表示大小端和系统保持一致。这个格式是avcodec_decode_audio4()会给我们的。 channels: 音频通道数。 silence: 是否静音。 samples: 音频缓存的大小。推荐值为 512~8192,ffplay 使用的是 1024。