header |= 1<<16; //no crc
AV_WB32(out, header);
if(size <= 0)
- return 2; //we guess theres no crc, if there is one the user clearly doesnt care about overhead
+ return 2; //we guess there is no crc, if there is one the user clearly does not care about overhead
if(bitrate_index == 30)
return -1; //something is wrong ...
header |= (bitrate_index&1)<<9;
return 2; //FIXME actually put the needed ones in build_elision_headers()
- return 3; //we guess that the private bit isnt set
-//FIXME the above asumtations should be checked, if these turn out false too often something should be done
+ return 3; //we guess that the private bit is not set
+//FIXME the above assumptions should be checked, if these turn out false too often something should be done
}
return 0;
}
return 0;
}
+static int write_streaminfo(NUTContext *nut, ByteIOContext *bc, int stream_id){
+ AVFormatContext *s= nut->avf;
+ AVStream* st = s->streams[stream_id];
+ ByteIOContext *dyn_bc;
+ uint8_t *dyn_buf=NULL;
+ int count=0, dyn_size, i;
+ int ret = url_open_dyn_buf(&dyn_bc);
+ if(ret < 0)
+ return ret;
+
+ for (i=0; ff_nut_dispositions[i].flag; ++i) {
+ if (st->disposition & ff_nut_dispositions[i].flag)
+ count += add_info(dyn_bc, "Disposition", ff_nut_dispositions[i].str);
+ }
+ dyn_size = url_close_dyn_buf(dyn_bc, &dyn_buf);
+
+ if (count) {
+ put_v(bc, stream_id + 1); //stream_id_plus1
+ put_v(bc, 0); //chapter_id
+ put_v(bc, 0); //timestamp_start
+ put_v(bc, 0); //length
+
+ put_v(bc, count);
+
+ put_buffer(bc, dyn_buf, dyn_size);
+ }
+
+ av_free(dyn_buf);
+ return count;
+}
+
static int write_headers(NUTContext *nut, ByteIOContext *bc){
ByteIOContext *dyn_bc;
int i, ret;
write_globalinfo(nut, dyn_bc);
put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
+ for (i = 0; i < nut->avf->nb_streams; i++) {
+ ret = url_open_dyn_buf(&dyn_bc);
+ if(ret < 0)
+ return ret;
+ ret = write_streaminfo(nut, dyn_bc, i);
+ if (ret < 0)
+ return ret;
+ if (ret > 0)
+ put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
+ else {
+ uint8_t* buf;
+ url_close_dyn_buf(dyn_bc, &buf);
+ av_free(buf);
+ }
+ }
+
nut->last_syncpoint_pos= INT_MIN;
nut->header_count++;
return 0;
write_packet,
write_trailer,
.flags = AVFMT_GLOBALHEADER,
- .codec_tag= (const AVCodecTag*[]){codec_bmp_tags, codec_wav_tags, 0},
+ .codec_tag= (const AVCodecTag*[]){codec_bmp_tags, codec_wav_tags, ff_nut_subtitle_tags, 0},
};