我是否正确使用GMFBridge. dll和GMFBridge播放器,GMFBridge播放器是否可以从套接字获取数据
Am i using the GMFBridge.DLL and GMFBridge player correctly and can gmf player be made to take data from socket?
我需要一个应用程序,我想把NAL单位的字节流给GMFBridge播放器而不是文件。所以我做了下面的事情为演示获取该文件并解析该文件,以便我可以找到最后的单元
FILE* infile;
uint8_t* buf = (uint8_t*)malloc(BUFSIZE );
char* buf1 = new char(BUFSIZE );
h264_stream_t* h = h264_new();
/*if (argc < 2) { usage(); return EXIT_FAILURE; }*/
infile = fopen(Filepath, "rb");
while (1)
{
rsz = fread(buf + sz, 1, BUFSIZE - sz, infile);
fseek (infile , 0 , SEEK_END);
lSize = ftell (infile);
rewind (infile);
buffer = (char*) malloc (sizeof(char)*lSize);
if (buffer == NULL)
{fputs ("Memory error",stderr); exit (2);}
// copy the file into the buffer:
result = fread (buffer,1,lSize,infile);
if (result != lSize)
{fputs ("Reading error",stderr); exit (3);}
fprintf( h264_dbgfile1,"data in file is %lldn",buffer);
int l=strlen(buffer);
fclose (h264_dbgfile1);
if (rsz == 0)
{
if (ferror(infile)) { fprintf( stderr, "!! Error: read failed: %s n", strerror(errno)); break; }
break; // if (feof(infile))
}
sz += rsz;
while (find_nal_unit(p, sz, &nal_start, &nal_end) > 0)
{
int length =nal_end-nal_start;
int j=0;
while(length!=0)
{
for (int start=nal_start;start<=nal_end;start++)
{
FileData[pointer][j]=buffer[start];
//FileData[pointer][j]=(p[j]);
j++;
length--;
if(length==0)
break;
}
}
HRESULT hr = m_pPlayer->AddClip(ofn.lpstrFile, &pClip);//i am not able to give the data here
请告诉上面的解决方案,或者我们可以连接GMFBridge播放器从socket获取数据并连续播放。我尝试使用套接字,但没有收到数据,因为连接调用成功
int find_nal_unit(uint8_t* buf, int size, int* nal_start, int* nal_end)
{
int i;
// find start
*nal_start = 0;
*nal_end = 0;
i = 0;
while ( //( next_bits( 24 ) != 0x000001 && next_bits( 32 ) != 0x00000001 )
(buf[i] != 0 || buf[i+1] != 0 || buf[i+2] != 0x01) &&
(buf[i] != 0 || buf[i+1] != 0 || buf[i+2] != 0 || buf[i+3] != 0x01)
)
{
i++; // skip leading zero
if (i+4 >= size) { return 0; } // did not find nal start
}
if (buf[i] != 0 || buf[i+1] != 0 || buf[i+2] != 0x01) // ( next_bits( 24 ) != 0x000001 )
{
i++;
}
if (buf[i] != 0 || buf[i+1] != 0 || buf[i+2] != 0x01) { /* error, should never happen */ return 0; }
i+= 3;
*nal_start = i;
while ( //( next_bits( 24 ) != 0x000000 && next_bits( 24 ) != 0x000001 )
(buf[i] != 0 || buf[i+1] != 0 || buf[i+2] != 0) &&
(buf[i] != 0 || buf[i+1] != 0 || buf[i+2] != 0x01)
)
{
i++;
// FIXME the next line fails when reading a nal that ends exactly at the end of the data
if (i+3 >= size) { *nal_end = size; return -1; } // did not find nal end, stream ended first
}
*nal_end = i;
return (*nal_end - *nal_start);
}
Bridge连接两个图,这样您就可以独立地更改它们的状态,而不会出现不必要的流中断。它与H.264、Sockets和NAL单位无关。
如果你发现或创建了一个过滤器,它可以将从套接字接收到的有效载荷传递到DirectShow管道中,桥将能够接受它并传递到第二个图中
相关文章:
- SFML纹理像播放器
- 根据用户回答声明"Players"。用户选择玩家数量。播放器是结构体
- (SFML)按下键时,播放器构造函数未使用正确的动画进行更新
- 旋转播放器模型以指向一个点
- 播放器未在程序中的"X"和"O"之间切换
- DwmGetWindowAttribute 在全屏模式下无法获得媒体播放器的正确矩形大小
- 可以访问一个类中的播放器结构,但不能访问另一个类中的播放器结构
- C++ 播放器墙与 SFML 的冲突
- 如何在不显示媒体播放器的情况下在libVLC中拍摄快照
- OpenGL沿方向矢量移动播放器
- 如何将 cdparanoia 读取的 CD 音频数据移交给 ALSA 播放器?
- 我应该如何在文本RPG中调用播放器咒语
- 类模板"没有用于调用播放器的匹配函数::P layer()"
- 使用 Struct 进行 mp3 播放器模拟C++(不需要播放 mp3 的唯一显示列表)
- 如何修复结构播放器对象中的矢量位置,以便它在 Main 中与 me.position 一起使用?
- 将超能力高级音频播放器同步到绝对位置
- QT 5.8 WebEngine HTML 5视频播放器支持
- 克里昂未初始化记录类型:播放器
- 当磁盘几乎完整时,使用C 流式播放器复制Linux中的文件也不例外
- 我是否正确使用GMFBridge. dll和GMFBridge播放器,GMFBridge播放器是否可以从套接字获取数据