OSDN Git Service

Don't drop subtitles when crossing PTS discontinuities by using buffer sequence numbe...
[handbrake-jp/handbrake-jp-git.git] / libhb / muxogm.c
index 6a3b1ec..86e44f0 100644 (file)
@@ -205,7 +205,7 @@ static int OGMInit( hb_mux_object_t * m )
                 SetDWLE( &h.header.audio.i_avgbytespersec,
                          job->abitrate / 8 );
 
-                op.packet   = (char*) &h;
+                op.packet   = (unsigned char*) &h;
                 op.bytes    = sizeof( ogg_stream_header_t );
                 op.b_o_s    = 1;
                 op.e_o_s    = 0;
@@ -268,7 +268,7 @@ static int OGMMux( hb_mux_object_t * m, hb_mux_data_t * mux_data,
         case HB_VCODEC_X264:
             op.bytes  = buf->size + 1;
             op.packet = malloc( op.bytes );
-            op.packet[0] = buf->key ? 0x08 : 0x00;
+            op.packet[0] = (buf->frametype & HB_FRAME_KEY) ? 0x08 : 0x00;
             memcpy( &op.packet[1], buf->data, buf->size );
             op.b_o_s       = 0;
             op.e_o_s       = 0;
@@ -336,6 +336,8 @@ static int OGMEnd( hb_mux_object_t * m )
     {
         return -1;
     }
+    ogg_stream_clear( &mux_data->os );
+    
     for( i = 0; i < hb_list_count( title->list_audio ); i++ )
     {
         audio = hb_list_item( title->list_audio, i );
@@ -344,6 +346,7 @@ static int OGMEnd( hb_mux_object_t * m )
         {
             return -1;
         }
+        ogg_stream_clear( &mux_data->os );
     }
 
     fclose( m->file );