嵌入式 双向链表实现视频预录(hi3518c)

原创 2013年12月02日 14:57:04

prerecord.h

typedef structjoseph_prerecord 

 char *ipnc_frame_buf[25];
 int ipnc_frame_buf_size[25];
 
}JOSEPH_RECORD;

typedef structnode 

 JOSEPH_RECORD joseph_prerecord_ipnc;
 struct node *next; 
 struct node *pione;
}NODE;

 

prerecord.c

#include "avserver.h" 


NODE * prerecord_node_create(void) 

 NODE *head = (NODE*)malloc(sizeof(NODE)); 
 memset(head,0,sizeof(NODE));
 head->next = NULL; 
 head->pione = NULL; 
  returnhead; 

void init_joseph_prerecord_ipnc(JOSEPH_RECORD *in)
{
 static int i_temp =0;
 for(i_temp = 0; i_temp< 25 ; i_temp++)
 {
  in->ipnc_frame_buf[i_temp] =NULL;
  in->ipnc_frame_buf_size[i_temp]= 0;
 }
  
}


void prerecord_node_fill(NODE *head,JOSEPH_RECORD *in)
{
 static int i_temp = 0;
 for(i_temp = 0; i_temp < 25; i_temp++)
 
  
  head->joseph_prerecord_ipnc.ipnc_frame_buf[i_temp]= (char*)malloc((in->ipnc_frame_buf_size[i_temp])*sizeof(char));
  memcpy(head->joseph_prerecord_ipnc.ipnc_frame_buf[i_temp],in->ipnc_frame_buf[i_temp],in->ipnc_frame_buf_size[i_temp]);
  head->joseph_prerecord_ipnc.ipnc_frame_buf_size[i_temp]= in->ipnc_frame_buf_size[i_temp];
 }

}

NODE * prerecord_node_insert(NODE *head,JOSEPH_RECORD*joseph_prerecord_in) 

 NODE *p = NULL;
 if(head->joseph_prerecord_ipnc.ipnc_frame_buf[0]== NULL) 
 
  prerecord_node_fill(head,joseph_prerecord_in);
  return head;
 
 else 
 
       p = (NODE *)malloc(sizeof(NODE));
       memset(p,0,sizeof(p));
  prerecord_node_fill(p,joseph_prerecord_in);
       head->pione = p; 
       p->next = head; 
       p->pione = NULL; 
      
  returnp; 
}


void ipnc_frame_print(NODE *head) 

 NODE *q = NULL; 
 q = head; 
      static int frame_count = 0;
 static int node_count = 1;
      while(q != NULL) 
      
       printf("\n%s %d The %dth node :\n\n",__FUNCTION__,__LINE__,node_count++);
             for(frame_count = 0; frame_count < 25; frame_count++)
             {
        printf("%s %d The contnet of the %dth is %s\n",__FUNCTION__,__LINE__,frame_count,q->joseph_prerecord_ipnc.ipnc_frame_buf[frame_count]);              
             }
     q = q->next;
     printf("\n"); 
   
    


void ipnc_frame_save(NODE * head)
{

 FILE *fp_video;
 NODE *q = NULL; 
 q = head; 
      static int frame_count = 0;
      static int node_count = 1;
   fp_video =fopen(JOSEPH_PRERECORD_FILE_NAME, "wb");

      while(q->next != NULL) 
      
     q = q->next;
    }

#if 1
while(q != NULL)
{

 ///save one node
 for(frame_count = 0; frame_count < 25;frame_count++)
      {
       
       fwrite(q->joseph_prerecord_ipnc.ipnc_frame_buf[frame_count],q->joseph_prerecord_ipnc.ipnc_frame_buf_size[frame_count],1,fp_video);
  fflush(fp_video);
     }
 q = q->pione;
 node_count++;
 
 
}

fclose(fp_video);

#endif
 
}


NODE * ipnc_frame_free_node(NODE *head) 

 NODE *q = NULL;
 NODE *p = NULL;
 NODE *p_head = NULL;
      q = head;
 p_head = head;
      static int frame_count = 0;
 while(q->next != NULL) 
      
       q = q->next;
  p = q->pione;
    }

 if(q->next == NULL)
 {
  p->next = NULL;
  for(frame_count = 0;frame_count < 25; frame_count++)
       {
        free(q->joseph_prerecord_ipnc.ipnc_frame_buf[frame_count]);
   q->joseph_prerecord_ipnc.ipnc_frame_buf[frame_count]= NULL;
   if(q->joseph_prerecord_ipnc.ipnc_frame_buf[frame_count] == NULL)
   {
    //printf("%s%d free %dth frame buf succeed!\n",__FUNCTION__,__LINE__,frame_count);
   }
        }
   free(q);
   q = NULL;
 }
    return p_head;


