summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2008-01-24 09:21:07 +0000
committerphintuka <phintuka>2008-01-24 09:21:07 +0000
commitfa19e1e74b19c800e42e7969295fd14b0f4cb7d6 (patch)
tree4bb8d3ebc5f7fa85515e76b8cae8c370e1fa8b58
parenta184409d84302054f22bcefc24987f2e2508d015 (diff)
downloadxineliboutput-fa19e1e74b19c800e42e7969295fd14b0f4cb7d6.tar.gz
xineliboutput-fa19e1e74b19c800e42e7969295fd14b0f4cb7d6.tar.bz2
H.264: update frame type counters in live mode.
(this should fix SCR tunning and help to maintain A/V sync)
-rw-r--r--xine_input_vdr.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/xine_input_vdr.c b/xine_input_vdr.c
index 2782ce04..84c5b97c 100644
--- a/xine_input_vdr.c
+++ b/xine_input_vdr.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_input_vdr.c,v 1.111 2008-01-10 23:32:18 phelin Exp $
+ * $Id: xine_input_vdr.c,v 1.112 2008-01-24 09:21:07 phintuka Exp $
*
*/
@@ -4855,6 +4855,29 @@ static int update_frames(vdr_input_plugin_t *this, uint8_t *data, int len)
}
#ifdef TEST_H264
+static int update_frames_h264(vdr_input_plugin_t *this, uint8_t *data, int len)
+{
+ int i = 8;
+ if (!this->I_frames)
+ this->P_frames = this->B_frames = 0;
+ i += data[i] + 1; /* possible additional header bytes */
+ for (; i < len-5; i++) {
+ if (data[i] == 0 && data[i + 1] == 0 && data[i + 2] == 1 && data[i + 3] == 9) {
+ uint8_t type = (data[i + 4] >> 5);
+ switch (type) {
+ case 0: case 3: case 5: this->I_frames++; LOGSCR("I %d", type); break;
+ case 1: case 4: case 6: this->P_frames++; LOGSCR("P %d", type); break;
+ case 2: case 7: this->B_frames++; LOGSCR("B %d", type); break;
+ default: return 0;
+ }
+ return type;
+ }
+ }
+ return 0;
+}
+#endif
+
+#ifdef TEST_H264
static int detect_h264(vdr_input_plugin_t *this, uint8_t *data, int len)
{
int i = 8;
@@ -4917,6 +4940,10 @@ buf_element_t *post_frame_h264(vdr_input_plugin_t *this, buf_element_t *buf)
LOGMSG("H.264: Possible MPEG2 start code (0x%02x)", data[i + 3]);
/* Should do something ... ? */
}
+
+ if(this->live_mode && this->I_frames < 4)
+ /*if((buf->content[3] & 0xf0) == 0xe0 && buf->size > 32)*/
+ update_frames_h264(this, buf->content, buf->size);
}
/* Handle PTS and DTS */