void CBCGPTextFormatDlg::OnUpdateFont() { SetupFormat(m_textFormatPreview, TRUE); m_wndPreview.m_HorzAlign = (CBCGPTextFormat::BCGP_TEXT_ALIGNMENT)m_nHorzAlignment; m_wndPreview.m_VertAlign = (CBCGPTextFormat::BCGP_TEXT_ALIGNMENT)m_nVertAlignment; m_wndPreview.RedrawWindow(); }
VideoStream::VideoStream( const char *filename, const char *format, int bitrate, double frame_rate, int colours, int width, int height ) { if ( !initialised ) { Initialise(); } SetupFormat( filename, format ); SetupCodec( colours, width, height, bitrate, frame_rate ); SetParameters(); }
VideoStream::VideoStream( const char *in_filename, const char *in_format, int bitrate, double frame_rate, int colours, int subpixelorder, int width, int height ) : filename(in_filename), format(in_format), last_pts( -1 ), streaming_thread(0), do_streaming(true), buffer_copy(NULL), buffer_copy_lock(new pthread_mutex_t), buffer_copy_size(0), buffer_copy_used(0), packet_index(0) { if ( !initialised ) { Initialise( ); } if ( format ) { int length = strlen(format); codec_and_format = new char[length+1];; strcpy( codec_and_format, format ); format = codec_and_format; codec_name = NULL; char *f = strchr(codec_and_format, '/'); if (f != NULL) { *f = 0; codec_name = f+1; } } SetupFormat( ); SetupCodec( colours, subpixelorder, width, height, bitrate, frame_rate ); SetParameters( ); // Allocate buffered packets. packet_buffers = new AVPacket*[2]; packet_buffers[0] = new AVPacket(); packet_buffers[1] = new AVPacket(); packet_index = 0; // Initialize mutex used by streaming thread. if ( pthread_mutex_init( buffer_copy_lock, NULL ) != 0 ) { Fatal("pthread_mutex_init failed"); } }
int InitVideo (access_t *access, int fd, uint32_t caps) { access_sys_t *sys = access->p_sys; if (!(caps & V4L2_CAP_VIDEO_CAPTURE)) { msg_Err (access, "not a video capture device"); return -1; } v4l2_std_id std; if (SetupInput (VLC_OBJECT(access), fd, &std)) return -1; /* NOTE: The V4L access_demux expects a VLC FOURCC as "chroma". It is used to set the * es_format_t structure correctly. However, the V4L access (*here*) has no use for a * VLC FOURCC and expects a V4L2 format directly instead. That is confusing :-( */ uint32_t pixfmt = 0; char *fmtstr = var_InheritString (access, CFG_PREFIX"chroma"); if (fmtstr != NULL && strlen (fmtstr) <= 4) { memcpy (&pixfmt, fmtstr, strlen (fmtstr)); free (fmtstr); } else /* Use the default^Wprevious format if none specified */ { struct v4l2_format fmt = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE }; if (v4l2_ioctl (fd, VIDIOC_G_FMT, &fmt) < 0) { msg_Err (access, "cannot get default format: %s", vlc_strerror_c(errno)); return -1; } pixfmt = fmt.fmt.pix.pixelformat; } msg_Dbg (access, "selected format %4.4s", (const char *)&pixfmt); struct v4l2_format fmt; struct v4l2_streamparm parm; if (SetupFormat (access, fd, pixfmt, &fmt, &parm)) return -1; msg_Dbg (access, "%"PRIu32" bytes for complete image", fmt.fmt.pix.sizeimage); /* Check interlacing */ switch (fmt.fmt.pix.field) { case V4L2_FIELD_INTERLACED: msg_Dbg (access, "Interlacing setting: interleaved"); /*if (NTSC) sys->block_flags = BLOCK_FLAG_BOTTOM_FIELD_FIRST; else*/ sys->block_flags = BLOCK_FLAG_TOP_FIELD_FIRST; break; case V4L2_FIELD_INTERLACED_TB: msg_Dbg (access, "Interlacing setting: interleaved top bottom" ); sys->block_flags = BLOCK_FLAG_TOP_FIELD_FIRST; break; case V4L2_FIELD_INTERLACED_BT: msg_Dbg (access, "Interlacing setting: interleaved bottom top" ); sys->block_flags = BLOCK_FLAG_BOTTOM_FIELD_FIRST; break; default: break; } /* Init I/O method */ if (caps & V4L2_CAP_STREAMING) { sys->bufc = 4; sys->bufv = StartMmap (VLC_OBJECT(access), fd, &sys->bufc); if (sys->bufv == NULL) return -1; access->pf_block = MMapBlock; } else if (caps & V4L2_CAP_READWRITE) { sys->blocksize = fmt.fmt.pix.sizeimage; sys->bufv = NULL; access->pf_block = ReadBlock; } else { msg_Err (access, "no supported capture method"); return -1; } return 0; }
bool wxSoundStreamOSS::SetSoundFormat(const wxSoundFormatBase& format) { int tmp; wxSoundFormatPcm *pcm_format; if (format.GetType() != wxSOUND_PCM) { m_snderror = wxSOUND_INVFRMT; return false; } if (!m_oss_ok) { m_snderror = wxSOUND_INVDEV; return false; } if (m_sndformat) delete m_sndformat; m_sndformat = format.Clone(); if (!m_sndformat) { m_snderror = wxSOUND_MEMERROR; return false; } pcm_format = (wxSoundFormatPcm *)m_sndformat; // We temporary open the OSS device if (m_oss_stop) { m_fd = open(m_devname.mb_str(), O_WRONLY); if (m_fd == -1) { m_snderror = wxSOUND_INVDEV; return false; } } // Set the sample rate field. tmp = pcm_format->GetSampleRate(); ioctl(m_fd, SNDCTL_DSP_SPEED, &tmp); pcm_format->SetSampleRate(tmp); // Detect the best format DetectBest(pcm_format); // Try to apply it SetupFormat(pcm_format); tmp = pcm_format->GetChannels(); ioctl(m_fd, SNDCTL_DSP_CHANNELS, &tmp); pcm_format->SetChannels(tmp); // Close the OSS device if (m_oss_stop) close(m_fd); m_snderror = wxSOUND_NOERROR; if (*pcm_format != format) { m_snderror = wxSOUND_NOEXACT; return false; } return true; }
BOOL CBCGPTextFormatDlg::OnInitDialog() { CBCGPDialog::OnInitDialog(); if (!m_Options.m_bShowAngle) { m_wndAngle.EnableWindow(FALSE); m_wndAngle.ShowWindow(SW_HIDE); m_wndAngleLabel.ShowWindow(SW_HIDE); } if (!m_Options.m_bShowWordWrap) { m_wndWordWrap.EnableWindow(FALSE); m_wndWordWrap.ShowWindow(SW_HIDE); m_wndWordWrap.ShowWindow(SW_HIDE); } if (!m_Options.m_bShowClipText) { m_wndClipText.EnableWindow(FALSE); m_wndClipText.ShowWindow(SW_HIDE); m_wndClipText.ShowWindow(SW_HIDE); } if (m_bUseCharSet) { CBCGPLocalResource locaRes; m_nLocaleIndex = GetCharsetIndex(m_textFormat.GetCharSet()); CString strLabel; strLabel.LoadString(IDS_BCGBARRES_SCRIPT_LABEL); m_wndLocaleLabel.SetWindowText(strLabel); } else { m_wndLocaleCombo.ResetContent(); m_wndLocaleCombo.AddString(_T("Default")); #ifndef _BCGSUITE_ const CStringList& list = globalData.GetLocaleList(); for (POSITION pos = list.GetHeadPosition (); pos != NULL;) { m_wndLocaleCombo.AddString(list.GetNext(pos)); } CString strLocale = globalData.GetLocaleByName(m_textFormat.GetFontLocale()); if (strLocale.IsEmpty()) { m_nLocaleIndex = 0; // Default } else { m_nLocaleIndex = m_wndLocaleCombo.FindStringExact(-1, strLocale); } m_wndLocaleCombo.SetCurSel(m_nLocaleIndex); #endif } m_wndFontComboBox.SelectFont(m_textFormat.GetFontFamily()); m_wndPreview.m_strText = m_Options.m_strPreviewText; SetupFormat(m_textFormatPreview, TRUE); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CBCGPTextFormatDlg::OnOK() { SetupFormat(m_textFormat, FALSE); CBCGPDialog::OnOK(); }