资源简介
基于 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 Creator5)
- vtk QT做的三维地质可视化系统2of2
- Qt局域网聊天软件
- Qt Creator opengl实现四元数鼠标控制轨迹
- QT局域网聊天系统(基于QT5.修改过)
- qt-电子点菜系统
- C 餐厅叫号系统(QT平)
- QT 实现文件下载
- qt图像处理
- QT,JPEG解码源代码(已完成)
- Qt 播放音频文件
- Qt 读取16进制的data文件
- MQTT+串口(usart)透传
- 易语言QQTEA算法源码
- VC工程转Qt工程文件的工具
- MQTT推送Demo
- 基于Linux、QT的视频监控系统的设计与
- Qt 百度地图 定位
- QT酷炫界面开发指南《QmlBook》
- Ubuntu下操作Excel,qt代码
- Qt图片浏览器 --基于Qt的Graphics View f
- qtnribbon2破解
- Qt软件开发 完整项目代码
- MQTT_3.1protocol_Specific中文版
- 在QT中使用RTP进行视频的采集和传输
- Mini6410 Qt4和Qtopia编程开发指南
- Qt实现Code39条形码
- qt_ffmpeg_mp4_export_and_import.zip
- QT5.5入门与项目实战
- Huffman Compress 霍夫曼编码 压缩 解压缩
评论
共有 条评论