我正在播放实时音频并希望具有暂停媒体播放器的功能,然后从当前的实时位置开始.默认的Pause()和Start()只是从它停止的位置开始.关于如何保持当前位置的任何想法,以便Start()是即时的?
我试图在CentOS 6.4的Qt 5.0中使用QNetworkAccessManager将文件上传到服务器.
我尝试过在线跟踪几个例子,但没有一个可行.QFTP工作正常,但很慢,现在已弃用.我的上传代码是:
void ftp::start(QString fileLocation)
{
QUrl url2("ftp://example.com");
url2.setUserName(ftpusername);
url2.setPassword(ftppassword);
data = new QFile(fileLocation, this);
if (data->open(QIODevice::ReadOnly)) {
nam = new QNetworkAccessManager();
reply = nam->put(QNetworkRequest(url2), data);
connect(nam, SIGNAL(finished(QNetworkReply*)),this, SLOT(requestFinished(QNetworkReply*)));
connect(reply, SIGNAL(uploadProgress(qint64, qint64)), SLOT(uploadProgress2(qint64, qint64)));
connect(reply, SIGNAL(finished()), SLOT(uploadDone()));
}
else
{
qDebug() << "Could not open file to FTP";
}
}
void ftp::uploadProgress2(qint64 done, qint64 total) {
double percent;
if(done > 0 && total > 0)
{
percent = (done*100)/total;
}
myParent->addLog("Completed: " + QString::number(done) + "/" + QString::number(total) …Run Code Online (Sandbox Code Playgroud) 我希望每5秒更新一次屏幕上的文字,我已经创建了一个计时器.但是,在第一次更新后,它永远不会再次更新该框.我假设我需要更新视图或其他东西,但我现在确定如何,任何想法?
public class HomeActivity extends Activity implements OnClickListener {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
textTitle = (TextView) findViewById(R.id.textTitle);
textArtist = (TextView) findViewById(R.id.textArtist);
timedMeta();
}
static void timedMeta()
{
timer.scheduleAtFixedRate(
new TimerTask() {
public void run() {
try{
textTitle.setText(title);
textArtist.setText(artist);
}
Thread.sleep(UPDATE_INTERVAL);
catch (Exception e)
{
},
DELAY_INTERVAL,
UPDATE_INTERVAL);
}
}
)
}
Run Code Online (Sandbox Code Playgroud) 我觉得这被列在某处并且非常容易,但我无法找到一个直截了当的答案.如何设置自定义背景图像.例如,将PNG设置为我的应用程序的默认背景,而不是黑屏.清单,布局,主要代码?一个例子是非常惊人的.
我目前在CentOS 6.3上使用FFMPEG v1.1.
我配置了FFMPEG:
./configure --arch=x86_64 --enable-libmp3lame --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libx264 --enable-pthreads --enable-gpl --enable-runtime-cpudetect
Run Code Online (Sandbox Code Playgroud)
当我运行一个简单的命令来记录MP4的实时输入时:
ffmpeg -f video4linux2 -s 640x480 -i /dev/video0 /home/irdb/Desktop/test.mp4
Run Code Online (Sandbox Code Playgroud)
我什么都没得到,只是一个灰色的屏幕边缘有一些文物.但是,当我运行与.MPG相同的命令时,它会很好.但是我需要MP4格式.
另外,我正在通过yum运行x264-0.120
我的问题是,我编译ffmpeg的方式有问题吗?或者它可能是别的什么?
编辑:
请求的示例输出:
# ffmpeg -f video4linux2 -s 640x480 -t 5 -i /dev/video0 -strict 2 /home/irdb/Desktop/test.mp4
ffmpeg version N-50546-g1f5b5b8 Copyright (c) 2000-2013 the FFmpeg developers
built on Mar 7 2013 00:17:44 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-libmp3lame --enable-librtmp --enable-libtheora --enable- libvorbis --enable-libx264 --enable-pthreads --enable-gpl --enable-runtime-cpudetect
libavutil 52. 18.100 / 52. 18.100 …Run Code Online (Sandbox Code Playgroud)