larksuite / rsmpeg

A Rust crate that exposes FFmpeg's power as much as possible.
https://docs.rs/rsmpeg/latest/rsmpeg/
MIT License
677 stars 41 forks source link

tests示例transcode.rs中有一些方法在文档中找不到,无法通过编译 #154

Closed yomiko451 closed 8 months ago

yomiko451 commented 9 months ago

我正在看tests中的示例代码transcode.rs学习怎么转码视频,但是编译器报错有几个方法找不到,我在文档中也没有找到,所以想请问一下: 一个是196行:

  if dec_ctx.ch_layout.order == ffi::AVChannelOrder_AV_CHANNEL_ORDER_UNSPEC {
      dec_ctx.set_ch_layout(
          AVChannelLayout::from_nb_channels(dec_ctx.ch_layout.nb_channels).into_inner(),
      );
  }

在结构体AVChannelLayout上,找不到方法from_nb_channels 还有一个是362行:

    loop {
        let mut filtered_frame = match buffersink_ctx.buffersink_get_frame(None) {
            Ok(frame) => frame,
            Err(RsmpegError::BufferSinkDrainError) | Err(RsmpegError::BufferSinkEofError) => break,
            Err(_) => bail!("Get frame from buffer sink failed."),
        };

        filtered_frame.set_time_base(buffersink_ctx.get_time_base());
        filtered_frame.set_pict_type(ffi::AVPictureType_AV_PICTURE_TYPE_NONE);

        encode_write_frame(Some(filtered_frame), enc_ctx, ofmt_ctx, stream_index)?;
    }

filtered_frame类型是AVFrame,上面没有set_time_base方法 buffersink_ctx类型是AVFilterContextMut,上面也没有get_time_base方法

vnghia commented 8 months ago

You can use the latest rsmpeg (master) which is not released yet. On your Cargo.toml rsmpeg = { git = "https://github.com/larksuite/rsmpeg.git", rev = "58d143d" }