admin 管理员组

文章数量: 1184232


2024年4月24日发(作者:数据库exists)

do {

double segment_time = 0.0;

AVPacket packet;

double packetStartTime = 0.0;

double packetDuration = 0.0;

if (!decode_done)

{

decode_done = av_read_frame(ic, &packet);

if (!decode_done)

{

if (_index != video_index &&

_index != audio_index)

{

av_free_packet(&packet);

continue;

}

timeStamp =

(double)() *

(double)(ic->streams[_index]->time_) /

(double)(ic->streams[_index]->time_);

if (av_dup_packet(&packet) < 0)

{

fprintf(stderr, "Could not duplicate packetn");

av_free_packet(&packet);

break;

}

insertPacket(streamLace, &packet, timeStamp);

}

}

if (countPackets(streamLace) < 50 && !decode_done)

{

/* allow the queue to fill up so that the packets can be sorted properly */

continue;

}

if (!removePacket(streamLace, &packet))

{

if (decode_done)

{

/* the queue is empty, we are done */

break;

}

assert(decode_done);

continue;

}

packetStartTime =

(double)() *

(double)(ic->streams[_index]->time_) /

(double)(ic->streams[_index]->time_);

packetDuration =

(double)(on) *

(double)(ic->streams[_index]->time_) /

(double)(ic->streams[_index]->time_);

#if !defined(NDEBUG) && (defined(DEBUG) || defined(_DEBUG))

if (av_log_get_level() >= AV_LOG_VERBOSE)

fprintf(stderr,

"stream %i, packet [%f, %f)n",

_index,

packetStartTime,

packetStartTime + packetDuration);

#endif

segment_duration = packetStartTime + packetDuration - prev_segment_time;

// NOTE: segments are supposed to start on a keyframe.

// If the keyframe interval and segment duration do not match

// forcing the segment creation for "better seeking behavior"

// will result in decoding artifacts after seeking or stream switching.

if (_index == video_index && ( & AV_PKT_FLAG_KEY || strict_segment_duration)) {

segment_time = packetStartTime;

}

else if (video_index < 0) {

segment_time = packetStartTime;

}

else {


本文标签: 数据库 作者