#include <frame.h>
Public Member Functions | |
| Frame () | |
| constructor | |
| ~Frame () | |
| bool | GetSSYBPack (int packNum, Pack &pack) const |
| gets a subcode data packet | |
| bool | GetVAUXPack (int packNum, Pack &pack) const |
| gets a video auxiliary data packet | |
| bool | GetAAUXPack (int packNum, Pack &pack) const |
| gets an audio auxiliary data packet | |
| bool | GetTimeCode (TimeCode &timeCode) const |
| gets the timecode information of this frame | |
| bool | GetRecordingDate (struct tm &recDate) const |
| gets the date and time of recording of this frame | |
| string | GetRecordingDate (void) const |
| bool | GetAudioInfo (AudioInfo &info) const |
| gets the audio properties of this frame | |
| bool | GetVideoInfo (VideoInfo &info) const |
| int | GetFrameSize (void) const |
| gets the size of the frame | |
| float | GetFrameRate (void) const |
| gets the frame rate of the video | |
| bool | IsPAL (void) const |
| checks whether the frame is in PAL or NTSC format | |
| bool | IsNewRecording (void) const |
| checks whether this frame is the first in a new recording | |
| bool | IsNormalSpeed (void) const |
| checks whether this frame is playing at normal speed | |
| bool | IsComplete (void) const |
| check whether we have received as many bytes as expected for this frame | |
| int | ExtractAudio (void *sound) const |
| retrieves the audio data from the frame | |
| void | SetPreferredQuality () |
| int | ExtractAudio (int16_t **channels) const |
| retrieves the audio data from the frame | |
| void | ExtractHeader (void) |
| void | Deinterlace (uint8_t *pdst, uint8_t *psrc, int stride, int height) |
| int | ExtractRGB (void *rgb) |
| int | ExtractPreviewRGB (void *rgb) |
| int | ExtractYUV (void *yuv) |
| int | ExtractYUV420 (uint8_t *yuv, uint8_t *output[3]) |
| int | ExtractPreviewYUV (void *yuv) |
| bool | IsWide (void) const |
| Get the frame aspect ratio. | |
| int | GetWidth () |
| Get the frame image width. | |
| int | GetHeight () |
| Get the frame image height. | |
| void | SetRecordingDate (time_t *datetime, int frame) |
| Set the RecordingDate of the frame. | |
| void | SetTimeCode (int frame) |
| Set the TimeCode of the frame. | |
| bool | EncodeAudio (AudioInfo &info, int16_t **channels) |
| void | GetUpperField (void *image, int bpp) |
| void | GetLowerField (void *image, int bpp) |
Static Public Member Functions | |
| static int | CalculateNumberSamples (int frequency, int iteration) |
Public Attributes | |
| unsigned char | data [144000] |
| enough space to hold a PAL frame | |
| int | bytesInFrame |
| the number of bytes written to the frame | |
| AVCodecContext | libavcodec |
| dv_decoder_t * | decoder |
| int16_t * | audio_buffers [4] |
Static Private Attributes | |
| static bool | maps_initialized = false |
| flag for initializing the lookup maps once at startup | |
| static int | palmap_ch1 [2000] |
| lookup tables for collecting the shuffled audio data | |
| static int | palmap_ch2 [2000] |
| static int | palmap_2ch1 [2000] |
| static int | palmap_2ch2 [2000] |
| static int | ntscmap_ch1 [2000] |
| static int | ntscmap_ch2 [2000] |
| static int | ntscmap_2ch1 [2000] |
| static int | ntscmap_2ch2 [2000] |
| static short | compmap [4096] |
| Frame::Frame | ( | ) |
constructor
All Frame objects share a set of lookup maps, which are initalized once (we are using a variant of the Singleton pattern).
| Frame::~Frame | ( | ) |
| int Frame::CalculateNumberSamples | ( | int | frequency, | |
| int | iteration | |||
| ) | [static] |
| void Frame::Deinterlace | ( | uint8_t * | pdst, | |
| uint8_t * | psrc, | |||
| int | stride, | |||
| int | height | |||
| ) |
| bool Frame::EncodeAudio | ( | AudioInfo & | info, | |
| int16_t ** | channels | |||
| ) |
| int Frame::ExtractAudio | ( | int16_t ** | channels | ) | const |
retrieves the audio data from the frame
The DV frame contains audio data mixed in the video data blocks, which can be retrieved easily using this function.
The audio data consists of 16 bit, two channel audio samples (a 16 bit word for channel 1, followed by a 16 bit word for channel 2 etc.)
| channels | an array of buffers of audio data, one per channel, up to four channels |
| int Frame::ExtractAudio | ( | void * | sound | ) | const |
retrieves the audio data from the frame
The DV frame contains audio data mixed in the video data blocks, which can be retrieved easily using this function.
The audio data consists of 16 bit, two channel audio samples (a 16 bit word for channel 1, followed by a 16 bit word for channel 2 etc.)
| sound | a pointer to a buffer that holds the audio data |
| void Frame::ExtractHeader | ( | void | ) |
| int Frame::ExtractPreviewRGB | ( | void * | rgb | ) |
| int Frame::ExtractPreviewYUV | ( | void * | yuv | ) |
| int Frame::ExtractRGB | ( | void * | rgb | ) |
| int Frame::ExtractYUV | ( | void * | yuv | ) |
| int Frame::ExtractYUV420 | ( | uint8_t * | yuv, | |
| uint8_t * | output[3] | |||
| ) |
| bool Frame::GetAAUXPack | ( | int | packNum, | |
| Pack & | pack | |||
| ) | const |
gets an audio auxiliary data packet
Every DIF block in the audio section contains 5 bytes audio auxiliary data and 72 bytes of audio data. The function searches through all DIF blocks although AAUX packets are only allowed in certain defined DIF blocks.
| packNum | the AAUX package id to return | |
| pack | a reference to the variable where the result is stored |
| bool Frame::GetAudioInfo | ( | AudioInfo & | info | ) | const |
gets the audio properties of this frame
get the sampling frequency and the number of samples in this particular DV frame (which can vary)
| info | the AudioInfo record |
| float Frame::GetFrameRate | ( | void | ) | const |
gets the frame rate of the video
Depending on the type (PAL or NTSC) of the frame, the frame rate is returned
| int Frame::GetFrameSize | ( | void | ) | const |
gets the size of the frame
Depending on the type (PAL or NTSC) of the frame, the length of the frame is returned
| int Frame::GetHeight | ( | ) |
Get the frame image height.
| void Frame::GetLowerField | ( | void * | image, | |
| int | bpp | |||
| ) |
| string Frame::GetRecordingDate | ( | void | ) | const |
| bool Frame::GetRecordingDate | ( | struct tm & | recDate | ) | const |
gets the date and time of recording of this frame
Returns a struct tm with date and time of recording of this frame.
This code courtesy of Andy (http://www.videox.net/)
| recDate | the time and date of recording of this frame |
| bool Frame::GetSSYBPack | ( | int | packNum, | |
| Pack & | pack | |||
| ) | const |
gets a subcode data packet
This function returns a SSYB packet from the subcode data section.
| packNum | the SSYB package id to return | |
| pack | a reference to the variable where the result is stored |
| bool Frame::GetTimeCode | ( | TimeCode & | timeCode | ) | const |
gets the timecode information of this frame
Returns a string with the timecode of this frame. The timecode is the relative location of this frame on the tape, and is defined by hour, minute, second and frame (within the last second).
| timeCode | the TimeCode struct |
| void Frame::GetUpperField | ( | void * | image, | |
| int | bpp | |||
| ) |
| bool Frame::GetVAUXPack | ( | int | packNum, | |
| Pack & | pack | |||
| ) | const |
gets a video auxiliary data packet
Every DIF block in the video auxiliary data section contains 15 video auxiliary data packets, for a total of 45 VAUX packets. As the position of a VAUX packet is fixed, we could directly look it up, but I choose to walk through all data as with the other routines.
| packNum | the VAUX package id to return | |
| pack | a reference to the variable where the result is stored |
| bool Frame::GetVideoInfo | ( | VideoInfo & | info | ) | const |
| int Frame::GetWidth | ( | ) |
Get the frame image width.
| bool Frame::IsComplete | ( | void | ) | const |
check whether we have received as many bytes as expected for this frame
| bool Frame::IsNewRecording | ( | void | ) | const |
checks whether this frame is the first in a new recording
To determine this, the function looks at the recStartPoint bit in AAUX pack 51.
| bool Frame::IsNormalSpeed | ( | void | ) | const |
checks whether this frame is playing at normal speed
To determine this, the function looks at the speed bit in AAUX pack 51.
| bool Frame::IsPAL | ( | void | ) | const |
checks whether the frame is in PAL or NTSC format
| bool Frame::IsWide | ( | void | ) | const |
Get the frame aspect ratio.
Indicates whether frame aspect ration is normal (4:3) or wide (16:9).
| void Frame::SetPreferredQuality | ( | ) |
| void Frame::SetRecordingDate | ( | time_t * | datetime, | |
| int | frame | |||
| ) |
Set the RecordingDate of the frame.
This updates the calendar date and time and the timecode. However, timecode is derived from the time in the datetime parameter and frame number. Use SetTimeCode for more control over timecode.
| datetime | A simple time value containing the RecordingDate and time information. The time in this structure is automatically incremented by one second depending on the frame parameter and updatded. | |
| frame | A zero-based running frame sequence/serial number. This is used both in the timecode as well as a timestamp on dif block headers. |
| void Frame::SetTimeCode | ( | int | frame | ) |
Set the TimeCode of the frame.
This function takes a zero-based frame counter and automatically derives the timecode.
| frame | The frame counter. |
| int16_t* Frame::audio_buffers[4] |
the number of bytes written to the frame
short Frame::compmap [static, private] |
| unsigned char Frame::data[144000] |
enough space to hold a PAL frame
| dv_decoder_t* Frame::decoder |
| AVCodecContext Frame::libavcodec |
bool Frame::maps_initialized = false [static, private] |
flag for initializing the lookup maps once at startup
int Frame::ntscmap_2ch1 [static, private] |
int Frame::ntscmap_2ch2 [static, private] |
int Frame::ntscmap_ch1 [static, private] |
int Frame::ntscmap_ch2 [static, private] |
int Frame::palmap_2ch1 [static, private] |
int Frame::palmap_2ch2 [static, private] |
int Frame::palmap_ch1 [static, private] |
lookup tables for collecting the shuffled audio data
int Frame::palmap_ch2 [static, private] |
1.4.7