我用VCL播放器(下载的软件)可以播放我自己做的ts流服务器发送的UDP流~
但是在vc里面用vcl控件就播放不了,怎么回事?
谁有例子程序可以给我一个?只要能播放就行,越简单越好。 我写的:
VC2008 - 建立工程 - win32应用程序
(
然后上来就带一堆代码。我从工具箱里面弄出个vcl拖到 form1.h设计 上,
然后在属性里面修改了:
BaseURL = L"udp://192.168.1.101:2224";
AutoPlay = true;
之后运行,不能播放TS流(用下载的VCL播放器打开网络串流udp://192.168.1.101:2224播放正常)。
) 之后我又在form1.h的构造函数上加了:
m_VCL->BaseURL = L"udp://192.168.1.101:2224";
//m_VCL->AutoLoop = true;
m_VCL->AutoPlay = true;
故障依旧。 怎么回事? 还要修改什么??
目前的完整代码: C/C++ codeform1.h
______________________________________
#pragma once
namespace ts { using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing; /// <summary>
/// Form1 摘要
///
/// 警告: 如果更改此类的名称,则需要更改
/// 与此类所依赖的所有 .resx 文件关联的托管资源编译器工具的
/// “资源文件名”属性。否则,
/// 设计器将不能与此窗体的关联
/// 本地化资源正确交互。
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: 在此处添加构造函数代码
//
m_VCL->BaseURL = L"udp://192.168.1.101:2224";
//m_VCL->AutoLoop = true;
m_VCL->AutoPlay = true;
} protected:
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: AxAXVLC::AxVLCPlugin2^ m_VCL;
protected: private:
/// <summary>
/// 必需的设计器变量。
/// </summary>
System::ComponentModel::Container ^components;#pragma region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
this->m_VCL = (gcnew AxAXVLC::AxVLCPlugin2());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->m_VCL))->BeginInit();
this->SuspendLayout();
//
// m_VCL
//
this->m_VCL->AllowDrop = true;
this->m_VCL->Enabled = true;
this->m_VCL->Location = System::Drawing::Point(12, 12);
this->m_VCL->Name = L"m_VCL";
this->m_VCL->OcxState = (cli::safe_cast<System::Windows::Forms::AxHost::State^ >(resources->GetObject(L"m_VCL.OcxState")));
this->m_VCL->Size = System::Drawing::Size(257, 224);
this->m_VCL->TabIndex = 0;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 266);
this->Controls->Add(this->m_VCL);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->m_VCL))->EndInit();
this->ResumeLayout(false); }
#pragma endregion
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
};
}main.c
__________________
// ts.cpp: 主项目文件。#include "stdafx.h"
#include "Form1.h"using namespace ts;[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// 在创建任何控件之前启用 Windows XP 可视化效果
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false); // 创建主窗口并运行它
Application::Run(gcnew Form1()); return 0;
}求高手指点。。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货