Audacity  3.0.3
Public Member Functions | Private Attributes | List of all members
FFmpegImportFileHandle Class Referencefinal

! Does actual import, returned by FFmpegImportPlugin::Open More...

Inheritance diagram for FFmpegImportFileHandle:
[legend]
Collaboration diagram for FFmpegImportFileHandle:
[legend]

Public Member Functions

 FFmpegImportFileHandle (const FilePath &name)
 
 ~FFmpegImportFileHandle ()
 
bool Init ()
 
bool InitCodecs ()
 
TranslatableString GetFileDescription () override
 
ByteCount GetFileUncompressedBytes () override
 
ProgressResult Import (WaveTrackFactory *trackFactory, TrackHolders &outTracks, Tags *tags) override
 
ProgressResult WriteData (StreamContext *sc, const AVPacketWrapper *packet)
 
void WriteMetadata (Tags *tags)
 
void GetMetadata (Tags &tags, const wxChar *tag, const char *name)
 
wxInt32 GetStreamCount () override
 
const TranslatableStringsGetStreamInfo () override
 
void SetStreamUsage (wxInt32 StreamID, bool Use) override
 
- Public Member Functions inherited from ImportFileHandle
 ImportFileHandle (const FilePath &filename)
 
virtual ~ImportFileHandle ()
 
void CreateProgress ()
 

Private Attributes

const std::shared_ptr< FFmpegFunctionsmFFmpeg = FFmpegFunctions::Load()
 
std::vector< StreamContextmStreamContexts
 
std::unique_ptr< AVFormatContextWrappermAVFormatContext
 
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
 
TrackHolders mChannels
 

Additional Inherited Members

- Public Types inherited from ImportFileHandle
using ProgressResult = BasicUI::ProgressResult
 
using ByteCount = unsigned long long
 
- Static Public Member Functions inherited from ImportFileHandle
static sampleFormat ChooseFormat (sampleFormat effectiveFormat)
 Choose appropriate format, which will not be narrower than the specified one. More...
 
- Protected Member Functions inherited from ImportFileHandle
std::shared_ptr< WaveTrackNewWaveTrack (WaveTrackFactory &trackFactory, sampleFormat effectiveFormat, double rate)
 Build a wave track with appropriate format, which will not be narrower than the specified one. More...
 
- Protected Attributes inherited from ImportFileHandle
FilePath mFilename
 
std::unique_ptr< ProgressDialogmProgress
 

Detailed Description

! Does actual import, returned by FFmpegImportPlugin::Open

An ImportFileHandle for FFmpeg data.

Definition at line 195 of file ImportFFmpeg.cpp.

Constructor & Destructor Documentation

◆ FFmpegImportFileHandle()

FFmpegImportFileHandle::FFmpegImportFileHandle ( const FilePath name)

Definition at line 337 of file ImportFFmpeg.cpp.

339 , mName{ name }
340 {
341 }

References name.

◆ ~FFmpegImportFileHandle()

FFmpegImportFileHandle::~FFmpegImportFileHandle ( )

Definition at line 702 of file ImportFFmpeg.cpp.

703 {
704 
705 }

Member Function Documentation

◆ GetFileDescription()

TranslatableString FFmpegImportFileHandle::GetFileDescription ( )
overridevirtual

Implements ImportFileHandle.

Definition at line 441 of file ImportFFmpeg.cpp.

442 {
443  return DESC;
444 }

References DESC.

◆ GetFileUncompressedBytes()

auto FFmpegImportFileHandle::GetFileUncompressedBytes ( )
overridevirtual

Implements ImportFileHandle.

Definition at line 447 of file ImportFFmpeg.cpp.

448 {
449  // TODO: Get Uncompressed byte count.
450  return 0;
451 }

◆ GetMetadata()

void FFmpegImportFileHandle::GetMetadata ( Tags tags,
const wxChar *  tag,
const char *  name 
)

! Retrieves metadata from FFmpeg and converts to wxString

Parameters
avf- file context \ tags - Audacity tags object \ tag - name of tag to set \ name - name of metadata item to retrieve

Definition at line 693 of file ImportFFmpeg.cpp.

694 {
695  auto metadata = mAVFormatContext->GetMetadata();
696 
697  if (metadata.HasValue(name, DICT_IGNORE_SUFFIX))
698  tags.SetTag(tag, wxString::FromUTF8(std::string(metadata.Get(name, {}, DICT_IGNORE_SUFFIX))));
699 }

