关于ffplay源码之serial变量的说明

serial翻译为连续的,在ffplay中是用于判断播放是否连续的标志,serial变量存在于自定义的多个结构体中

以下为read_thread中,音视频文件发生跳到时的操作。

static int read_thread(void *arg)
{
    ......
    for (;;) {
        if (is->seek_req) {		/*发生文件重定位事件*/
            ......
            /*重定位文件*/
            ret = avformat_seek_file(is->ic, -1, seek_min, seek_target, seek_max, is->seek_flags);
            if (ret < 0) {
                av_log(NULL, AV_LOG_ERROR,
                       "%s: error while seeking\n", is->ic->url);
            } else {   
                if (is->audio_stream >= 0)
                    packet_queue_put(&is->audioq);
                if (is->subtitle_stream >= 0)
                    packet_queue_put(&is->subtitleq);
                if (is->video_stream >= 0)
                    packet_queue_put(&is->videoq);
                ......
            }
            is->seek_req = 0;
            is->queue_attachments_req = 1;
            ......
        }
/*压入队列*/
static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
{
    AVPacket *pkt1;
    ......
    ret = packet_queue_put_private(q, pkt1);
    ......
    return ret;
}
static void packet_queue_put_private(PacketQueue *q)
{
    ......
    q->serial++;
    ......
}

也就是在seek后serial会加1,会产生变化

你可能感兴趣的:(FFMPEG,ijkplayer,ffmpeg,ijkplayer)