Esempio n. 1
0
static void
omx_stop (GstGooEncPcm* self)
{
	g_assert (self != NULL);
	g_assert (self->component != NULL);

  GST_INFO_OBJECT (self,
									"self->component %x state %d",
									self->component,
									goo_component_get_state (self->component) == OMX_StatePause);
	if (goo_component_get_state (self->component) == OMX_StateExecuting ||
			goo_component_get_state (self->component) == OMX_StatePause)
	{
		GST_INFO_OBJECT (self, "Going to idle");
		goo_component_set_state_idle (self->component);
	}

	if (goo_component_get_state (self->component) == OMX_StateIdle)
	{
		GST_INFO_OBJECT (self, "Going to loaded");
		goo_component_set_state_loaded (self->component);
	}
  GST_INFO_OBJECT (self, "");
	return;
}
Esempio n. 2
0
static gboolean
omx_stop (GstGooEncJpeg* self)
{
	g_assert (self != NULL);
	g_assert (self->component != NULL);

	GST_OBJECT_LOCK (self);
	if (goo_component_get_state (self->component) == OMX_StateExecuting ||
	    goo_component_get_state (self->component) == OMX_StatePause)
	{
		GST_INFO ("going to idle");
		goo_component_set_state_idle (self->component);
	}

	if (goo_component_get_state (self->component) == OMX_StateIdle)
	{
		GST_INFO ("going to loaded");
		goo_component_set_state_loaded (self->component);
	}
	GST_OBJECT_UNLOCK (self);

	GST_DEBUG ("");

	return TRUE;
}
Esempio n. 3
0
END_TEST

START_TEST (test_g711dec_2)
{
        GooComponentFactory* factory =
                goo_ti_component_factory_get_instance ();
        GooComponent* component =
                goo_component_factory_get_component (factory,
                                                     GOO_TI_G711_DECODER);
        /* audio properties */

        g_object_set (G_OBJECT (component),
                      "dasf-mode", TRUE,
                      "data-path", NULL,
                      "mute", FALSE,
                      "volume", 100,
                      NULL);

        /* input component parameters */
        {
                GOO_TI_G711DEC_GET_INPUT_PARAM (component)->nChannels = 1;
                GOO_TI_G711DEC_GET_INPUT_PARAM (component)->ePCMMode = OMX_AUDIO_PCMModeALaw;
        }

        /* input component parameters */
        {
                GOO_TI_G711DEC_GET_OUTPUT_PARAM (component)->nChannels = 1;
                GOO_TI_G711DEC_GET_OUTPUT_PARAM (component)->nSamplingRate = 8000;
                GOO_TI_G711DEC_GET_OUTPUT_PARAM (component)->ePCMMode = OMX_AUDIO_PCMModeLinear;
        }
        GOO_OBJECT_WARNING (component, "stream ID = %d",
                            goo_ti_audio_component_get_stream_id
                            (GOO_TI_AUDIO_COMPONENT (component)));

        goo_component_set_state_idle (component);

        goo_component_set_state_executing (component);

        GooEngine* engine = goo_engine_new (
                component,
                "/omx/patterns/mono_8000Hz_80_alaw.bit",
                NULL);

        goo_engine_play (engine);

        goo_component_set_state_idle (component);
        goo_component_set_state_loaded (component);

        g_object_unref (G_OBJECT (engine));
        g_object_unref (G_OBJECT (component));
        g_object_unref (G_OBJECT (factory));

}
Esempio n. 4
0
END_TEST