void ipnc_frame_free(NODE *head) 

 NODE *q = NULL; 
      static int frame_count = 0;
 while(head != NULL) 
      
       q = head;
  head = head->next;
  
             for(frame_count = 0; frame_count < 25; frame_count++)
             {
        free(q->joseph_prerecord_ipnc.ipnc_frame_buf[frame_count]);
   q->joseph_prerecord_ipnc.ipnc_frame_buf[frame_count]= NULL;
   if(q->joseph_prerecord_ipnc.ipnc_frame_buf[frame_count] == NULL)
   {
    //printf("%s%d free %dth frame buf succeed!\n",__FUNCTION__,__LINE__,frame_count);
   }
             }
       free(q);
  q = NULL;
   
    

#if 0
int joseph_prerecord_video()
{

 static int frame_count = 0;
 char buf[64] = {0};
 NODE *joseph_prerecord_head = (NODE*)malloc(sizeof(NODE));
 JOSEPH_RECORD *joseph_prerecord_frame =(JOSEPH_RECORD *)malloc(sizeof(JOSEPH_RECORD));
 memset(joseph_prerecord_head,0,sizeof(NODE));
 memset(joseph_prerecord_frame,0,sizeof(JOSEPH_RECORD));

 init_joseph_prerecord_ipnc(&joseph_prerecord_head->joseph_prerecord_ipnc);
 init_joseph_prerecord_ipnc(joseph_prerecord_frame); 


 joseph_prerecord_head =prerecord_node_create();
 if ( joseph_prerecord_head != NULL)
 {
  printf("%s %d Create the listsucceed !\n",__FUNCTION__,__LINE__);
  
 }

 //init joseph_prerecord_head

 //creat next node

 for(frame_count = 0; frame_count < 25;frame_count++)
 {
  memset(buf,0,64);
  sprintf(buf,"%d",(frame_count*frame_count));

  joseph_prerecord_frame->ipnc_frame_buf[frame_count]= (char *)malloc((strlen(buf))*sizeof(char));
  memset(joseph_prerecord_frame->ipnc_frame_buf[frame_count],0,strlen(joseph_prerecord_frame->ipnc_frame_buf[frame_count]));
  memcpy(joseph_prerecord_frame->ipnc_frame_buf[frame_count],buf,strlen(buf));
       //printf("%s %d The content of the buf is %s, thelength is%d\n",__FUNCTION__,__LINE__,buf,strlen(joseph_prerecord_frame->ipnc_frame_buf[frame_count]));
  printf("%s %d The content of%dth frame is  is%s\n",__FUNCTION__,__LINE__,frame_count,joseph_prerecord_frame->ipnc_frame_buf[frame_count]);
 }
 
 joseph_prerecord_head =prerecord_node_insert(joseph_prerecord_head,joseph_prerecord_frame);


 for(frame_count = 0; frame_count < 25;frame_count++)
 {
  memset(buf,0,64);
  sprintf(buf,"%d",(frame_count*frame_count*frame_count));

  joseph_prerecord_frame->ipnc_frame_buf[frame_count]= (char *)malloc((strlen(buf))*sizeof(char));
  memset(joseph_prerecord_frame->ipnc_frame_buf[frame_count],0,strlen(joseph_prerecord_frame->ipnc_frame_buf[frame_count]));
  memcpy(joseph_prerecord_frame->ipnc_frame_buf[frame_count],buf,strlen(buf));
       printf("%s %d The content of the buf is %s, thelength is%d\n",__FUNCTION__,__LINE__,buf,strlen(joseph_prerecord_frame->ipnc_frame_buf[frame_count]));
  printf("%s %d The content of%dth frame is  is%s\n",__FUNCTION__,__LINE__,frame_count,joseph_prerecord_frame->ipnc_frame_buf[frame_count]);
 }
 
 joseph_prerecord_head =prerecord_node_insert(joseph_prerecord_head,joseph_prerecord_frame);


 for(frame_count = 0; frame_count < 25;frame_count++)
 {
  memset(buf,0,64);
  sprintf(buf,"%d",(frame_count*frame_count*frame_count*frame_count));

  joseph_prerecord_frame->ipnc_frame_buf[frame_count]= (char *)malloc((strlen(buf))*sizeof(char));
  memset(joseph_prerecord_frame->ipnc_frame_buf[frame_count],0,strlen(joseph_prerecord_frame->ipnc_frame_buf[frame_count]));
  memcpy(joseph_prerecord_frame->ipnc_frame_buf[frame_count],buf,strlen(buf));
       printf("%s %d The content of the buf is %s, thelength is%d\n",__FUNCTION__,__LINE__,buf,strlen(joseph_prerecord_frame->ipnc_frame_buf[frame_count]));
  printf("%s %d The content of%dth frame is  is%s\n",__FUNCTION__,__LINE__,frame_count,joseph_prerecord_frame->ipnc_frame_buf[frame_count]);
 }
 
 joseph_prerecord_head =prerecord_node_insert(joseph_prerecord_head,joseph_prerecord_frame);

 
 for(frame_count = 0; frame_count < 25;frame_count++)
 {

  free(joseph_prerecord_frame->ipnc_frame_buf[frame_count]);
  joseph_prerecord_frame->ipnc_frame_buf[frame_count]= NULL;
  
 }
 
 ipnc_frame_print(joseph_prerecord_head);


 ipnc_frame_free(joseph_prerecord_head);

 
 return 0;
}
#endif