References DICT_IGNORE_SUFFIX, mAVFormatContext, name, and Tags::SetTag().

Referenced by WriteMetadata().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetStreamCount()

wxInt32 FFmpegImportFileHandle::GetStreamCount ( )
inlineoverridevirtual

! Called by Import.cpp

Returns
number of readable streams in the file

Implements ImportFileHandle.

Definition at line 236 of file ImportFFmpeg.cpp.

237  {
238  return static_cast<wxInt32>(mStreamContexts.size());
239  }

References mStreamContexts.

◆ GetStreamInfo()

const TranslatableStrings& FFmpegImportFileHandle::GetStreamInfo ( )
inlineoverridevirtual

! Called by Import.cpp

Returns
array of strings - descriptions of the streams

Implements ImportFileHandle.

Definition at line 243 of file ImportFFmpeg.cpp.

244  {
245  return mStreamInfo;
246  }

References mStreamInfo.

◆ Import()

ProgressResult FFmpegImportFileHandle::Import ( WaveTrackFactory trackFactory,
TrackHolders outTracks,
Tags tags 
)
overridevirtual

! Imports audio

Returns
import status (see Import.cpp)

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 453 of file ImportFFmpeg.cpp.

456 {
457  outTracks.clear();
458 
459  CreateProgress();
460 
462  mStreamContexts.erase (std::remove_if (mStreamContexts.begin (), mStreamContexts.end (), [](const StreamContext& ctx) {
463  return !ctx.Use;
464  }), mStreamContexts.end());
465 
466  mChannels.resize(mStreamContexts.size());
467 
468  int s = -1;
469  for (auto &stream : mChannels)
470  {
471  ++s;
472 
473  const StreamContext& sc = mStreamContexts[s];
474 
475  stream.resize(sc.InitialChannels);
476 
477  for (auto &channel : stream)
478  channel = NewWaveTrack(*trackFactory, sc.SampleFormat, sc.CodecContext->GetSampleRate());
479  }
480 
481  // Handles the start_time by creating silence. This may or may not be correct.
482  // There is a possibility that we should ignore first N milliseconds of audio instead. I do not know.
484  s = -1;
485  for (auto &stream : mChannels)
486  {
487  ++s;
488 
489  int64_t stream_delay = 0;
490  const auto& sc = mStreamContexts[s];
491 
492  const int64_t streamStartTime =
493  mAVFormatContext->GetStream(sc.StreamIndex)->GetStartTime();
494 
496  {
497  stream_delay = streamStartTime;
498 
499  wxLogDebug(
500  wxT("Stream %d start_time = %lld, that would be %f milliseconds."),
501  s, (long long)streamStartTime, double(streamStartTime) / 1000);
502  }
503 
504  if (stream_delay > 0)
505  {
506  int c = -1;
507  for (auto &channel : stream)
508  {
509  ++c;
510 
511  WaveTrack *t = channel.get();
512  t->InsertSilence(0,double(stream_delay)/AUDACITY_AV_TIME_BASE);
513  }
514  }
515  }
516  // This is the heart of the importing process
517  // The result of Import() to be returned. It will be something other than zero if user canceled or some error appears.
518  auto res = ProgressResult::Success;
519 
520  // Read frames.
521  for (std::unique_ptr<AVPacketWrapper> packet;
522  (packet = mAVFormatContext->ReadNextPacket()) != nullptr &&
523  (res == ProgressResult::Success);)
524  {
525  // Find a matching StreamContext
526  auto streamContextIt = std::find_if(
527  mStreamContexts.begin(), mStreamContexts.end(),
528  [index = packet->GetStreamIndex()](const StreamContext& ctx)
529  { return ctx.StreamIndex == index;
530  });
531 
532  if (streamContextIt == mStreamContexts.end())
533  continue;
534 
535  res = WriteData(&(*streamContextIt), packet.get());
536  }
537 
538  // Flush the decoders.
539  if (!mStreamContexts.empty() && (res == ProgressResult::Success || res == ProgressResult::Stopped))
540  {
541  auto emptyPacket = mFFmpeg->CreateAVPacketWrapper();
542 
543  for (StreamContext& sc : mStreamContexts)
544  WriteData(&sc, emptyPacket.get());
545  }
546 
547  // Something bad happened - destroy everything!
548  if (res == ProgressResult::Cancelled || res == ProgressResult::Failed)
549  return res;
550  //else if (res == 2), we just stop the decoding as if the file has ended
551 
552  // Copy audio from mChannels to newly created tracks (destroying mChannels elements in process)
553  for (auto &stream : mChannels)
554  for(auto &channel : stream)
555  channel->Flush();
556 
557  outTracks.swap(mChannels);
558 
559  // Save metadata
560  WriteMetadata(tags);
561 
562  return res;
563 }

