This class creates a preview image of a recording. More...
#include <previewgenerator.h>
Public Types | |
| enum | Mode { kNone = 0x0, kLocal = 0x1, kRemote = 0x2, kLocalAndRemote = 0x3, kForceLocal = 0x5, kModeMask = 0x7 } |
| typedef enum PreviewGenerator::Mode | Mode |
Public Slots | |
| void | deleteLater () |
Public Member Functions | |
| PreviewGenerator (const ProgramInfo *pginfo, const QString &token, Mode mode=kLocal) | |
| Constructor. | |
| void | SetPreviewTime (long long time, bool in_seconds) |
| void | SetPreviewTimeAsSeconds (long long seconds_in) |
| void | SetPreviewTimeAsFrameNumber (long long frame_number) |
| void | SetOutputFilename (const QString &) |
| void | SetOutputSize (const QSize &size) |
| QString | GetToken (void) const |
| void | run (void) |
| Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead. | |
| bool | Run (void) |
| void | AttachSignals (QObject *) |
Protected Member Functions | |
| virtual | ~PreviewGenerator () |
| void | TeardownAll (void) |
| bool | RemotePreviewRun (void) |
| bool | LocalPreviewRun (void) |
| bool | IsLocal (void) const |
| bool | RunReal (void) |
| This call creates a preview without starting a new thread. | |
| virtual bool | event (QEvent *e) |
| bool | SaveOutFile (const QByteArray &data, const QDateTime &dt) |
Static Protected Member Functions | |
| static char * | GetScreenGrab (const ProgramInfo &pginfo, const QString &filename, long long seektime, bool time_in_secs, int &bufferlen, int &video_width, int &video_height, float &video_aspect) |
| Returns a PIX_FMT_RGBA32 buffer containg a frame from the video. | |
| static bool | SavePreview (QString filename, const unsigned char *data, uint width, uint height, float aspect, int desired_width, int desired_height) |
| static QString | CreateAccessibleFilename (const QString &pathname, const QString &outFileName) |
Protected Attributes | |
| QWaitCondition | previewWaitCondition |
| QMutex | previewLock |
| ProgramInfo | programInfo |
| Mode | mode |
| QObject * | listener |
| QString | pathname |
| bool | timeInSeconds |
| tells us whether to use time as seconds or frame number | |
| long long | captureTime |
| snapshot time in seconds or frame number, depending on timeInSeconds | |
| QString | outFileName |
| QSize | outSize |
| QString | token |
| bool | gotReply |
| bool | pixmapOk |
Friends | |
| int | preview_helper (uint chanid, QDateTime starttime, long long previewFrameNumber, long long previewSeconds, const QSize &previewSize, const QString &infile, const QString &outfile) |
This class creates a preview image of a recording.
The usage is simple: First, pass a ProgramInfo whose pathname points to a local or remote recording to the constructor. Then call either start(void) or Run(void) to generate the preview.
start(void) will create a thread that processes the request.
Run(void) will block until the preview completes.
The PreviewGenerator will send a PREVIEW_SUCCESS or a PREVIEW_FAILED event when the preview completes or fails.
Definition at line 26 of file previewgenerator.h.
| typedef enum PreviewGenerator::Mode PreviewGenerator::Mode |
Definition at line 39 of file previewgenerator.h.
| PreviewGenerator::PreviewGenerator | ( | const ProgramInfo * | pginfo, | |
| const QString & | _token, | |||
| PreviewGenerator::Mode | _mode = kLocal | |||
| ) |
Constructor.
ProgramInfo::pathname must include recording prefix, so that the file can be found on the file system for local preview generation. When called by the backend 'local_only' should be set to true, otherwise the backend may deadlock if the PreviewGenerator cannot find the file.
| pginfo | ProgramInfo for the recording we want a preview of. | |
| local_only | If set to true, the preview will only be generated if the file is local. |
Definition at line 67 of file previewgenerator.cpp.
| PreviewGenerator::~PreviewGenerator | ( | ) | [protected, virtual] |
Definition at line 78 of file previewgenerator.cpp.
| void PreviewGenerator::SetPreviewTime | ( | long long | time, | |
| bool | in_seconds | |||
| ) | [inline] |
Definition at line 54 of file previewgenerator.h.
Referenced by PreviewGeneratorQueue::GeneratePreviewImage().
| void PreviewGenerator::SetPreviewTimeAsSeconds | ( | long long | seconds_in | ) | [inline] |
Definition at line 56 of file previewgenerator.h.
Referenced by Content::GetPreviewImage(), and preview_helper().
| void PreviewGenerator::SetPreviewTimeAsFrameNumber | ( | long long | frame_number | ) | [inline] |
Definition at line 58 of file previewgenerator.h.
Referenced by preview_helper().
| void PreviewGenerator::SetOutputFilename | ( | const QString & | fileName | ) |
Definition at line 84 of file previewgenerator.cpp.
Referenced by PreviewGeneratorQueue::GeneratePreviewImage(), Content::GetPreviewImage(), and preview_helper().
| void PreviewGenerator::SetOutputSize | ( | const QSize & | size | ) | [inline] |
Definition at line 61 of file previewgenerator.h.
Referenced by PreviewGeneratorQueue::GeneratePreviewImage(), Content::GetPreviewImage(), and preview_helper().
| QString PreviewGenerator::GetToken | ( | void | ) | const [inline] |
Definition at line 63 of file previewgenerator.h.
Referenced by PreviewGeneratorQueue::SetPreviewGenerator().
| void PreviewGenerator::run | ( | void | ) | [virtual] |
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Reimplemented from MThread.
Definition at line 327 of file previewgenerator.cpp.
| bool PreviewGenerator::Run | ( | void | ) |
Definition at line 192 of file previewgenerator.cpp.
Referenced by JobQueue::DoFlagCommercialsThread(), Content::GetPreviewImage(), and run().
| void PreviewGenerator::AttachSignals | ( | QObject * | obj | ) |
Definition at line 102 of file previewgenerator.cpp.
Referenced by PreviewGeneratorQueue::SetPreviewGenerator().
| void PreviewGenerator::deleteLater | ( | void | ) | [slot] |
Definition at line 96 of file previewgenerator.cpp.
Referenced by JobQueue::DoFlagCommercialsThread(), Content::GetPreviewImage(), preview_helper(), and PreviewGeneratorQueue::SetPreviewGenerator().
| void PreviewGenerator::TeardownAll | ( | void | ) | [protected] |
Definition at line 89 of file previewgenerator.cpp.
Referenced by deleteLater(), and ~PreviewGenerator().
| bool PreviewGenerator::RemotePreviewRun | ( | void | ) | [protected] |
Definition at line 334 of file previewgenerator.cpp.
| bool PreviewGenerator::LocalPreviewRun | ( | void | ) | [protected] |
Definition at line 600 of file previewgenerator.cpp.
Referenced by RunReal().
| bool PreviewGenerator::IsLocal | ( | void | ) | const [protected] |
Definition at line 719 of file previewgenerator.cpp.
| bool PreviewGenerator::RunReal | ( | void | ) | [protected] |
This call creates a preview without starting a new thread.
Definition at line 111 of file previewgenerator.cpp.
Referenced by preview_helper().
| char * PreviewGenerator::GetScreenGrab | ( | const ProgramInfo & | pginfo, | |
| const QString & | filename, | |||
| long long | seektime, | |||
| bool | time_in_secs, | |||
| int & | bufferlen, | |||
| int & | video_width, | |||
| int & | video_height, | |||
| float & | video_aspect | |||
| ) | [static, protected] |
Returns a PIX_FMT_RGBA32 buffer containg a frame from the video.
| pginfo | Recording to grab from. | |
| filename | File containing recording. | |
| seektime | Seconds or frames into the video to seek before capturing a frame. | |
| time_in_secs | if true time is in seconds, otherwise it is in frames. | |
| bufferlen | Returns size of buffer returned (in bytes). | |
| video_width | Returns width of frame grabbed. | |
| video_height | Returns height of frame grabbed. | |
| video_aspect | Returns aspect ratio of frame grabbed. |
Definition at line 757 of file previewgenerator.cpp.
Referenced by LocalPreviewRun().
| bool PreviewGenerator::SavePreview | ( | QString | filename, | |
| const unsigned char * | data, | |||
| uint | width, | |||
| uint | height, | |||
| float | aspect, | |||
| int | desired_width, | |||
| int | desired_height | |||
| ) | [static, protected] |
Definition at line 531 of file previewgenerator.cpp.
Referenced by LocalPreviewRun().
| QString PreviewGenerator::CreateAccessibleFilename | ( | const QString & | pathname, | |
| const QString & | outFileName | |||
| ) | [static, protected] |
Definition at line 688 of file previewgenerator.cpp.
Referenced by LocalPreviewRun().
| bool PreviewGenerator::event | ( | QEvent * | e | ) | [protected, virtual] |
Definition at line 395 of file previewgenerator.cpp.
| bool PreviewGenerator::SaveOutFile | ( | const QByteArray & | data, | |
| const QDateTime & | dt | |||
| ) | [protected] |
Definition at line 466 of file previewgenerator.cpp.
Referenced by event().
| int preview_helper | ( | uint | chanid, | |
| QDateTime | starttime, | |||
| long long | previewFrameNumber, | |||
| long long | previewSeconds, | |||
| const QSize & | previewSize, | |||
| const QString & | infile, | |||
| const QString & | outfile | |||
| ) | [friend] |
Definition at line 88 of file mythtv/programs/mythpreviewgen/main.cpp.
QWaitCondition PreviewGenerator::previewWaitCondition [protected] |
Definition at line 105 of file previewgenerator.h.
Referenced by event(), RemotePreviewRun(), and TeardownAll().
QMutex PreviewGenerator::previewLock [protected] |
Definition at line 106 of file previewgenerator.h.
Referenced by AttachSignals(), event(), RemotePreviewRun(), Run(), RunReal(), and TeardownAll().
ProgramInfo PreviewGenerator::programInfo [protected] |
Definition at line 107 of file previewgenerator.h.
Referenced by LocalPreviewRun(), RemotePreviewRun(), Run(), RunReal(), and SaveOutFile().
Mode PreviewGenerator::mode [protected] |
Definition at line 109 of file previewgenerator.h.
QObject* PreviewGenerator::listener [protected] |
Definition at line 110 of file previewgenerator.h.
Referenced by AttachSignals(), Run(), RunReal(), and TeardownAll().
QString PreviewGenerator::pathname [protected] |
Definition at line 111 of file previewgenerator.h.
Referenced by IsLocal(), LocalPreviewRun(), Run(), and RunReal().
bool PreviewGenerator::timeInSeconds [protected] |
tells us whether to use time as seconds or frame number
Definition at line 114 of file previewgenerator.h.
Referenced by LocalPreviewRun(), RemotePreviewRun(), and Run().
long long PreviewGenerator::captureTime [protected] |
snapshot time in seconds or frame number, depending on timeInSeconds
Definition at line 116 of file previewgenerator.h.
Referenced by LocalPreviewRun(), RemotePreviewRun(), and Run().
QString PreviewGenerator::outFileName [protected] |
Definition at line 117 of file previewgenerator.h.
Referenced by IsLocal(), LocalPreviewRun(), RemotePreviewRun(), Run(), RunReal(), SaveOutFile(), and SetOutputFilename().
QSize PreviewGenerator::outSize [protected] |
Definition at line 118 of file previewgenerator.h.
Referenced by LocalPreviewRun(), RemotePreviewRun(), and Run().
QString PreviewGenerator::token [protected] |
Definition at line 120 of file previewgenerator.h.
Referenced by event(), RemotePreviewRun(), Run(), and RunReal().
bool PreviewGenerator::gotReply [protected] |
Definition at line 121 of file previewgenerator.h.
Referenced by event(), and RemotePreviewRun().
bool PreviewGenerator::pixmapOk [protected] |
Definition at line 122 of file previewgenerator.h.
Referenced by event(), and RemotePreviewRun().
1.6.3