move ff* structs & typedef into dedicated namespace

(further avoid conflicts with plugins)
This commit is contained in:
Robin Gareus 2013-07-14 16:34:49 +02:00
parent 8f5cc1dbba
commit 003492cbf9
4 changed files with 22 additions and 21 deletions

View file

@ -584,7 +584,7 @@ ExportVideoDialog::encode_pass (int pass)
} }
std::string preset = preset_combo.get_active_text(); std::string preset = preset_combo.get_active_text();
FFSettings ffs ; /* = transcoder->default_encoder_settings(); */ TranscodeFfmpeg::FFSettings ffs ; /* = transcoder->default_encoder_settings(); */
ffs.clear(); ffs.clear();
if (fps_checkbox.get_active()) { if (fps_checkbox.get_active()) {
@ -740,7 +740,7 @@ ExportVideoDialog::encode_pass (int pass)
transcoder->set_avoffset(av_offset / (double)_session->nominal_frame_rate()); transcoder->set_avoffset(av_offset / (double)_session->nominal_frame_rate());
} }
FFSettings meta = transcoder->default_meta_data(); TranscodeFfmpeg::FFSettings meta = transcoder->default_meta_data();
if (meta_checkbox.get_active()) { if (meta_checkbox.get_active()) {
ARDOUR::SessionMetadata * session_data = ARDOUR::SessionMetadata::Metadata(); ARDOUR::SessionMetadata * session_data = ARDOUR::SessionMetadata::Metadata();
if (session_data->year() > 0 ) { if (session_data->year() > 0 ) {

View file

@ -261,10 +261,10 @@ TranscodeFfmpeg::probe ()
return true; return true;
} }
FFSettings TranscodeFfmpeg::FFSettings
TranscodeFfmpeg::default_encoder_settings () TranscodeFfmpeg::default_encoder_settings ()
{ {
FFSettings ffs; TranscodeFfmpeg::FFSettings ffs;
ffs.clear(); ffs.clear();
ffs["-vcodec"] = "mpeg4"; ffs["-vcodec"] = "mpeg4";
ffs["-acodec"] = "ac3"; ffs["-acodec"] = "ac3";
@ -273,10 +273,10 @@ TranscodeFfmpeg::default_encoder_settings ()
return ffs; return ffs;
} }
FFSettings TranscodeFfmpeg::FFSettings
TranscodeFfmpeg::default_meta_data () TranscodeFfmpeg::default_meta_data ()
{ {
FFSettings ffm; TranscodeFfmpeg::FFSettings ffm;
ffm.clear(); ffm.clear();
ffm["comment"] = "Created with ardour"; ffm["comment"] = "Created with ardour";
return ffm; return ffm;
@ -308,7 +308,7 @@ TranscodeFfmpeg::format_metadata (std::string key, std::string value)
} }
bool bool
TranscodeFfmpeg::encode (std::string outfile, std::string inf_a, std::string inf_v, FFSettings ffs, FFSettings meta, bool map) TranscodeFfmpeg::encode (std::string outfile, std::string inf_a, std::string inf_v, TranscodeFfmpeg::FFSettings ffs, TranscodeFfmpeg::FFSettings meta, bool map)
{ {
#define MAX_FFMPEG_ENCODER_ARGS (100) #define MAX_FFMPEG_ENCODER_ARGS (100)
char **argp; char **argp;
@ -327,11 +327,11 @@ TranscodeFfmpeg::encode (std::string outfile, std::string inf_a, std::string inf
argp[a++] = strdup("-i"); argp[a++] = strdup("-i");
argp[a++] = strdup(inf_a.c_str()); argp[a++] = strdup(inf_a.c_str());
for(FFSettings::const_iterator it = ffs.begin(); it != ffs.end(); ++it) { for(TranscodeFfmpeg::FFSettings::const_iterator it = ffs.begin(); it != ffs.end(); ++it) {
argp[a++] = strdup(it->first.c_str()); argp[a++] = strdup(it->first.c_str());
argp[a++] = strdup(it->second.c_str()); argp[a++] = strdup(it->second.c_str());
} }
for(FFSettings::const_iterator it = meta.begin(); it != meta.end(); ++it) { for(TranscodeFfmpeg::FFSettings::const_iterator it = meta.begin(); it != meta.end(); ++it) {
argp[a++] = strdup("-metadata"); argp[a++] = strdup("-metadata");
argp[a++] = format_metadata(it->first.c_str(), it->second.c_str()); argp[a++] = format_metadata(it->first.c_str(), it->second.c_str());
} }

View file

@ -24,14 +24,6 @@
#include "ardour/types.h" #include "ardour/types.h"
#include "system_exec.h" #include "system_exec.h"
/* TODO: use a namespace here ? */
struct FFAudioStream {
std::string name;
std::string stream_id;
uint32_t channels;
};
typedef std::vector<FFAudioStream> AudioStreams;
typedef std::map<std::string,std::string> FFSettings;
/** @class TranscodeFfmpeg /** @class TranscodeFfmpeg
* @brief wrapper around ffmpeg and ffprobe command-line utils * @brief wrapper around ffmpeg and ffprobe command-line utils
@ -46,6 +38,15 @@ class TranscodeFfmpeg : public sigc::trackable
{ {
public: public:
struct FFAudioStream {
std::string name;
std::string stream_id;
uint32_t channels;
};
typedef std::vector<FFAudioStream> FFAudioStreams;
typedef std::map<std::string,std::string> FFSettings;
/** instantiate a new transcoder. If a file-name is given, the file's /** instantiate a new transcoder. If a file-name is given, the file's
* attributes (fps, duration, geometry etc) are read. * attributes (fps, duration, geometry etc) are read.
* *
@ -110,7 +111,7 @@ class TranscodeFfmpeg : public sigc::trackable
ARDOUR::framecnt_t get_duration() { return m_duration; } ARDOUR::framecnt_t get_duration() { return m_duration; }
std::string get_codec() { return m_codec; } std::string get_codec() { return m_codec; }
AudioStreams get_audio() { return m_audio; } FFAudioStreams get_audio() { return m_audio; }
/** override file duration used with the \ref Progress signal. /** override file duration used with the \ref Progress signal.
* @param d duration in video-frames = length_in_seconds * get_fps() * @param d duration in video-frames = length_in_seconds * get_fps()
@ -145,7 +146,7 @@ class TranscodeFfmpeg : public sigc::trackable
bool ffexecok; bool ffexecok;
bool probeok; bool probeok;
AudioStreams m_audio; FFAudioStreams m_audio;
char *format_metadata (std::string, std::string); char *format_metadata (std::string, std::string);
void ffmpegparse_v (std::string d, size_t s); void ffmpegparse_v (std::string d, size_t s);

View file

@ -88,7 +88,7 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile)
int w = 0, h = 0; int w = 0, h = 0;
m_aspect = 4.0/3.0; m_aspect = 4.0/3.0;
AudioStreams as; as.clear(); TranscodeFfmpeg::FFAudioStreams as; as.clear();
path_hbox->pack_start (path_label, false, false, 3); path_hbox->pack_start (path_label, false, false, 3);
path_hbox->pack_start (path_entry, true, true, 3); path_hbox->pack_start (path_entry, true, true, 3);
@ -227,7 +227,7 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile)
t->attach (audio_combo, 1, 4, 2, 3); t->attach (audio_combo, 1, 4, 2, 3);
audio_combo.append_text("No audio"); audio_combo.append_text("No audio");
if (as.size() > 0) { if (as.size() > 0) {
for (AudioStreams::iterator it = as.begin(); it < as.end(); ++it) { for (TranscodeFfmpeg::FFAudioStreams::iterator it = as.begin(); it < as.end(); ++it) {
audio_combo.append_text((*it).name); audio_combo.append_text((*it).name);
} }
} }