summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authormichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-03-21 23:06:09 +0000
committermichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-03-21 23:06:09 +0000
commita812e6fc3c6c154047a52d16a9bcdec410a02a2b (patch)
tree912d0df2930be1aed7afa2d02abbccd2eec1db2f /libmpcodecs
parent35b0fb5056175dc548a994b8415c3f50b867228b (diff)
downloadmpv-a812e6fc3c6c154047a52d16a9bcdec410a02a2b.tar.bz2
mpv-a812e6fc3c6c154047a52d16a9bcdec410a02a2b.tar.xz
lavc doesnt pass AVFrame.opaque around :/
so lets use AVFrame.pts and hope lavcs pedantic timestamp checks like what mencoder generates ... git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17910 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ve_lavc.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/libmpcodecs/ve_lavc.c b/libmpcodecs/ve_lavc.c
index afca8612cd..715b86fde0 100644
--- a/libmpcodecs/ve_lavc.c
+++ b/libmpcodecs/ve_lavc.c
@@ -4,6 +4,7 @@
#include <math.h>
#include <limits.h>
#include <time.h>
+#include <assert.h>
#if !defined(INFINITY) && defined(HUGE_VAL)
#define INFINITY HUGE_VAL
@@ -857,8 +858,15 @@ static int encode_frame(struct vf_instance_s* vf, AVFrame *pic, double pts){
double dts;
if(pic){
+#if 0
pic->opaque= malloc(sizeof(pts));
memcpy(pic->opaque, &pts, sizeof(pts));
+#else
+ if(pts != MP_NOPTS_VALUE)
+ pic->pts= floor(pts / av_q2d(lavc_venc_context->time_base) + 0.5);
+ else
+ pic->pts= MP_NOPTS_VALUE;
+#endif
}
out_size = avcodec_encode_video(lavc_venc_context, mux_v->buffer, mux_v->buffer_size,
pic);
@@ -867,11 +875,18 @@ static int encode_frame(struct vf_instance_s* vf, AVFrame *pic, double pts){
dts= pts - lavc_venc_context->delay * av_q2d(lavc_venc_context->time_base);
else
dts= MP_NOPTS_VALUE;
-
+#if 0
pts= lavc_venc_context->coded_frame->opaque ?
*(double*)lavc_venc_context->coded_frame->opaque
: MP_NOPTS_VALUE;
-
+#else
+ if(lavc_venc_context->coded_frame->pts != MP_NOPTS_VALUE)
+ pts= lavc_venc_context->coded_frame->pts * av_q2d(lavc_venc_context->time_base);
+ else
+ pts= MP_NOPTS_VALUE;
+ assert(MP_NOPTS_VALUE == AV_NOPTS_VALUE);
+#endif
+//fprintf(stderr, "ve_lavc %f/%f\n", dts, pts);
if(out_size == 0) {
++mux_v->encoder_delay;
return 0;