summaryrefslogtreecommitdiffstats
path: root/libhb/enctheora.c
diff options
context:
space:
mode:
Diffstat (limited to 'libhb/enctheora.c')
-rw-r--r--libhb/enctheora.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/libhb/enctheora.c b/libhb/enctheora.c
index 59414687c..274887f9f 100644
--- a/libhb/enctheora.c
+++ b/libhb/enctheora.c
@@ -122,23 +122,22 @@ int enctheoraWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
hb_buffer_t * in = *buf_in, * buf;
yuv_buffer yuv;
ogg_packet op;
- static int last_p = 0;
- memset(&op, 0, sizeof(op));
- memset(&yuv, 0, sizeof(yuv));
-
- /* If this is the last empty frame, we're done */
- if(!in->data)
+ if ( in->size <= 0 )
{
- if (!last_p)
- {
- last_p++;
- goto finish;
- }
- *buf_out = NULL;
+ // EOF on input - send it downstream & say we're done.
+ // XXX may need to flush packets via a call to
+ // theora_encode_packetout(&pv->theora, 1, &op);
+ // but we don't have a timestamp to put on those packets so we
+ // drop them for now.
+ *buf_out = in;
+ *buf_in = NULL;
return HB_WORK_DONE;
}
+ memset(&op, 0, sizeof(op));
+ memset(&yuv, 0, sizeof(yuv));
+
yuv.y_width = job->width;
yuv.y_height = job->height;
yuv.y_stride = job->width;
@@ -153,8 +152,7 @@ int enctheoraWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
theora_encode_YUVin(&pv->theora, &yuv);
-finish:
- theora_encode_packetout(&pv->theora, last_p, &op);
+ theora_encode_packetout(&pv->theora, 0, &op);
buf = hb_buffer_init( op.bytes + sizeof(op) );
memcpy(buf->data, &op, sizeof(op));