changeset 4114:903017d72ffe libavcodec

CODEC_CAP_DELAY support
author mru
date Wed, 01 Nov 2006 18:18:48 +0000
parents 4ce3923d5806
children 4e1b1a37e9d6
files x264.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/x264.c	Wed Nov 01 17:18:49 2006 +0000
+++ b/x264.c	Wed Nov 01 18:18:48 2006 +0000
@@ -78,6 +78,7 @@
     x4->pic.img.i_csp = X264_CSP_I420;
     x4->pic.img.i_plane = 3;
 
+    if (frame) {
     for(i = 0; i < 3; i++){
         x4->pic.img.plane[i] = frame->data[i];
         x4->pic.img.i_stride[i] = frame->linesize[i];
@@ -85,8 +86,10 @@
 
     x4->pic.i_pts = frame->pts;
     x4->pic.i_type = X264_TYPE_AUTO;
+    }
 
-    if(x264_encoder_encode(x4->enc, &nal, &nnal, &x4->pic, &pic_out))
+    if(x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL,
+                           &pic_out))
         return -1;
 
     bufsize = encode_nals(buf, bufsize, nal, nnal);
@@ -291,5 +294,6 @@
     .init = X264_init,
     .encode = X264_frame,
     .close = X264_close,
+    .capabilities = CODEC_CAP_DELAY,
     .pix_fmts = (enum PixelFormat[]) { PIX_FMT_YUV420P, -1 }
 };