#if 0
START_TEST (test_pcmenc_2)
{
    GooComponentFactory *factory = goo_ti_component_factory_get_instance ();
    GooComponent *component = goo_component_factory_get_component (factory,
                              GOO_TI_PCM_ENCODER);
    /* audio properties */
    g_object_set (G_OBJECT (component),
                  "dasf-mode", TRUE,
                  "data-path", NULL,
                  "mute", FALSE,
                  NULL);

    {
        GOO_TI_PCMENC_GET_INPUT_PORT_PARAM (component)->nPortIndex = OMX_DirInput;
        GOO_TI_PCMENC_GET_INPUT_PORT_PARAM (component)->nChannels = 1;
    }

    /* output port component parameters */
    {
        GOO_TI_PCMENC_GET_OUTPUT_PORT_PARAM (component)->nPortIndex = OMX_DirOutput;
        GOO_TI_PCMENC_GET_OUTPUT_PORT_PARAM (component)->nChannels = 1;
        GOO_TI_PCMENC_GET_OUTPUT_PORT_PARAM (component)->nSamplingRate = 8000;
    }
    GOO_OBJECT_WARNING (component, "stream ID = %d",
                        goo_ti_audio_component_get_stream_id
                        (GOO_TI_AUDIO_COMPONENT (component)));

    GooEngine *engine = goo_engine_new (component,
                                        NULL,
                                        "/tmp/check_goo_8000.pcm");

    g_object_set (engine, "num-buffers", 500, NULL);

    goo_component_set_state_idle (component);

    goo_component_set_state_executing (component);

    goo_engine_play (engine);

    goo_component_set_state_idle (component);
    goo_component_set_state_loaded (component);

    g_object_unref (G_OBJECT (engine));
    g_object_unref (G_OBJECT (component));
    g_object_unref (G_OBJECT (factory));

}
Esempio n. 5
0
static GstStateChangeReturn
gst_dasf_sink_change_state (GstElement* element, GstStateChange transition)
{
	GstDasfSink *self = GST_DASF_SINK (element);
	GstDasfSinkPrivate* priv = GST_DASF_SINK_GET_PRIVATE (element);
	GST_LOG ("transition=%d", transition);

	switch (transition)
	{
//	case GST_STATE_CHANGE_NULL_TO_READY:
	case GST_STATE_CHANGE_READY_TO_PAUSED:
		/* When going to pause, all components should be already linked, so
		 * we can call again this function in order to ensure that everything
		 * that was not set in the linkage process is set here (this was
		 * added to ensure that OMX Clock is set no matter
		 * how the linkage is done before going to PAUSED)
		 */
		gst_dasf_enable(element);
		break;
	case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
		/* acquire "virtual" ringbuffer */
		priv->ring_buffer_acquired = TRUE;
		break;
	case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
	case GST_STATE_CHANGE_PAUSED_TO_READY:
	case GST_STATE_CHANGE_READY_TO_NULL:
		/* release "virtual" ringbuffer */
		priv->ring_buffer_acquired = FALSE;
		if (self->clock)
		{
			if (goo_component_get_state(self->clock) == OMX_StateExecuting)
			{
				GST_DEBUG_OBJECT (self, "Setting clock to idle");
				goo_component_set_state_idle (self->clock);
			}
			if (goo_component_get_state(self->clock) == OMX_StateIdle)
			{
				GST_DEBUG_OBJECT (self, "Setting clock to loaded");
				goo_component_set_state_loaded(self->clock);
			}
		}
		break;
	default:
		break;
	}

	return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
}
Esempio n. 6
0
static GstStateChangeReturn
gst_goo_filter_change_state (GstElement* element, GstStateChange transition)
{
	GST_LOG ("");

	GstGooFilter* self = GST_GOO_FILTER (element);
	GstStateChangeReturn result;
	GstGooFilterPrivate* priv = GST_GOO_FILTER_GET_PRIVATE (self);

	g_assert (self->component != NULL);
	g_assert (self->inport != NULL);
	g_assert (self->outport != NULL);

	switch (transition)
	{
	case GST_STATE_CHANGE_NULL_TO_READY:
		break;
	case GST_STATE_CHANGE_READY_TO_PAUSED:
		break;
	case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
		break;
	default:
		break;
	}

	result = GST_ELEMENT_CLASS (parent_class)->change_state (element,
								 transition);

	switch (transition)
	{
	case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
		/* goo_component_set_state_paused (self->component); */
		break;
	case GST_STATE_CHANGE_PAUSED_TO_READY:
		GST_INFO ("going to idle");
		goo_component_set_state_idle (self->component);
		GST_INFO ("going to loaded");
		goo_component_set_state_loaded (self->component);
		break;
	case GST_STATE_CHANGE_READY_TO_NULL:
		break;
	default:
		break;
	}

	return result;
}
Esempio n. 7
0
END_TEST

