Skip to content

Commit f5c0a0a

Browse files
committed
nvm change format again
1 parent b33312c commit f5c0a0a

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

include/recorder.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <vector>
77
#include <string>
88
#include <memory>
9+
#include <unordered_map>
910

1011
class AVFormatContext;
1112
class AVCodec;
@@ -61,9 +62,9 @@ class FFMPEG_API_DLL Recorder {
6162
* This function iterates through all available codecs in FFmpeg and
6263
* returns a sorted vector of codec names.
6364
*
64-
* @return A vector of pairs representing the ids and names of available codecs.
65+
* @return A map of representing the names and ids of available codecs.
6566
*/
66-
std::vector<std::pair<int, std::string>> getAvailableCodecs();
67+
std::unordered_map<std::string, int> getAvailableCodecs();
6768

6869
private:
6970
AVFormatContext* m_formatContext = nullptr;

src/recorder.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@ extern "C" {
1212

1313
namespace ffmpeg {
1414

15-
std::vector<std::pair<int, std::string>> Recorder::getAvailableCodecs() {
16-
std::vector<std::pair<int, std::string>> vet;
15+
std::unordered_map<std::string, int> Recorder::getAvailableCodecs() {
16+
std::unordered_map<std::string, int> map;
1717

1818
void* iter = nullptr;
1919
const AVCodec * codec;
2020

2121
while ((codec = av_codec_iterate(&iter))) {
2222
if(codec->type == AVMEDIA_TYPE_VIDEO)
23-
vet.push_back({(int)codec->id, codec->name});
23+
map.insert({codec->name, (int)codec->id});
2424
}
25-
26-
std::sort(vet.begin(), vet.end(), [](std::pair<int, std::string>& a, std::pair<int, std::string>& b) { return a.second < b.second; });
2725

28-
return vet;
26+
return map;
2927
}
3028

3129
bool Recorder::init(const RenderSettings& settings) {

0 commit comments

Comments
 (0)