References AUDACITY_AV_NOPTS_VALUE, AUDACITY_AV_TIME_BASE, RefreshCode::Cancelled, StreamContext::CodecContext, ImportFileHandle::CreateProgress(), StreamContext::InitialChannels, WaveTrack::InsertSilence(), mAVFormatContext, mChannels, mFFmpeg, mStreamContexts, ImportFileHandle::NewWaveTrack(), StreamContext::SampleFormat, anonymous_namespace{MIDIPlay.cpp}::streamStartTime, BasicUI::Success, WriteData(), and WriteMetadata().

Here is the call graph for this function:

◆ Init()

bool FFmpegImportFileHandle::Init ( )

! Format initialization

Returns
true if successful, false otherwise

Definition at line 343 of file ImportFFmpeg.cpp.

344 {
345  if (!mFFmpeg)
346  return false;
347 
348  mAVFormatContext = mFFmpeg->CreateAVFormatContext();
349 
350  const auto err = mAVFormatContext->OpenInputContext(mName, nullptr, AVDictionaryWrapper(*mFFmpeg));
351 
353  {
354  wxLogError(wxT("FFmpeg : AVFormatContextWrapper::OpenInputContext() failed for file %s"), mName);
355  return false;
356  }
357 
358  if (!InitCodecs())
359  return false;
360 
361  return true;
362 }

References InitCodecs(), mAVFormatContext, mFFmpeg, mName, and AVIOContextWrapper::Success.

Here is the call graph for this function:

◆ InitCodecs()

bool FFmpegImportFileHandle::InitCodecs ( )

! Codec initialization

Returns
true if successful, false otherwise

Definition at line 364 of file ImportFFmpeg.cpp.

365 {
366  for (unsigned int i = 0; i < mAVFormatContext->GetStreamsCount(); i++)
367  {
368  const AVStreamWrapper* stream = mAVFormatContext->GetStream(i);
369 
370  if (stream->IsAudio())
371  {
372  const AVCodecIDFwd id = mAVFormatContext->GetStream(i)->GetAVCodecID();
373 
374  auto codec = mFFmpeg->CreateDecoder(id);
375  auto name = mFFmpeg->avcodec_get_name(id);
376 
377  if (codec == NULL)
378  {
379  wxLogError(
380  wxT("FFmpeg : CreateDecoder() failed. Index[%02d], Codec[%02x - %s]"),
381  i, id, name);
382  //FFmpeg can't decode this stream, skip it
383  continue;
384  }
385 
386  auto codecContextPtr = stream->GetAVCodecContext();
387 
388  if ( codecContextPtr->Open( codecContextPtr->GetCodec() ) < 0 )
389  {
390  wxLogError(wxT("FFmpeg : Open() failed. Index[%02d], Codec[%02x - %s]"),i,id,name);
391  //Can't open decoder - skip this stream
392  continue;
393  }
394 
395  const int channels = codecContextPtr->GetChannels();
396  const sampleFormat preferredFormat =
397  codecContextPtr->GetPreferredAudacitySampleFormat();
398 
399  auto codecContext = codecContextPtr.get();
400 
401  mStreamContexts.emplace_back(
402  StreamContext { stream->GetIndex(), std::move(codecContextPtr),
403  channels, preferredFormat, true });
404 
405  // Stream is decodeable and it is audio. Add it and its description to the arrays
406  int duration = 0;
407  if (stream->GetDuration() > 0)
408  duration = stream->GetDuration() * stream->GetTimeBase().num / stream->GetTimeBase().den;
409  else
410  duration = mAVFormatContext->GetDuration() / AUDACITY_AV_TIME_BASE;
411 
412  wxString bitrate;
413  if (codecContext->GetBitRate() > 0)
414  bitrate.Printf(wxT("%d"),(int)codecContext->GetBitRate());
415  else
416  bitrate.Printf(wxT("?"));
417 
418  AVDictionaryWrapper streamMetadata = stream->GetMetadata();
419 
420  auto lang = std::string(streamMetadata.Get("language", {}));
421 
422  auto strinfo = XO(
423 /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
424 "Index[%02x] Codec[%s], Language[%s], Bitrate[%s], Channels[%d], Duration[%d]")
425  .Format(
426  stream->GetIndex(),
427  name,
428  lang,
429  bitrate,
430  (int)codecContext->GetChannels(),
431  (int)duration);
432 
433  mStreamInfo.push_back(strinfo);
434  }
435  //for video and unknown streams do nothing
436  }
437  //It doesn't really returns false, but GetStreamCount() will return 0 if file is composed entirely of unreadable streams
438  return true;
439 }

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, and XO.

