Add videoconvert and link it with pngenc plugin.

In the case of pngenc can't recognize the video format.
This commit is contained in:
Taeho Oh 2016-01-23 19:11:39 +09:00
parent 4ebf609062
commit 22de3de619

View File

@ -28,28 +28,31 @@ typedef struct _OMVSGstImpl {
OMVSGst omvs_gst_open(const gchar *uri, const gchar *filename) { OMVSGst omvs_gst_open(const gchar *uri, const gchar *filename) {
OMVSGstImpl *gst_impl; OMVSGstImpl *gst_impl;
GstElement *play; GstElement *play;
GstElement *conv;
GstElement *png; GstElement *png;
GstElement *file; GstElement *file;
GstElement *pngfile; GstElement *convpngfile;
GstPad *pad; GstPad *pad;
GstPad *ghostpad; GstPad *ghostpad;
gst_impl = g_malloc0(sizeof(OMVSGstImpl)); gst_impl = g_malloc0(sizeof(OMVSGstImpl));
gst_impl->play = play = gst_element_factory_make("playbin", "play"); gst_impl->play = play = gst_element_factory_make("playbin", "play");
g_object_set(G_OBJECT(play), "uri", uri, NULL); g_object_set(G_OBJECT(play), "uri", uri, NULL);
conv = gst_element_factory_make("queue", "conv");
png = gst_element_factory_make("pngenc", "png"); png = gst_element_factory_make("pngenc", "png");
g_object_set(G_OBJECT(png), "snapshot", 1, NULL); g_object_set(G_OBJECT(png), "snapshot", 1, NULL);
file = gst_element_factory_make("multifilesink", "file"); file = gst_element_factory_make("multifilesink", "file");
g_object_set(G_OBJECT(file), "max-files", 1, "location", filename, NULL); g_object_set(G_OBJECT(file), "max-files", 1, "location", filename, NULL);
pngfile = gst_bin_new("pngfile"); convpngfile = gst_bin_new("convpngfile");
gst_bin_add_many(GST_BIN(pngfile), png, file, NULL); gst_bin_add_many(GST_BIN(convpngfile), conv, png, file, NULL);
pad = gst_element_get_static_pad(png, "sink"); gst_element_link_many(conv, png, file, NULL);
pad = gst_element_get_static_pad(conv, "sink");
ghostpad = gst_ghost_pad_new("sink", pad); ghostpad = gst_ghost_pad_new("sink", pad);
gst_element_add_pad(pngfile, ghostpad); gst_element_add_pad(convpngfile, ghostpad);
gst_object_unref(GST_OBJECT(pad)); gst_object_unref(GST_OBJECT(pad));
g_object_set(play, "video-sink", pngfile, NULL); g_object_set(play, "video-sink", convpngfile, NULL);
g_object_set(play, "mute", TRUE, NULL); g_object_set(play, "mute", TRUE, NULL);
gst_element_set_state(play, GST_STATE_PLAYING); gst_element_set_state(play, GST_STATE_PLAYING);