Reorder pts.

This commit is contained in:
Johns 2011-12-20 15:05:35 +01:00
parent 8a98257515
commit 37192d5b53
3 changed files with 22 additions and 4 deletions

1
Todo
View File

@ -29,6 +29,7 @@ x11:
support fullscreen window support fullscreen window
support fullscreen / window toggle support fullscreen / window toggle
close window should send power button close window should send power button
disable cursor
audio/alsa: audio/alsa:
video/audio asyncron video/audio asyncron

22
codec.c
View File

@ -127,10 +127,17 @@ static int Codec_get_buffer(AVCodecContext * video_ctx, AVFrame * frame)
//Debug(3, "codec: use surface %#010x\n", surface); //Debug(3, "codec: use surface %#010x\n", surface);
frame->type = FF_BUFFER_TYPE_USER; frame->type = FF_BUFFER_TYPE_USER;
#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(53,46,0)
frame->age = 256 * 256 * 256 * 64; frame->age = 256 * 256 * 256 * 64;
#endif
frame->data[0] = (void *)(size_t) surface; frame->data[0] = (void *)(size_t) surface;
// FIXME: reordered? // reordered frames
if (video_ctx->pkt) {
frame->pkt_pts = video_ctx->pkt->pts;
} else {
frame->pkt_pts = AV_NOPTS_VALUE;
}
return 0; return 0;
} }
// VA-API: // VA-API:
@ -144,12 +151,19 @@ static int Codec_get_buffer(AVCodecContext * video_ctx, AVFrame * frame)
//Debug(3, "codec: use surface %#010x\n", surface); //Debug(3, "codec: use surface %#010x\n", surface);
frame->type = FF_BUFFER_TYPE_USER; frame->type = FF_BUFFER_TYPE_USER;
#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(53,46,0)
frame->age = 256 * 256 * 256 * 64; frame->age = 256 * 256 * 256 * 64;
#endif
// vaapi needs both fields set // vaapi needs both fields set
frame->data[0] = (void *)(size_t) surface; frame->data[0] = (void *)(size_t) surface;
frame->data[3] = (void *)(size_t) surface; frame->data[3] = (void *)(size_t) surface;
// FIXME: reordered? // reordered frames
if (video_ctx->pkt) {
frame->pkt_pts = video_ctx->pkt->pts;
} else {
frame->pkt_pts = AV_NOPTS_VALUE;
}
return 0; return 0;
} }
//Debug(3, "codec: fallback to default get_buffer\n"); //Debug(3, "codec: fallback to default get_buffer\n");
@ -369,7 +383,7 @@ void CodecVideoClose(VideoDecoder * video_decoder)
** ffmpeg 0.9 pkt_dts wild jumping -160 - 340 ms ** ffmpeg 0.9 pkt_dts wild jumping -160 - 340 ms
** **
** libav 0.8_pre20111116 pts always AV_NOPTS_VALUE ** libav 0.8_pre20111116 pts always AV_NOPTS_VALUE
** libav 0.8_pre20111116 pkt_pts always 0 ** libav 0.8_pre20111116 pkt_pts always 0 (could be fixed?)
** libav 0.8_pre20111116 pkt_dts wild jumping -160 - 340 ms ** libav 0.8_pre20111116 pkt_dts wild jumping -160 - 340 ms
*/ */
void DisplayPts(AVCodecContext * video_ctx, AVFrame * frame) void DisplayPts(AVCodecContext * video_ctx, AVFrame * frame)
@ -389,8 +403,10 @@ void DisplayPts(AVCodecContext * video_ctx, AVFrame * frame)
pts, (int)(pts - last_pts) / 90, video_ctx->time_base.num, pts, (int)(pts - last_pts) / 90, video_ctx->time_base.num,
video_ctx->time_base.den, ms_delay); video_ctx->time_base.den, ms_delay);
if (pts != (int64_t) AV_NOPTS_VALUE) {
last_pts = pts; last_pts = pts;
} }
}
#endif #endif

View File

@ -1422,6 +1422,7 @@ static enum PixelFormat Vaapi_get_format(VaapiDecoder * decoder,
VaapiCleanup(decoder); VaapiCleanup(decoder);
if (getenv("NO_HW")) { // FIXME: make config option if (getenv("NO_HW")) { // FIXME: make config option
Debug(3, "codec: hardware acceleration disabled\n");
goto slow_path; goto slow_path;
} }