Referenced by Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetStreamUsage()

void FFmpegImportFileHandle::SetStreamUsage ( wxInt32  StreamID,
bool  Use 
)
inlineoverridevirtual

! Called by Import.cpp

Parameters
StreamID- index of the stream in mStreamInfo and mStreamContexts
Use- true if this stream should be imported, false otherwise

Implements ImportFileHandle.

Definition at line 251 of file ImportFFmpeg.cpp.

252  {
253  if (StreamID < static_cast<wxInt32>(mStreamContexts.size()))
254  mStreamContexts[StreamID].Use = Use;
255  }

References mStreamContexts.

◆ WriteData()

ProgressResult FFmpegImportFileHandle::WriteData ( StreamContext sc,
const AVPacketWrapper packet 
)

! Writes decoded data into WaveTracks.

Parameters
sc- stream context

Definition at line 565 of file ImportFFmpeg.cpp.

566 {
567  // Find the stream index in mStreamContexts array
568  int streamid = -1;
569  auto iter = mChannels.begin();
570 
571  for (int i = 0; i < static_cast<int>(mStreamContexts.size()); ++iter, ++i)
572  {
573  if (&mStreamContexts[i] == sc)
574  {
575  streamid = i;
576  break;
577  }
578  }
579  // Stream is not found. This should not really happen
580  if (streamid == -1)
581  {
583  }
584 
585  size_t nChannels = std::min(sc->CodecContext->GetChannels(), sc->InitialChannels);
586 
587  if (sc->SampleFormat == int16Sample)
588  {
589  auto data = sc->CodecContext->DecodeAudioPacketInt16(packet);
590 
591  const int channelsCount = sc->CodecContext->GetChannels();
592  const int samplesPerChannel = data.size() / channelsCount;
593 
594  // Write audio into WaveTracks
595  auto iter2 = iter->begin();
596  for (size_t chn = 0; chn < nChannels; ++iter2, ++chn)
597  {
598  iter2->get()->Append(
599  reinterpret_cast<samplePtr>(data.data()), sc->SampleFormat,
600  samplesPerChannel,
601  sc->CodecContext->GetChannels());
602  }
603  }
604  else if (sc->SampleFormat == floatSample)
605  {
606  auto data = sc->CodecContext->DecodeAudioPacketFloat(packet);
607 
608  const int channelsCount = sc->CodecContext->GetChannels();
609  const int samplesPerChannel = data.size() / channelsCount;
610 
611  // Write audio into WaveTracks
612  auto iter2 = iter->begin();
613  for (size_t chn = 0; chn < nChannels; ++iter2, ++chn)
614  {
615  iter2->get()->Append(
616  reinterpret_cast<samplePtr>(data.data()), sc->SampleFormat,
617  samplesPerChannel, sc->CodecContext->GetChannels());
618  }
619  }
620 
621  const AVStreamWrapper* avStream = mAVFormatContext->GetStream(sc->StreamIndex);
622 
623  // Try to update the progress indicator (and see if user wants to cancel)
624  auto updateResult = ProgressResult::Success;
625  int64_t filesize = mFFmpeg->avio_size(mAVFormatContext->GetAVIOContext()->GetWrappedValue());
626  // PTS (presentation time) is the proper way of getting current position
627  if (
629  mAVFormatContext->GetDuration() != AUDACITY_AV_NOPTS_VALUE)
630  {
631  auto timeBase = avStream->GetTimeBase();
632 
633  mProgressPos =
634  packet->GetPresentationTimestamp() * timeBase.num / timeBase.den;
635 
636  mProgressLen =
637  (mAVFormatContext->GetDuration() > 0 ?
638  mAVFormatContext->GetDuration() / AUDACITY_AV_TIME_BASE :
639  1);
640  }
641  // When PTS is not set, use number of frames and number of current frame
642  else if (
643  avStream->GetFramesCount() > 0 && sc->CodecContext->GetFrameNumber() > 0 &&
644  sc->CodecContext->GetFrameNumber() <= avStream->GetFramesCount())
645  {
646  mProgressPos = sc->CodecContext->GetFrameNumber();
647  mProgressLen = avStream->GetFramesCount();
648  }
649  // When number of frames is unknown, use position in file
650  else if (
651  filesize > 0 && packet->GetPos() > 0 && packet->GetPos() <= filesize)
652  {
653  mProgressPos = packet->GetPos();
654  mProgressLen = filesize;
655  }
656  updateResult = mProgress->Update(mProgressPos, mProgressLen != 0 ? mProgressLen : 1);
657 
658  return updateResult;
659 }

