#include <mpegrecorder.h>
Public Member Functions | |
| MpegRecorder (TVRec *) | |
| ~MpegRecorder () | |
| void | TeardownAll (void) |
| void | SetOption (const QString &opt, int value) |
| handles the "wait_for_seqstart" option. | |
| void | SetOption (const QString &name, const QString &value) |
| Set an specific option. | |
| void | SetVideoFilters (QString &) |
| Tells recorder which filters to use. | |
| void | SetOptionsFromProfile (RecordingProfile *profile, const QString &videodev, const QString &audiodev, const QString &vbidev) |
| Sets basic recorder options. | |
| void | Initialize (void) |
| This is called between SetOptionsFromProfile() and run() to initialize any devices, etc. | |
| void | run (void) |
| run() starts the recording process, and does not exit until the recording is complete. | |
| void | StopRecording (void) |
| StopRecording() signals to the recorder that it should stop recording and exit cleanly. | |
| void | Reset (void) |
| Reset the recorder to the startup state. | |
| void | Pause (bool clear=true) |
| Pause tells recorder to pause, it should not block. | |
| bool | PauseAndWait (int timeout=100) |
| If request_pause is true, sets pause and blocks up to timeout milliseconds or until unpaused, whichever is sooner. | |
| bool | IsRecording (void) |
| Tells whether the StartRecorder() loop is running. | |
| bool | Open (void) |
| int | GetVideoFd (void) |
| Returns file descriptor of recorder device. | |
| virtual void | SetStreamData (void) |
| bool | ProcessTSPacket (const TSPacket &tspacket) |
| virtual void | ReaderPaused (int fd) |
| virtual void | PriorityEvent (int fd) |
Private Member Functions | |
| void | SetIntOption (RecordingProfile *profile, const QString &name) |
| Convenience function used to set integer options from a profile. | |
| void | SetStrOption (RecordingProfile *profile, const QString &name) |
| Convenience function used to set QString options from a profile. | |
| bool | OpenMpegFileAsInput (void) |
| bool | OpenV4L2DeviceAsInput (void) |
| bool | SetV4L2DeviceOptions (int chanfd) |
| bool | SetVideoCaptureFormat (int chanfd) |
| bool | SetLanguageMode (int chanfd) |
| Set audio language mode. | |
| bool | SetRecordingVolume (int chanfd) |
| bool | SetVBIOptions (int chanfd) |
| uint | GetFilteredStreamType (void) const |
| uint | GetFilteredAudioSampleRate (void) const |
| uint | GetFilteredAudioLayer (void) const |
| uint | GetFilteredAudioBitRate (uint audio_layer) const |
| void | RestartEncoding (void) |
| bool | StartEncoding (int fd) |
| bool | StopEncoding (int fd) |
| void | SetBitrate (int bitrate, int maxbitrate, const QString &reason) |
| void | HandleResolutionChanges (void) |
| virtual void | FormatCC (uint code1, uint code2) |
Private Attributes | |
| bool | deviceIsMpegFile |
| int | bufferSize |
| QString | card |
| QString | driver |
| uint32_t | version |
| bool | supports_sliced_vbi |
| QMutex | start_stop_encoding_lock |
| bool | cleartimeonpause |
| int | width |
| int | height |
| int | bitrate |
| int | maxbitrate |
| int | streamtype |
| int | aspectratio |
| int | audtype |
| int | audsamplerate |
| int | audbitratel1 |
| int | audbitratel2 |
| int | audbitratel3 |
| int | audvolume |
| unsigned int | language |
| 0 is Main Lang; 1 is SAP Lang; 2 is Dual | |
| unsigned int | low_mpeg4avgbitrate |
| unsigned int | low_mpeg4peakbitrate |
| unsigned int | medium_mpeg4avgbitrate |
| unsigned int | medium_mpeg4peakbitrate |
| unsigned int | high_mpeg4avgbitrate |
| unsigned int | high_mpeg4peakbitrate |
| int | chanfd |
| int | readfd |
| DeviceReadBuffer * | _device_read_buffer |
Static Private Attributes | |
| static const int | audRateL1 [] |
| static const int | audRateL2 [] |
| static const int | audRateL3 [] |
| static const char * | streamType [] |
| static const char * | aspectRatio [] |
| static const unsigned int | kBuildBufferMaxSize |
Definition at line 14 of file mpegrecorder.h.
| MpegRecorder::MpegRecorder | ( | TVRec * | rec | ) |
Definition at line 79 of file mpegrecorder.cpp.
| MpegRecorder::~MpegRecorder | ( | ) |
Definition at line 108 of file mpegrecorder.cpp.
| void MpegRecorder::TeardownAll | ( | void | ) |
Definition at line 113 of file mpegrecorder.cpp.
Referenced by ~MpegRecorder().
| void MpegRecorder::SetOption | ( | const QString & | name, | |
| int | value | |||
| ) | [virtual] |
handles the "wait_for_seqstart" option.
Reimplemented from V4LRecorder.
Definition at line 140 of file mpegrecorder.cpp.
Referenced by SetIntOption(), SetOption(), SetOptionsFromProfile(), and SetStrOption().
| void MpegRecorder::SetOption | ( | const QString & | opt, | |
| const QString & | value | |||
| ) | [virtual] |
Set an specific option.
Base options include: codec, videodevice, tvformat (ntsc,ntsc-jp,pal-m), vbiformat ("none","pal teletext","ntsc").
Reimplemented from V4LRecorder.
Definition at line 213 of file mpegrecorder.cpp.
| void MpegRecorder::SetVideoFilters | ( | QString & | filters | ) | [inline, virtual] |
Tells recorder which filters to use.
These filters are used by frame grabber encoders to lower the bitrate while keeping quality good. They must execute quickly so that frames are not lost by the recorder.
Reimplemented from DTVRecorder.
Definition at line 24 of file mpegrecorder.h.
| void MpegRecorder::SetOptionsFromProfile | ( | RecordingProfile * | profile, | |
| const QString & | videodev, | |||
| const QString & | audiodev, | |||
| const QString & | vbidev | |||
| ) | [virtual] |
Sets basic recorder options.
SetOptionsFromProfile is used to tell the recorder about the recording profile as well as the devices to use.
Reimplemented from DTVRecorder.
Definition at line 290 of file mpegrecorder.cpp.
| void MpegRecorder::Initialize | ( | void | ) | [inline, virtual] |
This is called between SetOptionsFromProfile() and run() to initialize any devices, etc.
Reimplemented from DTVRecorder.
Definition at line 31 of file mpegrecorder.h.
| void MpegRecorder::run | ( | void | ) | [virtual] |
run() starts the recording process, and does not exit until the recording is complete.
Implements RecorderBase.
Definition at line 901 of file mpegrecorder.cpp.
| void MpegRecorder::StopRecording | ( | void | ) | [virtual] |
StopRecording() signals to the recorder that it should stop recording and exit cleanly.
This function should block until recorder has finished up.
Reimplemented from V4LRecorder.
Definition at line 1179 of file mpegrecorder.cpp.
Referenced by TeardownAll().
| void MpegRecorder::Reset | ( | void | ) | [virtual] |
Reset the recorder to the startup state.
This is used after Pause(bool), WaitForPause() and after the RingBuffer's StopReads() method has been called.
Reimplemented from DTVRecorder.
Definition at line 1212 of file mpegrecorder.cpp.
| void MpegRecorder::Pause | ( | bool | clear = true |
) | [virtual] |
Pause tells recorder to pause, it should not block.
Once paused the recorder calls tvrec->RecorderPaused().
| clear | if true any generated timecodes should be reset. |
Reimplemented from RecorderBase.
Definition at line 1227 of file mpegrecorder.cpp.
| bool MpegRecorder::PauseAndWait | ( | int | timeout = 100 |
) | [virtual] |
If request_pause is true, sets pause and blocks up to timeout milliseconds or until unpaused, whichever is sooner.
This is the where we actually do the pausing. For most recorders that need to do something special on pause, this is the method to overide.
| timeout | number of milliseconds to wait defaults to 100. |
Reimplemented from RecorderBase.
Definition at line 1235 of file mpegrecorder.cpp.
Referenced by run().
| bool MpegRecorder::IsRecording | ( | void | ) | [inline, virtual] |
Tells whether the StartRecorder() loop is running.
Reimplemented from RecorderBase.
Definition at line 39 of file mpegrecorder.h.
| bool MpegRecorder::Open | ( | void | ) |
Definition at line 895 of file mpegrecorder.cpp.
Referenced by run().
| int MpegRecorder::GetVideoFd | ( | void | ) | [inline, virtual] |
Returns file descriptor of recorder device.
This is used by channel when only one open file descriptor is allowed on a device node. This is the case with video4linux devices and similar devices in BSD. It is not needed by newer drivers, such as those used for DVB.
Reimplemented from DTVRecorder.
Definition at line 42 of file mpegrecorder.h.
| void MpegRecorder::SetStreamData | ( | void | ) | [virtual] |
Reimplemented from DTVRecorder.
Definition at line 1392 of file mpegrecorder.cpp.
Referenced by run().
Reimplemented from DTVRecorder.
Definition at line 1188 of file mpegrecorder.cpp.
| virtual void MpegRecorder::ReaderPaused | ( | int | fd | ) | [inline, virtual] |
Implements DeviceReaderCB.
Definition at line 51 of file mpegrecorder.h.
| virtual void MpegRecorder::PriorityEvent | ( | int | fd | ) | [inline, virtual] |
Implements DeviceReaderCB.
Definition at line 52 of file mpegrecorder.h.
| void MpegRecorder::SetIntOption | ( | RecordingProfile * | profile, | |
| const QString & | name | |||
| ) | [private] |
Convenience function used to set integer options from a profile.
Reimplemented from RecorderBase.
Definition at line 344 of file mpegrecorder.cpp.
Referenced by SetOptionsFromProfile().
| void MpegRecorder::SetStrOption | ( | RecordingProfile * | profile, | |
| const QString & | name | |||
| ) | [private] |
Convenience function used to set QString options from a profile.
Reimplemented from RecorderBase.
Definition at line 352 of file mpegrecorder.cpp.
Referenced by SetOptionsFromProfile().
| bool MpegRecorder::OpenMpegFileAsInput | ( | void | ) | [private] |
Definition at line 359 of file mpegrecorder.cpp.
Referenced by Open().
| bool MpegRecorder::OpenV4L2DeviceAsInput | ( | void | ) | [private] |
Definition at line 374 of file mpegrecorder.cpp.
Referenced by Open().
| bool MpegRecorder::SetV4L2DeviceOptions | ( | int | chanfd | ) | [private] |
Definition at line 746 of file mpegrecorder.cpp.
Referenced by OpenV4L2DeviceAsInput(), PauseAndWait(), and RestartEncoding().
| bool MpegRecorder::SetVideoCaptureFormat | ( | int | chanfd | ) | [private] |
Definition at line 482 of file mpegrecorder.cpp.
Referenced by OpenV4L2DeviceAsInput().
| bool MpegRecorder::SetLanguageMode | ( | int | chanfd | ) | [private] |
Set audio language mode.
Definition at line 511 of file mpegrecorder.cpp.
Referenced by OpenV4L2DeviceAsInput().
| bool MpegRecorder::SetRecordingVolume | ( | int | chanfd | ) | [private] |
Definition at line 556 of file mpegrecorder.cpp.
Referenced by OpenV4L2DeviceAsInput().
| bool MpegRecorder::SetVBIOptions | ( | int | chanfd | ) | [private] |
Definition at line 840 of file mpegrecorder.cpp.
Referenced by OpenV4L2DeviceAsInput().
| uint MpegRecorder::GetFilteredStreamType | ( | void | ) | const [private] |
Definition at line 591 of file mpegrecorder.cpp.
Referenced by SetV4L2DeviceOptions().
| uint MpegRecorder::GetFilteredAudioSampleRate | ( | void | ) | const [private] |
Definition at line 620 of file mpegrecorder.cpp.
Referenced by SetV4L2DeviceOptions().
| uint MpegRecorder::GetFilteredAudioLayer | ( | void | ) | const [private] |
Definition at line 643 of file mpegrecorder.cpp.
Referenced by SetLanguageMode(), and SetV4L2DeviceOptions().
Definition at line 662 of file mpegrecorder.cpp.
Referenced by SetV4L2DeviceOptions().
| void MpegRecorder::RestartEncoding | ( | void | ) | [private] |
Definition at line 1289 of file mpegrecorder.cpp.
Referenced by run().
| bool MpegRecorder::StartEncoding | ( | int | fd | ) | [private] |
Definition at line 1323 of file mpegrecorder.cpp.
Referenced by PauseAndWait(), RestartEncoding(), and run().
| bool MpegRecorder::StopEncoding | ( | int | fd | ) | [private] |
Definition at line 1362 of file mpegrecorder.cpp.
Referenced by PauseAndWait(), RestartEncoding(), and run().
| void MpegRecorder::SetBitrate | ( | int | bitrate, | |
| int | maxbitrate, | |||
| const QString & | reason | |||
| ) | [private] |
Definition at line 1398 of file mpegrecorder.cpp.
Referenced by HandleResolutionChanges().
| void MpegRecorder::HandleResolutionChanges | ( | void | ) | [private] |
Definition at line 1427 of file mpegrecorder.cpp.
Referenced by StartEncoding().
Reimplemented from V4LRecorder.
Definition at line 1483 of file mpegrecorder.cpp.
bool MpegRecorder::deviceIsMpegFile [private] |
Definition at line 79 of file mpegrecorder.h.
Referenced by Open(), run(), and SetOptionsFromProfile().
int MpegRecorder::bufferSize [private] |
Definition at line 80 of file mpegrecorder.h.
Referenced by OpenV4L2DeviceAsInput(), run(), and SetOptionsFromProfile().
QString MpegRecorder::card [private] |
Definition at line 83 of file mpegrecorder.h.
Referenced by OpenV4L2DeviceAsInput().
QString MpegRecorder::driver [private] |
Definition at line 84 of file mpegrecorder.h.
Referenced by GetFilteredAudioLayer(), GetFilteredAudioSampleRate(), GetFilteredStreamType(), OpenV4L2DeviceAsInput(), PauseAndWait(), ProcessTSPacket(), RestartEncoding(), run(), SetV4L2DeviceOptions(), SetVBIOptions(), SetVideoCaptureFormat(), and StartEncoding().
uint32_t MpegRecorder::version [private] |
Definition at line 85 of file mpegrecorder.h.
Referenced by OpenV4L2DeviceAsInput().
bool MpegRecorder::supports_sliced_vbi [private] |
Definition at line 86 of file mpegrecorder.h.
Referenced by OpenV4L2DeviceAsInput(), and SetVBIOptions().
QMutex MpegRecorder::start_stop_encoding_lock [mutable, private] |
Definition at line 89 of file mpegrecorder.h.
Referenced by OpenV4L2DeviceAsInput(), RestartEncoding(), StartEncoding(), and StopEncoding().
bool MpegRecorder::cleartimeonpause [private] |
Definition at line 92 of file mpegrecorder.h.
Referenced by Pause().
int MpegRecorder::width [private] |
Definition at line 95 of file mpegrecorder.h.
Referenced by SetOption(), and SetVideoCaptureFormat().
int MpegRecorder::height [private] |
Definition at line 95 of file mpegrecorder.h.
Referenced by SetOption(), and SetVideoCaptureFormat().
int MpegRecorder::bitrate [private] |
Definition at line 96 of file mpegrecorder.h.
Referenced by HandleResolutionChanges(), SetOption(), and SetV4L2DeviceOptions().
int MpegRecorder::maxbitrate [private] |
Definition at line 96 of file mpegrecorder.h.
Referenced by HandleResolutionChanges(), SetOption(), and SetV4L2DeviceOptions().
int MpegRecorder::streamtype [private] |
Definition at line 96 of file mpegrecorder.h.
Referenced by GetFilteredStreamType(), and SetOption().
int MpegRecorder::aspectratio [private] |
Definition at line 96 of file mpegrecorder.h.
Referenced by SetOption(), and SetV4L2DeviceOptions().
int MpegRecorder::audtype [private] |
Definition at line 97 of file mpegrecorder.h.
Referenced by GetFilteredAudioLayer(), SetOption(), and SetV4L2DeviceOptions().
int MpegRecorder::audsamplerate [private] |
Definition at line 97 of file mpegrecorder.h.
Referenced by GetFilteredAudioSampleRate(), and SetOption().
int MpegRecorder::audbitratel1 [private] |
Definition at line 97 of file mpegrecorder.h.
Referenced by GetFilteredAudioBitRate(), and SetOption().
int MpegRecorder::audbitratel2 [private] |
Definition at line 97 of file mpegrecorder.h.
Referenced by GetFilteredAudioBitRate(), and SetOption().
int MpegRecorder::audbitratel3 [private] |
Definition at line 97 of file mpegrecorder.h.
Referenced by GetFilteredAudioBitRate(), and SetOption().
int MpegRecorder::audvolume [private] |
Definition at line 98 of file mpegrecorder.h.
Referenced by SetOption(), and SetRecordingVolume().
unsigned int MpegRecorder::language [private] |
0 is Main Lang; 1 is SAP Lang; 2 is Dual
Definition at line 99 of file mpegrecorder.h.
Referenced by SetLanguageMode(), and SetOption().
unsigned int MpegRecorder::low_mpeg4avgbitrate [private] |
Definition at line 100 of file mpegrecorder.h.
Referenced by HandleResolutionChanges(), and SetOption().
unsigned int MpegRecorder::low_mpeg4peakbitrate [private] |
Definition at line 101 of file mpegrecorder.h.
Referenced by HandleResolutionChanges(), and SetOption().
unsigned int MpegRecorder::medium_mpeg4avgbitrate [private] |
Definition at line 102 of file mpegrecorder.h.
Referenced by HandleResolutionChanges(), and SetOption().
unsigned int MpegRecorder::medium_mpeg4peakbitrate [private] |
Definition at line 103 of file mpegrecorder.h.
Referenced by HandleResolutionChanges(), and SetOption().
unsigned int MpegRecorder::high_mpeg4avgbitrate [private] |
Definition at line 104 of file mpegrecorder.h.
Referenced by HandleResolutionChanges(), SetOption(), and SetV4L2DeviceOptions().
unsigned int MpegRecorder::high_mpeg4peakbitrate [private] |
Definition at line 105 of file mpegrecorder.h.
Referenced by HandleResolutionChanges(), SetOption(), and SetV4L2DeviceOptions().
int MpegRecorder::chanfd [private] |
Definition at line 108 of file mpegrecorder.h.
Referenced by GetVideoFd(), HandleResolutionChanges(), OpenMpegFileAsInput(), OpenV4L2DeviceAsInput(), PauseAndWait(), RestartEncoding(), and TeardownAll().
int MpegRecorder::readfd [private] |
Definition at line 109 of file mpegrecorder.h.
Referenced by OpenMpegFileAsInput(), OpenV4L2DeviceAsInput(), PauseAndWait(), RestartEncoding(), run(), SetBitrate(), and TeardownAll().
const int MpegRecorder::audRateL1 [static, private] |
{
32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0
}
Definition at line 111 of file mpegrecorder.h.
Referenced by SetOption().
const int MpegRecorder::audRateL2 [static, private] |
{
32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0
}
Definition at line 112 of file mpegrecorder.h.
Referenced by SetOption().
const int MpegRecorder::audRateL3 [static, private] |
{
32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0
}
Definition at line 113 of file mpegrecorder.h.
Referenced by SetOption().
const char * MpegRecorder::streamType [static, private] |
{
"MPEG-2 PS", "MPEG-2 TS", "MPEG-1 VCD", "PES AV",
"", "PES V", "", "PES A",
"", "", "DVD", "VCD",
"SVCD", "DVD-Special 1", "DVD-Special 2", 0
}
Definition at line 114 of file mpegrecorder.h.
Referenced by GetFilteredStreamType(), and SetOption().
const char * MpegRecorder::aspectRatio [static, private] |
{
"Square", "4:3", "16:9", "2.21:1", 0
}
Definition at line 115 of file mpegrecorder.h.
Referenced by SetOption().
const unsigned int MpegRecorder::kBuildBufferMaxSize [static, private] |
Definition at line 116 of file mpegrecorder.h.
Definition at line 119 of file mpegrecorder.h.
Referenced by OpenV4L2DeviceAsInput(), PauseAndWait(), RestartEncoding(), run(), and StopRecording().
1.6.3