<div dir="ltr">Hello<div><br></div><div style>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. </div>
<div style>I am trying to do this on windows, using the 0.10 SDK.</div><div style><br></div><div style>Source code included below.</div><div style><br></div><div style>-----------------------------------------------------------------------------------------</div>
<div style><div>#include <Windows.h></div><div>#include <ges/ges.h></div><div>#include <gst/gst.h></div><div>DWORD WINAPI GnomeMessageThread( LPVOID lpParam );</div><div>void init();</div><div><br></div>
<div>typedef struct {<span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>GESTimeline * timeline;</div><div><span class="" style="white-space:pre"> </span>GESTimelinePipeline * pipeline;</div>
<div><span class="" style="white-space:pre"> </span>GESTrack * audioTrack, * videoTrack;</div><div><span class="" style="white-space:pre"> </span>GESTimelineLayer *layer;</div><div><span class="" style="white-space:pre"> </span>GstBus * bus;</div>
<div><br></div><div>}App;</div><div>GMainLoop * mainloop;</div><div>DWORD WINAPI GnomeMessageThread( LPVOID lpParam )</div><div>{</div><div><span class="" style="white-space:pre"> </span>mainloop = g_main_loop_new (NULL, FALSE);</div>
<div><span class="" style="white-space:pre"> </span>g_main_loop_run (mainloop); </div><div><span class="" style="white-space:pre"> </span>return 0;</div><div>}</div><div><br></div><div>void init()</div><div>{</div><div><span class="" style="white-space:pre"> </span>DWORD threadID;</div>
<div><span class="" style="white-space:pre"> </span>TCHAR msg[20];</div><div><span class="" style="white-space:pre"> </span>HANDLE hThread;</div><div><span class="" style="white-space:pre"> </span>g_type_init();</div><div>
<span class="" style="white-space:pre"> </span>gst_init(NULL,NULL);</div><div><span class="" style="white-space:pre"> </span>ges_init();</div><div><span class="" style="white-space:pre"> </span>printf("Starting main thread\n");</div>
<div><span class="" style="white-space:pre"> </span>hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)GnomeMessageThread,</div><div><span class="" style="white-space:pre"> </span>(LPVOID)msg, 0, &threadID);</div>
<div>}</div><div>int setup(void * _app)</div><div>{</div><div><span class="" style="white-space:pre"> </span> App * app = ( App *) _app;</div><div><span class="" style="white-space:pre"> </span>app->timeline = ges_timeline_new();</div>
<div><span class="" style="white-space:pre"> </span>app->pipeline = ges_timeline_pipeline_new();</div><div><br></div><div><span class="" style="white-space:pre"> </span>ges_timeline_pipeline_add_timeline(app->pipeline,app->timeline);</div>
<div><span class="" style="white-space:pre"> </span>app->bus = gst_pipeline_get_bus (GST_PIPELINE(app->pipeline)); </div><div><span class="" style="white-space:pre"> </span>gst_bus_add_signal_watch (app->bus); </div>
<div><br></div><div><span class="" style="white-space:pre"> </span>if(!(app->audioTrack = ges_track_audio_raw_new ()))</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>return -1;</div>
<div><br></div><div><span class="" style="white-space:pre"> </span>}</div><div><span class="" style="white-space:pre"> </span>if(!(app->videoTrack = ges_track_video_raw_new ()))</div><div><span class="" style="white-space:pre"> </span>{</div>
<div><span class="" style="white-space:pre"> </span>return -2;</div><div><span class="" style="white-space:pre"> </span>}</div><div><span class="" style="white-space:pre"> </span>if(!ges_timeline_add_track (app->timeline, app->videoTrack))</div>
<div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>return -3;</div><div><span class="" style="white-space:pre"> </span>}</div><div><span class="" style="white-space:pre"> </span>if(!ges_timeline_add_track (app->timeline, app->audioTrack))</div>
<div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>return -4;</div><div><span class="" style="white-space:pre"> </span>}</div><div><span class="" style="white-space:pre"> </span>//Add 1 layer</div>
<div><span class="" style="white-space:pre"> </span>app->layer = (GESTimelineLayer *) ges_timeline_layer_new ();</div><div><span class="" style="white-space:pre"> </span>ges_timeline_add_layer(app->timeline, app->layer);</div>
<div><span class="" style="white-space:pre"> </span>return 0;</div><div><br></div><div>}</div><div>void logMessage( const char * message)</div><div>{</div><div><span class="" style="white-space:pre"> </span>printf(message);</div>
<div>}</div><div><br></div><div>int main(int argc, char * argv[])</div><div>{</div><div><span class="" style="white-space:pre"> </span>GESTimelineObject * object; </div><div><span class="" style="white-space:pre"> </span>App * app;</div>
<div><span class="" style="white-space:pre"> </span>gchar * filename; </div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>if(argc != 2)</div>
<div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>printf("%s [file URI]",argv[0]);</div><div><span class="" style="white-space:pre"> </span>return 0;</div>
<div><span class="" style="white-space:pre"> </span>}</div><div><span class="" style="white-space:pre"> </span>printf("Init\n");</div><div><span class="" style="white-space:pre"> </span>init(); //Init GST,GES. and starts gnome message loop.</div>
<div><span class="" style="white-space:pre"> </span>app = ( App*) malloc(sizeof( App));</div><div><span class="" style="white-space:pre"> </span>setup(app);</div><div><br></div><div><span class="" style="white-space:pre"> </span>//Add file to the layer, then play it, and wait</div>
<div><span class="" style="white-space:pre"> </span>filename = argv[1];</div><div><span class="" style="white-space:pre"> </span>object = GES_TIMELINE_OBJECT (ges_timeline_filesource_new (filename));</div><div><span class="" style="white-space:pre"> </span>ges_timeline_layer_add_object (app->layer, object);</div>
<div><br></div><div><span class="" style="white-space:pre"> </span>gst_element_set_state (GST_ELEMENT (app->pipeline), GST_STATE_PAUSED);</div><div><span class="" style="white-space:pre"> </span>char filename1[1024];</div>
<div><span class="" style="white-space:pre"> </span>//Tries and save thumbnails to a file</div><div><span class="" style="white-space:pre"> </span>printf("Generating Thumbs\n");</div><div><span class="" style="white-space:pre"> </span>for(int i = 0; i < 10 ; i++)</div>
<div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>Sleep(70);</div><div><span class="" style="white-space:pre"> </span>sprintf(filename1,"file:///E:\\Temp\\image%i.png",i);</div>
<div><span class="" style="white-space:pre"> </span>gst_element_seek_simple(GST_ELEMENT(app->pipeline), GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,70e6*i);</div><div><span class="" style="white-space:pre"> </span>gboolean result = ges_timeline_pipeline_save_thumbnail (app->pipeline,-1,-1,"image/png",filename1);</div>
<div><span class="" style="white-space:pre"> </span>if(!result)</div><div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>printf("Error saving thumbnail\n");</div>
<div><span class="" style="white-space:pre"> </span>}</div><div><span class="" style="white-space:pre"> </span>}</div><div><br></div><div><span class="" style="white-space:pre"> </span>g_main_loop_quit(mainloop);</div><div>
<span class="" style="white-space:pre"> </span>return 0;</div><div>}</div></div></div>