TextureCollection::~TextureCollection()
		{
			Dispose(false);
		}
Exemple #2
0
CDVDOverlayCodecFFmpeg::~CDVDOverlayCodecFFmpeg()
{
  Dispose();
}
CDVDVideoCodecOpenMax::~CDVDVideoCodecOpenMax()
{
  Dispose();
}
CDVDDemuxPVRClient::~CDVDDemuxPVRClient()
{
  Dispose();
}
Exemple #5
0
void Game_Map::Quit() {
	Dispose();
	interpreter.reset();
}
Exemple #6
0
KinectThread::~KinectThread() {
  Dispose();
}
Exemple #7
0
Mover_c::~Mover_c()
{
	Dispose ();
}
Exemple #8
0
void CPCMRemap::Reset()
{
  m_inSet  = false;
  m_outSet = false;
  Dispose();
}
Exemple #9
0
UserTable::~UserTable()
{
  Dispose();
}
Exemple #10
0
/* EXPORT->HDumpGraf: dump a BMP image of current display into fname */
void HDumpGraf(char *fname)
{
   BITMAPFILEHEADER FileHeader;
   BITMAPINFOHEADER BitmapHeader;
   BITMAPINFO *Info;
   int ColorTableSize;
   int ImageSize;
   FILE *fp;
   char *img;
   HDC dc = GetDC(theWindow);
   HBITMAP temp = CreateCompatibleBitmap(memDC,1,1);
     
   SelectObject(memDC,temp);
     
   /* retrieve information about the bitmap */
   BitmapHeader.biSize = sizeof(BITMAPINFOHEADER);
   BitmapHeader.biBitCount = 0;
   GetDIBits(memDC,theBitmap,0,0,NULL,&BitmapHeader,BI_RGB);
     
   switch (BitmapHeader.biCompression) {
   case BI_RGB:
      if (BitmapHeader.biBitCount > 8) {
         ColorTableSize = 0;
      }
      else {
         ColorTableSize = BitmapHeader.biClrUsed*sizeof(RGBQUAD);
      }
      break;
   case BI_RLE8:
   case BI_RLE4:
      ColorTableSize = BitmapHeader.biClrUsed*sizeof(RGBQUAD); 
      break;
   case BI_BITFIELDS:
      ColorTableSize = 3*sizeof(DWORD);
   }
     
   Info = (BITMAPINFO *) New(&gcheap,sizeof(BITMAPINFOHEADER) + ColorTableSize);
   memcpy(Info,&BitmapHeader,sizeof(BITMAPINFOHEADER));
     
   ImageSize = BitmapHeader.biSizeImage;
   img = New(&gcheap,ImageSize);
     
   GetDIBits(memDC,theBitmap,0,ClientRect.bottom,img,Info,BI_RGB);
     
   FileHeader.bfType = 0x4d42;  /* 'BM' */
   FileHeader.bfSize = sizeof(BITMAPINFOHEADER) + sizeof(BITMAPFILEHEADER) + 
      ImageSize + ColorTableSize;
   FileHeader.bfReserved1 = FileHeader.bfReserved2 = 0;
   FileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + ColorTableSize; 
     
   fp = fopen(fname,"wb");
   fwrite(&FileHeader,1,sizeof(BITMAPFILEHEADER),fp);
   fwrite(Info,1,sizeof(BITMAPINFOHEADER) + ColorTableSize,fp);
   fwrite(img,1,ImageSize,fp);
   fclose(fp);

   SelectObject(memDC,theBitmap);
   DeleteObject(temp);
   Dispose(&gcheap,Info);
   Dispose(&gcheap,img);
}
Exemple #11
0
CPCMRemap::~CPCMRemap()
{
  Dispose();
}
Exemple #12
0
/* EXPORT->HDrawImage: draw grey scale image stored in p */
void HDrawImage(unsigned char *p, int x, int y, int width, int height)
{
   HDC tdc = GetDC(theWindow);
   HDC dc = CreateCompatibleDC(memDC);
   HBITMAP bm = CreateCompatibleBitmap(tdc,width,height);
   HGDIOBJ OldObject;

   char *data = New(&gcheap,sizeof(BITMAPINFOHEADER) + 
                    sizeof(RGBQUAD)*MAX_GREYS);
   BITMAPINFOHEADER *BitmapHeader = (BITMAPINFOHEADER *) data;
   RGBQUAD *ColorTable = (RGBQUAD *) (data + sizeof(BITMAPINFOHEADER));
   BITMAPINFO *Info = (BITMAPINFO *) data;

   int i,j;

   /* if the length of the scan line is not a */
   /* multiple of four, the bitmap must be reshaped. */
   /* SetDIBits() expects scan lines to start on word boundaries. */

   int ScanLineLen = 4*(1+(width-1)/4);  
   unsigned char *reshaped = NULL;       

   BitmapHeader->biSize = sizeof(BITMAPINFOHEADER);
   BitmapHeader->biWidth = width;
   BitmapHeader->biHeight = -height;
   BitmapHeader->biPlanes = 1;
   BitmapHeader->biBitCount = 8;
   BitmapHeader->biCompression = 0;
   BitmapHeader->biSizeImage = 0;
   BitmapHeader->biXPelsPerMeter = 0;
   BitmapHeader->biYPelsPerMeter = 0;
   BitmapHeader->biClrUsed = MAX_GREYS;
   BitmapHeader->biClrImportant = MAX_GREYS;
   for (i=0;i<MAX_GREYS;i++) {
      ColorTable[i].rgbRed =
         ColorTable[i].rgbBlue =
         ColorTable[i].rgbGreen = greys[i];
      ColorTable[i].rgbReserved = 0;
   }

   if (ScanLineLen != width) {
      reshaped = (unsigned char *) New(&gcheap,height*ScanLineLen);
      for (i=0;i<height;i++) {
         for (j=0;j<width;j++) {
            reshaped[i*ScanLineLen+j] = p[i*width+j];
         }
      }
      SetDIBits(memDC,bm,0,height,reshaped,Info,DIB_RGB_COLORS);
      Dispose(&gcheap,reshaped);
   }
   else {
      SetDIBits(memDC,bm,0,height,p,Info,DIB_RGB_COLORS);
   }

   OldObject = SelectObject(dc,bm);
   BitBlt(memDC,x,y,width,height,dc,0,0,SRCCOPY);
   if (WritingToMeta) { /* bitmap source location differs */
      BitBlt(tdc,x,y,width,height,dc,x,y,SRCCOPY);
   }
   else {
      BitBlt(tdc,x,y,width,height,dc,0,0,SRCCOPY);
   }

   DeleteDC(dc);
   DeleteObject(bm);
   ReleaseDC(theWindow,tdc);
   Dispose(&gcheap,data);
}
Exemple #13
0
CDVDVideoCodecMFC::~CDVDVideoCodecMFC() {

  Dispose();

}
Exemple #14
0
bool CDVDVideoCodecMFC::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) {
  struct v4l2_format fmt;
  struct v4l2_crop crop;
  struct V4l2SinkBuffer sinkBuffer;
  V4l2Device *finalSink = NULL;
  int finalFormat = -1;
  int resultVideoWidth;
  int resultVideoHeight;
  int resultLineSize;
  unsigned int extraSize = 0;
  uint8_t *extraData = NULL;

  m_hints = hints;
  if (m_hints.software)
    return false;

  Dispose();

  m_Buffer = new V4l2SinkBuffer();
  m_BufferNowOnScreen = new V4l2SinkBuffer();
  m_BufferNowOnScreen->iIndex = -1;
  m_bVideoConvert = false;
  m_bDropPictures = false;
  memzero(m_videoBuffer);

  if (!OpenDevices()) {
    CLog::Log(LOGERROR, "%s::%s - No Exynos MFC Decoder/Converter found", CLASSNAME, __func__);
    return false;
  }

  m_bVideoConvert = m_converter.Open(m_hints.codec, (uint8_t *)m_hints.extradata, m_hints.extrasize, true);

  if(m_bVideoConvert) {
    if(m_converter.GetExtraData() != NULL && m_converter.GetExtraSize() > 0) {
      extraSize = m_converter.GetExtraSize();
      extraData = m_converter.GetExtraData();
    }
  } else {
    if(m_hints.extrasize > 0 && m_hints.extradata != NULL) {
      extraSize = m_hints.extrasize;
      extraData = (uint8_t*)m_hints.extradata;
    }
  }

  // Test what formats we can get finally
  // If converter is present, it is our final sink
  (m_iConverterHandle) ? finalSink = m_iConverterHandle : finalSink = m_iDecoderHandle;
  // Test NV12 2 Planes Y/CbCr
  memzero(fmt);
  fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
  fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M;
  if (ioctl(finalSink->device, VIDIOC_TRY_FMT, &fmt) == 0)
    finalFormat = V4L2_PIX_FMT_NV12M;
  memzero(fmt);
/*
  // Test YUV420 3 Planes Y/Cb/Cr
  fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
  fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_YUV420M;
  if (ioctl(finalSink->device, VIDIOC_TRY_FMT, &fmt) == 0)
    finalFormat = V4L2_PIX_FMT_YUV420M;
*/

  // No suitable output formats available
  if (finalFormat < 0) {
    CLog::Log(LOGERROR, "%s::%s - No suitable format on %s to convert to found", CLASSNAME, __func__, finalSink->name);
    return false;
  }

  // Create MFC Output sink (the one where encoded frames are feed)
  m_MFCOutput = new CLinuxV4l2Sink(m_iDecoderHandle, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
  memzero(fmt);
  switch(m_hints.codec)
  {
    case AV_CODEC_ID_VC1:
      fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VC1_ANNEX_G;
      m_name = "mfc-vc1";
      break;
    case AV_CODEC_ID_MPEG1VIDEO:
      fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG1;
      m_name = "mfc-mpeg1";
      break;
    case AV_CODEC_ID_MPEG2VIDEO:
      fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG2;
      m_name = "mfc-mpeg2";
      break;
    case AV_CODEC_ID_MPEG4:
      fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG4;
      m_name = "mfc-mpeg4";
      break;
    case AV_CODEC_ID_H263:
      fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H263;
      m_name = "mfc-h263";
      break;
    case AV_CODEC_ID_H264:
      fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H264;
      m_name = "mfc-h264";
      break;
    default:
      return false;
      break;
  }
  fmt.fmt.pix_mp.plane_fmt[0].sizeimage = BUFFER_SIZE;
  // Set encoded format
  if (!m_MFCOutput->SetFormat(&fmt))
    return false;
  // Init with number of input buffers predefined
  if (!m_MFCOutput->Init(INPUT_BUFFERS))
    return false;

  // Get empty buffer to fill
  if (!m_MFCOutput->GetBuffer(&sinkBuffer))
    return false;
  // Fill it with the header
  sinkBuffer.iBytesUsed[0] = extraSize;
  memcpy(sinkBuffer.cPlane[0], extraData, extraSize);
  // Enqueue buffer
  if (!m_MFCOutput->PushBuffer(&sinkBuffer))
    return false;

  // Create MFC Capture sink (the one from which decoded frames are read)
  m_MFCCapture = new CLinuxV4l2Sink(m_iDecoderHandle, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
  memzero(fmt);
  // If there is no converter set output format on the MFC Capture sink
  if (!m_iConverterHandle) {
    fmt.fmt.pix_mp.pixelformat = finalFormat;
    if (!m_MFCCapture->SetFormat(&fmt))
        return false;
  }

  // Turn on MFC Output with header in it to initialize MFC with all we just setup
  m_MFCOutput->StreamOn(VIDIOC_STREAMON);

  // Initialize MFC Capture
  if (!m_MFCCapture->Init(0))
    return false;
  // Queue all buffers (empty) to MFC Capture
  m_MFCCapture->QueueAll();

  // Read the format of MFC Capture
  if (!m_MFCCapture->GetFormat(&fmt))
    return false;
  // Size of resulting picture coming out of MFC
  // It will be aligned by 16 since the picture is tiled
  // We need this to know where to split buffer line by line
  resultLineSize = fmt.fmt.pix_mp.width;
  // Get MFC capture crop settings
  if (!m_MFCCapture->GetCrop(&crop))
    return false;
  // This is the picture boundaries we are interested in, everything outside is alignement because of tiled MFC output
  resultVideoWidth = crop.c.width;
  resultVideoHeight = crop.c.height;

  // Turn on MFC Capture
  m_MFCCapture->StreamOn(VIDIOC_STREAMON);

  // If converter is needed (we need to untile the picture from format MFC produces it)
  if (m_iConverterHandle) {
    // Create FIMC Output sink
    m_FIMCOutput = new CLinuxV4l2Sink(m_iConverterHandle, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
    // Set the FIMC Output format to the one read from MFC
    if (!m_FIMCOutput->SetFormat(&fmt))
      return false;
    // Set the FIMC Output crop to the one read from MFC
    if (!m_FIMCOutput->SetCrop(&crop))
      return false;
    // Init FIMC Output and link it to buffers of MFC Capture
    if (!m_FIMCOutput->Init(m_MFCCapture))
      return false;
    // Get FIMC Output crop settings
    if (!m_FIMCOutput->GetCrop(&crop))
      return false;

    // Create FIMC Capture sink
    m_FIMCCapture = new CLinuxV4l2Sink(m_iConverterHandle, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
    // Set the final picture format and the same picture dimension settings to FIMC Capture
    // as picture crop coming from MFC (original picture dimensions)
    memzero(fmt);
    fmt.fmt.pix_mp.pixelformat = finalFormat;
    fmt.fmt.pix_mp.width = crop.c.width;
    fmt.fmt.pix_mp.height = crop.c.height;
    fmt.fmt.pix_mp.field = V4L2_FIELD_ANY;
    if (!m_FIMCCapture->SetFormat(&fmt))
      return false;
    // Init FIMC capture with number of buffers predefined
    if (!m_FIMCCapture->Init(OUTPUT_BUFFERS))
      return false;

    // Queue all buffers (empty) to FIMC Capture
    m_FIMCCapture->QueueAll();

    // Read FIMC capture format settings
    if (!m_FIMCCapture->GetFormat(&fmt))
      return false;
    resultLineSize = fmt.fmt.pix_mp.width;
    // Read FIMC capture crop settings
    if (!m_FIMCCapture->GetCrop(&crop))
      return false;
    resultVideoWidth = crop.c.width;
    resultVideoHeight = crop.c.height;

    // Turn on FIMC Output and Capture enabling the converter
    m_FIMCOutput->StreamOn(VIDIOC_STREAMON);
    m_FIMCCapture->StreamOn(VIDIOC_STREAMON);
  }

  m_videoBuffer.iFlags          = DVP_FLAG_ALLOCATED;

  m_videoBuffer.color_range     = 0;
  m_videoBuffer.color_matrix    = 4;

  m_videoBuffer.iDisplayWidth   = resultVideoWidth;
  m_videoBuffer.iDisplayHeight  = resultVideoHeight;
  m_videoBuffer.iWidth          = resultVideoWidth;
  m_videoBuffer.iHeight         = resultVideoHeight;

  m_videoBuffer.data[0]         = NULL;
  m_videoBuffer.data[1]         = NULL;
  m_videoBuffer.data[2]         = NULL;
  m_videoBuffer.data[3]         = NULL;

  m_videoBuffer.pts             = DVD_NOPTS_VALUE;
  m_videoBuffer.dts             = DVD_NOPTS_VALUE;

  m_videoBuffer.iLineSize[0]    = resultLineSize;
  m_videoBuffer.iLineSize[3]    = 0;

  if (finalFormat == V4L2_PIX_FMT_NV12M) {
    m_videoBuffer.format          = RENDER_FMT_NV12;
    m_videoBuffer.iLineSize[1]    = resultLineSize;
    m_videoBuffer.iLineSize[2]    = 0;
  } else if (finalFormat == V4L2_PIX_FMT_YUV420M) {
    /*
     Due to BUG in MFC v8 (-XU3) firmware the Y plane of the picture has the right line size,
     but the U and V planes line sizes are actually halves of Y plane line size padded to 32
     This is pure workaround for -XU3 MFCv8 firmware "MFC v8.0, F/W: 14yy, 01mm, 13dd (D)
     Seems that only MPEG2 is affected
    */
    // Only on -XU3 there are no converter, but the output format can be YUV420
    // So this is the easiest way to distinguish -XU3 from -U3 with FIMC
    if (!m_iConverterHandle && m_hints.codec == AV_CODEC_ID_MPEG2VIDEO)
      resultLineSize = resultLineSize + (32 - resultLineSize%32);

    m_videoBuffer.format          = RENDER_FMT_YUV420P;
    m_videoBuffer.iLineSize[1]    = resultLineSize >> 1;
    m_videoBuffer.iLineSize[2]    = resultLineSize >> 1;
  }

  m_BufferNowOnScreen->iIndex = -1;
  m_bCodecHealthy = true;

  CLog::Log(LOGNOTICE, "%s::%s - MFC Setup succesfull (%dx%d, linesize %d, format 0x%x), start streaming", CLASSNAME, __func__, resultVideoWidth, resultVideoHeight, resultLineSize, finalFormat);

  return true;

}
Exemple #15
0
void CDVDDemuxShoutcast::Reset()
{
    CDVDInputStream* pInputStream = m_pInput;
    Dispose();
    Open(pInputStream);
}
Exemple #16
0
CDVDDemuxFFmpeg::~CDVDDemuxFFmpeg()
{
  Dispose();
  DeleteCriticalSection(&m_critSection);
}
Exemple #17
0
CDVDDemuxShoutcast::~CDVDDemuxShoutcast()
{
    Dispose();
}
Exemple #18
0
bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput)
{
  AVInputFormat* iformat = NULL;
  std::string strFile;
  m_iCurrentPts = DVD_NOPTS_VALUE;
  m_speed = DVD_PLAYSPEED_NORMAL;

  if (!pInput) return false;

  if (!m_dllAvUtil.Load() || !m_dllAvCodec.Load() || !m_dllAvFormat.Load())  {
    CLog::Log(LOGERROR,"CDVDDemuxFFmpeg::Open - failed to load ffmpeg libraries");
    return false;
  }

  // register codecs
  m_dllAvFormat.av_register_all();
  m_dllAvFormat.url_set_interrupt_cb(interrupt_cb);

  // could be used for interupting ffmpeg while opening a file (eg internet streams)
  // url_set_interrupt_cb(NULL);

  m_pInput = pInput;
  strFile = m_pInput->GetFileName();

  bool streaminfo = true; /* set to true if we want to look for streams before playback*/

  if( m_pInput->GetContent().length() > 0 )
  {
    std::string content = m_pInput->GetContent();

    /* check if we can get a hint from content */
    if( content.compare("audio/aacp") == 0 )
      iformat = m_dllAvFormat.av_find_input_format("aac");
    else if( content.compare("audio/aac") == 0 )
      iformat = m_dllAvFormat.av_find_input_format("aac");
    else if( content.compare("audio/mpeg") == 0  )  
      iformat = m_dllAvFormat.av_find_input_format("mp3");
    else if( content.compare("video/mpeg") == 0 )
      iformat = m_dllAvFormat.av_find_input_format("mpeg");
    else if( content.compare("video/flv") == 0 )
      iformat = m_dllAvFormat.av_find_input_format("flv");
    else if( content.compare("video/x-flv") == 0 )
      iformat = m_dllAvFormat.av_find_input_format("flv");

    /* these are likely pure streams, and as such we don't */
    /* want to try to look for streaminfo before playback */
    if( iformat )
      streaminfo = false;
  }

  if( m_pInput->IsStreamType(DVDSTREAM_TYPE_FFMPEG) )
  {
    g_urltimeout = GetTickCount() + 10000;

    // special stream type that makes avformat handle file opening
    // allows internal ffmpeg protocols to be used
    if( m_dllAvFormat.av_open_input_file(&m_pFormatContext, strFile.c_str(), iformat, FFMPEG_FILE_BUFFER_SIZE, NULL) < 0 )
    {
      CLog::Log(LOGDEBUG, "Error, could not open file %s", strFile.c_str());
      Dispose();
      return false;
    }
  }
  else
  {
    g_urltimeout = 0;

    // initialize url context to be used as filedevice
    URLContext* context = (URLContext*)m_dllAvUtil.av_mallocz(sizeof(struct URLContext) + strFile.length() + 1);
    context->prot = &dvd_file_protocol;
    context->priv_data = (void*)m_pInput;
    context->max_packet_size = FFMPEG_FILE_BUFFER_SIZE;

    if (m_pInput->IsStreamType(DVDSTREAM_TYPE_DVD))
    {
      context->max_packet_size = FFMPEG_DVDNAV_BUFFER_SIZE;
      context->is_streamed = 1;
    }
    if (m_pInput->IsStreamType(DVDSTREAM_TYPE_TV))
    {
      if(m_pInput->Seek(0, SEEK_POSSIBLE) == 0)
        context->is_streamed = 1;

      // this actually speeds up channel changes by almost a second
      // however, it alsa makes player not buffer anything, this
      // leads to buffer underruns in audio renderer
      //if(context->is_streamed)
      //  streaminfo = false;
    }
    else
    {
      if(m_pInput->Seek(0, SEEK_POSSIBLE) == 0)
        context->is_streamed = 1;
    }

#if LIBAVFORMAT_VERSION_INT >= (52<<16)
    context->filename = (char *) &context[1];
#endif

    strcpy(context->filename, strFile.c_str());  

    // open our virtual file device
    if(m_dllAvFormat.url_fdopen(&m_ioContext, context) < 0)
    {
      CLog::Log(LOGERROR, "%s - Unable to init io context", __FUNCTION__);
      m_dllAvUtil.av_free(context);
      Dispose();
      return false;
    }

    if( iformat == NULL )
    {
      // let ffmpeg decide which demuxer we have to open
      AVProbeData pd;
      BYTE probe_buffer[2048];

      // init probe data
      pd.buf = probe_buffer;
      pd.filename = strFile.c_str();

      // read data using avformat's buffers
      pd.buf_size = m_dllAvFormat.get_buffer(m_ioContext, pd.buf, sizeof(probe_buffer));            
      if (pd.buf_size == 0)
      {
        CLog::Log(LOGERROR, "%s - error reading from input stream, %s", __FUNCTION__, strFile.c_str());
        return false;
      }
      // restore position again
      m_dllAvFormat.url_fseek(m_ioContext , 0, SEEK_SET);

      iformat = m_dllAvFormat.av_probe_input_format(&pd, 1);
      if (!iformat)
      {
        CLog::Log(LOGERROR, "%s - error probing input format, %s", __FUNCTION__, strFile.c_str());
        return false;
      }
    }


    // open the demuxer
    if (m_dllAvFormat.av_open_input_stream(&m_pFormatContext, m_ioContext, strFile.c_str(), iformat, NULL) < 0)
    {
      CLog::Log(LOGERROR, "Error, could not open file %s", strFile.c_str());
      Dispose();
      return false;
    }
  }
  
  // we need to know if this is matroska later
  m_bMatroska = strcmp(m_pFormatContext->iformat->name, "matroska") == 0;

  // in combination with libdvdnav seek, av_find_stream_info wont work
  // so we do this for files only
  if (streaminfo)
  {
    if (m_pInput->IsStreamType(DVDSTREAM_TYPE_TV))
    {
      /* too speed up livetv channel changes, only analyse very short */ 
      if(m_pInput->Seek(0, SEEK_POSSIBLE) == 0)
        m_pFormatContext->max_analyze_duration = 500000;
    }


    CLog::Log(LOGDEBUG, "%s - av_find_stream_info starting", __FUNCTION__);
    int iErr = m_dllAvFormat.av_find_stream_info(m_pFormatContext);
    if (iErr < 0)
    {
      CLog::Log(LOGWARNING,"could not find codec parameters for %s", strFile.c_str());
      if (m_pFormatContext->nb_streams == 1 && m_pFormatContext->streams[0]->codec->codec_id == CODEC_ID_AC3)
      {
        // special case, our codecs can still handle it.
      }
      else
      {
        Dispose();
        return false;
      }
    }
    CLog::Log(LOGDEBUG, "%s - av_find_stream_info finished", __FUNCTION__);
  }
  // reset any timeout
  g_urltimeout = 0;

  // if format can be nonblocking, let's use that
  m_pFormatContext->flags |= AVFMT_FLAG_NONBLOCK;

  // print some extra information
  m_dllAvFormat.dump_format(m_pFormatContext, 0, strFile.c_str(), 0);

  UpdateCurrentPTS();

  // add the ffmpeg streams to our own stream array
  m_program = 0;
  if (m_pFormatContext->nb_programs)
  {
    // discard nonselected programs
    for (unsigned int i = 0; i < m_pFormatContext->nb_programs; i++)
    {
      if(i != m_program)
        m_pFormatContext->programs[m_program]->discard = AVDISCARD_ALL;
    }
    // add streams from selected program
    for (unsigned int i = 0; i < m_pFormatContext->programs[m_program]->nb_stream_indexes; i++)
      AddStream(m_pFormatContext->programs[m_program]->stream_index[i]);
  }
  else
  {
    for (unsigned int i = 0; i < m_pFormatContext->nb_streams; i++)
      AddStream(i);
  }

  return true;
}
Exemple #19
0
CanvasGDIP::~CanvasGDIP()
{
	Dispose();
}
Exemple #20
0
void CDVDDemuxFFmpeg::Reset()
{
  CDVDInputStream* pInputStream = m_pInput;
  Dispose();
  Open(pInputStream);
}
Exemple #21
0
CDVDDemuxCDDA::~CDVDDemuxCDDA()
{
  Dispose();
}
Exemple #22
0
 /**
  * Default destructor
  */
 ~VertexBuffer()
 {
     Dispose();
 }
Exemple #23
0
 Hash<TK>::~Hash()
 {
     for( int i = 0; i < nodes.Size(); ++i )
         Dispose( nodes[ i ] );
 }
Exemple #24
0
CDVDAudioCodecAndroidMediaCodec::~CDVDAudioCodecAndroidMediaCodec()
{
  Dispose();
}
Exemple #25
0
void Game_Map::SetupCommon(int _id) {
	ready = false;
	// Execute remaining events (e.g. ones listed after a teleport)
	Update();
	Dispose();

	location.map_id = _id;

	// Try loading EasyRPG map files first, then fallback to normal RPG Maker
	std::stringstream ss;
	ss << "Map" << std::setfill('0') << std::setw(4) << location.map_id << ".emu";

	std::string map_file = FileFinder::FindDefault(ss.str());
	if (map_file.empty()) {
		ss.str("");
		ss << "Map" << std::setfill('0') << std::setw(4) << location.map_id << ".lmu";
		map_file = FileFinder::FindDefault(ss.str());

		map = LMU_Reader::Load(map_file, Player::encoding);
	} else {
		map = LMU_Reader::LoadXml(map_file);
	}
	Output::Debug("Loading Map %s", map_file.c_str());

	if (map.get() == NULL) {
		Output::ErrorStr(LcfReader::GetError());
	}

	if (map->parallax_flag) {
		SetParallaxName(map->parallax_name);
		SetParallaxScroll(map->parallax_loop_x, map->parallax_loop_y,
			map->parallax_auto_loop_x, map->parallax_auto_loop_y,
			map->parallax_sx, map->parallax_sy);
	}
	else {
		SetParallaxName("");
	}

	SetChipset(map->chipset_id);
	need_refresh = true;

	scroll_direction = 2;
	scroll_rest = 0;
	scroll_speed = 4;

	int current_index = GetMapIndex(location.map_id);
	map_info.encounter_rate = Data::treemap.maps[current_index].encounter_steps;

	while (Data::treemap.maps[current_index].save == 0 && GetMapIndex(Data::treemap.maps[current_index].parent_map) != current_index) {
		current_index = GetMapIndex(Data::treemap.maps[current_index].parent_map);
	}
	Game_System::SetAllowSave(Data::treemap.maps[current_index].save == 1);

	for (int i = 0; i < 3; i++)
		vehicles[i]->Refresh();

	pan_locked = false;
	pan_wait = false;
	pan_speed = 0;

	// Make RPG_RT happy
	// Otherwise current event not resumed after loading
	location.map_save_count = map->save_count;

	ResetEncounterSteps();
}
CDVDAudioCodecLibMad::~CDVDAudioCodecLibMad()
{
  Dispose();
}
CDVDVideoCodecAmlogic::~CDVDVideoCodecAmlogic()
{
  Dispose();
  pthread_mutex_destroy(&m_queue_mutex);
}
Exemple #28
0
/*********************************************************
*NAME:          ircCheckClients
*AUTHOR:        John Morrison
*CREATION DATE: 00/10/01
*LAST MODIFIED: 00/10/02
*PURPOSE:
* Checks each of the connected irc clients for new data
*
*ARGUMENTS:
*
*********************************************************/
void ircCheckClients() {
  ircClients q;      /* Temp Pointers */
  int dataLen;            /* Length of the read */
  bool remove;            /* Do we remove this item */
  char txt[IRC_READ_LEN]; /* Um, yeah. */

  pthread_mutex_lock(&ircMutex);
    
  q = ircc;
  while (NonEmpty(q)) {
    remove = FALSE;
    dataLen = recv(q->sock, txt, IRC_READ_LEN, IRC_SEND_SIGNAL);
/*    fprintf(stderr, "IRC: checking client read %d err %d EAGAIN %d\n", dataLen, SOCKET_ERROR, EAGAIN)*/;
    if (dataLen == SOCKET_ERROR) {
      /* Error */
#ifdef _WIN32
      if (WSAGetLastError() != WSAEWOULDBLOCK) {
#else
      if (errno != EAGAIN) { 
#endif 
        remove = TRUE;
      }
    } else if (dataLen == 0) {
      /* Socket close gracefully */
      remove = TRUE;
    }

    /* Remove the item */
    if (remove == TRUE) {
	    ircRemoveClient(&q);
    } else {
	    q = IrcTail(q);
    }
  }
  
  pthread_mutex_unlock(&ircMutex);
}

/*********************************************************
 *NAME:          ircRemoveClient
 *AUTHOR:        Andrew Roth
 *CREATION DATE: 03/03/29 YMD
 *LAST MODIFIED: 03/03/29
 *PURPOSE:
 * Removes a client from client linked list
 *
 *ARGUMENTS:
 *  text   - Text to send
 *********************************************************/
void ircRemoveClient(ircClients *q2) {
	  ircClients q = *q2, del;
	  
	  fprintf(stderr, "IRC: removed client\n");
	  mainRemoveSocket(q->sock);
	  shutdown(q->sock, SD_BOTH);
	  closesocket(q->sock);      
	  if (q->prev != NULL) {
		  q->prev->next = q->next;
		  /*fprintf(stderr, "IRC: REM: removed nonfirst");*/
	  } else {
		  ircc = q->next;
		  /*fprintf(stderr, "IRC: REM: removed first one, ircc now %p", ircc);*/
	  }
	  if (q->next != NULL) {
		  q->next->prev = q->prev;
	  } /*else fprintf(stderr, "IRC: REM: next is null");*/
	  del = q;
	  *q2 = IrcTail(q);
	  Dispose(del);
  } 
Exemple #29
0
void CDVDDemuxClient::Reset()
{
  CDVDInputStream* pInputStream = m_pInput;
  Dispose();
  Open(pInputStream);
}
		void TextureCollection::Dispose()
		{
			Dispose(true);
		}