资源简介
基于 qt的gstreamer 应用,实现视频播放,外国人写的linux系统,需要本机安装 gstreamer 插件
代码片段和文件信息
#include “apetoflac.h“
#define TIME 200
GstElement *audiobin;
ApeToFlac *apetoflac = 0;
static gboolean
bus_call (GstBus *bus
GstMessage *msg
gpointer data)
{
bus = NULL;
data = NULL;
switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_EOS:
g_print (“Конец потока\n“);
apetoflac->stopCode();
break;
case GST_MESSAGE_STATE_CHANGED: {
GstState oldstate;
GstState newstate;
GstState pending;
if (!strcmp(gst_element_get_name(GST_MESSAGE_SRC(msg)) “atf-transcoder“))
{
gst_message_parse_state_changed(msg &oldstate &newstate &pending);
//g_print (“%s changed state from %d to %d pending %d\n“ GST_ELEMENT_NAME(GST_MESSAGE_SRC(msg)) oldstate newstate pending);
if (newstate == GST_STATE_PLAYING)
apetoflac->decoding();
}
break;
}
case GST_MESSAGE_ERROR: {
gchar *debug;
GError *error;
gst_message_parse_error (msg &error &debug);
g_free (debug);
g_printerr (“Ошибка: %s\n“ error->message);
g_error_free (error);
break;
}
default:
break;
}
return TRUE;
}
static void
cb_newpad (GstElement *decodebin
GstPad *pad
gboolean last
gpointer data)
{
GstCaps *caps;
GstStructure *str;
GstPad *audiopad;
audiopad = gst_element_get_static_pad (audiobin “sink“);
if (GST_PAD_IS_linkED (audiopad)) {
g_object_unref (audiopad);
decodebin = NULL;
last = NULL;
data = NULL;
return;
}
caps = gst_pad_get_caps (pad);
str = gst_caps_get_structure (caps 0);
if (!g_strrstr (gst_structure_get_name (str) “audio“)) {
gst_caps_unref (caps);
gst_object_unref (audiopad);
return;
}
gst_caps_unref (caps);
gst_pad_link (pad audiopad);
}
// Конструктор
ApeToFlac::ApeToFlac(QWidget *parent) : QDialog(parent)
{
setupUi(this);
apetoflac = this;
timer = new QTimer(this);
connect(okButton SIGNAL(clicked()) this SLOT(startDecoder()));
connect(timer SIGNAL(timeout()) this SLOT(progressUpd()));
}
// Получение имен файлов
void ApeToFlac::setFileNames(QString cuefile QString apefile)
{
QString line;
QRegExp rxFilename(“(.*)\\.(.{3})“);
QRegExp rxFilename2(“.*/([^/]*)$“);
QRegExp rxSoundfile(“^FILE \“(.*)\““);
QFile inCuefile(cuefile);
atfCuefile = cuefile;
atfApefile = apefile;
rxFilename.indexIn(atfApefile);
outFile = rxFilename.cap(1) + “.flac“;
rxFilename.indexIn(atfCuefile);
outCue = rxFilename.cap(1);
if (rxFilename.indexIn(outCue) != -1)
outCue = rxFilename.cap(1) + “.flac.cue“;
else
outCue += “.flac.cue“;
QFile outCueFile(outCue);
outCueFile.open(QFile::WriteOnly | QFile::Truncate);
inCuefile.open(QFile::ReadOnly);
QTextStream cueInText(&inCuefile);
QTextStream cueOutText(&outCueFile);
cueInText.setCodec(“Windows-1251“);
cueOutText.setCodec(“Windows-1251“);
do {
line = cueInText.readLine();
if (rxSoundfile.indexIn(line) != -1)
{
if (rxFilename2.indexIn(atfApefile) != -1)
if(rxFilename.indexIn(rxFilename2.cap(1)) != -1)
cueOutText << “FILE \““ << rxFilename.cap(1) << “
相关资源
- 基于QT的网络聊天室+收发数据及文件
- QT 不规则悬浮球 仿360
- qt数据画波形
- qt 实现ftp服务器源码
- VTK应用之VTK与Qt整合的
- qt实现的滑动设置时间自定义控件
- Qt的pro文件转VS的工程文件
- QT Qudpsocket 传送结构体数据
- Qt 使用多线程QThread实现进度条
- JasonQt_BaiduVop Demo
- Qt实现半透明不规则窗体的
- qtwinmigrate-2.8_1-opensource_qt5.7
- image_process.zip
- Qt 自绘波形图 心电图 的 实时显示
- Qt实现高级组织结构图
- Qt实现绘图工具
- Qt实现网络拓扑图
- QTtabBar+中文语言文件+win8主题
- CustomDelegate.rar
- Qt读取txt文件的内容,保存到数组,并
- 利用百度人脸识别API和pyqt5实现基于人
- QTTabBar 1038 中文汉化包 自己优化使用
- Qt条码生成器
- Qt QLocalServer QLocalSocket进程通信
- numberKeyBoard.rar
- 用Qt5实现QCamera摄像头的调用和监控
- Qt界面美化
- 基于Qt的通用态势显示平台的设计与实
- QT5 计算器
- qt双色球
评论
共有 条评论