References AUDACITY_AV_NOPTS_VALUE, AUDACITY_AV_TIME_BASE, StreamContext::CodecContext, floatSample, AVStreamWrapper::GetFramesCount(), AVPacketWrapper::GetPos(), AVPacketWrapper::GetPresentationTimestamp(), AVStreamWrapper::GetTimeBase(), StreamContext::InitialChannels, int16Sample, mAVFormatContext, mChannels, mFFmpeg, min(), ImportFileHandle::mProgress, mProgressLen, mProgressPos, mStreamContexts, StreamContext::SampleFormat, StreamContext::StreamIndex, and BasicUI::Success.

Referenced by Import().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteMetadata()

void FFmpegImportFileHandle::WriteMetadata ( Tags tags)

! Writes extracted metadata to tags object

Parameters
avf- file context \ tags - Audacity tags object

Definition at line 661 of file ImportFFmpeg.cpp.

662 {
663  Tags temp;
664 
665  GetMetadata(temp, TAG_TITLE, "title");
666  GetMetadata(temp, TAG_COMMENTS, "comment");
667  GetMetadata(temp, TAG_ALBUM, "album");
668  GetMetadata(temp, TAG_TRACK, "track");
669  GetMetadata(temp, TAG_GENRE, "genre");
670 
671  if (wxString(mAVFormatContext->GetInputFormat()->GetName()).Contains("m4a"))
672  {
673  GetMetadata(temp, TAG_ARTIST, "artist");
674  GetMetadata(temp, TAG_YEAR, "date");
675  }
676  else if (wxString(mAVFormatContext->GetInputFormat()->GetName()).Contains("asf")) /* wma */
677  {
678  GetMetadata(temp, TAG_ARTIST, "artist");
679  GetMetadata(temp, TAG_YEAR, "year");
680  }
681  else
682  {
683  GetMetadata(temp, TAG_ARTIST, "author");
684  GetMetadata(temp, TAG_YEAR, "year");
685  }
686 
687  if (!temp.IsEmpty())
688  {
689  *tags = temp;
690  }
691 }

References GetMetadata(), Tags::IsEmpty(), mAVFormatContext, TAG_ALBUM, TAG_ARTIST, TAG_COMMENTS, TAG_GENRE, TAG_TITLE, TAG_TRACK, and TAG_YEAR.

Referenced by Import().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mAVFormatContext

std::unique_ptr<AVFormatContextWrapper> FFmpegImportFileHandle::mAVFormatContext
private

Definition at line 264 of file ImportFFmpeg.cpp.

Referenced by GetMetadata(), Import(), Init(), InitCodecs(), WriteData(), and WriteMetadata().

◆ mCancelled

bool FFmpegImportFileHandle::mCancelled = false
private

True if importing was canceled by user.

Definition at line 271 of file ImportFFmpeg.cpp.

◆ mChannels

TrackHolders FFmpegImportFileHandle::mChannels
private

2-dimensional array of WaveTracks. First dimension - streams, After Import(), same size as mStreamContexts; second - channels of a stream.

Definition at line 274 of file ImportFFmpeg.cpp.

Referenced by Import(), and WriteData().

◆ mFFmpeg

const std::shared_ptr<FFmpegFunctions> FFmpegImportFileHandle::mFFmpeg = FFmpegFunctions::Load()
private

