示例#1
0
static void
send_port_auto_detect_events (dirble_prc_t * ap_prc)
{
  assert (ap_prc);
  if (ap_prc->audio_coding_type_ != OMX_AUDIO_CodingUnused
      && ap_prc->audio_coding_type_ != OMX_AUDIO_CodingAutoDetect)
    {
      TIZ_DEBUG (handleOf (ap_prc), "Issuing OMX_EventPortFormatDetected");
      tiz_srv_issue_event ((OMX_PTR) ap_prc, OMX_EventPortFormatDetected, 0, 0,
                           NULL);
      TIZ_DEBUG (handleOf (ap_prc), "Issuing OMX_EventPortSettingsChanged");
      tiz_srv_issue_event ((OMX_PTR) ap_prc, OMX_EventPortSettingsChanged,
                           ARATELIA_HTTP_SOURCE_PORT_INDEX, /* port 0 */
                           OMX_IndexParamPortDefinition,    /* the index of the
                                                         struct that has
                                                         been modififed */
                           NULL);
    }
  else
    {
      /* Oops... could not detect the stream format */

      /* This is to make sure this url will not get processed again... */
      ap_prc->remove_current_url_ = true;

      /* Get ready to auto-detect another stream */
      set_auto_detect_on_port (ap_prc);
      prepare_for_port_auto_detection (ap_prc);

      /* Finally, signal the client */
      TIZ_DEBUG (handleOf (ap_prc), "Issuing OMX_ErrorFormatNotDetected");
      tiz_srv_issue_err_event ((OMX_PTR) ap_prc, OMX_ErrorFormatNotDetected);
    }
}
示例#2
0
static OMX_ERRORTYPE
update_pcm_mode (mp3d_prc_t * ap_prc, const OMX_U32 a_samplerate,
                 const OMX_U32 a_channels)
{
  assert (ap_prc);
  if (a_samplerate != ap_prc->pcmmode_.nSamplingRate
      || a_channels != ap_prc->pcmmode_.nChannels)
    {
      TIZ_DEBUG (handleOf (ap_prc),
                 "Updating pcm mode : old samplerate [%d] new samplerate [%d]",
                 ap_prc->pcmmode_.nSamplingRate, a_samplerate);
      TIZ_DEBUG (handleOf (ap_prc),
                 "Updating pcm mode : old channels [%d] new channels [%d]",
                 ap_prc->pcmmode_.nChannels, a_channels);
      ap_prc->pcmmode_.nSamplingRate = a_samplerate;
      ap_prc->pcmmode_.nChannels = a_channels;
      tiz_check_omx (tiz_krn_SetParameter_internal (
        tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc),
        OMX_IndexParamAudioPcm, &(ap_prc->pcmmode_)));
      tiz_srv_issue_event ((OMX_PTR) ap_prc, OMX_EventPortSettingsChanged,
                           ARATELIA_MP3_DECODER_OUTPUT_PORT_INDEX,
                           OMX_IndexParamAudioPcm, /* the index of the
                                                      struct that has
                                                      been modififed */
                           NULL);
    }
  return OMX_ErrorNone;
}
示例#3
0
static bool
data_available (OMX_PTR ap_arg, const void * ap_ptr, const size_t a_nbytes)
{
  dirble_prc_t * p_prc = ap_arg;
  bool pause_needed = false;
  assert (p_prc);
  assert (ap_ptr);

  TIZ_DEBUG (handleOf (p_prc), "p_prc->auto_detect_on_ [%s]",
             (p_prc->auto_detect_on_ ? "TRUE" : "FALSE"));

  if (p_prc->auto_detect_on_ && a_nbytes > 0)
    {
      p_prc->auto_detect_on_ = false;

      /* This will pause the http transfer */
      pause_needed = true;

      /* And now trigger the OMX_EventPortFormatDetected and
         OMX_EventPortSettingsChanged events or a
         OMX_ErrorFormatNotDetected event */
      send_port_auto_detect_events (p_prc);
    }
  return pause_needed;
}
示例#4
0
static int
read_page_normal (OGGZ * ap_oggz, const ogg_page * ap_og, long a_serialno,
                  void * ap_user_data)
{
  oggdmux_prc_t * p_prc = ap_user_data;
  TIZ_DEBUG (handleOf (p_prc), "serialno = [%d] : granule pos [%lld]",
             a_serialno, oggz_tell_granulepos (ap_oggz));
  return OGGZ_CONTINUE;
}
static int
mp4_read_cback (void * ap_handle, void * ap_buffer, int64_t a_size,
                int64_t * ap_nin, int64_t a_maxChunkSize)
{
  mp4dmuxflt_prc_t * p_prc = ap_handle;
  int retval = -1;

  assert (gp_prc == ap_handle);
  assert (p_prc);
  assert (ap_buffer);
  assert (ap_nin);

  *ap_nin = 0;

  if (tiz_filter_prc_is_eos (p_prc)
      && tiz_buffer_available (p_prc->p_mp4_store_) == 0)
    {
      TIZ_DEBUG (handleOf (p_prc), "out of compressed data");
      return 1;
    }

  (void) store_data (p_prc);

  if (ap_buffer && a_size > 0)
    {
      if (tiz_buffer_available (p_prc->p_mp4_store_) >= a_size)
        {
          memcpy (ap_buffer, tiz_buffer_get (p_prc->p_mp4_store_), a_size);
          tiz_buffer_advance (p_prc->p_mp4_store_, a_size);
          *ap_nin = a_size;
          retval = 0;
        }
      else
        {
          TIZ_DEBUG (handleOf (p_prc), "out of compressed data");
          retval = 1;
        }
    }

  TIZ_DEBUG (handleOf (p_prc), "a_size [%lld] nin [%lld]", a_size, *ap_nin);

  return retval;
}
static void
print_track_info (mp4dmuxflt_prc_t * ap_prc, const MP4TrackId tid)
{
  assert (ap_prc);
  assert (ap_prc->mp4v2_hdl_ != MP4_INVALID_FILE_HANDLE);
  if (MP4_INVALID_TRACK_ID != tid)
    {
      char * p_track_nfo = MP4Info (ap_prc->mp4v2_hdl_, tid);
      TIZ_DEBUG (handleOf (ap_prc), "track info: ", (p_track_nfo ? p_track_nfo : ""));
      tiz_mem_free (p_track_nfo);
    }
}
示例#7
0
static int
flush_temp_store (oggdmux_prc_t * ap_prc, const OMX_U32 a_pid)
{
  OMX_BUFFERHEADERTYPE * p_hdr = NULL;
  OMX_U32 * p_offset = get_store_offset_ptr (ap_prc, a_pid);
  OMX_U32 ds_offset = *p_offset;

  assert (p_offset);

  if (0 == *p_offset)
    {
      /* The temp store is empty */
      return 0;
    }

  while ((p_hdr = get_header (ap_prc, a_pid)))
    {
      ds_offset = dump_temp_store (ap_prc, a_pid, p_hdr);
#ifdef _DEBUG
      if (a_pid == ARATELIA_OGG_DEMUXER_AUDIO_PORT_BASE_INDEX)
        {
          g_total_released += p_hdr->nFilledLen;
          OMX_U32 * p_offset = get_store_offset_ptr (ap_prc, a_pid);
          TIZ_TRACE (handleOf (ap_prc),
                     "total released [%d] "
                     "total read [%d] store [%d] last read [%d] diff [%d]",
                     g_total_released, g_total_read, *p_offset, g_last_read,
                     g_total_read - (g_total_released + *p_offset));
        }
#endif
      if (ap_prc->file_eos_ && 0 == ds_offset)
        {
          bool * p_eos = get_eos_ptr (ap_prc, a_pid);
          if (!p_eos)
            {
              TIZ_DEBUG (handleOf (ap_prc), "Adding EOS flag - PID [%d]",
                         a_pid);
              p_hdr->nFlags |= OMX_BUFFERFLAG_EOS;
              *p_eos = true;
            }
        }
      release_header (ap_prc, a_pid);
      p_hdr = 0;
      if (0 == ds_offset)
        {
          break;
        }
    }
  return ds_offset;
}
示例#8
0
static void
send_port_auto_detect_events (scloud_prc_t * ap_prc)
{
  assert (ap_prc);
  if (ap_prc->audio_coding_type_ != OMX_AUDIO_CodingUnused
      || ap_prc->audio_coding_type_ != OMX_AUDIO_CodingAutoDetect)
    {
      TIZ_DEBUG (handleOf (ap_prc), "Issuing OMX_EventPortFormatDetected");
      tiz_srv_issue_event ((OMX_PTR) ap_prc, OMX_EventPortFormatDetected, 0, 0,
                           NULL);
      TIZ_DEBUG (handleOf (ap_prc), "Issuing OMX_EventPortSettingsChanged");
      tiz_srv_issue_event ((OMX_PTR) ap_prc, OMX_EventPortSettingsChanged,
                           ARATELIA_HTTP_SOURCE_PORT_INDEX, /* port 0 */
                           OMX_IndexParamPortDefinition,    /* the index of the
                                                         struct that has
                                                         been modififed */
                           NULL);
    }
  else
    {
      /* Oops... could not detect the stream format */
      tiz_srv_issue_err_event ((OMX_PTR) ap_prc, OMX_ErrorFormatNotDetected);
    }
}
static void
mp4_log_cback (MP4LogLevel loglevel, const char * fmt, va_list ap)
{
  #define MAX_ALLOCA_BUF 1024
  char * buffer = alloca (MAX_ALLOCA_BUF);
  vsnprintf (buffer, MAX_ALLOCA_BUF, fmt, ap);

  /* typedef enum {
     MP4_LOG_NONE = 0,
     MP4_LOG_ERROR = 1,
     MP4_LOG_WARNING = 2,
     MP4_LOG_INFO = 3,
     MP4_LOG_VERBOSE1 = 4,
     MP4_LOG_VERBOSE2 = 5,
     MP4_LOG_VERBOSE3 = 6,
     MP4_LOG_VERBOSE4 = 7
     }  MP4LogLevel;
  */

  switch(loglevel)
    {
    case MP4_LOG_ERROR:
      {
        TIZ_ERROR(handleOf(gp_prc), "%s", buffer);
      }
      break;
    case MP4_LOG_INFO:
      {
        TIZ_NOTICE(handleOf(gp_prc), "%s", buffer);
      }
      break;
    case MP4_LOG_WARNING:
      {
        TIZ_DEBUG(handleOf(gp_prc), "%s", buffer);
      }
      break;
    default:
      {
        TIZ_TRACE(handleOf(gp_prc), "%s", buffer);
      }
      break;
    };
}
示例#10
0
static OMX_ERRORTYPE
release_output_header (mp4dmuxflt_prc_t * ap_prc, const OMX_U32 a_pid)
{
  OMX_ERRORTYPE rc = OMX_ErrorNone;

  if (tiz_filter_prc_is_port_enabled (ap_prc, a_pid))
    {
      OMX_BUFFERHEADERTYPE * p_hdr = tiz_filter_prc_get_header (ap_prc, a_pid);
      assert (ap_prc);
      if (p_hdr)
        {
          TIZ_DEBUG (handleOf (ap_prc), "p_hdr [%p] nFilledLen [%u]", p_hdr,
                     p_hdr->nFilledLen);
          propagate_eos_if_required (ap_prc, p_hdr);
          rc = tiz_filter_prc_release_header (ap_prc, a_pid);
        }
    }
  return rc;
}
示例#11
0
static OMX_ERRORTYPE
cc_http_prc_store_stream_metadata (const void * p_obj)
{
  cc_http_prc_t * p_prc = (cc_http_prc_t *) p_obj;
  cc_prc_t * p_cc_prc = (cc_prc_t *) p_obj;
  assert (p_prc);

  TIZ_DEBUG (handleOf (p_prc), "store_stream_metadata");

  /* Station url */
  {
    tiz_check_omx (cc_prc_store_display_title (
      p_cc_prc, "Station", (const char *) p_prc->p_content_uri_->contentURI));
    tiz_check_omx (cc_prc_store_stream_metadata_item (
      p_cc_prc, "Station", (const char *) p_prc->p_content_uri_->contentURI));
  }

  return OMX_ErrorNone;
}
示例#12
0
/* TODO: move this functionality to tiz_filter_prc_t */
static OMX_ERRORTYPE
release_input_header (mp4dmuxflt_prc_t * ap_prc)
{
  OMX_ERRORTYPE rc = OMX_ErrorNone;
  OMX_BUFFERHEADERTYPE * p_hdr = get_mp4_hdr (ap_prc);

  assert (ap_prc);

  if (p_hdr)
    {
      TIZ_DEBUG (handleOf (ap_prc), "[%p] nFlags [%d]", p_hdr, p_hdr->nFlags);
      if ((p_hdr->nFlags & OMX_BUFFERFLAG_EOS) > 0)
        {
          tiz_filter_prc_update_eos_flag (ap_prc, true);
          p_hdr->nFlags &= ~(1 << OMX_BUFFERFLAG_EOS);
        }
      rc = tiz_filter_prc_release_header (
        ap_prc, ARATELIA_MP4_DEMUXER_FILTER_PORT_0_INDEX);
    }
  return rc;
}
示例#13
0
static OMX_BOOL
egl_image_validation_hook (const OMX_HANDLETYPE ap_hdl,
                           OMX_U32 pid, OMX_PTR ap_eglimage,
                           void *ap_args)
{
  const void * p_krn = NULL;
  const tiz_port_t * p_port = NULL;
  const tiz_videoport_t * p_videoport = NULL;

  TIZ_DEBUG (ap_hdl, "vp8 decoder EGLImage validation hook : ap_eglimage=[%p]",
             ap_eglimage);

  /* TODO: */
  // vp8d_prc_t * ap_prc = NULL;

  assert (ap_hdl);
  assert (ap_eglimage);
  assert (!ap_args);

  p_krn = tiz_get_krn (ap_hdl);
  p_port = tiz_krn_get_port (p_krn, pid);
  p_videoport = (tiz_videoport_t *) p_port;

  assert (p_videoport);

/*   { */
/*     const OMX_VIDEO_PORTDEFINITIONTYPE * p_video_portdef */
/*       = &(p_port->portdef_.format.video); */

/*     if (!p_video_portdef->pNativeWindow) */
/*       { */
/*         return OMX_FALSE; */
/*       } */
/*   } */

  /* This function must return true or false */
  return OMX_TRUE;
}