summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2016-05-17 13:42:50 -0600
committerJohn Stebbins <[email protected]>2016-05-17 13:42:50 -0600
commitfd311280dba1530d3666c4a9bd4e98380833565b (patch)
treece583274828bf821ed060102f141ea6e24bdf0f3
parent9d52fbd1cefebb9bea49246c8d04081a20a1fc4d (diff)
sync: move chapter logging to sync.c
-rw-r--r--libhb/decavcodec.c22
-rw-r--r--libhb/sync.c30
2 files changed, 30 insertions, 22 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index 83bbcf517..c35ec6343 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -909,26 +909,6 @@ static hb_buffer_t *copy_frame( hb_work_private_t *pv )
return out;
}
-static void log_chapter( hb_work_private_t *pv, int chap_num, int64_t pts )
-{
- hb_chapter_t *c;
-
- if ( !pv->job )
- return;
-
- c = hb_list_item( pv->job->list_chapter, chap_num - 1 );
- if ( c && c->title )
- {
- hb_log( "%s: \"%s\" (%d) at frame %u time %"PRId64,
- pv->context->codec->name, c->title, chap_num, pv->nframes, pts );
- }
- else
- {
- hb_log( "%s: Chapter %d at frame %u time %"PRId64,
- pv->context->codec->name, chap_num, pv->nframes, pts );
- }
-}
-
static void flushDelayQueue( hb_work_private_t *pv )
{
hb_buffer_t *buf;
@@ -1250,7 +1230,6 @@ static int decodeFrame( hb_work_object_t *w, uint8_t *data, int size, int64_t pt
if ( pv->new_chap && buf->s.start >= pv->chap_time )
{
buf->s.new_chap = pv->new_chap;
- log_chapter( pv, pv->new_chap, buf->s.start );
pv->new_chap = 0;
pv->chap_time = 0;
}
@@ -1289,7 +1268,6 @@ static int decodeFrame( hb_work_object_t *w, uint8_t *data, int size, int64_t pt
if ( pv->new_chap && buf->s.start >= pv->chap_time )
{
buf->s.new_chap = pv->new_chap;
- log_chapter( pv, pv->new_chap, buf->s.start );
pv->new_chap = 0;
pv->chap_time = 0;
}
diff --git a/libhb/sync.c b/libhb/sync.c
index 8375edc61..2ee82e7a3 100644
--- a/libhb/sync.c
+++ b/libhb/sync.c
@@ -133,6 +133,8 @@ struct sync_common_s
uint64_t st_counts[4];
uint64_t st_dates[4];
uint64_t st_first;
+
+ int chapter;
};
struct hb_work_private_s
@@ -774,6 +776,27 @@ static void streamFlush( sync_stream_t * stream )
hb_buffer_list_append(&stream->out_queue, hb_buffer_eof_init());
}
+static void log_chapter( sync_common_t *common, int chap_num,
+ int nframes, int64_t pts )
+{
+ hb_chapter_t *c;
+
+ if ( !common->job )
+ return;
+
+ c = hb_list_item( common->job->list_chapter, chap_num - 1 );
+ if ( c && c->title )
+ {
+ hb_log("sync: \"%s\" (%d) at frame %d time %"PRId64,
+ c->title, chap_num, nframes, pts);
+ }
+ else
+ {
+ hb_log("sync: Chapter %d at frame %d time %"PRId64,
+ chap_num, nframes, pts );
+ }
+}
+
#define TOP_FIRST PIC_FLAG_TOP_FIELD_FIRST
#define PROGRESSIVE PIC_FLAG_PROGRESSIVE_FRAME
#define REPEAT_FIRST PIC_FLAG_REPEAT_FIRST_FIELD
@@ -1109,6 +1132,13 @@ static void OutputBuffer( sync_common_t * common )
{
out_stream->max_frame_duration = buf->s.duration;
}
+ if (out_stream->type == SYNC_TYPE_VIDEO &&
+ buf->s.new_chap > common->chapter)
+ {
+ common->chapter = buf->s.new_chap;
+ log_chapter(common, buf->s.new_chap, out_stream->frame_count,
+ buf->s.start);
+ }
hb_buffer_list_append(&out_stream->out_queue, buf);
}
} while (full);