#define BTB_PROG 64
#define TB_PROG 128
#define TBT_PROG 256
-int cadence[6];
+int cadence[12];
int flag = 0;
/**********************************************************************
}
else if( state == STATE_GOP && m->look_for_break == 2)
{
- printf("MPEG2: Group of pictures found, searching for I-Frame\n");
+ hb_log("MPEG2: Group of pictures found, searching for I-Frame");
m->look_for_break = 1;
}
else if( ( state == STATE_SLICE || state == STATE_END ) &&
// If we are looking for a break, insert the chapter break on an I-Frame
if( m->look_for_break == 1 )
{
- printf("MPEG2: I-Frame Found\n");
+ hb_log("MPEG2: I-Frame Found");
m->look_for_break = 0;
chap_break = 1;
}
buf = hb_buffer_init( m->width * m->height * 3 / 2 );
data = buf->data;
+ buf->sequence = buf_es->sequence;
+
// Was a good break point found?
if( chap_break )
{
- printf("MPEG2: Chapter Break Inserted\n");
+ hb_log("MPEG2: Chapter Break Inserted");
chap_break = 0;
buf->new_chap = 1;
}
hb_log("fields: %d", m->info->display_picture->nb_fields);
*/
/* Rotate the cadence tracking. */
- cadence[5] = cadence[4];
- cadence[4] = cadence[3];
- cadence[3] = cadence[2];
- cadence[2] = cadence[1];
- cadence[1] = cadence[0];
+ int i = 0;
+ for(i=11; i > 0; i--)
+ {
+ cadence[i] = cadence[i-1];
+ }
if ( !(flag & PROGRESSIVE) && !(flag & TOP_FIRST) )
{
cadence[0] = TBT_PROG;
}
- if ( (cadence[2] <= TB) && (cadence[1] <= TB) && (cadence[0] > TB) && (cadence[0]) && (cadence[1]) )
- hb_log("PTS %lld: Interlaced -> Progressive", buf->start);
- if ( (cadence[2] > TB) && (cadence[1] <= TB) && (cadence[0] <= TB) && (cadence[0]) && (cadence[1]) )
- hb_log("PTS %lld: Progressive -> Interlaced", buf->start);
+ if ( (cadence[2] <= TB) && (cadence[1] <= TB) && (cadence[0] > TB) && (cadence[11]) )
+ hb_log("%fs: Interlaced -> Progressive", (float)buf->start / 90000);
+ if ( (cadence[2] > TB) && (cadence[1] <= TB) && (cadence[0] <= TB) && (cadence[11]) )
+ hb_log("%fs: Progressive -> Interlaced", (float)buf->start / 90000);
/* Store picture flags for later use by filters */
buf->flags = m->info->display_picture->flags;
// stream. We need to shift it.
if( (*buf_in)->new_chap )
{
- printf("MPEG2: Chapter Break Cell Found, searching for GOP\n");
+ hb_log("MPEG2: Chapter Break Cell Found, searching for GOP");
pv->libmpeg2->look_for_break = 2;
(*buf_in)->new_chap = 0;
}