libeplayer3: use av_rescale for pts calulations

This commit is contained in:
martii
2014-04-18 11:16:44 +02:00
parent 020be569fa
commit 91712236fe
6 changed files with 9 additions and 10 deletions

View File

@@ -60,7 +60,7 @@ bool WriterDIVX::Write(int fd, AVFormatContext * /* avfc */, AVStream *stream, A
unsigned int FakeStartCode = (Version << 8) | PES_VERSION_FAKE_START_CODE;
BitPacker_t ld = { FakeHeaders, 0, 32 };
unsigned int usecPerFrame = AV_TIME_BASE * stream->r_frame_rate.den / stream->r_frame_rate.num;
unsigned int usecPerFrame = av_rescale(AV_TIME_BASE, stream->r_frame_rate.den, stream->r_frame_rate.num);
/* Create info record for frame parser */
/* divx4 & 5

View File

@@ -75,7 +75,7 @@ bool WriterH264::Write(int fd, AVFormatContext * /* avfc */, AVStream *stream, A
int ic = 0;
struct iovec iov[128];
TimeDelta = 1000 * stream->r_frame_rate.num / stream->r_frame_rate.den;
TimeDelta = av_rescale(1000ll, stream->r_frame_rate.num, stream->r_frame_rate.den);
TimeScale = (TimeDelta < 23970) ? 1001 : 1000; /* fixme: revise this */
if ((packet->size > 3)

View File

@@ -326,7 +326,6 @@ bool WriterPCM::Write(int fd, AVFormatContext *avfc, AVStream *stream, AVPacket
fprintf(stderr, "av_samples_alloc: %d\n", -e);
continue;
}
// FIXME. PTS calculation is probably broken.
int64_t next_in_pts = av_rescale(av_frame_get_best_effort_timestamp(decoded_frame),
stream->time_base.num * (int64_t)out_sample_rate * c->sample_rate,
stream->time_base.den);

View File

@@ -89,7 +89,7 @@ bool WriterVC1::Write(int fd, AVFormatContext * /* avfc */, AVStream *stream, AV
uint8_t PesHeader[PES_MAX_HEADER_SIZE];
uint8_t PesPayload[128];
uint8_t *PesPtr;
unsigned int usecPerFrame = AV_TIME_BASE * stream->r_frame_rate.den / stream->r_frame_rate.num;
unsigned int usecPerFrame = av_rescale(AV_TIME_BASE, stream->r_frame_rate.den, stream->r_frame_rate.num);
struct iovec iov[2];

View File

@@ -78,7 +78,7 @@ bool WriterWMV::Write(int fd, AVFormatContext * /* avfc */, AVStream *stream, AV
uint8_t PesPacket[PES_MIN_HEADER_SIZE + 128];
uint8_t *PesPtr;
unsigned int MetadataLength;
unsigned int usecPerFrame = AV_TIME_BASE * stream->r_frame_rate.den / stream->r_frame_rate.num;
unsigned int usecPerFrame = av_rescale(AV_TIME_BASE, stream->r_frame_rate.den, stream->r_frame_rate.num);
PesPtr = &PesPacket[PES_MIN_HEADER_SIZE];