- ret = shift_data(format_context, headersize);
- if (ret < 0)
- return ret;
- /* Seek back to the beginning to start writing the header now */
- avio_seek(pb, 0, SEEK_SET);
-
- if (film->audio_index > -1)
- audio = format_context->streams[film->audio_index];
- if (film->video_index > -1)
- video = format_context->streams[film->video_index];
-
- if (audio != NULL) {
- audio_codec = get_audio_codec_id(audio->codecpar->codec_id);
- if (audio_codec < 0) {
- av_log(format_context, AV_LOG_ERROR, "Incompatible audio stream format.\n");
- return AVERROR(EINVAL);
- }
- }
-
- if (video->codecpar->format != AV_PIX_FMT_RGB24) {
- av_log(format_context, AV_LOG_ERROR, "Pixel format must be rgb24.\n");
- return AVERROR(EINVAL);
- }
-
- /* First, write the FILM header; this is very simple */
-
- ffio_wfourcc(pb, "FILM");
- avio_wb32(pb, 48 + stabsize);
+ /* Write the header at the position in the buffer reserved for it.
+ * First, write the FILM header; this is very simple */
+ ptr = header;
+ bytestream_put_be32(&ptr, MKBETAG('F', 'I', 'L', 'M'));
+ bytestream_put_be32(&ptr, headersize);