嵌入式 双向链表实现视频预录(hi3518c)

转载注明出处:http://blog.sina.com.cn/s/blog_8795b0970101jlns.html prerecord.h typedef struct joseph_...
  • huguohu2006
  • huguohu2006
  • 2017年11月10日 09:36
  • 44

嵌入式 hi3518c平台uboot中start.s小结

第一阶段: /*====================================Hi3518c start.S Begin 2014-04-20=====================...
  • lin364812726
  • lin364812726
  • 2014年09月02日 14:42
  • 819

嵌入式 视频编码(H264)hi3518

这几天在编写视频录制模块,所以,闲暇之余,又粗粗的整理了一下,主要是API,以备不时之用   视频编码(H264)hi3518" />     摄像头获取的模拟信号通过经芯片处理(我们使用的是CX2...
  • skdkjxy
  • skdkjxy
  • 2013年12月02日 14:51
  • 3025

用TextureView实现视频录制

https://android.googlesource.com/platform/development/+/4b737b6/samples/browseable/MediaRecorder/src...
  • h3c4lenovo
  • h3c4lenovo
  • 2015年01月29日 10:58
  • 5356

基于Qt的嵌入式媒体播放器系统的设计

转自:http://blog.csdn.net/HEN_MAN/article/details/6917159 摘要:本文以无线多媒体终端项目的需求为背景,提出了一种适用于嵌入式系统的媒体播...
  • adazone
  • adazone
  • 2015年04月15日 22:35
  • 1140

iOS三种录制视频方式详细对比

先附上参考资料 http://www.jianshu.com/p/16cb14f53933 https://developer.apple.com/library/content/sampleco...
  • qq_34047841
  • qq_34047841
  • 2017年03月23日 09:59
  • 2115

强制Html5视频全量加载方法步骤详解

本文和大家分享的主要是强制Html5视频全量加载相关内容,一起来看看吧,希望对大家学习html5有所帮助。   默认情况下我们实现一个简单的 H5 的播放器,只需要这么简单的代码就好:  ...
  • qq_32506555
  • qq_32506555
  • 2017年07月19日 13:01
  • 510

Android开发之使用MediaRecorder录制视频

MediaRecorder除了可以用于录制音频,还可用于录制视频。使用MediaRecorder录制视频与录制音频的步骤基本相同。只是录制视频时不仅需要采集声音,还需要采集图像。为了让MediaRec...
  • fengyuzhengfan
  • fengyuzhengfan
  • 2014年08月14日 20:20
  • 12859

github视频录制播放相关功能-参考

http://www.cnblogs.com/niexiaobo/p/4933990.html github视频录制播放相关功能-参考 lookingstars/JZVideoDemo ...
  • jeffasd
  • jeffasd
  • 2016年07月09日 22:30
  • 1584

使用SurfaceBiew录制视频

一直对录制视频感兴趣,最近项目中遇到了,就顺便学习了下,话不多说,直接上代码 RecordVideoActivity.class package com.czh.tongjiproject.u...
  • jiahuan0207
  • jiahuan0207
  • 2016年07月23日 15:53
  • 467
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:嵌入式 双向链表实现视频预录(hi3518c)
举报原因:
原因补充:

(最多只允许输入30个字)