Definition at line 260 of file ImportFFmpeg.cpp.

Referenced by Import(), Init(), InitCodecs(), and WriteData().

◆ mName

const FilePath FFmpegImportFileHandle::mName
private

Definition at line 273 of file ImportFFmpeg.cpp.

Referenced by Init().

◆ mProgressLen

wxInt64 FFmpegImportFileHandle::mProgressLen = 1
private

Duration, total length or whatever is used as second argument for Update()

Definition at line 269 of file ImportFFmpeg.cpp.

Referenced by WriteData().

◆ mProgressPos

wxInt64 FFmpegImportFileHandle::mProgressPos = 0
private

Current timestamp, file position or whatever is used as first argument for Update()

Definition at line 268 of file ImportFFmpeg.cpp.

Referenced by WriteData().

◆ mStopped

bool FFmpegImportFileHandle::mStopped = false
private

True if importing was stopped by user.

Definition at line 272 of file ImportFFmpeg.cpp.

◆ mStreamContexts

std::vector<StreamContext> FFmpegImportFileHandle::mStreamContexts
private

Definition at line 262 of file ImportFFmpeg.cpp.

Referenced by GetStreamCount(), Import(), InitCodecs(), SetStreamUsage(), and WriteData().

◆ mStreamInfo

TranslatableStrings FFmpegImportFileHandle::mStreamInfo
private

Array of stream descriptions. After Init() and before Import(), same size as mStreamContexts.

Definition at line 266 of file ImportFFmpeg.cpp.

Referenced by GetStreamInfo(), and InitCodecs().


