+FFMpegPixelFormat::FFMpegPixelFormat(FFMPEGConfigVideo *vid_config,
+ int x, int y, int w, int list_h)
+ : BC_PopupTextBox(vid_config, 0, 0, x, y, w, list_h)
+{
+ this->vid_config = vid_config;
+}
+
+int FFMpegPixelFormat::handle_event()
+{
+ strncpy(vid_config->asset->ff_pixel_format, get_text(),
+ sizeof(vid_config->asset->ff_pixel_format));
+ return 1;
+}
+
+void FFMpegPixelFormat::update_formats()
+{
+ pixfmts.remove_all_objects();
+ char video_codec[BCSTRLEN]; video_codec[0] = 0;
+ const char *vcodec = vid_config->asset->vcodec;
+ AVCodec *av_codec = !FFMPEG::get_codec(video_codec, "video", vcodec) ?
+ avcodec_find_encoder_by_name(video_codec) : 0;
+ const AVPixelFormat *pix_fmts = av_codec ? av_codec->pix_fmts : 0;
+ if( pix_fmts ) {
+ for( int i=0; pix_fmts[i]>=0; ++i ) {
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmts[i]);
+ if( desc ) pixfmts.append(new BC_ListBoxItem(desc->name));
+ }
+ }
+ update_list(&pixfmts);
+}
+
+FFMpegSampleFormat::FFMpegSampleFormat(FFMPEGConfigAudio *aud_config,
+ int x, int y, int w, int list_h)
+ : BC_PopupTextBox(aud_config, 0, 0, x, y, w, list_h)
+{
+ this->aud_config = aud_config;
+}
+
+int FFMpegSampleFormat::handle_event()
+{
+ strncpy(aud_config->asset->ff_sample_format, get_text(),
+ sizeof(aud_config->asset->ff_sample_format));
+ return 1;
+}
+
+void FFMpegSampleFormat::update_formats()
+{
+ samplefmts.remove_all_objects();
+ char audio_codec[BCSTRLEN]; audio_codec[0] = 0;
+ const char *acodec = aud_config->asset->acodec;
+ AVCodec *av_codec = !FFMPEG::get_codec(audio_codec, "audio", acodec) ?
+ avcodec_find_encoder_by_name(audio_codec) : 0;
+ const AVSampleFormat *sample_fmts = av_codec ? av_codec->sample_fmts : 0;
+ if( sample_fmts ) {
+ for( int i=0; sample_fmts[i]>=0; ++i ) {
+ const char *name = av_get_sample_fmt_name(sample_fmts[i]);
+ if( name ) samplefmts.append(new BC_ListBoxItem(name));
+ }
+ }
+ update_list(&samplefmts);
+}
+
+void FileFFMPEG::set_options(char *cp, int len, const char *bp)