START_TEST (test_pcmenc_2)
{
    GooComponentFactory *factory = goo_ti_component_factory_get_instance ();
    GooComponent *component = goo_component_factory_get_component (factory,
                              GOO_TI_PCM_ENCODER);
    /* audio properties */
    g_object_set (G_OBJECT (component),
                  "dasf-mode", FALSE,
                  "data-path", NULL,
                  NULL);

    {
        GOO_TI_PCMENC_GET_INPUT_PORT_PARAM (component)->nPortIndex = 0;
        GOO_TI_PCMENC_GET_INPUT_PORT_PARAM (component)->nChannels = 1;
    }

    /* output port component parameters */
    {
        GOO_TI_PCMENC_GET_OUTPUT_PORT_PARAM (component)->nPortIndex = 1;
        GOO_TI_PCMENC_GET_OUTPUT_PORT_PARAM (component)->nChannels = 1;
    }
    GOO_OBJECT_WARNING (component, "stream ID = %d",
                        goo_ti_audio_component_get_stream_id
                        (GOO_TI_AUDIO_COMPONENT (component)));

    GooEngine *engine = goo_engine_new (component,
                                        "/omx/patterns/m16.wav",
                                        "/tmp/m_16000.pcm");

    goo_component_set_state_idle (component);

    goo_component_set_state_executing (component);

    goo_engine_play (engine);

    goo_component_set_state_idle (component);
    goo_component_set_state_loaded (component);

    g_object_unref (G_OBJECT (engine));
    g_object_unref (G_OBJECT (component));
    g_object_unref (G_OBJECT (factory));

}
Esempio n. 8
0
static void omx_stop (GstGooEncGsmHr* self)
{
	g_assert (self != NULL);
	g_assert (self->component != NULL);

	if (goo_component_get_state (self->component) == OMX_StateExecuting)
	{
		GST_INFO_OBJECT (self, "going to idle");
		goo_component_set_state_idle (self->component);
	}

	if (goo_component_get_state (self->component) == OMX_StateIdle)
	{
		GST_INFO_OBJECT (self, "going to loaded");
		goo_component_set_state_loaded (self->component);
	}

	return;
}
Esempio n. 9
0
static void
process (gchar *infile, gint width, gint height, gint outcolor, GooTiVideoDecoderProcessMode process_mode)
{
	fail_unless (infile != NULL, "unspecified filename in test");
	fail_unless (g_file_test (infile, G_FILE_TEST_IS_REGULAR),
		     "file don't exist");

	gchar outfile[100];
	gchar *fn, *fn1;
	gboolean vopparser;

	fn = g_path_get_basename (infile);
	fn1 = strchr (fn, '.');
	fn1[0] = '\0';
	g_snprintf (outfile, 100, "/tmp/%s.yuv", fn);
	g_free (fn);

	/* input port */
	{
		GooPort* port = goo_component_get_port (component, "input0");
		g_assert (port != NULL);
		OMX_PARAM_PORTDEFINITIONTYPE* param =
			GOO_PORT_GET_DEFINITION (port);

		param->nBufferCountActual = 4;
		param->format.video.nFrameWidth = width;
		param->format.video.nFrameHeight = height;
		param->format.video.eColorFormat = OMX_COLOR_FormatCbYCrY;

		g_object_unref (G_OBJECT (port));
	}

	/* output port */
	{
		GooPort* port = goo_component_get_port (component, "output0");
		g_assert (port != NULL);
		OMX_PARAM_PORTDEFINITIONTYPE* param =
			GOO_PORT_GET_DEFINITION (port);

		param->nBufferCountActual = 4;
		param->format.video.nFrameWidth = width;
		param->format.video.nFrameHeight = height;
		param->format.video.eColorFormat = outcolor;

		g_object_unref (G_OBJECT (port));
	}

	/* video properties */
	  g_object_set (G_OBJECT (component),
					"process-mode", process_mode,
					NULL);
	vopparser = (process_mode == GOO_TI_VIDEO_DECODER_FRAMEMODE) ? TRUE : FALSE;

/*	GooEngine* engine = goo_engine_new_vop (component, infile, outfile, vopparser); */
	GooEngine* engine = goo_engine_new_vop (component, infile, "/dev/null", vopparser);

	goo_component_set_state_idle (component);
	goo_component_set_state_executing (component);

	goo_engine_play (engine);

	goo_component_set_state_idle (component);
	goo_component_set_state_loaded (component);

	g_object_unref (G_OBJECT (engine));

	return;
}