MythTV  0.28pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
Static Private Member Functions | Static Private Attributes | List of all members
ChannelUtil Class Reference

Collection of helper utilities for channel DB use. More...

#include <channelutil.h>

Static Private Member Functions

static Q_DECLARE_TR_FUNCTIONS(ChannelUtil)
public uint 
CreateMultiplex (int sourceid, QString sistandard, uint64_t frequency, QString modulation, int transport_id, int network_id, int symbol_rate, signed char bandwidth, signed char polarity, signed char inversion, signed char trans_mode, QString inner_FEC, QString constellation, signed char hierarchy, QString hp_code_rate, QString lp_code_rate, QString guard_interval, QString mod_sys, QString rolloff)
 
static uint CreateMultiplex (uint sourceid, const DTVMultiplex &, int transport_id, int network_id)
 
static vector< uintCreateMultiplexes (int sourceid, const NetworkInformationTable *nit)
 
static uint GetMplexID (uint sourceid, const QString &channum)
 
static int GetMplexID (uint sourceid, uint64_t frequency)
 
static int GetMplexID (uint sourceid, uint64_t frequency, uint transport_id, uint network_id)
 
static int GetMplexID (uint sourceid, uint transport_id, uint network_id)
 
static uint GetMplexID (uint chanid)
 
static int GetBetterMplexID (int current_mplexid, int transport_id, int network_id)
 Returns best match multiplex ID, creating one if needed. More...
 
static bool GetTuningParams (uint mplexid, QString &modulation, uint64_t &frequency, uint &dvb_transportid, uint &dvb_networkid, QString &si_std)
 
static bool GetATSCChannel (uint sourceid, const QString &channum, uint &major, uint &minor)
 
static bool IsATSCChannel (uint sourceid, const QString &channum)
 
static int CreateChanID (uint sourceid, const QString &chan_num)
 Creates a unique channel ID for database use. More...
 
static bool CreateChannel (uint db_mplexid, uint db_sourceid, uint new_channel_id, const QString &callsign, const QString &service_name, const QString &chan_num, uint service_id, uint atsc_major_channel, uint atsc_minor_channel, bool use_on_air_guide, bool hidden, bool hidden_in_guide, const QString &freqid, QString icon=QString::null, QString format="Default", QString xmltvid=QString::null, QString default_authority=QString::null)
 
static bool UpdateChannel (uint db_mplexid, uint source_id, uint channel_id, const QString &callsign, const QString &service_name, const QString &chan_num, uint service_id, uint atsc_major_channel, uint atsc_minor_channel, bool use_on_air_guide, bool hidden, bool hidden_in_guide, QString freqid=QString::null, QString icon=QString::null, QString format=QString::null, QString xmltvid=QString::null, QString default_authority=QString::null)
 
static bool CreateIPTVTuningData (uint channel_id, const IPTVTuningData &tuning)
 
static bool UpdateIPTVTuningData (uint channel_id, const IPTVTuningData &tuning)
 
static void UpdateInsertInfoFromDB (ChannelInsertInfo &chan)
 
static bool DeleteChannel (uint channel_id)
 
static bool SetVisible (uint channel_id, bool hidden)
 
static bool SetServiceVersion (int mplexid, int version)
 
static int GetChanID (int db_mplexid, int service_transport_id, int major_channel, int minor_channel, int program_number)
 
static int GetServiceVersion (int mplexid)
 
static QString GetDefaultAuthority (uint chanid)
 Returns the DVB default authority for the chanid given. More...
 
static QString GetIcon (uint chanid)
 
static vector< uintGetCardIDs (uint chanid)
 
static QString GetUnknownCallsign (void)
 
static uint FindChannel (uint sourceid, const QString &freqid)
 
static int GetChanID (uint sourceid, const QString &channum)
 
static bool GetChannelData (uint sourceid, const QString &channum, QString &tvformat, QString &modulation, QString &freqtable, QString &freqid, int &finetune, uint64_t &frequency, QString &dtv_si_std, int &mpeg_prog_num, uint &atsc_major, uint &atsc_minor, uint &dvb_transportid, uint &dvb_networkid, uint &mplexid, bool &commfree)
 
static int GetProgramNumber (uint sourceid, const QString &channum)
 
static QString GetVideoFilters (uint sourceid, const QString &channum)
 
static IPTVTuningData GetIPTVTuningData (uint chanid)
 
static ChannelInfoList GetChannels (uint sourceid, bool visible_only, const QString &group_by=QString(), uint channel_groupid=0)
 
