Hi,<br>I've written a gst-app that use a fakesrc in which I get mpeg4 packets from a stream source.The timestamp buffer in the callback function of the fakesrc is set with the basetime (saved from the pipeline at the play moment) subtracted from the current_time (seved on each callback call with the get_current_time function), here's an example:
<br><br><br>here I get the basetime:<br><br>int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])<br>{<br>...<br><br>//clock is a static GstClock*<br>//basetime is a static GstClockTime<br>gst_element_set_state (pipeline, GST_STATE_PLAYING);
<br>clock=gst_pipeline_get_clock ((GstPipeline*)pipeline);<br>baseTime=gst_clock_get_time(clock2);<br> <br>g_main_loop_run (loop);<br clear="all">....<br><br><br>And here I set the timestamp:<br><br>static void cb_handoff (GstElement *fakesrc,
<br> GstBuffer *buffer,<br> GstPad *pad,<br> gpointer user_data)<br>{<br><br>...<br><br>GTimeVal gtime;<br>g_get_current_time(&gtime);<br>GstClockTime gstClock=GST_TIMEVAL_TO_TIME(gtime);<br>
buffer->timestamp =gstClock-baseTime;<br>.....<br><br>}<br><br><br>The stream works well and the video show the frames at my framerate but I get continuosly an error of "header damaged", like this:<br><br>0:00:
01.109361000 [335m 4336[00m 014FD458 [33;01mWARN [00m [00;04m default :0::<mpeg4-decoder>[00m ffdec_mpeg4: decoding error (len: -1, have_data: 0)<br>0:00:01.109361000 [335m 4336[00m 014FD458 [31;01mERROR[00m [00m ffmpeg :0::[00m header damaged
<br><br>And the cpu goes to 100%.<br>Now, my questions are:<br><br><ol><li>There's a way to know exactly what's the error on the header (I've already tried a debug level 5 with no success)?</li><li>Is right to setting the timestamp in this way?
</li><li>How can I set the duration on the buffer?</li></ol><br>Thank's you for all the tips&hints.<br><br>Regards.<br><br><br><br><br><br><br><br><br><br><br><br>...<br><br><br><br><br><br>-- <br>Riccardo Corona