diff options
-rw-r--r-- | libhb/encavcodec.c | 2 | ||||
-rw-r--r-- | libhb/encfaac.c | 2 | ||||
-rw-r--r-- | libhb/enclame.c | 2 | ||||
-rw-r--r-- | libhb/encvorbis.c | 2 | ||||
-rw-r--r-- | libhb/encx264.c | 27 | ||||
-rw-r--r-- | libhb/encxvid.c | 2 | ||||
-rw-r--r-- | libhb/internal.h | 11 | ||||
-rw-r--r-- | libhb/muxavi.c | 2 | ||||
-rw-r--r-- | libhb/muxmp4.c | 4 | ||||
-rw-r--r-- | libhb/muxogm.c | 2 | ||||
-rw-r--r-- | libhb/sync.c | 2 |
11 files changed, 34 insertions, 24 deletions
diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c index 701caf923..7bccfc759 100644 --- a/libhb/encavcodec.c +++ b/libhb/encavcodec.c @@ -195,7 +195,7 @@ int encavcodecWork( hb_work_object_t * w, hb_buffer_t ** buf_in, frame ); buf->start = in->start; buf->stop = in->stop; - buf->key = pv->context->coded_frame->key_frame; + buf->frametype = pv->context->coded_frame->key_frame ? HB_FRAME_KEY : HB_FRAME_REF; av_free( frame ); diff --git a/libhb/encfaac.c b/libhb/encfaac.c index 5545f9ebf..2ba9ad4e0 100644 --- a/libhb/encfaac.c +++ b/libhb/encfaac.c @@ -157,7 +157,7 @@ static hb_buffer_t * Encode( hb_work_object_t * w ) buf->stop = buf->start + 90000 * pv->input_samples / pv->job->arate / pv->out_discrete_channels; buf->size = faacEncEncode( pv->faac, (int32_t *) pv->buf, pv->input_samples, buf->data, pv->output_bytes ); - buf->key = 1; + buf->frametype = HB_FRAME_AUDIO; if( !buf->size ) { diff --git a/libhb/enclame.c b/libhb/enclame.c index 33cfa14c8..491365136 100644 --- a/libhb/enclame.c +++ b/libhb/enclame.c @@ -108,7 +108,7 @@ static hb_buffer_t * Encode( hb_work_object_t * w ) buf->stop = buf->start + 90000 * 1152 / pv->job->arate; buf->size = lame_encode_buffer_interleaved( pv->lame, samples_s16, 1152, buf->data, LAME_MAXMP3BUFFER ); - buf->key = 1; + buf->frametype = HB_FRAME_AUDIO; if( !buf->size ) { diff --git a/libhb/encvorbis.c b/libhb/encvorbis.c index df91e14e8..f8aa365a9 100644 --- a/libhb/encvorbis.c +++ b/libhb/encvorbis.c @@ -157,7 +157,7 @@ static hb_buffer_t * Flush( hb_work_object_t * w ) memcpy( buf->data, &op, sizeof( ogg_packet ) ); memcpy( buf->data + sizeof( ogg_packet ), op.packet, op.bytes ); - buf->key = 1; + buf->frametype = HB_FRAME_AUDIO; buf->start = pv->pts; /* No exact, but who cares - the OGM muxer doesn't use it */ buf->stop = buf->start + diff --git a/libhb/encx264.c b/libhb/encx264.c index 6bd214051..98ede9704 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -316,7 +316,7 @@ int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in, buf->size = 0; buf->start = in->start; buf->stop = in->stop; - buf->key = 0; + buf->frametype = 0; int64_t dts_start, dts_stop; @@ -340,7 +340,7 @@ int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in, { if( nal[i].i_ref_idc == NAL_PRIORITY_HIGHEST ) { - buf->key = 1; + buf->frametype = HB_FRAME_KEY; } buf->size += size; continue; @@ -362,26 +362,27 @@ int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in, buf->data[buf->size+3] = ( ( size - 4 ) >> 0 ) & 0xFF; switch( pic_out.i_type ) { - /* For IDR (key frames), buf->key = 1, - and the same for regular I-frames. */ + /* Decide what type of frame we have. */ case X264_TYPE_IDR: + buf->frametype = HB_FRAME_IDR; + break; case X264_TYPE_I: - buf->key = 1; + buf->frametype = HB_FRAME_I; + break; + case X264_TYPE_P: + buf->frametype = HB_FRAME_P; break; - /* For B-frames, buf->key = 2 */ case X264_TYPE_B: - buf->key = 2; + buf->frametype = HB_FRAME_B; break; /* This is for b-pyramid, which has reference b-frames - However, it doesn't seem to ever be used... - They just show up as buf->key == 2 like - regular b-frames. */ + However, it doesn't seem to ever be used... */ case X264_TYPE_BREF: - buf->key = 3; + buf->frametype = HB_FRAME_BREF; break; - /* For P-frames, buf->key = 0 */ + /* If it isn't the above, what type of frame is it?? */ default: - buf->key = 0; + buf->frametype = 0; } diff --git a/libhb/encxvid.c b/libhb/encxvid.c index 7430aca0f..7bdee7b96 100644 --- a/libhb/encxvid.c +++ b/libhb/encxvid.c @@ -194,7 +194,7 @@ int encxvidWork( hb_work_object_t * w, hb_buffer_t ** buf_in, frame.quant_inter_matrix = NULL; buf->size = xvid_encore( pv->xvid, XVID_ENC_ENCODE, &frame, NULL ); - buf->key = ( frame.out_flags & XVID_KEYFRAME ); + buf->frametype = ( frame.out_flags & XVID_KEYFRAME ) ? HB_FRAME_KEY : HB_FRAME_REF; if( !pv->configDone ) { diff --git a/libhb/internal.h b/libhb/internal.h index 0f0262e7c..34bca3d65 100644 --- a/libhb/internal.h +++ b/libhb/internal.h @@ -38,7 +38,16 @@ struct hb_buffer_s int64_t start; int64_t stop; int new_chap; - int key; + +#define HB_FRAME_IDR 0x01 +#define HB_FRAME_I 0x02 +#define HB_FRAME_AUDIO 0x04 +#define HB_FRAME_P 0x10 +#define HB_FRAME_B 0x20 +#define HB_FRAME_BREF 0x40 +#define HB_FRAME_KEY 0x0F +#define HB_FRAME_REF 0xF0 + uint8_t frametype; /* Holds the output PTS from x264, for use by b-frame offsets in muxmp4.c */ int64_t renderOffset; diff --git a/libhb/muxavi.c b/libhb/muxavi.c index de377f692..92ec80668 100644 --- a/libhb/muxavi.c +++ b/libhb/muxavi.c @@ -482,7 +482,7 @@ static int AVIMux( hb_mux_object_t * m, hb_mux_data_t * mux_data, /* Update index */ IndexAddInt32( m->index, mux_data->fourcc ); - IndexAddInt32( m->index, buf->key ? AVIIF_KEYFRAME : 0 ); + IndexAddInt32( m->index, (buf->frametype & HB_FRAME_KEY) ? AVIIF_KEYFRAME : 0 ); IndexAddInt32( m->index, 4 + m->size ); IndexAddInt32( m->index, buf->size ); diff --git a/libhb/muxmp4.c b/libhb/muxmp4.c index c70e2c114..c029487b0 100644 --- a/libhb/muxmp4.c +++ b/libhb/muxmp4.c @@ -384,7 +384,7 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, initial delay added to the frame order offset for b-frames. Because of b-pyramid, double this duration when there are b-pyramids, as denoted by job->areBframes equalling 2. */ - if ((mux_data->track == 1) && (thisSample == 0) && (buf->key == 1) && (job->vcodec == HB_VCODEC_X264)) + if ((mux_data->track == 1) && (thisSample == 0) && (buf->frametype & HB_FRAME_KEY) && (job->vcodec == HB_VCODEC_X264)) { initDelay = buf->renderOffset; thisSample++; @@ -398,7 +398,7 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, and the decoding time stamp from the buffer data. */ MP4WriteSample( m->file, mux_data->track, buf->data, buf->size, duration, ((mux_data->track != 1) || (job->areBframes==0) || (job->vcodec != HB_VCODEC_X264)) ? 0 : ( buf->renderOffset * job->arate / 90000), - (buf->key == 1) ); + ((buf->frametype & HB_FRAME_KEY) != 0) ); return 0; } diff --git a/libhb/muxogm.c b/libhb/muxogm.c index 4a008ff78..86e44f0e9 100644 --- a/libhb/muxogm.c +++ b/libhb/muxogm.c @@ -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; diff --git a/libhb/sync.c b/libhb/sync.c index 6ebbf6e0d..f1029156e 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -558,7 +558,7 @@ static void SyncAudio( hb_work_object_t * w, int i ) sync->count_frames += sync->data.output_frames_gen; } - buf->key = 1; + buf->frametype = HB_FRAME_AUDIO; hb_fifo_push( fifo, buf ); } |