Jump to content

DanW

Members
  • Content Count

    7
  • Joined

  • Last visited

Posts posted by DanW


  1. Unit1 source:

     

     

    #include <vcl.h>
    #pragma hdrstop

    #include <gst/gst.h>
    #include <string.h>

    #include "Unit1.h"

    #pragma link "libgstreamer-1.0.a"

    typedef struct _CustomData {
      gboolean is_live;
      GstElement *pipeline;
      GMainLoop *loop;
    } CustomData;

    static void cb_message (GstBus *bus, GstMessage *msg, CustomData *data)
    {

      switch (GST_MESSAGE_TYPE (msg)) {
        case GST_MESSAGE_ERROR: {
          GError *err;
          gchar *debug;

          gst_message_parse_error (msg, &err, &debug);
          g_print ("Error: %s\n", err->message);
          g_error_free (err);
          g_free (debug);

          gst_element_set_state (data->pipeline, GST_STATE_READY);
          g_main_loop_quit (data->loop);
          break;
        }
        case GST_MESSAGE_EOS:
          /* end-of-stream */
          gst_element_set_state (data->pipeline, GST_STATE_READY);
          g_main_loop_quit (data->loop);
          break;
        case GST_MESSAGE_BUFFERING: {
          gint percent = 0;

          /* If the stream is live, we do not care about buffering. */
          if (data->is_live) break;

          gst_message_parse_buffering (msg, &percent);
          g_print ("Buffering (%3d%%)\r", percent);
          /* Wait until buffering is complete before start/resume playing */
          if (percent < 100)
            gst_element_set_state (data->pipeline, GST_STATE_PAUSED);
          else
            gst_element_set_state (data->pipeline, GST_STATE_PLAYING);
          break;
        }
        case GST_MESSAGE_CLOCK_LOST:
          /* Get a new clock */
          gst_element_set_state (data->pipeline, GST_STATE_PAUSED);
          gst_element_set_state (data->pipeline, GST_STATE_PLAYING);
          break;
        default:
          /* Unhandled message */
          break;
        }


    }

    //---------------------------------------------------------------------------
    #pragma package(smart_init)
    #pragma resource "*.dfm"
    TForm1 *Form1;
    //---------------------------------------------------------------------------
    __fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
    {
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
      GstElement *pipeline;
      GstBus *bus;
      GstStateChangeReturn ret;
      GMainLoop *main_loop;
      CustomData data;

      /* Initialize GStreamer */
      gst_init (0, 0);

      /* Initialize our data structure */
      memset (&data, 0, sizeof (data));

      /* Build the pipeline */
      pipeline = gst_parse_launch ("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm", NULL);
      bus = gst_element_get_bus (pipeline);

      /* Start playing */
      ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
      if (ret == GST_STATE_CHANGE_FAILURE) {
        g_printerr ("Unable to set the pipeline to the playing state.\n");
        gst_object_unref (pipeline);
        return;
      } else if (ret == GST_STATE_CHANGE_NO_PREROLL) {
        data.is_live = TRUE;
      }

      main_loop = g_main_loop_new (NULL, FALSE);
      data.loop = main_loop;
      data.pipeline = pipeline;

      gst_bus_add_signal_watch (bus);
      g_signal_connect (bus, "message", G_CALLBACK (cb_message), &data);

      g_main_loop_run (main_loop);

      /* Free resources */
      g_main_loop_unref (main_loop);
      gst_object_unref (bus);
      gst_element_set_state (pipeline, GST_STATE_NULL);
      gst_object_unref (pipeline);
    }
    //---------------------------------------------------------------------------
     


  2. when I use the mingw version of gstreamer I see

     

    ilink64 command line
      c:\program files (x86)\embarcadero\studio\21.0\bin\ilink64.exe -G8 -L.\Win64\Debug;"c:\program files (x86)\embarcadero\studio\21.0\lib\Win64\debug";
      "c:\program files (x86)\embarcadero\studio\21.0\lib\win64\release";"c:\program files (x86)\embarcadero\studio\21.0\lib\win64\release\psdk";
      C:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp\Win64;C:\gstreamer\1.0\mingw_x86_64\lib;"C:\gstreamer\1.0\mingw_x86_64\lib\gstreamer-1.0";
      C:\Users\Public\Documents\Embarcadero\Studio\21.0\DCP\Win64\Debug;C:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp\Win64 -j.\Win64\Debug;
      "c:\program files (x86)\embarcadero\studio\21.0\lib\Win64\debug";"c:\program files (x86)\embarcadero\studio\21.0\lib\win64\release";"c:\program files 
      (x86)\embarcadero\studio\21.0\lib\win64\release\psdk";C:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp\Win64;C:\gstreamer\1.0\mingw_x86_64\lib;
      "C:\gstreamer\1.0\mingw_x86_64\lib\gstreamer-1.0";C:\Users\Public\Documents\Embarcadero\Studio\21.0\DCP\Win64\Debug;
      C:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp\Win64 -l.\Win64\Debug -v -Gn 
      -GA"C:\Users\DWinsor\AppData\Local\Temp\vfsE889.tmp"="F:\Users\dwinsor\Documents\Embarcadero\Studio\Projects\test2\Unit1.dfm" -aa -V5.0 -Tpe c0w64w 
      rtl.bpi vcl.bpi memmgr.a sysinit.o .\Win64\Debug\Project1.o .\Win64\Debug\Unit1.o , .\Win64\Debug\Project1.exe , .\Win64\Debug\Project1.map , 
      import64.a cp64mti.a , , Project1.res 
    [ilink64 Error] Fatal: Invalid object file 'asnprintf.c.obj'

     

     

     

×