Hi,<br><br>I wanted to use url_open_buf to write frames into it. I wrote a sample code for this, which is working fine with url_fopen . But i want to write into a file from buffer at the end of processing and in between of the processing use only buffer. <br>
<br> uint8_t * buf = malloc(sizeof(uint8_t)*2048000);<br>....<br> if (url_open_buf(&output_context->pb, buf, 2048000, URL_WRONLY) < 0)<br> {<br> fprintf(stderr, "Segmenter error: Could not open '%s'\n", output_filename);<br>
exit(1);<br> }<br><br>... if (av_write_header(output_context))<br> {<br> fprintf(stderr, "Segmenter error: Could not write mpegts header to first output file\n");<br> exit(1);<br> }<br><br>.....<br>
<br>ret = av_interleaved_write_frame(output_context, &packet);<br> if (ret < 0)<br> {<br> fprintf(stderr, "Segmenter error: Could not write frame of stream: %d\n", ret);<br> }<br><br>.....<br>
if (segment_time - prev_segment_time >= config.segment_length)<br> {<br><br> av_write_trailer(output_context);<br><br> FILE *fp = fopen("temp.ts", "w");<br> int si = url_close_buf(output_context->pb);<br>
printf("content %d", si); //this is always 0<br> fwrite(buf, sizeof(uint8_t), 1000000, fp);<br> fclose(fp);<br> exit(0);<br> }<br><br>When i use url_fopen its working fine . but i want to use buffer as a stream. <br>
How can i get the length of the buffer to write into a file? <br><br><br>Thanks in advance. <br><br><br><br><br><br><br><br><br><br><br><br>