• rtsp 播放器


    http://blog.csdn.net/niu_gao/article/details/7753672


    /******************************************************************************
    * INCLUDE FILES
    ******************************************************************************/
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <sys/stat.h>
    int main(int argc,char *argv[])
    {
    FILE *fp =NULL;
    FILE *fd = NULL;

    //unsigned char stream_buffer[14*1024*1024];//={0};
    unsigned char *stream_buffer;//={0};

    //unsigned char *steam =stream_buffer;
    int x=0;
    int y=0;
    int stream_len=0;
    int mycount = 0;
    int temp = 0;
    struct stat stat_buf;
    int file_len =0;
    int flag =0;

    stat("video-H264-1.h264",&stat_buf);
    file_len = stat_buf.st_size;
    stream_buffer = malloc(file_len);
    memset(stream_buffer,0,sizeof(stream_buffer));
    fp = fopen("video-H264-1.h264","rb");
    if(fp ==NULL)
    {
    exit(-1);
    }

    fd = fopen("tvvideo.h264","wb");
    /*
    while((x=fgetc(fp))!=EOF)
    {
    stream_buffer[y++]=x;
    printf("size:%d ",y);
    };*/
    fread(stream_buffer,1,file_len,fp);
    y = file_len;
    printf("size:%d ",y);
    stream_len = y;
    x =0;

    while(x<y)//1 char
    {
    flag =0;
    temp = stream_buffer[x];
    mycount = x;

    if ((stream_buffer[mycount++] == 0 && stream_buffer[mycount++] == 0 &&
    stream_buffer[mycount++] == 0 && stream_buffer[mycount++] == 0x01))//detect 00 00 00 01
    {
    if ((stream_buffer[mycount++] == 0 && stream_buffer[mycount++] == 0 &&
    stream_buffer[mycount++] == 0 && stream_buffer[mycount++] == 0x01))
    {
    x=x+3;
    flag =1;
    }
    printf("xx ");

    //NewNalType = stream_buffer[loopCount++] & 0x1f;
    //firstMbInSliceFlag = stream_buffer[loopCount++] & 0x80;
    }
    x++;
    if(flag==0)fputc(temp,fd);

    }
    free(stream_buffer);

    fclose(fp);
    fclose(fd);
    return 0;
    }

  • 相关阅读:
    解决junit @RunWith无法使用的问题
    git .gitignore 有时不起作用的问题
    Docker常用命令 InsaneLoafer
    NOI2021 退役记
    2021“MINIEYE杯”中国大学生算法设计超级联赛 第二场 题解
    2021“MINIEYE杯”中国大学生算法设计超级联赛 第一场 题解
    数位DP
    Windows下Jmeter安装配置
    Linux安装docker-compose
    Ubuntu卸载MySQL
  • 原文地址:https://www.cnblogs.com/pengkunfan/p/3980102.html
Copyright © 2020-2023  润新知