All pastes #622352 Raw Edit

Someone

public text v1 · immutable
·published 2007-07-16 20:24 UTC
rendered paste body
 // get info about the stream
  GList* streaminfo;
  g_object_get(G_OBJECT(playbin), "stream-info", &streaminfo, NULL);
                 
  for( ; streaminfo != NULL; streaminfo = streaminfo->next) {
    GObject* info = (GObject*) streaminfo->data;
                 
    typedef enum {
      GST_STREAM_TYPE_UNKNOWN = 0,
      GST_STREAM_TYPE_AUDIO   = 1,
      GST_STREAM_TYPE_VIDEO   = 2,
      GST_STREAM_TYPE_TEXT    = 3,
    } GstStreamType;

    int type;
    g_object_get(info, "type", &type, NULL);
                 
    switch(type) {
      case GST_STREAM_TYPE_AUDIO: {
	  printf("\n GST_STREAM_TYPE_AUDIO");
        break;
      }

      // video
      case GST_STREAM_TYPE_VIDEO: {
	  printf("\n GST_STREAM_TYPE_VIDEO");
        break;
      }
    }

    char* decoder;
    char* codec;
    GstCaps *caps;
    GstStructure *s;
    gint rate, channels;
    gint numerator = 0;
    gint denominator = 0;

   g_object_get(info, "decoder", &decoder, "codec", &codec, "caps", &caps, NULL);

   printf("\n decoder : %s \n", decoder);
   printf("\n codec : %s \n", codec);
   printf ("\ncaps : %s\n", gst_caps_to_string(caps));

   if (caps)
   {
	s = gst_caps_get_structure (caps, 0);
	if (gst_structure_get_int (s, "rate", &rate) &&
			gst_structure_get_int (s, "channels", &channels)) {
		g_print ("\n\%d channels @ %d Hz\n", channels, rate);
	}
	if (gst_structure_get_fraction (s, "framerate",
					&numerator, &denominator))
	{
		printf("\n\n numerator : %d", numerator);
		printf("\n denominator : %d \n", denominator);
		}
	}
   }