The documentation for this class was generated from the following file:
StreamContext::StreamIndex
int StreamIndex
Definition: ImportFFmpeg.cpp:184
FFmpegImportFileHandle::mStreamInfo
TranslatableStrings mStreamInfo
Array of stream descriptions. After Init() and before Import(), same size as mStreamContexts.
Definition: ImportFFmpeg.cpp:266
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
BasicUI::ProgressResult::Success
@ Success
Tags::IsEmpty
bool IsEmpty()
Definition: Tags.cpp:326
Tags
ID3 Tags (for MP3)
Definition: Tags.h:74
AVDictionaryWrapper
Definition: AVDictionaryWrapper.h:24
AVDictionaryWrapper::Get
std::string_view Get(const std::string_view &key, const std::string_view &defaultValue, int flags=0) const
Definition: AVDictionaryWrapper.cpp:101
TAG_TRACK
#define TAG_TRACK
Definition: Tags.h:63
FFmpegImportFileHandle::mChannels
TrackHolders mChannels
Definition: ImportFFmpeg.cpp:274
FFmpegImportFileHandle::InitCodecs
bool InitCodecs()
Definition: ImportFFmpeg.cpp:364
FFmpegImportFileHandle::mAVFormatContext
std::unique_ptr< AVFormatContextWrapper > mAVFormatContext
Definition: ImportFFmpeg.cpp:264
AVPacketWrapper::GetPos
virtual int64_t GetPos() const noexcept=0
RefreshCode::Cancelled
@ Cancelled
Definition: RefreshCode.h:23
XO
#define XO(s)
Definition: Internat.h:31
AUDACITY_AV_NOPTS_VALUE
#define AUDACITY_AV_NOPTS_VALUE
Definition: FFmpegTypes.h:69
AVCodecIDFwd
int AVCodecIDFwd
Definition: AVCodecID.h:407
StreamContext::SampleFormat
sampleFormat SampleFormat
Definition: ImportFFmpeg.cpp:189
AUDACITY_AV_TIME_BASE
#define AUDACITY_AV_TIME_BASE
Definition: FFmpegTypes.h:75
AVStreamWrapper::GetFramesCount
virtual int64_t GetFramesCount() const noexcept=0
ImportFileHandle::mProgress
std::unique_ptr< ProgressDialog > mProgress
Definition: ImportPlugin.h:159
AVStreamWrapper::IsAudio
virtual bool IsAudio() const noexcept=0
StreamContext
Definition: ImportFFmpeg.cpp:183
FFmpegImportFileHandle::mFFmpeg
const std::shared_ptr< FFmpegFunctions > mFFmpeg
Definition: ImportFFmpeg.cpp:260
FFmpegImportFileHandle::GetMetadata
void GetMetadata(Tags &tags, const wxChar *tag, const char *name)
Definition: ImportFFmpeg.cpp:693
floatSample
@ floatSample
Definition: SampleFormat.h:34
ImportFileHandle::ImportFileHandle
ImportFileHandle(const FilePath &filename)
Definition: ImportPlugin.cpp:36
ImportFileHandle::CreateProgress
void CreateProgress()
Definition: ImportPlugin.cpp:45
WaveTrack::InsertSilence
void InsertSilence(double t, double len) override
Definition: WaveTrack.cpp:1447
ImportFileHandle::NewWaveTrack
std::shared_ptr< WaveTrack > NewWaveTrack(WaveTrackFactory &trackFactory, sampleFormat effectiveFormat, double rate)
Build a wave track with appropriate format, which will not be narrower than the specified one.
Definition: ImportPlugin.cpp:69
Tags::SetTag
void SetTag(const wxString &name, const wxString &value, const bool bSpecialTag=false)
Definition: Tags.cpp:486
FFmpegImportFileHandle::WriteData
ProgressResult WriteData(StreamContext *sc, const AVPacketWrapper *packet)
Definition: ImportFFmpeg.cpp:565
int16Sample
@ int16Sample
Definition: SampleFormat.h:32
StreamContext::InitialChannels
int InitialChannels
Definition: ImportFFmpeg.cpp:188
name
const TranslatableString name
Definition: Distortion.cpp:98
AVIOContextWrapper::OpenResult::Success
@ Success
TAG_GENRE
#define TAG_GENRE
Definition: Tags.h:65
AVStreamWrapper::GetIndex
virtual int GetIndex() const noexcept=0
AudacityAVRational::den
int den
denominator
Definition: FFmpegTypes.h:134
TAG_YEAR
#define TAG_YEAR
Definition: Tags.h:64
AVStreamWrapper::GetTimeBase
virtual AudacityAVRational GetTimeBase() const noexcept=0
AVStreamWrapper::GetMetadata
virtual AVDictionaryWrapper GetMetadata() const noexcept=0
DICT_IGNORE_SUFFIX
#define DICT_IGNORE_SUFFIX
Definition: AVDictionaryWrapper.h:21
sampleFormat
sampleFormat
Definition: SampleFormat.h:29
samplePtr
char * samplePtr
Definition: SampleFormat.h:49
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
DESC
#define DESC
Definition: ImportFFmpeg.cpp:40
anonymous_namespace{MIDIPlay.cpp}::streamStartTime
static double streamStartTime
Definition: MIDIPlay.cpp:485
FFmpegImportFileHandle::mProgressLen
wxInt64 mProgressLen
Duration, total length or whatever is used as second argument for Update()
Definition: ImportFFmpeg.cpp:269
FFmpegImportFileHandle::mName
const FilePath mName
Definition: ImportFFmpeg.cpp:273
AVPacketWrapper::GetPresentationTimestamp
virtual int64_t GetPresentationTimestamp() const noexcept=0
AudacityAVRational::num
int num
numerator
Definition: FFmpegTypes.h:133
StreamContext::CodecContext
std::unique_ptr< AVCodecContextWrapper > CodecContext
Definition: ImportFFmpeg.cpp:186
TAG_COMMENTS
#define TAG_COMMENTS
Definition: Tags.h:66
TAG_ARTIST
#define TAG_ARTIST
Definition: Tags.h:61
AVStreamWrapper::GetAVCodecContext
virtual std::unique_ptr< AVCodecContextWrapper > GetAVCodecContext() const noexcept=0
FFmpegImportFileHandle::WriteMetadata
void WriteMetadata(Tags *tags)
Definition: ImportFFmpeg.cpp:661
AVStreamWrapper
Definition: AVStreamWrapper.h:25
TAG_TITLE
#define TAG_TITLE
Definition: Tags.h:60
AVStreamWrapper::GetDuration
virtual int64_t GetDuration() const noexcept=0
FFmpegImportFileHandle::mStreamContexts
std::vector< StreamContext > mStreamContexts
Definition: ImportFFmpeg.cpp:262
FFmpegImportFileHandle::mProgressPos
wxInt64 mProgressPos
Current timestamp, file position or whatever is used as first argument for Update()
Definition: ImportFFmpeg.cpp:268
TAG_ALBUM
#define TAG_ALBUM
Definition: Tags.h:62