summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
Diffstat (limited to 'libhb')
-rw-r--r--libhb/cropscale.c2
-rw-r--r--libhb/deblock.c2
-rw-r--r--libhb/decavcodec.c12
-rw-r--r--libhb/deccc608sub.c2
-rw-r--r--libhb/declpcm.c2
-rw-r--r--libhb/decomb.c2
-rw-r--r--libhb/decpgssub.c2
-rw-r--r--libhb/decssasub.c2
-rw-r--r--libhb/dectx3gsub.c2
-rw-r--r--libhb/decutf8sub.c14
-rw-r--r--libhb/decvobsub.c2
-rw-r--r--libhb/deinterlace.c4
-rw-r--r--libhb/denoise.c2
-rw-r--r--libhb/detelecine.c2
-rw-r--r--libhb/enc_qsv.c2
-rw-r--r--libhb/encavcodec.c2
-rw-r--r--libhb/encavcodecaudio.c6
-rw-r--r--libhb/enclame.c2
-rw-r--r--libhb/enctheora.c2
-rw-r--r--libhb/encvobsub.c4
-rw-r--r--libhb/encvorbis.c9
-rw-r--r--libhb/encx264.c2
-rw-r--r--libhb/encx265.c2
-rw-r--r--libhb/fifo.c7
-rw-r--r--libhb/internal.h27
-rw-r--r--libhb/muxcommon.c2
-rw-r--r--libhb/nlmeans.c2
-rw-r--r--libhb/platform/macosx/encca_aac.c10
-rw-r--r--libhb/qsv_filter.c2
-rw-r--r--libhb/qsv_filter_pp.c4
-rw-r--r--libhb/reader.c6
-rw-r--r--libhb/rendersub.c8
-rw-r--r--libhb/rotate.c2
-rw-r--r--libhb/stream.c9
-rw-r--r--libhb/sync.c16
-rw-r--r--libhb/vfr.c3
36 files changed, 94 insertions, 87 deletions
diff --git a/libhb/cropscale.c b/libhb/cropscale.c
index d1ef0f9bb..fc88e32a4 100644
--- a/libhb/cropscale.c
+++ b/libhb/cropscale.c
@@ -222,7 +222,7 @@ static int hb_crop_scale_work( hb_filter_object_t * filter,
hb_filter_private_t * pv = filter->private_data;
hb_buffer_t * in = *buf_in;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_out = in;
*buf_in = NULL;
diff --git a/libhb/deblock.c b/libhb/deblock.c
index 5acb3f5d0..e05f2e21e 100644
--- a/libhb/deblock.c
+++ b/libhb/deblock.c
@@ -400,7 +400,7 @@ static int hb_deblock_work( hb_filter_object_t * filter,
hb_filter_private_t * pv = filter->private_data;
hb_buffer_t * in = *buf_in, * out;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_out = in;
*buf_in = NULL;
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index 32eb4a21a..bdca1e180 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -535,7 +535,7 @@ static int decavcodecaWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
hb_work_private_t * pv = w->private_data;
hb_buffer_t * in = *buf_in;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
/* EOF on input stream - send it downstream & say that we're done */
*buf_out = in;
@@ -1564,7 +1564,7 @@ static void decodeVideo( hb_work_object_t *w, uint8_t *data, int size, int seque
#endif
flushDelayQueue(pv);
if (pv->list_subtitle != NULL)
- cc_send_to_decoder(pv, hb_buffer_init(0));
+ cc_send_to_decoder(pv, hb_buffer_eof_init());
}
}
@@ -1810,11 +1810,11 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
*buf_out = NULL;
/* if we got an empty buffer signaling end-of-stream send it downstream */
- if ( in->size == 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
if (pv->context != NULL && pv->context->codec != NULL)
{
- decodeVideo( w, in->data, in->size, in->sequence, pts, dts, in->s.frametype );
+ decodeVideo(w, in->data, 0, 0, pts, dts, 0);
}
hb_list_add( pv->list, in );
*buf_out = link_buf_list( pv );
@@ -1841,7 +1841,7 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
if ( codec == NULL )
{
hb_log( "decavcodecvWork: failed to find codec for id (%d)", w->codec_param );
- *buf_out = hb_buffer_init( 0 );;
+ *buf_out = hb_buffer_eof_init();
return HB_WORK_DONE;
}
@@ -1882,7 +1882,7 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
{
av_dict_free( &av_opts );
hb_log( "decavcodecvWork: avcodec_open failed" );
- *buf_out = hb_buffer_init( 0 );;
+ *buf_out = hb_buffer_eof_init();
return HB_WORK_DONE;
}
av_dict_free( &av_opts );
diff --git a/libhb/deccc608sub.c b/libhb/deccc608sub.c
index 4a5e4af8b..3b3f95393 100644
--- a/libhb/deccc608sub.c
+++ b/libhb/deccc608sub.c
@@ -1825,7 +1825,7 @@ static int decccWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
hb_work_private_t * pv = w->private_data;
hb_buffer_t * in = *buf_in;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
/* EOF on input stream - send it downstream & say that we're done */
handle_end_of_data(pv->cc608);
diff --git a/libhb/declpcm.c b/libhb/declpcm.c
index 42cc13e50..c85c803e9 100644
--- a/libhb/declpcm.c
+++ b/libhb/declpcm.c
@@ -189,7 +189,7 @@ static int declpcmWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
hb_buffer_t *in = *buf_in;
hb_buffer_t *buf = NULL;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
/* EOF on input stream - send it downstream & say that we're done */
*buf_out = in;
diff --git a/libhb/decomb.c b/libhb/decomb.c
index 7a1b4bf66..60aa95f1a 100644
--- a/libhb/decomb.c
+++ b/libhb/decomb.c
@@ -2523,7 +2523,7 @@ static int hb_decomb_work( hb_filter_object_t * filter,
hb_buffer_t * in = *buf_in;
hb_buffer_t * last = NULL, * out = NULL;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_out = in;
*buf_in = NULL;
diff --git a/libhb/decpgssub.c b/libhb/decpgssub.c
index 99ed8be36..4f60f5722 100644
--- a/libhb/decpgssub.c
+++ b/libhb/decpgssub.c
@@ -165,7 +165,7 @@ static int decsubWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
hb_work_private_t * pv = w->private_data;
hb_buffer_t * in = *buf_in;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
/* EOF on input stream - send it downstream & say that we're done */
if ( pv->list_buffer == NULL )
diff --git a/libhb/decssasub.c b/libhb/decssasub.c
index 3aec3a0bc..4a974ac38 100644
--- a/libhb/decssasub.c
+++ b/libhb/decssasub.c
@@ -439,7 +439,7 @@ static int decssaWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
printf("\nPACKET(%"PRId64",%"PRId64"): %.*s\n", in->s.start/90, in->s.stop/90, in->size, in->data);
#endif
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_out = in;
*buf_in = NULL;
diff --git a/libhb/dectx3gsub.c b/libhb/dectx3gsub.c
index 76dc3b67d..9fe9ced6c 100644
--- a/libhb/dectx3gsub.c
+++ b/libhb/dectx3gsub.c
@@ -267,7 +267,7 @@ static int dectx3gWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
hb_log( "dectx3gsub: subtitle packet lacks duration" );
}
- if (in->size == 0)
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_out = in;
*buf_in = NULL;
diff --git a/libhb/decutf8sub.c b/libhb/decutf8sub.c
index 4461f1ef4..5a278c786 100644
--- a/libhb/decutf8sub.c
+++ b/libhb/decutf8sub.c
@@ -48,10 +48,15 @@ static int decutf8Work(hb_work_object_t * w,
hb_buffer_t **buf_in, hb_buffer_t **buf_out)
{
hb_work_private_t * pv = w->private_data;
- // Pass the packets through without modification
+ hb_buffer_t * in = *buf_in;
hb_buffer_t *out = *buf_in;
- out->s.frametype = HB_FRAME_SUBTITLE;
+ *buf_in = NULL;
+ if (in->s.flags & HB_BUF_FLAG_EOF)
+ {
+ *buf_out = in;
+ return HB_WORK_DONE;
+ }
// Warn if the subtitle's duration has not been passed through by the
// demuxer, which will prevent the subtitle from displaying at all
@@ -61,12 +66,9 @@ static int decutf8Work(hb_work_object_t * w,
}
hb_srt_to_ssa(out, ++pv->line);
-
- *buf_in = NULL;
+ out->s.frametype = HB_FRAME_SUBTITLE;
*buf_out = out;
- if (out->size == 0)
- return HB_WORK_DONE;
return HB_WORK_OK;
}
diff --git a/libhb/decvobsub.c b/libhb/decvobsub.c
index 7109b506b..fa247ab28 100644
--- a/libhb/decvobsub.c
+++ b/libhb/decvobsub.c
@@ -97,7 +97,7 @@ int decsubWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
hb_buffer_t * in = *buf_in;
int size_sub, size_rle;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
/* EOF on input stream - send it downstream & say that we're done */
*buf_out = in;
diff --git a/libhb/deinterlace.c b/libhb/deinterlace.c
index dadbd397d..0e8de8d8e 100644
--- a/libhb/deinterlace.c
+++ b/libhb/deinterlace.c
@@ -433,7 +433,7 @@ static hb_buffer_t * deint_fast(hb_filter_private_t * pv, hb_buffer_t * in)
if (in == NULL)
{
// Flushing final buffers. Append EOS marker buffer.
- dst = hb_buffer_init(0);
+ dst = hb_buffer_eof_init();
if (first == NULL)
{
first = dst;
@@ -583,7 +583,7 @@ static int hb_deinterlace_work( hb_filter_object_t * filter,
hb_buffer_t * in = *buf_in;
hb_buffer_t * last = NULL, * out = NULL;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_out = in;
*buf_in = NULL;
diff --git a/libhb/denoise.c b/libhb/denoise.c
index dbeb98664..8057b6c7d 100644
--- a/libhb/denoise.c
+++ b/libhb/denoise.c
@@ -334,7 +334,7 @@ static int hb_denoise_work( hb_filter_object_t * filter,
hb_filter_private_t * pv = filter->private_data;
hb_buffer_t * in = *buf_in, * out;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_out = in;
*buf_in = NULL;
diff --git a/libhb/detelecine.c b/libhb/detelecine.c
index 019286011..983db217f 100644
--- a/libhb/detelecine.c
+++ b/libhb/detelecine.c
@@ -903,7 +903,7 @@ static int hb_detelecine_work( hb_filter_object_t * filter,
hb_filter_private_t * pv = filter->private_data;
hb_buffer_t * in = *buf_in, * out;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_out = in;
*buf_in = NULL;
diff --git a/libhb/enc_qsv.c b/libhb/enc_qsv.c
index 8bd5fbcd7..91405eaea 100644
--- a/libhb/enc_qsv.c
+++ b/libhb/enc_qsv.c
@@ -1744,7 +1744,7 @@ int encqsvWork(hb_work_object_t *w, hb_buffer_t **buf_in, hb_buffer_t **buf_out)
* EOF on input. Flush the decoder, then send the
* EOF downstream to let the muxer know we're done.
*/
- if (in->size <= 0)
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
qsv_enc_work(pv, NULL, NULL);
hb_list_add(pv->encoded_frames, in);
diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c
index 7b1c01ccc..856fff31a 100644
--- a/libhb/encavcodec.c
+++ b/libhb/encavcodec.c
@@ -518,7 +518,7 @@ int encavcodecWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
hb_job_t * job = pv->job;
AVFrame * frame;
hb_buffer_t * in = *buf_in, * buf;
- char final_flushing_call = (in->size <= 0);
+ char final_flushing_call = !!(in->s.flags & HB_BUF_FLAG_EOF);
if ( final_flushing_call )
{
//make a flushing call to encode for codecs that can encode out of order
diff --git a/libhb/encavcodecaudio.c b/libhb/encavcodecaudio.c
index 784ba5e2f..78c993286 100644
--- a/libhb/encavcodecaudio.c
+++ b/libhb/encavcodecaudio.c
@@ -431,11 +431,11 @@ static hb_buffer_t * Flush( hb_work_object_t * w )
if( last )
{
- last->next = hb_buffer_init( 0 );
+ last->next = hb_buffer_eof_init();
}
else
{
- first = hb_buffer_init( 0 );
+ first = hb_buffer_eof_init();
}
return first;
@@ -452,7 +452,7 @@ static int encavcodecaWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
hb_work_private_t * pv = w->private_data;
hb_buffer_t * in = *buf_in, * buf;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
/* EOF on input - send it downstream & say we're done */
*buf_out = Flush( w );
diff --git a/libhb/enclame.c b/libhb/enclame.c
index ef34b40f8..0efe21906 100644
--- a/libhb/enclame.c
+++ b/libhb/enclame.c
@@ -186,7 +186,7 @@ int enclameWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
hb_buffer_t * in = *buf_in;
hb_buffer_t * buf;
- if ( (*buf_in)->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
/* EOF on input - send it downstream & say we're done */
diff --git a/libhb/enctheora.c b/libhb/enctheora.c
index 3b9dacebb..a49d7ff6b 100644
--- a/libhb/enctheora.c
+++ b/libhb/enctheora.c
@@ -225,7 +225,7 @@ int enctheoraWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
int frame_width, frame_height;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
// EOF on input - send it downstream & say we're done.
// XXX may need to flush packets via a call to
diff --git a/libhb/encvobsub.c b/libhb/encvobsub.c
index e9aefac26..3994a491a 100644
--- a/libhb/encvobsub.c
+++ b/libhb/encvobsub.c
@@ -36,9 +36,9 @@ int encsubWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
// Invalid source, send EOF, this shouldn't ever happen
hb_log("encvobsub: invalid subtitle source");
hb_buffer_close( buf_in );
- *buf_out = hb_buffer_init(0);
+ *buf_out = hb_buffer_eof_init();
}
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
/* EOF on input stream - send it downstream & say that we're done */
*buf_out = in;
diff --git a/libhb/encvorbis.c b/libhb/encvorbis.c
index 226c8ff81..aee7b9d80 100644
--- a/libhb/encvorbis.c
+++ b/libhb/encvorbis.c
@@ -256,21 +256,20 @@ int encvorbisWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
hb_buffer_t ** buf_out )
{
hb_work_private_t * pv = w->private_data;
+ hb_buffer_t * in = *buf_in;
hb_buffer_t * buf;
- if ( (*buf_in)->size <= 0 )
+ *buf_in = NULL;
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
/* EOF on input - send it downstream & say we're done */
- *buf_out = *buf_in;
- *buf_in = NULL;
+ *buf_out = in;
return HB_WORK_DONE;
}
hb_list_add( pv->list, *buf_in );
- *buf_in = NULL;
*buf_out = buf = Encode( w );
-
while( buf )
{
buf->next = Encode( w );
diff --git a/libhb/encx264.c b/libhb/encx264.c
index ce7018278..a6989fcf5 100644
--- a/libhb/encx264.c
+++ b/libhb/encx264.c
@@ -662,7 +662,7 @@ int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in,
*buf_out = NULL;
- if( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
// EOF on input. Flush any frames still in the decoder then
// send the eof downstream to tell the muxer we're done.
diff --git a/libhb/encx265.c b/libhb/encx265.c
index b09b0b4d2..ba55ab703 100644
--- a/libhb/encx265.c
+++ b/libhb/encx265.c
@@ -536,7 +536,7 @@ int encx265Work(hb_work_object_t *w, hb_buffer_t **buf_in, hb_buffer_t **buf_out
hb_work_private_t *pv = w->private_data;
hb_buffer_t *in = *buf_in;
- if (in->size <= 0)
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
uint32_t nnal;
x265_nal *nal;
diff --git a/libhb/fifo.c b/libhb/fifo.c
index f88c43bfb..72c1c181f 100644
--- a/libhb/fifo.c
+++ b/libhb/fifo.c
@@ -447,6 +447,13 @@ hb_buffer_t * hb_buffer_init( int size )
return hb_buffer_init_internal(size, 0);
}
+hb_buffer_t * hb_buffer_eof_init(void)
+{
+ hb_buffer_t * buf = hb_buffer_init(0);
+ buf->s.flags = HB_BUF_FLAG_EOF;
+ return buf;
+}
+
void hb_buffer_realloc( hb_buffer_t * b, int size )
{
if ( size > b->alloc || b->data == NULL )
diff --git a/libhb/internal.h b/libhb/internal.h
index 85ceb7474..30d8c24c8 100644
--- a/libhb/internal.h
+++ b/libhb/internal.h
@@ -83,6 +83,19 @@ struct hb_buffer_settings_s
#define HB_FRAME_KEY 0x0F
#define HB_FRAME_REF 0xF0
uint8_t frametype;
+
+// Picture flags used by filters
+#ifndef PIC_FLAG_REPEAT_FIRST_FIELD
+#define PIC_FLAG_REPEAT_FIRST_FIELD 0x0100
+#endif
+#ifndef PIC_FLAG_TOP_FIELD_FIRST
+#define PIC_FLAG_TOP_FIELD_FIRST 0x0008
+#endif
+#ifndef PIC_FLAG_PROGRESSIVE_FRAME
+#define PIC_FLAG_PROGRESSIVE_FRAME 0x0010
+#endif
+#define PIC_FLAG_REPEAT_FRAME 0x0200
+#define HB_BUF_FLAG_EOF 0x0400
uint16_t flags;
};
@@ -165,6 +178,7 @@ void hb_buffer_pool_init( void );
void hb_buffer_pool_free( void );
hb_buffer_t * hb_buffer_init( int size );
+hb_buffer_t * hb_buffer_eof_init( void );
hb_buffer_t * hb_frame_buffer_init( int pix_fmt, int w, int h);
void hb_buffer_init_planes( hb_buffer_t * b );
void hb_buffer_realloc( hb_buffer_t *, int size );
@@ -458,19 +472,6 @@ extern hb_filter_object_t hb_filter_qsv_pre;
extern hb_filter_object_t hb_filter_qsv_post;
#endif
-// Picture flags used by filters
-#ifndef PIC_FLAG_REPEAT_FIRST_FIELD
-#define PIC_FLAG_REPEAT_FIRST_FIELD 256
-#endif
-#ifndef PIC_FLAG_TOP_FIELD_FIRST
-#define PIC_FLAG_TOP_FIELD_FIRST 8
-#endif
-#ifndef PIC_FLAG_PROGRESSIVE_FRAME
-#define PIC_FLAG_PROGRESSIVE_FRAME 16
-#endif
-
-#define PIC_FLAG_REPEAT_FRAME 512
-
extern hb_work_object_t * hb_objects;
#define HB_WORK_IDLE 0
diff --git a/libhb/muxcommon.c b/libhb/muxcommon.c
index 9b15ee97a..afda745be 100644
--- a/libhb/muxcommon.c
+++ b/libhb/muxcommon.c
@@ -366,7 +366,7 @@ static int muxWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
return HB_WORK_DONE;
}
- if ( buf->size <= 0 )
+ if (buf->s.flags & HB_BUF_FLAG_EOF)
{
// EOF - mark this track as done
hb_buffer_close( &buf );
diff --git a/libhb/nlmeans.c b/libhb/nlmeans.c
index e0aac23c7..3e78ab95a 100644
--- a/libhb/nlmeans.c
+++ b/libhb/nlmeans.c
@@ -1160,7 +1160,7 @@ static int nlmeans_work(hb_filter_object_t *filter,
hb_filter_private_t *pv = filter->private_data;
hb_buffer_t *in = *buf_in;
- if (in->size <= 0)
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
hb_buffer_t *last;
// Flush buffered frames
diff --git a/libhb/platform/macosx/encca_aac.c b/libhb/platform/macosx/encca_aac.c
index e199f3640..96ee1f04d 100644
--- a/libhb/platform/macosx/encca_aac.c
+++ b/libhb/platform/macosx/encca_aac.c
@@ -503,19 +503,19 @@ int encCoreAudioWork(hb_work_object_t *w, hb_buffer_t **buf_in,
hb_buffer_t **buf_out)
{
hb_work_private_t *pv = w->private_data;
+ hb_buffer_t * in = *buf_in;
hb_buffer_t *buf;
- if ((*buf_in)->size <= 0)
+ *buf_in = NULL;
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
// EOF on input. Finish encoding what we have buffered then send
// it & the eof downstream.
- *buf_out = Flush(w, *buf_in);
- *buf_in = NULL;
+ *buf_out = Flush(w, in);
return HB_WORK_DONE;
}
- hb_list_add(pv->list, *buf_in);
- *buf_in = NULL;
+ hb_list_add(pv->list, in);
*buf_out = buf = Encode(w);
diff --git a/libhb/qsv_filter.c b/libhb/qsv_filter.c
index 8487865fe..87e10ee28 100644
--- a/libhb/qsv_filter.c
+++ b/libhb/qsv_filter.c
@@ -608,7 +608,7 @@ static int hb_qsv_filter_work( hb_filter_object_t * filter,
*buf_in = NULL;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
while(1){
sts = process_frame(in->qsv_details.qsv_atom, qsv, pv);
diff --git a/libhb/qsv_filter_pp.c b/libhb/qsv_filter_pp.c
index e05050a20..250e2b52c 100644
--- a/libhb/qsv_filter_pp.c
+++ b/libhb/qsv_filter_pp.c
@@ -445,7 +445,7 @@ static int hb_qsv_filter_pre_work( hb_filter_object_t * filter,
if(!in->qsv_details.filter_details)
in->qsv_details.filter_details = pv;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_out = in;
*buf_in = NULL;
@@ -559,7 +559,7 @@ static int hb_qsv_filter_post_work( hb_filter_object_t * filter,
hb_buffer_t * in = *buf_in;
hb_buffer_t * out = *buf_out;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_out = in;
*buf_in = NULL;
diff --git a/libhb/reader.c b/libhb/reader.c
index 3e1c0c48b..d730c1f09 100644
--- a/libhb/reader.c
+++ b/libhb/reader.c
@@ -735,20 +735,20 @@ void ReadLoop( void * _w )
// send empty buffers downstream to video & audio decoders to signal we're done.
if( !*r->die && !r->job->done )
{
- push_buf( r, r->job->fifo_mpeg2, hb_buffer_init(0) );
+ push_buf(r, r->job->fifo_mpeg2, hb_buffer_eof_init());
hb_audio_t *audio;
for( n = 0; (audio = hb_list_item( r->job->list_audio, n)); ++n )
{
if ( audio->priv.fifo_in )
- push_buf( r, audio->priv.fifo_in, hb_buffer_init(0) );
+ push_buf(r, audio->priv.fifo_in, hb_buffer_eof_init());
}
hb_subtitle_t *subtitle;
for( n = 0; (subtitle = hb_list_item( r->job->list_subtitle, n)); ++n )
{
if ( subtitle->fifo_in && subtitle->source == VOBSUB)
- push_buf( r, subtitle->fifo_in, hb_buffer_init(0) );
+ push_buf(r, subtitle->fifo_in, hb_buffer_eof_init());
}
}
diff --git a/libhb/rendersub.c b/libhb/rendersub.c
index 21d039b20..3c17c4a01 100644
--- a/libhb/rendersub.c
+++ b/libhb/rendersub.c
@@ -336,7 +336,7 @@ static int vobsub_work( hb_filter_object_t * filter,
hb_buffer_t * in = *buf_in;
hb_buffer_t * sub;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_in = NULL;
*buf_out = in;
@@ -563,7 +563,7 @@ static int ssa_work( hb_filter_object_t * filter,
filter->subtitle->extradata_size);
pv->script_initialized = 1;
}
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_in = NULL;
*buf_out = in;
@@ -659,7 +659,7 @@ static int textsub_work(hb_filter_object_t * filter,
pv->script_initialized = 1;
}
- if (in->size <= 0)
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_in = NULL;
*buf_out = in;
@@ -817,7 +817,7 @@ static int pgssub_work( hb_filter_object_t * filter,
hb_buffer_t * in = *buf_in;
hb_buffer_t * sub;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_in = NULL;
*buf_out = in;
diff --git a/libhb/rotate.c b/libhb/rotate.c
index 81bd661b7..f67759ea4 100644
--- a/libhb/rotate.c
+++ b/libhb/rotate.c
@@ -337,7 +337,7 @@ static int hb_rotate_work( hb_filter_object_t * filter,
hb_filter_private_t * pv = filter->private_data;
hb_buffer_t * in = *buf_in, * out;
- if ( in->size <= 0 )
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_out = in;
*buf_in = NULL;
diff --git a/libhb/stream.c b/libhb/stream.c
index 5713f6dee..166830a5d 100644
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -5712,12 +5712,9 @@ hb_buffer_t * hb_ffmpeg_read( hb_stream_t *stream )
// following them to preserve the timing (since the packing puts two
// or more frames in what looks like one avi frame). The contents and
// size of these null frames are ignored by the ff_h263_decode_frame
- // as long as they're < 20 bytes. We need a positive size so we use
- // one byte if we're given a zero or negative size. We don't know
- // if the pkt data points anywhere reasonable so we just stick a
- // byte of zero in our outbound buf.
- buf = hb_buffer_init( 1 );
- *buf->data = 0;
+ // as long as they're < 20 bytes. Zero length buffers are also
+ // use by theora to indicate duplicate frames.
+ buf = hb_buffer_init( 0 );
}
else
{
diff --git a/libhb/sync.c b/libhb/sync.c
index d11fbd228..594251b0d 100644
--- a/libhb/sync.c
+++ b/libhb/sync.c
@@ -600,7 +600,7 @@ static void flushSubtitles(hb_work_private_t *pv)
}
if (subtitle->config.dest == PASSTHRUSUB)
{
- hb_fifo_push(subtitle->fifo_out, hb_buffer_init(0));
+ hb_fifo_push(subtitle->fifo_out, hb_buffer_eof_init());
}
}
}
@@ -624,7 +624,7 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
next = *buf_in;
*buf_in = NULL;
- if (next->size == 0)
+ if (next->s.flags & HB_BUF_FLAG_EOF)
{
if (sync->cur != NULL)
{
@@ -738,7 +738,7 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
pv->common->count_frames);
hb_buffer_close(&sync->cur);
hb_buffer_close(&next);
- *buf_out = hb_buffer_init(0);
+ *buf_out = hb_buffer_eof_init();
flushSubtitles(pv);
// Unblock anybody waiting on this threads last PTS
setSyncPTS(pv, INT64_MAX, 0);
@@ -754,7 +754,7 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
sync->cur->s.start);
hb_buffer_close(&sync->cur);
hb_buffer_close( &next );
- *buf_out = hb_buffer_init(0);
+ *buf_out = hb_buffer_eof_init();
flushSubtitles(pv);
// Unblock anybody waiting on this threads last PTS
setSyncPTS(pv, INT64_MAX, 0);
@@ -874,7 +874,7 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
// muxer or renderer filter.
while ( ( sub = hb_fifo_get( subtitle->fifo_raw ) ) != NULL )
{
- if (sub->size > 0)
+ if (!(next->s.flags & HB_BUF_FLAG_EOF))
{
out = sanitizeSubtitle(pv, i, sub);
if (out != NULL)
@@ -1013,7 +1013,7 @@ static int syncAudioWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
*buf_in = NULL;
/* if the next buffer is an eof send it downstream */
- if ( buf->size <= 0 )
+ if (buf->s.flags & HB_BUF_FLAG_EOF)
{
*buf_out = buf;
// Unblock anybody waiting on this threads last PTS
@@ -1064,7 +1064,7 @@ static int syncAudioWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
if (job->frame_to_stop && pv->common->count_frames >= job->frame_to_stop)
{
hb_buffer_close( &buf );
- *buf_out = hb_buffer_init(0);
+ *buf_out = hb_buffer_eof_init();
// Unblock anybody waiting on this threads last PTS
setSyncPTS(pv, INT64_MAX, sync->index+1);
return HB_WORK_DONE;
@@ -1072,7 +1072,7 @@ static int syncAudioWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
if (job->pts_to_stop && sync->next_start >= job->pts_to_stop)
{
hb_buffer_close( &buf );
- *buf_out = hb_buffer_init(0);
+ *buf_out = hb_buffer_eof_init();
// Unblock anybody waiting on this threads last PTS
setSyncPTS(pv, INT64_MAX, sync->index+1);
return HB_WORK_DONE;
diff --git a/libhb/vfr.c b/libhb/vfr.c
index 499d85059..8f62c9241 100644
--- a/libhb/vfr.c
+++ b/libhb/vfr.c
@@ -469,7 +469,8 @@ static int hb_vfr_work( hb_filter_object_t * filter,
*buf_in = NULL;
*buf_out = NULL;
- if( in->size <= 0 )
+
+ if (in->s.flags & HB_BUF_FLAG_EOF)
{
hb_buffer_t *head = NULL, *tail = NULL, *next;
int counter = 2;