Grabbing thumbnails with GES on Windows
Kim Lam
kim at redgiantsoftware.com
Tue Apr 16 05:41:31 PDT 2013
Hello
I am trying to grab thumbnails on a GESTimelinePipeline using the
provided ges_timeline_pipeline_save_thumbnail function. The results return
true, but no file is created.
I am trying to do this on windows, using the 0.10 SDK.
Source code included below.
-----------------------------------------------------------------------------------------
#include <Windows.h>
#include <ges/ges.h>
#include <gst/gst.h>
DWORD WINAPI GnomeMessageThread( LPVOID lpParam );
void init();
typedef struct {
GESTimeline * timeline;
GESTimelinePipeline * pipeline;
GESTrack * audioTrack, * videoTrack;
GESTimelineLayer *layer;
GstBus * bus;
}App;
GMainLoop * mainloop;
DWORD WINAPI GnomeMessageThread( LPVOID lpParam )
{
mainloop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (mainloop);
return 0;
}
void init()
{
DWORD threadID;
TCHAR msg[20];
HANDLE hThread;
g_type_init();
gst_init(NULL,NULL);
ges_init();
printf("Starting main thread\n");
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)GnomeMessageThread,
(LPVOID)msg, 0, &threadID);
}
int setup(void * _app)
{
App * app = ( App *) _app;
app->timeline = ges_timeline_new();
app->pipeline = ges_timeline_pipeline_new();
ges_timeline_pipeline_add_timeline(app->pipeline,app->timeline);
app->bus = gst_pipeline_get_bus (GST_PIPELINE(app->pipeline));
gst_bus_add_signal_watch (app->bus);
if(!(app->audioTrack = ges_track_audio_raw_new ()))
{
return -1;
}
if(!(app->videoTrack = ges_track_video_raw_new ()))
{
return -2;
}
if(!ges_timeline_add_track (app->timeline, app->videoTrack))
{
return -3;
}
if(!ges_timeline_add_track (app->timeline, app->audioTrack))
{
return -4;
}
//Add 1 layer
app->layer = (GESTimelineLayer *) ges_timeline_layer_new ();
ges_timeline_add_layer(app->timeline, app->layer);
return 0;
}
void logMessage( const char * message)
{
printf(message);
}
int main(int argc, char * argv[])
{
GESTimelineObject * object;
App * app;
gchar * filename;
if(argc != 2)
{
printf("%s [file URI]",argv[0]);
return 0;
}
printf("Init\n");
init(); //Init GST,GES. and starts gnome message loop.
app = ( App*) malloc(sizeof( App));
setup(app);
//Add file to the layer, then play it, and wait
filename = argv[1];
object = GES_TIMELINE_OBJECT (ges_timeline_filesource_new (filename));
ges_timeline_layer_add_object (app->layer, object);
gst_element_set_state (GST_ELEMENT (app->pipeline), GST_STATE_PAUSED);
char filename1[1024];
//Tries and save thumbnails to a file
printf("Generating Thumbs\n");
for(int i = 0; i < 10 ; i++)
{
Sleep(70);
sprintf(filename1,"file:///E:\\Temp\\image%i.png",i);
gst_element_seek_simple(GST_ELEMENT(app->pipeline), GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH,70e6*i);
gboolean result = ges_timeline_pipeline_save_thumbnail
(app->pipeline,-1,-1,"image/png",filename1);
if(!result)
{
printf("Error saving thumbnail\n");
}
}
g_main_loop_quit(mainloop);
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130416/737bea0f/attachment.html>
More information about the gstreamer-devel
mailing list