V4LChannel Class Reference

Implements tuning for TV cards using the V4L driver API, both versions 1 and 2. More...

#include <v4lchannel.h>

Inheritance diagram for V4LChannel:
DTVChannel ChannelBase

List of all members.

Public Member Functions

 V4LChannel (TVRec *parent, const QString &videodevice)
virtual ~V4LChannel (void)
bool Init (QString &inputname, QString &startchannel, bool setchan)
bool SwitchToInput (int newcapchannel, bool setstarting)
 Switches to another input on hardware, and sets the channel is setstarting is true.
bool Open (void)
 Opens the channel changing hardware for use.
void Close (void)
 Closes the channel changing hardware to use.
bool Tune (const DTVMultiplex &tuning, QString inputname)
 This performs the actual frequency tuning and in some cases input switching.
bool Tune (uint64_t frequency, QString inputname)
 Tunes to a specific frequency (Hz) on a particular input.
bool Tune (const QString &freqid, int finetune)
 This tunes on the frequency Identification parameter for hardware that supports it.
bool Retune (void)
 Retunes to last tuned frequency.
void SetFd (int fd)
 Sets file descriptor.
void SetFormat (const QString &format)
 Initializes tuner and modulator variables.
int SetDefaultFreqTable (const QString &name)
bool IsOpen (void) const
 Reports whether channel is already open.
int GetFd (void) const
 Returns file descriptor, -1 if it does not exist.
QString GetDevice (void) const
 Returns String representing device, useful for debugging.
QString GetSIStandard (void) const
 Returns PSIP table standard: MPEG, DVB, ATSC, or OpenCable.
virtual bool IsExternalChannelChangeSupported (void)
bool InitPictureAttributes (void)
int GetPictureAttribute (PictureAttribute) const
int ChangePictureAttribute (PictureAdjustType, PictureAttribute, bool up)

Private Member Functions

void SetFreqTable (const int index)
int SetFreqTable (const QString &name)
bool SetInputAndFormat (int newcapchannel, QString newFmt)
int GetCurrentChannelNum (const QString &channame)
QString GetFormatForChannel (QString channum, QString inputname)
bool InitPictureAttribute (const QString db_col_name)
bool InitializeInputs (void)
 This enumerates the inputs, converts the format string to something the hardware understands, and if the parent pointer is valid retrieves the channels from the database.

Private Attributes

QString device
int videofd
QString device_name
QString driver_name
QMap< QString, int > pict_attr_default
struct CHANLISTcurList
int totalChannels
QString currentFormat
bool usingv4l2
 Set to true if tuner accepts v4l2 commands.
bool has_stream_io
bool has_std_io
bool has_async_io
bool has_tuner
bool has_sliced_vbi
VidModV4L1 videomode_v4l1
 Current video mode if 'usingv4l2' is false.
VidModV4L2 videomode_v4l2
 Current video mode if 'usingv4l2' is true.
int defaultFreqTable

Detailed Description

Implements tuning for TV cards using the V4L driver API, both versions 1 and 2.

This class supports a wide range of tuning hardware including frame grabbers (whose output requires encoding), hardware encoders, digital cameras, and non-encoding hardware which simply records pre-encoded broadcast streams.

Definition at line 32 of file v4lchannel.h.


Constructor & Destructor Documentation

V4LChannel::V4LChannel ( TVRec parent,
const QString &  videodevice 
)

Definition at line 40 of file v4lchannel.cpp.

V4LChannel::~V4LChannel ( void   )  [virtual]

Definition at line 55 of file v4lchannel.cpp.


Member Function Documentation

bool V4LChannel::Init ( QString &  inputname,
QString &  startchannel,
bool  setchan 
) [virtual]

Reimplemented from ChannelBase.

Definition at line 60 of file v4lchannel.cpp.

bool V4LChannel::SwitchToInput ( int  inputNum,
bool  setstarting 
) [virtual]

Switches to another input on hardware, and sets the channel is setstarting is true.

Reimplemented from ChannelBase.

Definition at line 753 of file v4lchannel.cpp.

Referenced by Tune().

bool V4LChannel::Open ( void   )  [virtual]

Opens the channel changing hardware for use.

