mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 01:31:03 +00:00
cleanup. Still not working...
Original commit message from CVS: cleanup. Still not working...
This commit is contained in:
parent
514ac0999d
commit
8dfef4d6b6
1 changed files with 18 additions and 7 deletions
|
@ -3,7 +3,7 @@
|
|||
extern gboolean _gst_plugin_spew;
|
||||
|
||||
void eof(GstSrc *src) {
|
||||
g_print("have eof, quitting\n");
|
||||
g_print("have eof, quitting\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -12,11 +12,24 @@ void mp1parse_info_chain(GstPad *pad,GstBuffer *buf) {
|
|||
gst_buffer_unref(buf);
|
||||
}
|
||||
|
||||
void new_pad_created(GstElement *parse, GstPad *pad) {
|
||||
GstPad *infopad;
|
||||
g_print("a new pad %s was created\n", gst_pad_get_name(pad));
|
||||
|
||||
// connect to audio pad
|
||||
if (strncmp(gst_pad_get_name(pad), "audio_", 6) == 0) {
|
||||
infopad = gst_pad_new("sink",GST_PAD_SINK);
|
||||
gst_pad_set_chain_function(infopad,mp1parse_info_chain);
|
||||
|
||||
gst_pad_connect(gst_element_get_pad(parse,gst_pad_get_name(pad)),
|
||||
infopad);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[]) {
|
||||
GstPipeline *pipeline;
|
||||
GstElementFactory *srcfactory, *parsefactory;
|
||||
GstElement *src, *parse;
|
||||
GstPad *infopad;
|
||||
|
||||
g_print("have %d args\n",argc);
|
||||
|
||||
|
@ -40,19 +53,17 @@ int main(int argc,char *argv[]) {
|
|||
parse = gst_elementfactory_create(parsefactory,"parse");
|
||||
g_return_if_fail(parse != NULL);
|
||||
|
||||
infopad = gst_pad_new("sink",GST_PAD_SINK);
|
||||
gst_pad_set_chain_function(infopad,mp1parse_info_chain);
|
||||
|
||||
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src));
|
||||
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(parse));
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(parse),"new_pad",
|
||||
GTK_SIGNAL_FUNC(new_pad_created),NULL);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(src),"eos",
|
||||
GTK_SIGNAL_FUNC(eof),NULL);
|
||||
|
||||
gst_pad_connect(gst_element_get_pad(src,"src"),
|
||||
gst_element_get_pad(parse,"sink"));
|
||||
gst_pad_connect(gst_element_get_pad(parse,"src"),
|
||||
infopad);
|
||||
|
||||
g_print("setting to RUNNING state\n");
|
||||
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_RUNNING);
|
||||
|
|
Loading…
Reference in a new issue