static ChannelInfoList GetAllChannels (uint sourceid)
 Returns channels that are not connected to a capture card and channels that are not marked as visible. More...
 
static vector< uintGetChanIDs (int sourceid=-1)
 
static uint GetChannelCount (int sourceid=-1)
 
static void SortChannels (ChannelInfoList &list, const QString &order, bool eliminate_duplicates=false)
 
static int GetNearestChannel (const ChannelInfoList &list, const QString &channum)
 
static uint GetNextChannel (const ChannelInfoList &sorted, uint old_chanid, uint mplexid_restriction, ChannelChangeDirection direction, bool skip_non_visible=true, bool skip_same_channum_and_callsign=false)
 
static QString GetChannelValueStr (const QString &channel_field, uint sourceid, const QString &channum)
 
static int GetChannelValueInt (const QString &channel_field, uint sourceid, const QString &channum)
 
static bool IsOnSameMultiplex (uint sourceid, const QString &new_channum, const QString &old_channum)
 
static QStringList GetValidRecorderList (uint chanid, const QString &channum)
 
static bool IsConflicting (const QString &channum, uint sourceid=0, uint excluded_chanid=0)
 
static vector< uintGetConflicting (const QString &channum, uint sourceid=0)
 
static QString GetChanNum (int chanid)
 Returns the channel-number string of the given channel. More...
 
static int GetTimeOffset (int chanid)
 Returns the listings time offset in minutes for given channel. More...
 
static int GetSourceID (int mplexid)
 
static uint GetSourceIDForChannel (uint chanid)
 
static int GetInputID (int sourceid, int cardid)
 
static QStringList GetCardTypes (uint chandid)
 
static bool GetCachedPids (uint chanid, pid_cache_t &pid_cache)
 Returns cached MPEG PIDs when given a Channel ID. More...
 
static bool SetChannelValue (const QString &field_name, QString value, uint sourceid, const QString &channum)
 
static bool SetChannelValue (const QString &field_name, QString value, int chanid)
 
static bool SaveCachedPids (uint chanid, const pid_cache_t &pid_cache, bool delete_all=false)
 Saves PIDs for PSIP tables to database. More...
 
static ChannelInfoList GetChannelsInternal (uint sourceid, bool visible_only, bool include_disconnected, const QString &group_by, uint channel_groupid)
 
static QString GetChannelStringField (int chanid, const QString &field)
 
static QString GetChannelValueStr (const QString &channel_field, uint cardid, const QString &input, const QString &channum)
 
static int GetChannelValueInt (const QString &channel_field, uint cardid, const QString &input, const QString &channum)
 

Static Private Attributes

static const QString kATSCSeparators = "(_|-|#|\\.)"
 

Detailed Description

Collection of helper utilities for channel DB use.

Definition at line 50 of file channelutil.h.

Member Function Documentation

uint ChannelUtil::CreateMultiplex ( int  sourceid,
QString  sistandard,
uint64_t  frequency,
QString  modulation,
int  transport_id,
int  network_id,
int  symbol_rate,
signed char  bandwidth,
signed char  polarity,
signed char  inversion,
signed char  trans_mode,
QString  inner_FEC,
QString  constellation,
signed char  hierarchy,
QString  hp_code_rate,
QString  lp_code_rate,
QString  guard_interval,
QString  mod_sys,
QString  rolloff 
)
staticprivate
uint ChannelUtil::CreateMultiplex ( uint  sourceid,
const DTVMultiplex mux,
int  transport_id,
int  network_id 
)
staticprivate

Definition at line 414 of file channelutil.cpp.

vector< uint > ChannelUtil::CreateMultiplexes ( int  sourceid,
const NetworkInformationTable nit 
)
staticprivate

Definition at line 435 of file channelutil.cpp.

uint ChannelUtil::GetMplexID ( uint  sourceid,
const QString &  channum 
)
staticprivate
int ChannelUtil::GetMplexID ( uint  sourceid,
uint64_t  frequency 
)
staticprivate

Definition at line 481 of file channelutil.cpp.

int ChannelUtil::GetMplexID ( uint  sourceid,
uint64_t  frequency,
uint  transport_id,
uint  network_id 
)
staticprivate

Definition at line 506 of file channelutil.cpp.

int ChannelUtil::GetMplexID ( uint  sourceid,
uint  transport_id,
uint  network_id 
)
staticprivate

Definition at line 536 of file channelutil.cpp.

