#include <sys/ioctl.h>
#include <errno.h>
+ /* these are quite new... */
+#ifndef AUDIO_GET_PTS
+#define AUDIO_GET_PTS _IOR('o', 19, __u64)
+#define VIDEO_GET_PTS _IOR('o', 57, __u64)
+#endif
+
DEFINE_REF(eDVBAudio);
eDVBAudio::eDVBAudio(eDVBDemux *demux, int dev): m_demux(demux)
if (::ioctl(m_fd, AUDIO_CONTINUE) < 0)
eDebug("video: AUDIO_CONTINUE: %m");
}
-
+
+int eDVBAudio::getPTS(pts_t &now)
+{
+ return ::ioctl(m_fd, AUDIO_GET_PTS, &now);
+}
+
eDVBAudio::~eDVBAudio()
{
if (m_fd >= 0)
m_is_fast_forward = skip;
return ::ioctl(m_fd, VIDEO_FAST_FORWARD, skip);
}
+
+int eDVBVideo::getPTS(pts_t &now)
+{
+ return ::ioctl(m_fd, VIDEO_GET_PTS, &now);
+}
eDVBVideo::~eDVBVideo()
{
setState();
return 0;
}
+
+RESULT eTSMPEGDecoder::getPTS(int what, pts_t &pts)
+{
+ if (what == 0) /* auto */
+ what = m_video ? 1 : 2;
+
+ if (what == 1) /* video */
+ {
+ if (m_video)
+ return m_video->getPTS(pts);
+ else
+ return -1;
+ }
+
+ if (what == 2) /* audio */
+ {
+ if (m_audio)
+ return m_audio->getPTS(pts);
+ else
+ return -1;
+ }
+
+ return -1;
+}
void flush();
void freeze();
void unfreeze();
+ int getPTS(pts_t &now);
virtual ~eDVBAudio();
};
int setSlowMotion(int repeat);
int setFastForward(int skip);
void unfreeze();
+ int getPTS(pts_t &now);
virtual ~eDVBVideo();
};
RESULT setZoom(int what);
RESULT flush();
RESULT setTrickmode(int what);
+
+ /* what 0=auto, 1=video, 2=audio. */
+ RESULT getPTS(int what, pts_t &pts);
};
+
#endif
return -1;
pts_t now;
+
int r;
- /* TODO: this is a gross hack. */
- r = decoding_demux->getSTC(now, mode ? 128 : 0);
-
- if (r)
+
+ if (mode == 0) /* demux */
{
- eDebug("demux getSTC failed");
- return -1;
- }
+ r = decoding_demux->getSTC(now, 0);
+ if (r)
+ {
+ eDebug("demux getSTC failed");
+ return -1;
+ }
+ } else
+ now = pos; /* fixup supplied */
off_t off = 0; /* TODO: fixme */
r = m_tstools.fixupPTS(off, now);
virtual RESULT setZoom(int what)=0;
virtual RESULT setTrickmode(int what) = 0;
+
+ virtual RESULT getPTS(int what, pts_t &pts) = 0;
};
#endif
updateTimeshiftPids();
if (!m_timeshift_active)
updateDecoder();
+ if (m_first_program_info && m_is_pvr)
+ {
+ m_first_program_info = 0;
+ seekTo(0);
+ }
m_event((iPlayableService*)this, evUpdatedInfo);
break;
}
two (one for decoding, one for data source), as we must be prepared
to start recording from the data demux. */
m_cue = new eCueSheet();
+ m_first_program_info = 1;
r = m_service_handler.tune((eServiceReferenceDVB&)m_reference, m_is_pvr, m_cue);
m_event(this, evStart);
m_event((iPlayableService*)this, evSeekableStatusChanged);
if ((m_timeshift_enabled ? m_service_handler_timeshift : m_service_handler).getPVRChannel(pvr_channel))
return -1;
- return pvr_channel->getCurrentPosition(m_decode_demux, pos, 1);
+ int r = 0;
+
+ /* if there is a decoder, use audio or video PTS */
+ if (m_decoder)
+ {
+ r = m_decoder->getPTS(0, pos);
+ if (r)
+ return r;
+ }
+
+ /* fixup */
+ return pvr_channel->getCurrentPosition(m_decode_demux, pos, m_decoder ? 1 : 0);
}
RESULT eDVBServicePlay::setTrickmode(int trick)
Signal2<void,iPlayableService*,int> m_event;
int m_is_pvr, m_is_paused, m_timeshift_enabled, m_timeshift_active;
+ int m_first_program_info;
std::string m_timeshift_file;
int m_timeshift_fd;