Implements ChannelBase.

Definition at line 70 of file v4lchannel.cpp.

Referenced by SetFormat().

void V4LChannel::Close ( void   )  [virtual]

Closes the channel changing hardware to use.

Implements ChannelBase.

Definition at line 126 of file v4lchannel.cpp.

Referenced by Open(), SetFd(), and ~V4LChannel().

bool V4LChannel::Tune ( const DTVMultiplex tuning,
QString  inputname 
) [virtual]

This performs the actual frequency tuning and in some cases input switching.

In rare cases such as ASI this does nothing since all the channels are in the same MPTS stream on the same input. But generally you will need to implement this when adding support for new hardware.

Implements DTVChannel.

Definition at line 476 of file v4lchannel.cpp.

Referenced by SwitchToInput(), and Tune().

bool V4LChannel::Tune ( uint64_t  frequency,
QString  inputname 
) [virtual]

Tunes to a specific frequency (Hz) on a particular input.

Note:
This function always uses modulator zero.
Unlike digital tuning functions this accepts the visual carrier frequency and not the center frequency.
Parameters:
frequency Frequency in Hz, this is divided by 62.5 kHz or 62.5 Hz depending on the modulator and sent to the hardware.
inputname Name of the input (Television, Antenna 1, etc.)
modulation "radio", "analog", or "digital"

Reimplemented from DTVChannel.

Definition at line 493 of file v4lchannel.cpp.

bool V4LChannel::Tune ( const QString &  freqid,
int  finetune 
) [virtual]

This tunes on the frequency Identification parameter for hardware that supports it.

This is only called when there is no frequency set. This is used to implement "Channel Numbers" in analog tuning scenarios and to implement "Virtual Channels" in the OCUR and Firewire tuners.

Reimplemented from DTVChannel.

Definition at line 455 of file v4lchannel.cpp.

bool V4LChannel::Retune ( void   )  [virtual]

Retunes to last tuned frequency.

NOTE: This only works for V4L2 and only for analog tuning.

Reimplemented from ChannelBase.

Definition at line 580 of file v4lchannel.cpp.

void V4LChannel::SetFd ( int  fd  )  [virtual]

Sets file descriptor.

Reimplemented from ChannelBase.

Definition at line 133 of file v4lchannel.cpp.

void V4LChannel::SetFormat ( const QString &  format  )  [virtual]

Initializes tuner and modulator variables.

Parameters:
format One of twelve formats: "NTSC", "NTSC-JP", "ATSC", "SECAM", "PAL", "PAL-BG", "PAL-DK", "PAL-I", "PAL-60", "PAL-NC", "PAL-M", or "PAL-N"

Reimplemented from ChannelBase.

Definition at line 366 of file v4lchannel.cpp.

Referenced by Init(), and Open().

int V4LChannel::SetDefaultFreqTable ( const QString &  name  ) 

Definition at line 392 of file v4lchannel.cpp.

Referenced by Init().

bool V4LChannel::IsOpen ( void   )  const [inline, virtual]

Reports whether channel is already open.

Implements ChannelBase.

Definition at line 55 of file v4lchannel.h.

int V4LChannel::GetFd ( void   )  const [inline, virtual]

Returns file descriptor, -1 if it does not exist.

Reimplemented from ChannelBase.

Definition at line 56 of file v4lchannel.h.

Referenced by IsOpen().

QString V4LChannel::GetDevice ( void   )  const [inline, virtual]

Returns String representing device, useful for debugging.

Reimplemented from ChannelBase.

Definition at line 57 of file v4lchannel.h.

QString V4LChannel::GetSIStandard ( void   )  const [inline]

Returns PSIP table standard: MPEG, DVB, ATSC, or OpenCable.

Reimplemented from DTVChannel.

Definition at line 58 of file v4lchannel.h.

virtual bool V4LChannel::IsExternalChannelChangeSupported ( void   )  [inline, virtual]

Reimplemented from ChannelBase.

Definition at line 59 of file v4lchannel.h.

bool V4LChannel::InitPictureAttributes ( void   )  [virtual]

Reimplemented from ChannelBase.

Definition at line 958 of file v4lchannel.cpp.