uint ChannelUtil::GetMplexID ( uint  chanid)
staticprivate

Definition at line 564 of file channelutil.cpp.

int ChannelUtil::GetBetterMplexID ( int  current_mplexid,
int  transport_id,
int  network_id 
)
staticprivate

Returns best match multiplex ID, creating one if needed.

First, see if you can get an exact match based on the current mplexid's sourceID and the NetworkID/TransportID.

Next, see if current one is NULL, if so update those values and return current mplexid.

Next, if values were set, see where you can find this NetworkID/TransportID. If we get an exact match just return it, since there is no question what mplexid this NetworkId/TransportId is for. If we get many matches, return CurrentMplexID.

Next, try to repeat query without currentmplexid as source id. If we get a singe match return it, if we get many matches we return the first one.

If none of these work return -1.

Returns
mplexid on success, -1 on failure.

Definition at line 607 of file channelutil.cpp.

Referenced by ChannelImporter::InsertChannels(), and ChannelImporter::UpdateChannels().

bool ChannelUtil::GetTuningParams ( uint  mplexid,
QString &  modulation,
uint64_t &  frequency,
uint dvb_transportid,
uint dvb_networkid,
QString &  si_std 
)
staticprivate

Definition at line 708 of file channelutil.cpp.

Referenced by FillChannelInfo(), and handle_transport_desc().

bool ChannelUtil::GetATSCChannel ( uint  sourceid,
const QString &  channum,
uint major,
uint minor 
)
staticprivate

Definition at line 1860 of file channelutil.cpp.

Referenced by TVRec::TuningOnSameMultiplex().

static bool ChannelUtil::IsATSCChannel ( uint  sourceid,
const QString &  channum 
)
inlinestaticprivate

Definition at line 100 of file channelutil.h.

int ChannelUtil::CreateChanID ( uint  sourceid,
const QString &  chan_num 
)
staticprivate

Creates a unique channel ID for database use.

Returns
chanid if successful, -1 if not

Definition at line 1483 of file channelutil.cpp.

Referenced by ChannelScanSM::HandleAllGood(), ChannelData::handleChannels(), ChannelImporter::InsertChannels(), IPTVChannelFetcher::run(), and update_channel_basic().

bool ChannelUtil::CreateChannel ( uint  db_mplexid,
uint  db_sourceid,
uint  new_channel_id,
const QString &  callsign,
const QString &  service_name,
const QString &  chan_num,
uint  service_id,
uint  atsc_major_channel,
uint  atsc_minor_channel,
bool  use_on_air_guide,
bool  hidden,
bool  hidden_in_guide,
const QString &  freqid,
QString  icon = QString::null,
QString  format = "Default",
QString  xmltvid = QString::null,
QString  default_authority = QString::null 
)
staticprivate
bool ChannelUtil::UpdateChannel ( uint  db_mplexid,
uint  source_id,
uint  channel_id,
const QString &  callsign,
const QString &  service_name,
const QString &  chan_num,
uint  service_id,
uint  atsc_major_channel,
uint  atsc_minor_channel,
bool  use_on_air_guide,
bool  hidden,
bool  hidden_in_guide,
QString  freqid = QString::null,
QString  icon = QString::null,
QString  format = QString::null,
QString  xmltvid = QString::null,
QString  default_authority = QString::null 
)
staticprivate
static bool ChannelUtil::CreateIPTVTuningData ( uint  channel_id,
const IPTVTuningData tuning 
)
inlinestaticprivate

Definition at line 142 of file channelutil.h.

Referenced by ChannelImporter::InsertChannels(), and IPTVChannelFetcher::run().

bool ChannelUtil::UpdateIPTVTuningData ( uint  channel_id,
const IPTVTuningData tuning 
)
staticprivate

Definition at line 1718 of file channelutil.cpp.

Referenced by IPTVChannelFetcher::run().

void ChannelUtil::UpdateInsertInfoFromDB ( ChannelInsertInfo chan)
staticprivate

Definition at line 1686 of file channelutil.cpp.

Referenced by ChannelImporter::UpdateChannels().

bool ChannelUtil::DeleteChannel ( uint  channel_id)
staticprivate
bool ChannelUtil::SetVisible ( uint  channel_id,
bool  hidden 
)
staticprivate

Definition at line 1804 of file channelutil.cpp.

Referenced by ChannelImporter::DeleteChannels().

bool ChannelUtil::SetServiceVersion ( int  mplexid,
int  version 
)
staticprivate

