【FFmpeg编程进阶】(17)解码packet数据 try_decode_frame() 代码分析

【FFmpeg编程进阶】(17)解码packet数据 try_decode_frame 代码分析

    • 一、try_decode_frame()
    • 二、解码一帧数据 avcodec_send_packet(avctx, &pkt)
      • 2.1 decode_simple_receive_frame(avctx, frame)
    • 三、接收解码后的数据 avcodec_receive_frame(avctx, frame)
    • 四、解码字幕数据 avcodec_decode_subtitle2()

一、try_decode_frame()

  1. 判断是否已经打开 avcodec(条件为: AVCodecInternal 是否存在,found_decodercodec_id)
    如果未初始化decoder,则从codec_list[]查找与 codec_id 匹配的 AVCodec 结构体对象
    调用 avcodec_open2() 打开及初始化 codec
  2. 判断是否需要跳过 1 帧
  3. 开始解码
  4. 如果是video 或 audio ,发 packet 进入解码队列进行解码
  5. 接收解码后的帧数据
  6. 如果是字幕数据,调用avcodec_decode_subtitle2() 解码字幕数据
/* returns 1 or 0 if or if not decoded data was returned, or a negative error */
static int

你可能感兴趣的:(音频.视频.图像,#,FFmpeg)