[Ffmpeg-devel] [PATCH] flv with streamed ByteIO support
nazo
lovesyao
Thu Sep 21 17:11:59 CEST 2006
michaelni at gmx.at wrote:
>> - if (av_rescale_q(st->codec_info_duration, st->time_base, AV_TIME_BASE_Q) >= MAX_STREAM_DURATION) {
>> + if (av_rescale_q(st->codec_info_duration, st->time_base, AV_TIME_BASE_Q) >= MAX_STREAM_DURATION
>> + || ((&ic->pb)->is_streamed && i==ic->nb_streams)) {
>
> i see no sense in this change
I think so too :-(
I don't understand to how to do.
>> - url_fseek(&s->pb, offset, SEEK_SET);
>> + url_fskip(&s->pb, offset - url_ftell(&s->pb));
>
> rejected this is the same, or at least should be, if not thats a bug
Yes. But I think that should be use fskip when seek to near late(for
streamed byteio). streamed byteio can't seek back now(See http.c).
>> - next= size + url_ftell(&s->pb);
>> + next = size + url_ftell(&s->pb);
>
> cosmetic
.
>> {
>> - AVStream *st = s->streams[stream_index];
>> - int index = av_index_search_timestamp(st, timestamp, flags);
>> + AVStream *st;
>> + int index;
>> + if(url_is_streamed(s))
>> + return -1;
>> + st = s->streams[stream_index];
>> + index = av_index_search_timestamp(st, timestamp, flags);
>
> rejected this function must not be called if the if() is true
ok. I'll change av_seek_frame.
>> +static void fill_buffer(ByteIOContext *s)
>> +{
>> + int len;
>> +
>> + /* no need to do anything if EOF already reached */
>> + if (s->eof_reached)
>> + return;
>> +
>> + if(s->update_checksum){
>> + if(s->buf_end > s->checksum_ptr)
>> + s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_end - s->checksum_ptr);
>> + s->checksum_ptr= s->buffer;
>> + }
>> +
>> + len = s->read_packet(s->opaque, s->buffer, s->buffer_size);
>> + if (len <= 0) {
>> + /* do not modify buffer if EOF reached so that a seek back can
>> + be done without rereading data */
>> + s->eof_reached = 1;
>> + if(len<0)
>> + s->error= len;
>> + } else {
>> + s->pos += len;
>> + s->buf_ptr = s->buffer;
>> + s->buf_end = s->buffer + len;
>> + }
>> +}
>> +
>
> moving a function around is a purely cosmetical change which is not allowed
> unless its 1. needed (its not here) and 2. its a seperate patch
It was needed to use in "url_fskip".
>> static void flush_buffer(ByteIOContext *s)
>> {
>> if (s->buf_ptr > s->buffer) {
>> @@ -161,6 +189,14 @@
>>
>> void url_fskip(ByteIOContext *s, offset_t offset)
>> {
>> + if(url_is_streamed(s)){
>> + while(s->buf_end - s->buf_ptr < offset){
>> + offset -= s->buf_end - s->buf_ptr;
>> + fill_buffer(s);
>> + }
>> + s->buf_ptr += offset;
>> + return;
>> + }
>> url_fseek(s, offset, SEEK_CUR);
>
> url_fskip() behavior MUST NOT differ from url_fseek(SEEK_CUR)
look at the beginning.
More information about the ffmpeg-devel
mailing list