Audacity 3.2.0
|
! Does actual import, returned by FFmpegImportPlugin::Open More...
Public Member Functions | |
FFmpegImportFileHandle (const FilePath &name) | |
~FFmpegImportFileHandle () | |
bool | Init () |
bool | InitCodecs () |
TranslatableString | GetFileDescription () override |
ByteCount | GetFileUncompressedBytes () override |
void | Import (ImportProgressListener &progressListener, WaveTrackFactory *trackFactory, TrackHolders &outTracks, Tags *tags, std::optional< LibFileFormats::AcidizerTags > &outAcidTags) override |
FilePath | GetFilename () const override |
void | Cancel () override |
void | Stop () override |
void | WriteData (StreamContext *sc, const AVPacketWrapper *packet) |
void | WriteMetadata (Tags *tags) |
void | GetMetadata (Tags &tags, const wxChar *tag, const char *name) |
wxInt32 | GetStreamCount () override |
const TranslatableStrings & | GetStreamInfo () override |
void | SetStreamUsage (wxInt32 StreamID, bool Use) override |
Public Member Functions inherited from ImportFileHandle | |
virtual | ~ImportFileHandle () |
virtual FilePath | GetFilename () const =0 |
virtual TranslatableString | GetErrorMessage () const |
virtual TranslatableString | GetFileDescription ()=0 |
virtual ByteCount | GetFileUncompressedBytes ()=0 |
virtual wxInt32 | GetStreamCount ()=0 |
virtual const TranslatableStrings & | GetStreamInfo ()=0 |
virtual void | SetStreamUsage (wxInt32 StreamID, bool Use)=0 |
virtual void | Import (ImportProgressListener &progressListener, WaveTrackFactory *trackFactory, TrackHolders &outTracks, Tags *tags, std::optional< LibFileFormats::AcidizerTags > &acidTags)=0 |
virtual void | Cancel ()=0 |
virtual void | Stop ()=0 |
Private Attributes | |
const std::shared_ptr< FFmpegFunctions > | mFFmpeg = FFmpegFunctions::Load() |
std::vector< StreamContext > | mStreamContexts |
std::unique_ptr< AVFormatContextWrapper > | mAVFormatContext |
TranslatableStrings | mStreamInfo |
Array of stream descriptions. After Init() and before Import(), same size as mStreamContexts. More... | |
wxInt64 | mProgressPos = 0 |
Current timestamp, file position or whatever is used as first argument for Update() More... | |
wxInt64 | mProgressLen = 1 |
Duration, total length or whatever is used as second argument for Update() More... | |
bool | mCancelled = false |
True if importing was canceled by user. More... | |
bool | mStopped = false |
True if importing was stopped by user. More... | |
const FilePath | mName |
std::vector< TrackListHolder > | mStreams |
Additional Inherited Members | |
Public Types inherited from ImportFileHandle | |
using | ByteCount = unsigned long long |
! Does actual import, returned by FFmpegImportPlugin::Open
An ImportFileHandle for FFmpeg data.
Definition at line 191 of file ImportFFmpeg.cpp.
FFmpegImportFileHandle::FFmpegImportFileHandle | ( | const FilePath & | name | ) |
Definition at line 336 of file ImportFFmpeg.cpp.
FFmpegImportFileHandle::~FFmpegImportFileHandle | ( | ) |
Definition at line 710 of file ImportFFmpeg.cpp.
|
overridevirtual |
Implements ImportFileHandle.
Definition at line 558 of file ImportFFmpeg.cpp.
References mCancelled, and mStopped.
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
Implements ImportFileHandle.
Definition at line 445 of file ImportFFmpeg.cpp.
void FFmpegImportFileHandle::GetMetadata | ( | Tags & | tags, |
const wxChar * | tag, | ||
const char * | name | ||
) |
! Retrieves metadata from FFmpeg and converts to wxString
avf | - file context \ tags - Audacity tags object \ tag - name of tag to set \ name - name of metadata item to retrieve |
Definition at line 701 of file ImportFFmpeg.cpp.
References DICT_IGNORE_SUFFIX, mAVFormatContext, name, and Tags::SetTag().
Referenced by WriteMetadata().
|
inlineoverridevirtual |
! Called by Import.cpp
Implements ImportFileHandle.
Definition at line 238 of file ImportFFmpeg.cpp.
References mStreamContexts.
|
inlineoverridevirtual |
! Called by Import.cpp
Implements ImportFileHandle.
Definition at line 245 of file ImportFFmpeg.cpp.
References mStreamInfo.
|
overridevirtual |
This may break the correspondence with mStreamInfo
TODO: Nag FFmpeg devs about start_time until they finally say WHAT is this and HOW to handle it.
Implements ImportFileHandle.
Definition at line 451 of file ImportFFmpeg.cpp.
References AUDACITY_AV_NOPTS_VALUE, AUDACITY_AV_TIME_BASE, ImportProgressListener::Cancelled, ImportUtils::ChooseFormat(), StreamContext::CodecContext, WaveTrackFactory::CreateMany(), ImportUtils::FinalizeImport(), anonymous_namespace{ExportPCM.cpp}::format, StreamContext::InitialChannels, mAVFormatContext, mCancelled, mFFmpeg, mProgressLen, mProgressPos, mStopped, mStreamContexts, mStreams, ImportProgressListener::OnImportProgress(), ImportProgressListener::OnImportResult(), StreamContext::SampleFormat, ImportProgressListener::Stopped, StreamContext::StreamIndex, anonymous_namespace{MIDIPlay.cpp}::streamStartTime, ImportProgressListener::Success, tracks, WriteData(), WriteMetadata(), and wxT().
bool FFmpegImportFileHandle::Init | ( | ) |
! Format initialization
Definition at line 341 of file ImportFFmpeg.cpp.
References InitCodecs(), mAVFormatContext, mFFmpeg, mName, AVIOContextWrapper::Success, and wxT().
bool FFmpegImportFileHandle::InitCodecs | ( | ) |
! Codec initialization
Definition at line 362 of file ImportFFmpeg.cpp.
References AUDACITY_AV_TIME_BASE, AudacityAVRational::den, AVDictionaryWrapper::Get(), AVStreamWrapper::GetAVCodecContext(), AVStreamWrapper::GetDuration(), AVStreamWrapper::GetIndex(), AVStreamWrapper::GetMetadata(), AVStreamWrapper::GetTimeBase(), AVStreamWrapper::IsAudio(), mAVFormatContext, mFFmpeg, mStreamContexts, mStreamInfo, name, AudacityAVRational::num, wxT(), and XO().
Referenced by Init().
|
inlineoverridevirtual |
! Called by Import.cpp
StreamID | - index of the stream in mStreamInfo and mStreamContexts |
Use | - true if this stream should be imported, false otherwise |
Implements ImportFileHandle.
Definition at line 253 of file ImportFFmpeg.cpp.
References mStreamContexts.
|
overridevirtual |
Implements ImportFileHandle.
Definition at line 564 of file ImportFFmpeg.cpp.
References mCancelled, and mStopped.
void FFmpegImportFileHandle::WriteData | ( | StreamContext * | sc, |
const AVPacketWrapper * | packet | ||
) |
! Writes decoded data into WaveTracks.
sc | - stream context |
Definition at line 570 of file ImportFFmpeg.cpp.
References AUDACITY_AV_NOPTS_VALUE, AUDACITY_AV_TIME_BASE, StreamContext::CodecContext, floatSample, ImportUtils::ForEachChannel(), AVStreamWrapper::GetFramesCount(), AVPacketWrapper::GetPos(), AVPacketWrapper::GetPresentationTimestamp(), AVStreamWrapper::GetTimeBase(), StreamContext::InitialChannels, int16Sample, mAVFormatContext, mFFmpeg, min(), mProgressLen, mProgressPos, mStreamContexts, mStreams, StreamContext::SampleFormat, and StreamContext::StreamIndex.
Referenced by Import().
void FFmpegImportFileHandle::WriteMetadata | ( | Tags * | tags | ) |
! Writes extracted metadata to tags object
avf | - file context \ tags - Audacity tags object |
Definition at line 669 of file ImportFFmpeg.cpp.
References GetMetadata(), Tags::IsEmpty(), mAVFormatContext, TAG_ALBUM, TAG_ARTIST, TAG_COMMENTS, TAG_GENRE, TAG_TITLE, TAG_TRACK, and TAG_YEAR.
Referenced by Import().
|
private |
Definition at line 266 of file ImportFFmpeg.cpp.
Referenced by GetMetadata(), Import(), Init(), InitCodecs(), WriteData(), and WriteMetadata().
|
private |
True if importing was canceled by user.
Definition at line 273 of file ImportFFmpeg.cpp.
|
private |
Definition at line 262 of file ImportFFmpeg.cpp.
Referenced by Import(), Init(), InitCodecs(), and WriteData().
|
private |
Definition at line 275 of file ImportFFmpeg.cpp.
Referenced by GetFilename(), and Init().
|
private |
Duration, total length or whatever is used as second argument for Update()
Definition at line 271 of file ImportFFmpeg.cpp.
Referenced by Import(), and WriteData().
|
private |
Current timestamp, file position or whatever is used as first argument for Update()
Definition at line 270 of file ImportFFmpeg.cpp.
Referenced by Import(), and WriteData().
|
private |
True if importing was stopped by user.
Definition at line 274 of file ImportFFmpeg.cpp.
|
private |
Definition at line 264 of file ImportFFmpeg.cpp.
Referenced by GetStreamCount(), Import(), InitCodecs(), SetStreamUsage(), and WriteData().
|
private |
Array of stream descriptions. After Init() and before Import(), same size as mStreamContexts.
Definition at line 268 of file ImportFFmpeg.cpp.
Referenced by GetStreamInfo(), and InitCodecs().
|
private |
Definition at line 276 of file ImportFFmpeg.cpp.
Referenced by Import(), and WriteData().