Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
wxVideoSettingsDialog.cpp
1 #include "wxVideoSettingsDialog.h"
2 #include <wx/filedlg.h>
3 #include <Gui/StringConv.hh>
4 
5 #ifdef BIAS_HAVE_FFMPEG
6  #ifdef __cplusplus
7  extern "C" {
8  #endif
9  #include <libavcodec/avcodec.h>
10  #ifdef __cplusplus
11  }
12  #endif
13 #endif
14 
16 :
18 {
19  //default settings as in VideoSink_FFmpeg
20  mFilename_ = wxT("");
21  mWidth_ = 352;
22  mHeight_ = 288;
23  mFps_ = 25;
24  mBitrate_ = 1000000;
25  mGoPSize_ = 12;
26  mMaxBFrames_ = 0;
27 
28  #ifdef BIAS_HAVE_FFMPEG
29  mCodecID_ = CODEC_ID_MPEG1VIDEO;
30  #endif
31 }
32 
33 void wxVideoSettingsDialog::OnSelectFile( wxCommandEvent& event )
34 {
35  wxFileDialog dialog(this,wxT("Select File"),wxT(""),wxT(""),
36  wxT("Movie files(*.avi;*.mpeg)|*.avi;*.mpeg|All files (*.*)|*.*"),
37  wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
38  int ret = dialog.ShowModal();
39  if(ret == wxID_OK){
40  SetOutputFilename(dialog.GetPath());
41  }
42 }
43 
44 void wxVideoSettingsDialog::OnOk( wxCommandEvent& event ){
45  mFilename_ = m_textOutFilenames->GetValue();
46  wxString value =m_textGoPSize->GetValue();
47  mGoPSize_ = atoi(WxToAscii(value));
48 
49  value = m_textWidth->GetValue();
50  mWidth_ = atoi(WxToAscii(value));
51  value = m_textHeight->GetValue();
52  mHeight_ = atoi(WxToAscii(value));
53  value = m_textBitrate->GetValue();
54  mBitrate_= atoi(WxToAscii(value));
55  value = m_textFPS->GetValue();
56  mFps_= atoi(WxToAscii(value));
57  value = m_textMaxBFrames->GetValue();
58  mMaxBFrames_= atoi(WxToAscii(value));
59 
60  int id = m_choiceCodec->GetSelection();
62  event.Skip();
63 }
64 
66  return mGoPSize_;
67 }
68 
70  return mFps_;
71 }
72 
74  return mBitrate_;
75 }
76 
78  return mWidth_;
79 }
80 
82  return mHeight_;
83 }
84 
86  return mMaxBFrames_;
87 }
88 
90  return mFilename_;
91 }
92 
94  return mCodecID_;
95 }
96 
97 /////////////////////////////////////////////////
99  mGoPSize_ = value;
100  wxString v; v.Printf(wxT("%d"),value);
101  m_textGoPSize->SetValue(v);
102 }
103 
105  mFps_ = value;
106  wxString v; v.Printf(wxT("%d"),value);
107  m_textFPS->SetValue(v);
108 }
109 
111  mBitrate_ = value;
112  wxString v; v.Printf(wxT("%d"),value);
113  m_textBitrate->SetValue(v);
114 }
115 
117  mWidth_ = value;
118  wxString v; v.Printf(wxT("%d"),value);
119  m_textWidth->SetValue(v);
120 }
121 
123  mHeight_ = value;
124  wxString v; v.Printf(wxT("%d"),value);
125  m_textHeight->SetValue(v);
126 }
127 
129  mMaxBFrames_ = value;
130  wxString v; v.Printf(wxT("%d"),value);
131  m_textMaxBFrames->SetValue(v);
132 }
133 
135  mFilename_ = value;
136  m_textOutFilenames->SetValue(value);
137 }
138 ///////////////////////////////////////////////////////////
140 #ifdef BIAS_HAVE_FFMPEG
141  switch(id)
142  {
143  case 0: return CODEC_ID_MPEG1VIDEO;
144  case 1: return CODEC_ID_MPEG2VIDEO;
145  case 2: return CODEC_ID_MPEG4;
146  case 3: return CODEC_ID_FFV1;
147  case 4: return CODEC_ID_H261;
148  case 5: return CODEC_ID_H263;
149  case 6: return CODEC_ID_H264;
150  case 7: return CODEC_ID_MJPEG;
151  case 8: return CODEC_ID_RAWVIDEO;
152  case 9: return CODEC_ID_MSMPEG4V1;
153  case 10: return CODEC_ID_MSMPEG4V2;
154  case 11: return CODEC_ID_MSMPEG4V3;
155  case 12: return CODEC_ID_WMV1;
156  case 13: return CODEC_ID_WMV2;
157  case 14: return CODEC_ID_THEORA;
158  case 15: return CODEC_ID_TRUEMOTION1;
159  }
160 #endif
161  return -1;
162 }
void SetOutputFilename(wxString value)
int GetCodecID()
Returns the codec ID as in libavcodec/avcodec.h.
void OnOk(wxCommandEvent &event)
Class wxVideoSettingsDialogBase.
wxVideoSettingsDialog(wxWindow *parent)
Constructor.
void OnSelectFile(wxCommandEvent &event)