diff options
author | wm4 <wm4@nowhere> | 2014-06-14 22:17:55 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-06-14 22:17:55 +0200 |
commit | 53d762e9725826fcf16ec06cc54d691ba4646f98 (patch) | |
tree | 76bed906528454202e8e304c78e300ebcb3ec6f6 /stream | |
parent | dfd93a108c4049c0fd93eb88ab5c410202d1ed78 (diff) |
tv: if timestamp is unset, return NOPTS
Well, not sure if this really improves anything, but at least it's less
of a WTF to the playback core than always returning the same timestamp
for every frame.
Diffstat (limited to 'stream')
-rw-r--r-- | stream/tvi_v4l2.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c index df3f971584..96ddd639d8 100644 --- a/stream/tvi_v4l2.c +++ b/stream/tvi_v4l2.c @@ -56,6 +56,7 @@ known issues: #include <libv4l2.h> #endif #include "common/msg.h" +#include "common/common.h" #include "video/img_fourcc.h" #include "audio/format.h" #include "tv.h" @@ -1609,7 +1610,7 @@ static void *video_grabber(void *data) } } else { if (priv->immediate_mode) { - priv->video_ringbuffer[priv->video_tail].timestamp = 0; + priv->video_ringbuffer[priv->video_tail].timestamp = -1; } else { // compensate for audio skew // negative skew => there are more audio samples, increase interval @@ -1640,7 +1641,6 @@ static void *video_grabber(void *data) #define MAX_LOOP 50 static double grab_video_frame(priv_t *priv, char *buffer, int len) { - double interval; int loop_cnt = 0; if (priv->first) { @@ -1654,13 +1654,13 @@ static double grab_video_frame(priv_t *priv, char *buffer, int len) } pthread_mutex_lock(&priv->video_buffer_mutex); - interval = (double)priv->video_ringbuffer[priv->video_head].timestamp*1e-6; + long long interval = priv->video_ringbuffer[priv->video_head].timestamp; memcpy(buffer, priv->video_ringbuffer[priv->video_head].data, len); priv->video_cnt--; priv->video_head = (priv->video_head+1)%priv->video_buffer_size_current; pthread_mutex_unlock(&priv->video_buffer_mutex); - return interval; + return interval == -1 ? MP_NOPTS_VALUE : interval*1e-6; } static int get_video_framesize(priv_t *priv) |