[gst-devel] How to make GNonLin not to decode videoclip?

wl2776 wl2776 at gmail.com
Mon Aug 9 14:25:18 CEST 2010



Edward Hervey wrote:
> 
>> Is it possible to avoid decoding and pause just at the demuxing and
>> discovering elementary stream formats?
> 
>   Set the caps property of the gnlfilesource to the format you want
> (ex : video/mpeg,mpegversion=2 for mpeg2 video)
> 

Have quickly created a small test program in C - same thing, it doesn't
work, "pad-added" signal handler is not called, if I set "caps" property;


#include <stdio.h>
#include <stdlib.h>
#include <gst/gst.h>


static void pad_added (GstPadTemplate * templ, GstPad * newpad, gpointer
data)
{
	g_print("pad_added");
	return;
}

gboolean bus_call(GstMessage *msg)
{
	switch(GST_MESSAGE_TYPE(msg)){
		case GST_MESSAGE_EOS:
			GST_INFO("eos");
			return FALSE;
		case GST_MESSAGE_ERROR:{
			GError *err;
			gchar *debug;

			gst_message_parse_error (msg, &err, &debug);

			GST_ERROR ("Error: %s", err->message);

			g_error_free (err);

			if (debug) {
				GST_ERROR ("Debug deails: %s", debug);

				g_free (debug);
			}
		}
			return FALSE;
		default:
			GST_DEBUG("message %s(%d) from
%s",GST_MESSAGE_TYPE_NAME(msg),GST_MESSAGE_TYPE(msg),GST_MESSAGE_SRC_NAME(msg));
			return TRUE;
	}
}

int main(int argc,char *argv[])
{
	GstElement *pipeline;
	GstBus *bus;
	GstElement *comp;
	GstElement *filesource1;
	GstElement *filesource2;
	GstElement *asink;
	GstElement *vsink;

	gst_init(&argc,&argv);

	pipeline = gst_pipeline_new("pipeline");
	bus = gst_pipeline_get_bus(pipeline);

	comp = gst_element_factory_make("gnlcomposition","compbin");
	g_signal_connect(G_OBJECT(comp),"pad-added",pad_added,NULL);

	asink = gst_element_factory_make("fakesink","asink");
	vsink = gst_element_factory_make("fakesink","vsink");

	gst_bin_add(GST_BIN(pipeline),comp);
	gst_bin_add(GST_BIN(pipeline),asink);
	gst_bin_add(GST_BIN(pipeline),vsink);

	filesource1=gst_element_factory_make("gnlfilesource","fr1");


g_object_set(G_OBJECT(filesource1),"location","file:///home/wl/AVIK/video/10.mpg",
									   //"caps",gst_caps_from_string("video/mpeg,mpegversion=2"),
									   "start",5*GST_MSECOND,
									   "duration",5*GST_MSECOND,
									   "media-start",0,
									   "media-duration",5*GST_MSECOND,
									   NULL);
	gst_bin_add(GST_BIN(comp),filesource1);

	filesource2=gst_element_factory_make("gnlfilesource","fr2");

g_object_set(G_OBJECT(filesource1),"location","file:///home/wl/AVIK/video/10.mpg",
									   //"caps",gst_caps_from_string("video/mpeg,mpegversion=2"),
									   "start",125*GST_MSECOND,
									   "duration",5*GST_MSECOND,
									   "media-start",5,
									   "media-duration",5*GST_MSECOND,
									   NULL);
	gst_bin_add(GST_BIN(comp),filesource2);

	gst_element_set_state(pipeline,GST_STATE_PLAYING);

	while(1){
		GstMessage *msg=gst_bus_pop(bus);
		gboolean r;

		if(msg!=NULL)
			r=bus_call(msg);

		gst_message_unref(msg);

		if(!r)
			break;

	}

	return EXIT_SUCCESS;
}


-- 
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/How-to-make-GNonLin-not-to-decode-videoclip-tp2316321p2318440.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list