[libbluray-devel] Updated graphics_processor_Decode_pes() return value
hpi1
git at videolan.org
Mon Jun 13 19:48:42 CEST 2011
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Jun 12 16:22:14 2011 +0300| [0db4be88c1eca24414383f33c237fb3639daed9a] | committer: hpi1
Updated graphics_processor_Decode_pes() return value
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=0db4be88c1eca24414383f33c237fb3639daed9a
---
src/libbluray/decoders/graphics_processor.c | 23 ++++++++++++++++-------
src/libbluray/decoders/graphics_processor.h | 15 ++++++++++-----
2 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/src/libbluray/decoders/graphics_processor.c b/src/libbluray/decoders/graphics_processor.c
index 5a76744..8dfde2f 100644
--- a/src/libbluray/decoders/graphics_processor.c
+++ b/src/libbluray/decoders/graphics_processor.c
@@ -358,7 +358,7 @@ int graphics_processor_decode_pes(PG_DISPLAY_SET **s, PES_BUFFER **p, int64_t st
*s = calloc(1, sizeof(PG_DISPLAY_SET));
}
- while (*p && !(*s)->complete) {
+ while (*p) {
/* time to decode next segment ? */
if (stc >= 0 && (*p)->dts > stc) {
@@ -373,21 +373,30 @@ int graphics_processor_decode_pes(PG_DISPLAY_SET **s, PES_BUFFER **p, int64_t st
return 0;
}
+ if ((*p)->len <= 2) {
+ BD_DEBUG(DBG_DECODE, "segment too short, skipping (%d bytes)\n", (*p)->len);
+ pes_buffer_remove(p, *p);
+ continue;
+ }
+
+ /* decode segment */
+
GP_TRACE("Decoding segment, dts %010"PRId64" pts %010"PRId64" len %d\n",
(*p)->dts, (*p)->pts, (*p)->len);
- /* decode segment */
- if ((*p)->len > 2) {
+ (*s)->complete = 0;
- (*s)->complete = 0;
+ _decode_segment(*s, *p);
- _decode_segment(*s, *p);
+ pes_buffer_remove(p, *p);
+
+ if ((*s)->complete) {
+ return 1;
}
- pes_buffer_remove(p, *p);
}
- return (*s)->complete;
+ return 0;
}
/*
diff --git a/src/libbluray/decoders/graphics_processor.h b/src/libbluray/decoders/graphics_processor.h
index b7e90c4..698b3c4 100644
--- a/src/libbluray/decoders/graphics_processor.h
+++ b/src/libbluray/decoders/graphics_processor.h
@@ -61,18 +61,20 @@ BD_PRIVATE void pg_display_set_free(PG_DISPLAY_SET **s);
BD_PRIVATE GRAPHICS_PROCESSOR *graphics_processor_init(void);
BD_PRIVATE void graphics_processor_free(GRAPHICS_PROCESSOR **p);
-/*
- * stc: current STC
+/**
*
- * return: 0 : wait for more data
- * 1 : display set complete
+ * Decode data from MPEG-PES input stream
*
* Only segments where DTS <= STC are decoded.
* If STC < 0, all segments are immediately decoded to display set.
*
* All decoded PES packets are removed from buffer.
+ *
+ * @param s display set
+ * @param buf data to decode
+ * @param stc current playback time
+ * @return 1 if display set was completed, 0 otherwise
*/
-
BD_PRIVATE int
graphics_processor_decode_pes(PG_DISPLAY_SET **s,
struct pes_buffer_s **buf,
@@ -82,6 +84,9 @@ graphics_processor_decode_pes(PG_DISPLAY_SET **s,
*
* Decode data from MPEG-TS input stream
*
+ * Segments are queued and decoded when DTS <= STC.
+ * If STC < 0, all segments are immediately decoded to display set.
+ *
* @param p GRAPHICS_PROCESSOR object
* @param s display set
* @param pid mpeg-ts PID to decode (HDMV IG/PG stream)
More information about the libbluray-devel
mailing list