[vlc-commits] x265: initialize picture and set picture type

Rafaël Carré git at videolan.org
Mon Oct 14 16:49:56 CEST 2013


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Mon Oct 14 12:49:36 2013 +0200| [2abf305a31de788183b28d1ad0853111282ac40e] | committer: Rafaël Carré

x265: initialize picture and set picture type

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2abf305a31de788183b28d1ad0853111282ac40e
---

 modules/codec/x265.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/modules/codec/x265.c b/modules/codec/x265.c
index 8a8305f..72683a5 100644
--- a/modules/codec/x265.c
+++ b/modules/codec/x265.c
@@ -70,6 +70,8 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
     encoder_sys_t *p_sys = p_enc->p_sys;
     x265_picture_t pic;
 
+    x265_picture_init(&p_sys->param, &pic);
+
     if (likely(p_pict)) {
         if (unlikely(p_sys->initial_date == 0)) {
             p_sys->initial_date = p_pict->date;
@@ -120,6 +122,19 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
     p_block->i_pts = p_sys->initial_date + pic.poc * p_block->i_length;
     p_block->i_dts = p_sys->initial_date + p_sys->dts++ * p_block->i_length;
 
+    switch (pic.sliceType)
+    {
+    case X265_TYPE_I:
+        p_block->i_flags |= BLOCK_FLAG_TYPE_I;
+        break;
+    case X265_TYPE_P:
+        p_block->i_flags |= BLOCK_FLAG_TYPE_P;
+        break;
+    case X265_TYPE_B:
+        p_block->i_flags |= BLOCK_FLAG_TYPE_B;
+        break;
+    }
+
 #ifndef NDEBUG
     msg_Dbg(p_enc, "%zu bytes (frame %"PRId64", %.2ffps)", p_block->i_buffer,
         p_sys->dts, (float)p_sys->dts * CLOCK_FREQ / (mdate() - p_sys->start));



More information about the vlc-commits mailing list