I am trying to flush the internal buffers used by libavcodec.  I have set up 
code to use my own read function and inspect the stream type.  I then proceed 
to start decoding, but I need to flush the internal buffers before running and 
during seeks.

This is how I am setting up the format context.  Using this, av_read_frame 
succeeds without any calls to my read function, implying buffered data from the 
stream inspection process and associated previous calls to my read function.

Does anyone know how force the flush to occur so that av_read_frame needs to 
make calls to get fresh data?

Here is the code used for the stream inspection.  Thank you very much in 
advance...

  if(init_put_byte(&ByteIOCtx, m_pDataBuffer, m_nInputBufferSize, 0, this, 
MyDecoderReadFunction, NULL, NULL) < 0)
  {
   return false;
  }

  AVProbeData pd;
  BYTE buf[2048];
  pd.buf = m_pDataBuffer;
  pd.buf_size = get_buffer(&ByteIOCtx, buf, 2048);
  pd.filename = "";

  AVInputFormat* pAVInputFormat = av_probe_input_format(&pd, 1);
  if(!pAVInputFormat)
  {
   return false;
  }

  if(av_open_input_stream(&m_pFormatCtx, &ByteIOCtx, "", pAVInputFormat, NULL) 
< 0 || m_pFormatCtx == NULL)
  {
   return false;
  }

  pAVInputFormat->flags |= AVFMT_NOFILE;
  if(av_find_stream_info(m_pFormatCtx) < 0)
  {
   return false;
  }
  pAVInputFormat->flags &= ~AVFMT_NOFILE;




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

Reply via email to