예제 #1
0
/* WORKAROUND for DR OMAPS00164744 */
static void
goo_ti_aacenc_eos_buffer_flag (GooComponent* self, guint portindex)
{
	g_assert (GOO_IS_COMPONENT (self));
	g_assert (portindex >= 0);

	g_print ("INFORMATION: workaround for OMAPS00164744\n");

	GooPort* port = NULL;
	OMX_PARAM_PORTDEFINITIONTYPE* param = NULL;

	GooIterator* iter = goo_component_iterate_ports (self);
	goo_iterator_nth (iter, portindex);
	port = GOO_PORT (goo_iterator_get_current (iter));
	g_assert (port != NULL);

	goo_port_set_eos (port);

	param = GOO_PORT_GET_DEFINITION (port);

	if (param->eDir == OMX_DirOutput)
	{
		goo_component_set_done (self);
	}

	g_object_unref (G_OBJECT (port));
	g_object_unref (G_OBJECT (iter));

	return;
}
예제 #2
0
파일: goo-engine.c 프로젝트: ceyusa/libgoo
static void
goo_engine_outport_cb (GooPort* port, OMX_BUFFERHEADERTYPE* buffer,
                       gpointer data)
{
    g_assert (GOO_IS_PORT (port));
    g_assert (buffer != NULL);
    g_assert (GOO_IS_COMPONENT (data));

    GooComponent* component = GOO_COMPONENT (data);
    GooEngine* self = GOO_ENGINE (
                          g_object_get_data (G_OBJECT (component), "engine")
                      );

    g_assert (self->outstream != NULL);

    if (buffer->nFilledLen <= 0 &&
            (buffer->nFlags & OMX_BUFFERFLAG_EOS) != 0x1)
    {
        GOO_OBJECT_ERROR (self, "Empty buffer received!!");
    }

    if (buffer->nFilledLen > 0)
    {
        GOO_OBJECT_DEBUG (self, "%d bytes written",
                          buffer->nFilledLen);
        fwrite (buffer->pBuffer, 1, buffer->nFilledLen,
                self->outstream);
        /* fflush (self->outfile); */
    }

    /* we count the empty buffer only if it have de EOS flag */
    if ((buffer->nFilledLen > 0) ||
            ((buffer->nFlags & OMX_BUFFERFLAG_EOS) == 0x1 &&
             buffer->nFilledLen == 0))
    {
        g_atomic_int_inc (&self->outcount);
    }

    /* if we assigned the number of buffer to process */
    if (self->numbuffers != 0 && self->outcount == self->numbuffers)
    {
        goo_port_set_eos (port);
    }

    if ((buffer->nFlags & OMX_BUFFERFLAG_EOS) == 0x1 ||
            goo_port_is_eos (port))
    {
        goo_component_set_done (self->component);
    }

    goo_component_release_buffer (component, buffer);

    return;
}
예제 #3
0
	/* output */
	{
		GooIterator* iter =
			goo_component_iterate_output_ports (component);
		goo_iterator_nth (iter, 0);
		GooPort* port = GOO_PORT (goo_iterator_get_current (iter));
		g_assert (port != NULL);

		GOO_PORT_GET_DEFINITION (port)->nBufferSize =
			OUTPUT_BUFFERSIZE;
		GOO_PORT_GET_DEFINITION (port)->nBufferCountActual = OUTPUT_NUM_BUFFERS;
		GOO_PORT_GET_DEFINITION (port)->format.audio.eEncoding =
			OMX_AUDIO_CodingPCM;

		g_object_unref (iter);
		g_object_unref (port);
	}

	return;
}

#if 0 /* i think it is not necessary now */
static void
goo_ti_mp3dec_release_buffer (GooComponent* self,
			      OMX_BUFFERHEADERTYPE* buffer)
{
	g_assert (GOO_IS_COMPONENT (self));
	g_assert (buffer != NULL);
	g_assert (self->cur_state == OMX_StateExecuting ||
		  self->cur_state == OMX_StateIdle);

	GooPort* port = GOO_PORT (g_object_ref (buffer->pAppPrivate));

	if (goo_port_is_eos (port) || goo_port_is_tunneled (port))
	{
		g_object_unref (port);
		return;
	}

	if ((buffer->nFlags & OMX_BUFFERFLAG_EOS) == 0x1)
	{
		GOO_OBJECT_INFO (port, "eos found!");
		goo_port_set_eos (port);
	}

	/* We should always push the EOS buffer */
	GOO_OBJECT_NOTICE (self, "OMX_EmptyThisBuffer, 0x%x", buffer);

	if (self->cur_state != OMX_StateIdle)
	{
		GOO_OBJECT_LOCK (self);
		GOO_RUN (
			OMX_EmptyThisBuffer (self->handle, buffer)
			);
		GOO_OBJECT_UNLOCK (self);
	}
	else
	{
		g_print("INFORMATION (workaround): Implementing workaround "
			"for DR OMAPS00143083\n");
	}

	g_object_unref (port);

	GOO_OBJECT_DEBUG (self, "");

	return;
}