int V4LChannel::GetPictureAttribute ( PictureAttribute  attr  )  const [virtual]

Reimplemented from ChannelBase.

Definition at line 966 of file v4lchannel.cpp.

Referenced by ChangePictureAttribute().

int V4LChannel::ChangePictureAttribute ( PictureAdjustType  type,
PictureAttribute  attr,
bool  up 
) [virtual]

Reimplemented from ChannelBase.

Definition at line 1122 of file v4lchannel.cpp.

void V4LChannel::SetFreqTable ( const int  index  )  [private]

Definition at line 398 of file v4lchannel.cpp.

Referenced by SetDefaultFreqTable(), and SetFreqTable().

int V4LChannel::SetFreqTable ( const QString &  name  )  [private, virtual]

Reimplemented from ChannelBase.

Definition at line 404 of file v4lchannel.cpp.

bool V4LChannel::SetInputAndFormat ( int  newcapchannel,
QString  newFmt 
) [private]

Definition at line 634 of file v4lchannel.cpp.

Referenced by SetFormat(), and SwitchToInput().

int V4LChannel::GetCurrentChannelNum ( const QString &  channame  )  [private]

Definition at line 440 of file v4lchannel.cpp.

Referenced by Tune().

QString V4LChannel::GetFormatForChannel ( QString  channum,
QString  inputname 
) [private]

Definition at line 612 of file v4lchannel.cpp.

Referenced by SwitchToInput().

bool V4LChannel::InitPictureAttribute ( const QString  db_col_name  )  [private]

Definition at line 849 of file v4lchannel.cpp.

Referenced by InitPictureAttributes().

bool V4LChannel::InitializeInputs ( void   )  [private, virtual]

This enumerates the inputs, converts the format string to something the hardware understands, and if the parent pointer is valid retrieves the channels from the database.

Reimplemented from ChannelBase.

Definition at line 310 of file v4lchannel.cpp.

Referenced by Open().


Member Data Documentation

QString V4LChannel::device [private]

Definition at line 83 of file v4lchannel.h.

Referenced by GetDevice(), Open(), SetFreqTable(), SwitchToInput(), and Tune().

int V4LChannel::videofd [private]
QString V4LChannel::device_name [private]

Definition at line 85 of file v4lchannel.h.

Referenced by InitPictureAttribute(), and Open().

QString V4LChannel::driver_name [private]

Definition at line 86 of file v4lchannel.h.

Referenced by Open().

QMap<QString,int> V4LChannel::pict_attr_default [private]

Definition at line 87 of file v4lchannel.h.

Referenced by GetPictureAttribute(), and InitPictureAttribute().

struct CHANLIST* V4LChannel::curList [private]

Definition at line 89 of file v4lchannel.h.

Referenced by GetCurrentChannelNum(), SetFreqTable(), and Tune().

Definition at line 90 of file v4lchannel.h.

Referenced by GetCurrentChannelNum(), and SetFreqTable().

QString V4LChannel::currentFormat [private]

Definition at line 92 of file v4lchannel.h.

Referenced by SetFormat(), and SwitchToInput().

Set to true if tuner accepts v4l2 commands.

Definition at line 93 of file v4lchannel.h.

Referenced by ChangePictureAttribute(), InitPictureAttribute(), Open(), Retune(), SetInputAndFormat(), and Tune().

Definition at line 94 of file v4lchannel.h.

Referenced by Open(), and SetInputAndFormat().

Definition at line 95 of file v4lchannel.h.

Referenced by Open().

Definition at line 96 of file v4lchannel.h.

Referenced by Open().

Definition at line 97 of file v4lchannel.h.

Referenced by Open().

Definition at line 98 of file v4lchannel.h.

Referenced by Open().

Current video mode if 'usingv4l2' is false.

Definition at line 100 of file v4lchannel.h.

Referenced by InitializeInputs().

Current video mode if 'usingv4l2' is true.

Definition at line 101 of file v4lchannel.h.

Referenced by InitializeInputs().

Definition at line 103 of file v4lchannel.h.

Referenced by SetDefaultFreqTable(), and SetFreqTable().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Generated on Mon May 28 06:42:31 2012 for MythTV by  doxygen 1.6.3