Definition at line 1823 of file channelutil.cpp.

int ChannelUtil::GetChanID ( int  db_mplexid,
int  service_transport_id,
int  major_channel,
int  minor_channel,
int  program_number 
)
staticprivate
int ChannelUtil::GetServiceVersion ( int  mplexid)
staticprivate

Definition at line 1840 of file channelutil.cpp.

QString ChannelUtil::GetDefaultAuthority ( uint  chanid)
staticprivate

Returns the DVB default authority for the chanid given.

Definition at line 1219 of file channelutil.cpp.

Referenced by EITFixUp::AddDVBEITAuthority().

QString ChannelUtil::GetIcon ( uint  chanid)
staticprivate
static vector<uint> ChannelUtil::GetCardIDs ( uint  chanid)
staticprivate
QString ChannelUtil::GetUnknownCallsign ( void  )
staticprivate
uint ChannelUtil::FindChannel ( uint  sourceid,
const QString &  freqid 
)
staticprivate

Definition at line 1421 of file channelutil.cpp.

Referenced by ChannelScanSM::HandleAllGood().

static int ChannelUtil::GetChanID ( uint  sourceid,
const QString &  channum 
)
inlinestaticprivate

Definition at line 171 of file channelutil.h.

bool ChannelUtil::GetChannelData ( uint  sourceid,
const QString &  channum,
QString &  tvformat,
QString &  modulation,
QString &  freqtable,
QString &  freqid,
int finetune,
uint64_t &  frequency,
QString &  dtv_si_std,
int mpeg_prog_num,
uint atsc_major,
uint atsc_minor,
uint dvb_transportid,
uint dvb_networkid,
uint mplexid,
bool commfree 
)
staticprivate

Definition at line 1887 of file channelutil.cpp.

Referenced by ChannelBase::IsTunable(), and DTVChannel::SetChannelByString().

static int ChannelUtil::GetProgramNumber ( uint  sourceid,
const QString &  channum 
)
inlinestaticprivate

Definition at line 182 of file channelutil.h.

Referenced by TVRec::TuningOnSameMultiplex().

static QString ChannelUtil::GetVideoFilters ( uint  sourceid,
const QString &  channum 
)
inlinestaticprivate

Definition at line 184 of file channelutil.h.

Referenced by TVRec::SetVideoFiltersForChannel().

IPTVTuningData ChannelUtil::GetIPTVTuningData ( uint  chanid)
staticprivate

Definition at line 1950 of file channelutil.cpp.

Referenced by DTVChannel::SetChannelByString().

static ChannelInfoList ChannelUtil::GetChannels ( uint  sourceid,
bool  visible_only,
const QString &  group_by = QString(),
uint  channel_groupid = 0 
)
inlinestaticprivate
static ChannelInfoList ChannelUtil::GetAllChannels ( uint  sourceid)
inlinestaticprivate

Returns channels that are not connected to a capture card and channels that are not marked as visible.

Definition at line 197 of file channelutil.h.

Referenced by StartingChannel::SetSourceID().

vector< uint > ChannelUtil::GetChanIDs ( int  sourceid = -1)
staticprivate
uint ChannelUtil::GetChannelCount ( int  sourceid = -1)
staticprivate

Definition at line 2228 of file channelutil.cpp.

Referenced by ChannelImporter::Process().

void ChannelUtil::SortChannels ( ChannelInfoList list,
const QString &  order,
bool  eliminate_duplicates = false 
)
staticprivate
int ChannelUtil::GetNearestChannel ( const ChannelInfoList list,
const QString &  channum 
)
staticprivate

Definition at line 2280 of file channelutil.cpp.

Referenced by GuideGrid::FindChannel().

uint ChannelUtil::GetNextChannel ( const ChannelInfoList sorted,
uint  old_chanid,
uint  mplexid_restriction,
ChannelChangeDirection  direction,
bool  skip_non_visible = true,
bool  skip_same_channum_and_callsign = false 
)
staticprivate
QString ChannelUtil::GetChannelValueStr ( const QString &  channel_field,
uint  sourceid,
const QString &  channum 
)
staticprivate

Definition at line 984 of file channelutil.cpp.

int ChannelUtil::GetChannelValueInt ( const QString &  channel_field,
uint  sourceid,
const QString &  channum 
)
staticprivate
bool ChannelUtil::IsOnSameMultiplex ( uint  sourceid,
const QString &  new_channum,
const QString &  old_channum 
)
staticprivate

