Hi all,
I am using playbin2 to build the pipleline. In a case I need to get the raw size of the video will be played. I tried to use "get-video-pad" signal to get the videopad,but failed. And than I found g_object_get (G_OBJECT (player->pipeline ), "n-video", &n_video, NULL); return n_video is 0; But why? The vides is played well,how can n-video of playbin2 be 0? And can anyone give a hint about how to get a video's raw width and height ? With thanks! alex July 31 Below is my function to get the info of the video: static void parse_video_info (PLAYER *player) { GstPad *videopad = NULL; int n_video; int i = 0; g_object_get (G_OBJECT (player->pipeline ), "n-video", &n_video, NULL); g_print("n-video:%d",n_video); if (n_video > 0) { for (i = 0; i < n_video && videopad == NULL; i++) g_signal_emit_by_name (player->pipeline, "get-video-pad", i, &videopad); } if (videopad) { GstCaps *caps; if ((caps = gst_pad_get_negotiated_caps (videopad))) { GstStructure *s = gst_caps_get_structure (caps, 0); gst_structure_get_int (s, "width", &(player->width)); gst_structure_get_int (s, "height", &(player->height)); gst_caps_unref (caps); } gst_object_unref (videopad); } g_print ("get stream width:%d;height:%d",player->width ,player->height ); } |
Anyone knows about this?
|
In reply to this post by forestzhu
On 07/31/2012 08:05 AM, forestzhu wrote:
> Hi all, > I am using playbin2 to build the pipleline. > In a case I need to get the raw size of the video will be played. > I tried to use "get-video-pad" signal to get the videopad,but failed. > And than I found > g_object_get (G_OBJECT (player->pipeline ), "n-video", &n_video, NULL); > return n_video is 0; > But why? The vides is played well,how can n-video of playbin2 be 0? > > And can anyone give a hint about how to get a video's raw width and height ? and how it is called. Once issue could be that you call this too early (the fact that your getting n_video=0 is supporting that assumtion). The pipeline should be in >=paused state the return meaningful results. Stefan > > With thanks! > alex > July 31 > > Below is my function to get the info of the video: > > static void > parse_video_info (PLAYER *player) > { > GstPad *videopad = NULL; > int n_video; > int i = 0; > g_object_get (G_OBJECT (player->pipeline ), "n-video", &n_video, NULL); > g_print("n-video:%d",n_video); > if (n_video > 0) > { > for (i = 0; i < n_video && videopad == NULL; i++) > g_signal_emit_by_name (player->pipeline, "get-video-pad", i, &videopad); > } > > if (videopad) > { > > GstCaps *caps; > if ((caps = gst_pad_get_negotiated_caps (videopad))) > { > GstStructure *s = gst_caps_get_structure (caps, 0); > gst_structure_get_int (s, "width", &(player->width)); > gst_structure_get_int (s, "height", &(player->height)); > gst_caps_unref (caps); > } > gst_object_unref (videopad); > } > g_print ("get stream width:%d;height:%d",player->width ,player->height ); > } > > > > > > > > -- > View this message in context: http://gstreamer-devel.966125.n4.nabble.com/How-to-get-a-video-s-raw-width-and-height-tp4655756.html > Sent from the GStreamer-devel mailing list archive at Nabble.com. > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |