mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-27 07:23:11 +02:00
add libduckbox
This commit is contained in:
@@ -7,7 +7,7 @@ AM_CPPFLAGS += \
|
||||
|
||||
AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing
|
||||
|
||||
AM_LDFLAGS = -lpthread -lasound -lass -lrt\
|
||||
AM_LDFLAGS = -lpthread -lasound -lass -lrt \
|
||||
@AVFORMAT_LIBS@ \
|
||||
@AVUTIL_LIBS@ \
|
||||
@AVCODEC_LIBS@ \
|
||||
@@ -24,4 +24,4 @@ libspark_la_SOURCES = \
|
||||
pwrmngr.cpp \
|
||||
record.cpp
|
||||
|
||||
#AM_CPPFLAGS = -DF_INTERRUPTS=20000 -DIRMP_EMBED -DLIRC_IRMP
|
||||
#AM_CPPFLAGS += -DF_INTERRUPTS=20000 -DIRMP_EMBED -DLIRC_IRMP
|
||||
|
@@ -6,9 +6,9 @@
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AUDIO_SYNC_WITH_PTS,
|
||||
AUDIO_NO_SYNC,
|
||||
AUDIO_SYNC_AUDIO_MASTER
|
||||
AUDIO_SYNC_WITH_PTS,
|
||||
AUDIO_NO_SYNC,
|
||||
AUDIO_SYNC_AUDIO_MASTER
|
||||
} AUDIO_SYNC_MODE;
|
||||
|
||||
typedef enum {
|
||||
@@ -19,20 +19,20 @@ typedef enum {
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AUDIO_FMT_AUTO = 0,
|
||||
AUDIO_FMT_MPEG,
|
||||
AUDIO_FMT_MP3,
|
||||
AUDIO_FMT_DOLBY_DIGITAL,
|
||||
AUDIO_FMT_BASIC = AUDIO_FMT_DOLBY_DIGITAL,
|
||||
AUDIO_FMT_AAC,
|
||||
AUDIO_FMT_AAC_PLUS,
|
||||
AUDIO_FMT_DD_PLUS,
|
||||
AUDIO_FMT_DTS,
|
||||
AUDIO_FMT_AVS,
|
||||
AUDIO_FMT_MLP,
|
||||
AUDIO_FMT_WMA,
|
||||
AUDIO_FMT_MPG1, // TD only. For Movieplayer / cPlayback
|
||||
AUDIO_FMT_ADVANCED = AUDIO_FMT_MLP
|
||||
AUDIO_FMT_AUTO = 0,
|
||||
AUDIO_FMT_MPEG,
|
||||
AUDIO_FMT_MP3,
|
||||
AUDIO_FMT_DOLBY_DIGITAL,
|
||||
AUDIO_FMT_BASIC = AUDIO_FMT_DOLBY_DIGITAL,
|
||||
AUDIO_FMT_AAC,
|
||||
AUDIO_FMT_AAC_PLUS,
|
||||
AUDIO_FMT_DD_PLUS,
|
||||
AUDIO_FMT_DTS,
|
||||
AUDIO_FMT_AVS,
|
||||
AUDIO_FMT_MLP,
|
||||
AUDIO_FMT_WMA,
|
||||
AUDIO_FMT_MPG1, // TD only. For Movieplayer / cPlayback
|
||||
AUDIO_FMT_ADVANCED = AUDIO_FMT_MLP
|
||||
} AUDIO_FORMAT;
|
||||
|
||||
class cAudio
|
||||
|
@@ -30,6 +30,7 @@ hw_caps_t *get_hwcaps(void)
|
||||
memset(&caps, 0, sizeof(hw_caps_t));
|
||||
|
||||
initialized = 1;
|
||||
caps.has_CI = 0;
|
||||
caps.can_cec = 1;
|
||||
caps.can_shutdown = 1;
|
||||
caps.display_type = HW_DISPLAY_LED_NUM;
|
||||
|
@@ -1,23 +0,0 @@
|
||||
#ifndef __MMI_H_
|
||||
#define __MMI_H_
|
||||
|
||||
#define MAX_MMI_ITEMS 40
|
||||
#define MAX_MMI_TEXT_LEN 255
|
||||
#define MAX_MMI_CHOICE_TEXT_LEN 255
|
||||
|
||||
typedef struct {
|
||||
int choice_nb;
|
||||
char title[MAX_MMI_TEXT_LEN];
|
||||
char subtitle[MAX_MMI_TEXT_LEN];
|
||||
char bottom[MAX_MMI_TEXT_LEN];
|
||||
char choice_item[MAX_MMI_ITEMS][MAX_MMI_CHOICE_TEXT_LEN];
|
||||
} MMI_MENU_LIST_INFO;
|
||||
|
||||
typedef struct {
|
||||
int blind;
|
||||
int answerlen;
|
||||
char enguiryText[MAX_MMI_TEXT_LEN];
|
||||
} MMI_ENGUIRY_INFO;
|
||||
|
||||
#endif // __MMI_H_
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,125 +0,0 @@
|
||||
#ifndef __PLAYBACK_TD_H
|
||||
#define __PLAYBACK_TD_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
/* almost 256kB */
|
||||
#define INBUF_SIZE (1394 * 188)
|
||||
#define PESBUF_SIZE (128 * 1024)
|
||||
|
||||
typedef enum {
|
||||
PLAYMODE_TS = 0,
|
||||
PLAYMODE_FILE,
|
||||
} playmode_t;
|
||||
|
||||
typedef enum {
|
||||
FILETYPE_UNKNOWN,
|
||||
FILETYPE_TS,
|
||||
FILETYPE_MPG,
|
||||
FILETYPE_VDR
|
||||
} filetype_t;
|
||||
|
||||
typedef enum {
|
||||
STATE_STOP,
|
||||
STATE_PLAY,
|
||||
STATE_PAUSE,
|
||||
STATE_FF,
|
||||
STATE_REW,
|
||||
STATE_INIT
|
||||
} playstate_t;
|
||||
|
||||
typedef struct {
|
||||
std::string Name;
|
||||
off_t Size;
|
||||
} filelist_t;
|
||||
|
||||
class cPlayback
|
||||
{
|
||||
private:
|
||||
uint8_t *inbuf;
|
||||
ssize_t inbuf_pos;
|
||||
ssize_t inbuf_sync;
|
||||
uint8_t *pesbuf;
|
||||
ssize_t pesbuf_pos;
|
||||
ssize_t inbuf_read(void);
|
||||
ssize_t read_ts(void);
|
||||
ssize_t read_mpeg(void);
|
||||
|
||||
uint8_t cc[256];
|
||||
|
||||
int in_fd;
|
||||
|
||||
int video_type;
|
||||
int playback_speed;
|
||||
int mSpeed;
|
||||
playmode_t playMode;
|
||||
std::vector<filelist_t> filelist; /* for multi-file playback */
|
||||
|
||||
bool filelist_auto_add(void);
|
||||
int mf_open(int fileno);
|
||||
int mf_close(void);
|
||||
off_t mf_lseek(off_t pos);
|
||||
off_t mf_getsize(void);
|
||||
int curr_fileno;
|
||||
off_t curr_pos;
|
||||
off_t last_size;
|
||||
off_t bytes_per_second;
|
||||
|
||||
uint16_t vpid;
|
||||
uint16_t apid;
|
||||
bool ac3;
|
||||
struct AStream {
|
||||
// uint16_t pid;
|
||||
bool ac3;
|
||||
std::string lang; /* not yet really used */
|
||||
};
|
||||
std::map<uint16_t, AStream> astreams; /* stores AStream sorted by pid */
|
||||
|
||||
int64_t pts_start;
|
||||
int64_t pts_end;
|
||||
int64_t _pts_end; /* last good endpts */
|
||||
int64_t pts_curr;
|
||||
int64_t get_pts(uint8_t *p, bool pes, int bufsize);
|
||||
|
||||
filetype_t filetype;
|
||||
playstate_t playstate;
|
||||
|
||||
off_t seek_to_pts(int64_t pts);
|
||||
off_t mp_seekSync(off_t pos);
|
||||
int64_t get_PES_PTS(uint8_t *buf, int len, bool until_eof);
|
||||
|
||||
pthread_t thread;
|
||||
bool thread_started;
|
||||
public:
|
||||
cPlayback(int num = 0);
|
||||
~cPlayback();
|
||||
|
||||
void playthread();
|
||||
|
||||
bool Open(playmode_t PlayMode);
|
||||
void Close(void);
|
||||
bool Start(char *filename, unsigned short vpid, int vtype, unsigned short apid,
|
||||
int ac3, unsigned int duration);
|
||||
bool SetAPid(unsigned short pid, int ac3);
|
||||
bool SetSpeed(int speed);
|
||||
bool GetSpeed(int &speed) const;
|
||||
bool GetPosition(int &position, int &duration); /* pos: current time in ms, dur: file length in ms */
|
||||
bool SetPosition(int position, bool absolute = false); /* position: jump in ms */
|
||||
void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language);
|
||||
#if 0
|
||||
// Functions that are not used by movieplayer.cpp:
|
||||
bool Stop(void);
|
||||
bool GetOffset(off64_t &offset);
|
||||
bool IsPlaying(void) const { return playing; }
|
||||
bool IsEnabled(void) const { return enabled; }
|
||||
void * GetHandle(void);
|
||||
void * GetDmHandle(void);
|
||||
int GetCurrPlaybackSpeed(void) const { return nPlaybackSpeed; }
|
||||
void PlaybackNotify (int Event, void *pData, void *pTag);
|
||||
void DMNotify(int Event, void *pTsBuf, void *Tag);
|
||||
#endif
|
||||
};
|
||||
#endif
|
@@ -168,7 +168,7 @@ bool cPlayback::SetSpeed(int speed)
|
||||
|
||||
bool cPlayback::GetSpeed(int &speed) const
|
||||
{
|
||||
speed = nPlaybackSpeed;
|
||||
speed = nPlaybackSpeed;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -307,6 +307,28 @@ int cPlayback::GetFirstTeletextPid(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* dummy functions for subtitles */
|
||||
void cPlayback::FindAllSubs(uint16_t * /*pids*/, unsigned short * /*supp*/, uint16_t *num, std::string * /*lang*/)
|
||||
{
|
||||
*num = 0;
|
||||
}
|
||||
|
||||
bool cPlayback::SelectSubtitles(int pid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void cPlayback::GetTitles(std::vector<int> &playlists, std::vector<std::string> &titles, int ¤t)
|
||||
{
|
||||
playlists.clear();
|
||||
titles.clear();
|
||||
current = 0;
|
||||
}
|
||||
|
||||
void cPlayback::SetTitle(int /*title*/)
|
||||
{
|
||||
}
|
||||
|
||||
void cPlayback::GetChapters(std::vector<int> &positions, std::vector<std::string> &titles)
|
||||
{
|
||||
player->GetChapters(positions, titles);
|
||||
|
@@ -52,10 +52,10 @@ class cPlayback
|
||||
void RequestAbort(void);
|
||||
bool IsPlaying(void);
|
||||
uint64_t GetReadCount(void);
|
||||
#if 0
|
||||
void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language);
|
||||
bool SelectSubtitles(int pid);
|
||||
#endif
|
||||
void GetTitles(std::vector<int> &playlists, std::vector<std::string> &titles, int ¤t);
|
||||
void SetTitle(int title);
|
||||
void GetChapters(std::vector<int> &positions, std::vector<std::string> &titles);
|
||||
void GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values);
|
||||
#if 0
|
||||
|
@@ -14,7 +14,7 @@ void cCpuFreqManager::Down(void) { lt_debug("%s\n", __FUNCTION__); }
|
||||
void cCpuFreqManager::Reset(void) { lt_debug("%s\n", __FUNCTION__); }
|
||||
/* those function dummies return true or "harmless" values */
|
||||
bool cCpuFreqManager::SetDelta(unsigned long) { lt_debug("%s\n", __FUNCTION__); return true; }
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE
|
||||
unsigned long cCpuFreqManager::GetCpuFreq(void) {
|
||||
int freq = 0;
|
||||
if (FILE *pll0 = fopen("/proc/cpu_frequ/pll0_ndiv_mdiv", "r")) {
|
||||
@@ -48,7 +48,7 @@ bool cPowerManager::SetStandby(bool Active, bool Passive)
|
||||
|
||||
bool cCpuFreqManager::SetCpuFreq(unsigned long f)
|
||||
{
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE
|
||||
if (f) {
|
||||
FILE *pll0 = fopen ("/proc/cpu_frequ/pll0_ndiv_mdiv", "w");
|
||||
if (pll0) {
|
||||
|
@@ -183,11 +183,13 @@ void cRecord::RecordThread()
|
||||
prctl (PR_SET_NAME, (unsigned long)&threadname);
|
||||
int readsize = bufsize/16;
|
||||
int buf_pos = 0;
|
||||
int count = 0;
|
||||
int queued = 0;
|
||||
uint8_t *buf;
|
||||
struct aiocb a;
|
||||
|
||||
buf = (uint8_t *)malloc(bufsize);
|
||||
lt_info("BUFSIZE=0x%x READSIZE=0x%x\n", bufsize, readsize);
|
||||
if (!buf)
|
||||
{
|
||||
exit_flag = RECORD_FAILED_MEMORY;
|
||||
@@ -237,6 +239,15 @@ void cRecord::RecordThread()
|
||||
{
|
||||
overflow = false;
|
||||
buf_pos += s;
|
||||
if (count > 100)
|
||||
{
|
||||
if (buf_pos < bufsize / 2)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* compatibility stuff for Tripledragon audio API
|
||||
*
|
||||
* (C) 2009 Stefan Seyfried
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __td_audio_compat_h__
|
||||
#define __td_audio_compat_h__
|
||||
|
||||
#include <aud/aud_inf.h>
|
||||
// types
|
||||
typedef enum {
|
||||
AUDIO_SOURCE_DEMUX = AUD_SOURCE_DEMUX,
|
||||
AUDIO_SOURCE_MEMORY = AUD_SOURCE_MEMORY
|
||||
} audio_stream_source_t;
|
||||
#define audio_channel_select_t audChannel_t
|
||||
// ioctls
|
||||
#define AUDIO_CHANNEL_SELECT MPEG_AUD_SELECT_CHANNEL
|
||||
#define AUDIO_SELECT_SOURCE MPEG_AUD_SELECT_SOURCE
|
||||
#define AUDIO_PLAY MPEG_AUD_PLAY
|
||||
#define AUDIO_STOP MPEG_AUD_STOP
|
||||
#define AUDIO_SET_MUTE MPEG_AUD_SET_MUTE
|
||||
|
||||
#endif /* __td_audio_compat_h__ */
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* compatibility stuff for Tripledragon demux API
|
||||
*
|
||||
* (C) 2009 Stefan Seyfried
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __td_demux_compat_h__
|
||||
#define __td_demux_compat_h__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <xp/xp_osd_user.h>
|
||||
// types
|
||||
#define dmx_output_t OutDevice
|
||||
#define dmx_pes_type_t PesType
|
||||
#define dmx_sct_filter_params demux_filter_para
|
||||
#define dmx_pes_filter_params demux_pes_para
|
||||
#define pes_type pesType
|
||||
// defines
|
||||
#define DMX_FILTER_SIZE FILTER_LENGTH
|
||||
#define DMX_ONESHOT XPDF_ONESHOT
|
||||
#define DMX_CHECK_CRC 0 // TD checks CRC by default
|
||||
#define DMX_IMMEDIATE_START XPDF_IMMEDIATE_START
|
||||
#define DMX_OUT_DECODER OUT_DECODER
|
||||
// ioctls
|
||||
#define DMX_SET_FILTER DEMUX_FILTER_SET
|
||||
#define DMX_SET_PES_FILTER DEMUX_FILTER_PES_SET
|
||||
#define DMX_START DEMUX_START
|
||||
#define DMX_STOP DEMUX_STOP
|
||||
#define DMX_SET_BUFFER_SIZE DEMUX_SET_BUFFER_SIZE
|
||||
|
||||
#endif /* __td_demux_compat_h__ */
|
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* compatibility stuff for Tripledragon frontend API
|
||||
*
|
||||
* (C) 2009 Stefan Seyfried
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __td_frontend_compat_h__
|
||||
#define __td_frontend_compat_h__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <tdtuner/tuner_inf.h>
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* I know that those are different. But functions that get a
|
||||
dvb_frontend_parameters struct passed on dbox/dreambox will most likely
|
||||
get a tunersetup struct on TD, so it keeps the differences in headers
|
||||
and function prototypes small. Of course, the functions itself will have
|
||||
#ifdef TRIPLEDRAGON or similar... */
|
||||
#define dvb_frontend_parameters tunersetup
|
||||
|
||||
/* compat stuff for settings.cpp */
|
||||
enum {
|
||||
INVERSION_OFF,
|
||||
INVERSION_ON,
|
||||
INVERSION_AUTO
|
||||
};
|
||||
typedef enum fe_code_rate {
|
||||
FEC_NONE = 0,
|
||||
FEC_1_2,
|
||||
FEC_2_3,
|
||||
FEC_3_4,
|
||||
FEC_4_5,
|
||||
FEC_5_6,
|
||||
FEC_6_7,
|
||||
FEC_7_8,
|
||||
FEC_8_9,
|
||||
FEC_AUTO
|
||||
} fe_code_rate_t;
|
||||
|
||||
enum td_code_rate {
|
||||
TD_FEC_AUTO = 0,
|
||||
TD_FEC_1_2,
|
||||
TD_FEC_2_3,
|
||||
TD_FEC_3_4,
|
||||
TD_FEC_5_6,
|
||||
TD_FEC_7_8
|
||||
};
|
||||
|
||||
typedef enum fe_sec_tone_mode {
|
||||
SEC_TONE_ON,
|
||||
SEC_TONE_OFF
|
||||
} fe_sec_tone_mode_t;
|
||||
|
||||
typedef enum fe_sec_voltage {
|
||||
SEC_VOLTAGE_13,
|
||||
SEC_VOLTAGE_18,
|
||||
SEC_VOLTAGE_OFF
|
||||
} fe_sec_voltage_t;
|
||||
|
||||
typedef enum fe_sec_mini_cmd {
|
||||
SEC_MINI_A,
|
||||
SEC_MINI_B
|
||||
} fe_sec_mini_cmd_t;
|
||||
|
||||
struct dvb_diseqc_master_cmd {
|
||||
unsigned char msg [6]; /* { framing, address, command, data [3] } */
|
||||
unsigned char msg_len; /* valid values are 3...6 */
|
||||
};
|
||||
|
||||
typedef enum fe_type {
|
||||
FE_QPSK,
|
||||
FE_QAM,
|
||||
FE_OFDM,
|
||||
FE_ATSC
|
||||
} fe_type_t;
|
||||
|
||||
struct dvb_frontend_info {
|
||||
// char name[128];
|
||||
fe_type_t type;
|
||||
#if 0
|
||||
__u32 frequency_min;
|
||||
__u32 frequency_max;
|
||||
__u32 frequency_stepsize;
|
||||
__u32 frequency_tolerance;
|
||||
__u32 symbol_rate_min;
|
||||
__u32 symbol_rate_max;
|
||||
__u32 symbol_rate_tolerance; /* ppm */
|
||||
__u32 notifier_delay; /* DEPRECATED */
|
||||
fe_caps_t caps;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct dvb_frontend_event {
|
||||
fe_status_t status;
|
||||
tunersetup parameters;
|
||||
};
|
||||
|
||||
#ifdef _DVBFRONTEND_H_
|
||||
#error _DVBFRONTEND_H_ included
|
||||
#endif
|
||||
|
||||
#endif /* __td_frontend_compat_h__ */
|
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* compatibility stuff for conversion of Tripledragon API values to DVB API
|
||||
* and vice versa
|
||||
*
|
||||
* (C) 2009 Stefan Seyfried
|
||||
*
|
||||
* Released under the GPL V2.
|
||||
*/
|
||||
|
||||
#ifndef _td_value_compat_
|
||||
#define _td_value_compat_
|
||||
|
||||
#undef FE_GET_INFO
|
||||
#undef FE_READ_BER
|
||||
#undef FE_READ_SIGNAL_STRENGTH
|
||||
#undef FE_READ_SNR
|
||||
#undef FE_READ_UNCORRECTED_BLOCKS
|
||||
#undef FE_GET_EVENT
|
||||
#undef FE_READ_STATUS
|
||||
#undef FE_SET_PROPERTY
|
||||
#undef FE_GET_EVENT
|
||||
#undef FE_GET_EVENT
|
||||
#undef FE_SET_PROPERTY
|
||||
#undef FE_SET_TONE
|
||||
#undef FE_ENABLE_HIGH_LNB_VOLTAGE
|
||||
#undef FE_SET_VOLTAGE
|
||||
#undef FE_DISEQC_SEND_MASTER_CMD
|
||||
#undef FE_DISEQC_SEND_BURST
|
||||
/* hack, linux/dvb/frontend.h already defines fe_status */
|
||||
#define fe_status td_fe_status
|
||||
#define fe_status_t td_fe_status_t
|
||||
#define FE_HAS_SIGNAL TD_FE_HAS_SIGNAL
|
||||
#define FE_HAS_CARRIER TD_FE_HAS_CARRIER
|
||||
#define FE_HAS_VITERBI TD_FE_HAS_VITERBI
|
||||
#define FE_HAS_SYNC TD_FE_HAS_SYNC
|
||||
#define FE_HAS_LOCK TD_FE_HAS_LOCK
|
||||
#define FE_TIMEDOUT TD_FE_TIMEDOUT
|
||||
#define FE_REINIT TD_FE_REINIT
|
||||
#include <tdtuner/tuner_inf.h>
|
||||
#undef fe_status
|
||||
#undef fe_status_t
|
||||
#undef FE_HAS_SIGNAL
|
||||
#undef FE_HAS_CARRIER
|
||||
#undef FE_HAS_VITERBI
|
||||
#undef FE_HAS_SYNC
|
||||
#undef FE_HAS_LOCK
|
||||
#undef FE_TIMEDOUT
|
||||
#undef FE_REINIT
|
||||
enum td_code_rate {
|
||||
TD_FEC_AUTO = 0,
|
||||
TD_FEC_1_2,
|
||||
TD_FEC_2_3,
|
||||
TD_FEC_3_4,
|
||||
TD_FEC_5_6,
|
||||
TD_FEC_7_8
|
||||
};
|
||||
|
||||
static inline unsigned int dvbfec2tdfec(fe_code_rate_t fec)
|
||||
{
|
||||
switch (fec) {
|
||||
case FEC_1_2: // FEC_1_2 ... FEC_3_4 are equal to TD_FEC_1_2 ... TD_FEC_3_4
|
||||
case FEC_2_3:
|
||||
case FEC_3_4:
|
||||
return (unsigned int)fec;
|
||||
case FEC_5_6:
|
||||
return TD_FEC_5_6;
|
||||
case FEC_7_8:
|
||||
return TD_FEC_7_8;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TD_FEC_AUTO;
|
||||
}
|
||||
|
||||
static inline fe_code_rate_t tdfec2dvbfec(unsigned int tdfec)
|
||||
{
|
||||
switch (tdfec)
|
||||
{
|
||||
case TD_FEC_1_2:
|
||||
case TD_FEC_2_3:
|
||||
case TD_FEC_3_4:
|
||||
return (fe_code_rate_t)tdfec;
|
||||
case TD_FEC_5_6:
|
||||
return FEC_5_6;
|
||||
case TD_FEC_7_8:
|
||||
return FEC_7_8;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return FEC_AUTO;
|
||||
}
|
||||
|
||||
#endif /* _td_value_compat_ */
|
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* compatibility stuff for Tripledragon video API
|
||||
*
|
||||
* (C) 2009 Stefan Seyfried
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __td_video_compat_h__
|
||||
#define __td_video_compat_h__
|
||||
|
||||
#include <vid/vid_inf.h>
|
||||
// types
|
||||
#define video_format_t vidDispSize_t
|
||||
#define video_displayformat_t vidDispMode_t
|
||||
typedef enum {
|
||||
VIDEO_SOURCE_DEMUX = VID_SOURCE_DEMUX,
|
||||
VIDEO_SOURCE_MEMORY = VID_SOURCE_MEMORY
|
||||
} video_stream_source_t;
|
||||
typedef enum {
|
||||
VIDEO_STOPPED, /* Video is stopped */
|
||||
VIDEO_PLAYING, /* Video is currently playing */
|
||||
VIDEO_FREEZED /* Video is freezed */
|
||||
} video_play_state_t;
|
||||
//#define video_play_state_t vidState_t
|
||||
// ioctls
|
||||
#define VIDEO_SET_SYSTEM MPEG_VID_SET_DISPFMT
|
||||
#define VIDEO_SET_FORMAT MPEG_VID_SET_DISPSIZE
|
||||
#define VIDEO_SET_DISPLAY_FORMAT MPEG_VID_SET_DISPMODE
|
||||
#define VIDEO_SELECT_SOURCE MPEG_VID_SELECT_SOURCE
|
||||
#define VIDEO_PLAY MPEG_VID_PLAY
|
||||
#define VIDEO_STOP MPEG_VID_STOP
|
||||
#define VIDEO_SET_BLANK MPEG_VID_SET_BLANK
|
||||
|
||||
#endif /* __td_video_compat_h__ */
|
@@ -426,6 +426,8 @@ void cVideo::SetVideoMode(analog_mode_t mode)
|
||||
void cVideo::ShowPicture(const char * fname, const char *_destname)
|
||||
{
|
||||
lt_debug("%s(%s)\n", __func__, fname);
|
||||
static const unsigned char pes_header[] = { 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x80, 0x00, 0x00 };
|
||||
static const unsigned char seq_end[] = { 0x00, 0x00, 0x01, 0xB7 };
|
||||
char destname[512];
|
||||
char cmd[512];
|
||||
char *p;
|
||||
@@ -444,7 +446,7 @@ void cVideo::ShowPicture(const char * fname, const char *_destname)
|
||||
if (_destname)
|
||||
strncpy(destname, _destname, sizeof(destname));
|
||||
else {
|
||||
strcpy(destname, "/var/cache");
|
||||
strcpy(destname, "/tmp/cache");
|
||||
if (stat(fname, &st2))
|
||||
{
|
||||
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
|
||||
@@ -456,7 +458,7 @@ void cVideo::ShowPicture(const char * fname, const char *_destname)
|
||||
build that filename first...
|
||||
TODO: this could cause name clashes, use a hashing function instead... */
|
||||
strcat(destname, fname);
|
||||
p = &destname[strlen("/var/cache/")];
|
||||
p = &destname[strlen("/tmp/cache/")];
|
||||
while ((p = strchr(p, '/')) != NULL)
|
||||
*p = '.';
|
||||
strcat(destname, ".m2v");
|
||||
@@ -468,7 +470,7 @@ void cVideo::ShowPicture(const char * fname, const char *_destname)
|
||||
u.actime = time(NULL);
|
||||
u.modtime = st2.st_mtime;
|
||||
/* it does not exist or has a different date, so call ffmpeg... */
|
||||
sprintf(cmd, "ffmpeg -y -f mjpeg -i '%s' -s 1280x720 '%s' </dev/null",
|
||||
sprintf(cmd, "ffmpeg -y -f mjpeg -i '%s' -s 1280x720 -aspect 16:9 '%s' </dev/null",
|
||||
fname, destname);
|
||||
system(cmd); /* TODO: use libavcodec to directly convert it */
|
||||
utime(destname, &u);
|
||||
@@ -491,17 +493,30 @@ void cVideo::ShowPicture(const char * fname, const char *_destname)
|
||||
|
||||
if (ioctl(fd, VIDEO_SET_FORMAT, VIDEO_FORMAT_16_9) < 0)
|
||||
lt_info("%s: VIDEO_SET_FORMAT failed (%m)\n", __func__);
|
||||
char *iframe = (char *)malloc(st.st_size);
|
||||
bool seq_end_avail = false;
|
||||
size_t pos=0;
|
||||
unsigned char *iframe = (unsigned char *)malloc((st.st_size < 8192) ? 8192 : st.st_size);
|
||||
if (! iframe)
|
||||
{
|
||||
lt_info("%s: malloc failed (%m)\n", __func__);
|
||||
goto out;
|
||||
}
|
||||
read(mfd, iframe, st.st_size);
|
||||
fop(ioctl, VIDEO_PLAY);
|
||||
fop(ioctl, VIDEO_CONTINUE);
|
||||
video_still_picture sp = { iframe, st.st_size };
|
||||
fop(ioctl, VIDEO_STILLPICTURE, &sp);
|
||||
ioctl(fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY);
|
||||
ioctl(fd, VIDEO_PLAY);
|
||||
ioctl(fd, VIDEO_CONTINUE);
|
||||
ioctl(fd, VIDEO_CLEAR_BUFFER);
|
||||
while (pos <= (st.st_size-4) && !(seq_end_avail = (!iframe[pos] && !iframe[pos+1] && iframe[pos+2] == 1 && iframe[pos+3] == 0xB7)))
|
||||
++pos;
|
||||
|
||||
if ((iframe[3] >> 4) != 0xE) // no pes header
|
||||
write(fd, pes_header, sizeof(pes_header));
|
||||
write(fd, iframe, st.st_size);
|
||||
if (!seq_end_avail)
|
||||
write(fd, seq_end, sizeof(seq_end));
|
||||
memset(iframe, 0, 8192);
|
||||
write(fd, iframe, 8192);
|
||||
ioctl(fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX);
|
||||
free(iframe);
|
||||
}
|
||||
out:
|
||||
|
@@ -63,7 +63,7 @@ typedef enum {
|
||||
DISPLAY_AR_14_9,
|
||||
DISPLAY_AR_16_9,
|
||||
DISPLAY_AR_20_9,
|
||||
DISPLAY_AR_RAW,
|
||||
DISPLAY_AR_RAW
|
||||
} DISPLAY_AR;
|
||||
|
||||
typedef enum {
|
||||
@@ -138,11 +138,11 @@ class cVideo
|
||||
int /*vidOutFmt_t*/ outputformat;
|
||||
int scartvoltage;
|
||||
|
||||
VIDEO_FORMAT StreamType;
|
||||
VIDEO_DEFINITION VideoDefinition;
|
||||
VIDEO_FORMAT StreamType;
|
||||
VIDEO_DEFINITION VideoDefinition;
|
||||
DISPLAY_AR DisplayAR;
|
||||
VIDEO_PLAY_MODE SyncMode;
|
||||
DISPLAY_AR_MODE ARMode;
|
||||
DISPLAY_AR_MODE ARMode;
|
||||
VIDEO_DB_DR eDbDr;
|
||||
DISPLAY_AR PictureAR;
|
||||
VIDEO_FRAME_RATE FrameRate;
|
||||
|
Reference in New Issue
Block a user