Definition at line 1038 of file channelutil.cpp.

Referenced by TVRec::TuningOnSameMultiplex().

QStringList ChannelUtil::GetValidRecorderList ( uint  chanid,
const QString &  channum 
)
staticprivate

Definition at line 1138 of file channelutil.cpp.

Referenced by TV::ChangeChannel(), TV::HandleStateChange(), and TV::SwitchCards().

static bool ChannelUtil::IsConflicting ( const QString &  channum,
uint  sourceid = 0,
uint  excluded_chanid = 0 
)
inlinestaticprivate
vector< uint > ChannelUtil::GetConflicting ( const QString &  channum,
uint  sourceid = 0 
)
staticprivate

Definition at line 1149 of file channelutil.cpp.

QString ChannelUtil::GetChanNum ( int  chanid)
staticprivate

Returns the channel-number string of the given channel.

Parameters
chanidprimary key for channel record

Definition at line 763 of file channelutil.cpp.

Referenced by TV::ChangeChannel(), ChannelImporter::DeleteChannels(), TV::SwitchCards(), and TVRec::TuningGetChanNum().

int ChannelUtil::GetTimeOffset ( int  chanid)
staticprivate

Returns the listings time offset in minutes for given channel.

Parameters
chanidprimary key for channel record

Definition at line 768 of file channelutil.cpp.

Referenced by ProgramData::ClearDataByChannel().

int ChannelUtil::GetSourceID ( int  mplexid)
staticprivate

Definition at line 773 of file channelutil.cpp.

uint ChannelUtil::GetSourceIDForChannel ( uint  chanid)
staticprivate
int ChannelUtil::GetInputID ( int  sourceid,
int  cardid 
)
staticprivate

Definition at line 811 of file channelutil.cpp.

QStringList ChannelUtil::GetCardTypes ( uint  chandid)
staticprivate

Definition at line 829 of file channelutil.cpp.

Referenced by ChannelWizard::ChannelWizard().

bool ChannelUtil::GetCachedPids ( uint  chanid,
pid_cache_t pid_cache 
)
staticprivate

Returns cached MPEG PIDs when given a Channel ID.

Parameters
chanidChannel ID to fetch cached pids for.
pid_cacheList of PIDs with their TableID types is returned in pid_cache.

Definition at line 863 of file channelutil.cpp.

Referenced by DTVChannel::GetCachedPids(), ChannelOptionsRawTS::Load(), and DTVChannel::SetChannelByString().

bool ChannelUtil::SetChannelValue ( const QString &  field_name,
QString  value,
uint  sourceid,
const QString &  channum 
)
staticprivate
bool ChannelUtil::SetChannelValue ( const QString &  field_name,
QString  value,
int  chanid 
)
staticprivate

Definition at line 1202 of file channelutil.cpp.

bool ChannelUtil::SaveCachedPids ( uint  chanid,
const pid_cache_t _pid_cache,
bool  delete_all = false 
)
staticprivate

Saves PIDs for PSIP tables to database.

Parameters
chanidChannel ID to fetch cached pids for.
pid_cacheList of PIDs with their TableID types to be saved.
delete_allIf true delete both permanent and transient pids first.

Definition at line 894 of file channelutil.cpp.

Referenced by ChannelOptionsRawTS::Save(), and DTVChannel::SaveCachedPids().

ChannelInfoList ChannelUtil::GetChannelsInternal ( uint  sourceid,
bool  visible_only,
bool  include_disconnected,
const QString &  group_by,
uint  channel_groupid 
)
staticprivate

Definition at line 2021 of file channelutil.cpp.

QString ChannelUtil::GetChannelStringField ( int  chanid,
const QString &  field 
)
staticprivate

Definition at line 743 of file channelutil.cpp.

QString ChannelUtil::GetChannelValueStr ( const QString &  channel_field,
uint  cardid,
const QString &  input,
const QString &  channum 
)
staticprivate

Definition at line 952 of file channelutil.cpp.

int ChannelUtil::GetChannelValueInt ( const QString &  channel_field,
uint  cardid,
const QString &  input,
const QString &  channum 
)
staticprivate

Definition at line 1011 of file channelutil.cpp.

Member Data Documentation

const QString ChannelUtil::kATSCSeparators = "(_|-|#|\\.)"
staticprivate

Definition at line 274 of file channelutil.h.

Referenced by GuideGrid::FindChannel(), and lt_smart().


The documentation for this class was generated from the following files: