Hi all.
I am writing an application, receiving the MPEG2 Transport Stream from a DVB-S 
card and saving its parts to a file in the MPEG Program Stream (without 
recoding data).

This application is going to run forever as a service or a daemon, accepting 
requests via HTTP interface.

Main cycle is basically following.

// initialization

input=av_alloc_format_context();
input->iformat=av_find_input_format("mpegts");
AVFormatParameters ap;
memset(&ap, 0, sizeof(ap));
ap.prealloced_context=1;

av_open_input_stream(&input,input->pb,"linsys",input->iformat,&ap);
av_find_stream_info(input);

// main loop
while(!is_exiting()){
AVPacket pkt;
  av_read_frame(input,&pkt);
  int pid=input->streams[pkt.stream_index]->id;

   for(< loop over all current tasks, each is an array of 2 elementary PIDs >) {
     int pkt_stream_index=pkt.stream_index;

     if ( < task[i] needs current pid > ){
       < reassing pkt.stream_index to 0 or 1 >; 

       if(!tasks[i]->header_written){
          av_write_header(tasks[i]->output);
          tasks[i]->header_written;
       } 
       av_write_frame(m_tasks[i]->output,&pkt)
       pkt.stream_index=pkt_stream_index;
    }
  }
  av_free_packet(&pkt);
}

Is above loop correct?
Is av_free_packet() call correct or should I use something else?

Run for the last night, my program has worked for about 1.5 hours, and stopped.

drmingw.exe said that the error was caused by memcpy, called from 
ff_combine_frame:

main.exe caused an Access Violation at location 77bd3ec4 in module msvcrt.dll 
Writing to location 0f820f5f.

Registers:
eax=000000ff ebx=0f820f57 ecx=000000b7 edx=00000003 esi=167f44b0 edi=0f820f5f
eip=77bd3ec4 esp=0380fd3c ebp=0380fd44 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00210206

Call stack:
77BD3EC4  msvcrt.dll:77BD3EC4  memcpy
00AB90D7  avcodec-51.dll:00AB90D7  ff_combine_frame


_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to