diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-10-18 16:43:47 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-10-18 19:17:01 +0200 |
commit | e9dad737b086537803210987ccbd9a59651c4613 (patch) | |
tree | ea35383b3007044e1013d79e46aaf5216de49a92 /avmedia | |
parent | 772bde754cfc7cbda6498b255272de0d8cf81b5f (diff) |
Simplify MediaWindow::getMediaFilters
Change-Id: I6c2ed432d2d5472ec984ea6e48aa3435c464067f
Reviewed-on: https://gerrit.libreoffice.org/81053
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'avmedia')
-rw-r--r-- | avmedia/source/viewer/mediawindow.cxx | 69 |
1 files changed, 29 insertions, 40 deletions
diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx index 81b8d968a36e..521c4151f98f 100644 --- a/avmedia/source/viewer/mediawindow.cxx +++ b/avmedia/source/viewer/mediawindow.cxx @@ -173,41 +173,34 @@ vcl::Window* MediaWindow::getWindow() const } -void MediaWindow::getMediaFilters( FilterNameVector& rFilterNameVector ) +FilterNameVector MediaWindow::getMediaFilters() { - static const char* pFilters[] = { "Advanced Audio Coding", "aac", - "AIF Audio", "aif;aiff", - "Advanced Systems Format", "asf;wma;wmv", - "AU Audio", "au", - "AC3 Audio", "ac3", - "AVI", "avi", - "CD Audio", "cda", - "Digital Video", "dv", - "FLAC Audio", "flac", - "Flash Video", "flv", - "Matroska Media", "mkv", - "MIDI Audio", "mid;midi", - "MPEG Audio", "mp2;mp3;mpa;m4a", - "MPEG Video", "mpg;mpeg;mpv;mp4;m4v", - "Ogg Audio", "ogg;oga;opus", - "Ogg Video", "ogv;ogx", - "Real Audio", "ra", - "Real Media", "rm", - "RMI MIDI Audio", "rmi", - "SND (SouND) Audio", "snd", - "Quicktime Video", "mov", - "Vivo Video", "viv", - "WAVE Audio", "wav", - "WebM Video", "webm", - "Windows Media Audio", "wma", - "Windows Media Video", "wmv"}; - - for( size_t i = 0; i < SAL_N_ELEMENTS(pFilters); i += 2 ) - { - rFilterNameVector.push_back( std::make_pair< OUString, OUString >( - OUString::createFromAscii(pFilters[i]), - OUString::createFromAscii(pFilters[i+1]) ) ); - } + return {{"Advanced Audio Coding", "aac"}, + {"AIF Audio", "aif;aiff"}, + {"Advanced Systems Format", "asf;wma;wmv"}, + {"AU Audio", "au"}, + {"AC3 Audio", "ac3"}, + {"AVI", "avi"}, + {"CD Audio", "cda"}, + {"Digital Video", "dv"}, + {"FLAC Audio", "flac"}, + {"Flash Video", "flv"}, + {"Matroska Media", "mkv"}, + {"MIDI Audio", "mid;midi"}, + {"MPEG Audio", "mp2;mp3;mpa;m4a"}, + {"MPEG Video", "mpg;mpeg;mpv;mp4;m4v"}, + {"Ogg Audio", "ogg;oga;opus"}, + {"Ogg Video", "ogv;ogx"}, + {"Real Audio", "ra"}, + {"Real Media", "rm"}, + {"RMI MIDI Audio", "rmi"}, + {"SND (SouND) Audio", "snd"}, + {"Quicktime Video", "mov"}, + {"Vivo Video", "viv"}, + {"WAVE Audio", "wav"}, + {"WebM Video", "webm"}, + {"Windows Media Audio", "wma"}, + {"Windows Media Video", "wmv"}}; } @@ -218,15 +211,13 @@ bool MediaWindow::executeMediaURLDialog(weld::Window* pParent, OUString& rURL, b : ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, pParent); static const char aWildcard[] = "*."; - FilterNameVector aFilters; + FilterNameVector aFilters = getMediaFilters(); static const char aSeparator[] = ";"; OUStringBuffer aAllTypes; aDlg.SetTitle( AvmResId( o_pbLink != nullptr ? AVMEDIA_STR_INSERTMEDIA_DLG : AVMEDIA_STR_OPENMEDIA_DLG ) ); - getMediaFilters( aFilters ); - for( FilterNameVector::size_type i = 0; i < aFilters.size(); ++i ) { for( sal_Int32 nIndex = 0; nIndex >= 0; ) @@ -337,11 +328,9 @@ bool MediaWindow::isMediaURL( const OUString& rURL, const OUString& rReferer, bo } else { - FilterNameVector aFilters; + FilterNameVector aFilters = getMediaFilters(); const OUString aExt( aURL.getExtension() ); - getMediaFilters( aFilters ); - for( FilterNameVector::size_type i = 0; i < aFilters.size(); ++i ) { for( sal_Int32 nIndex = 0; nIndex >= 0; ) |