Mercurial > libavformat.hg
changeset 887:d70e50f1495f libavformat
COSMETICS: tabs --> spaces, some prettyprinting
author | diego |
---|---|
date | Thu, 22 Dec 2005 01:10:11 +0000 |
parents | 7ed1351f8c7e |
children | 78b99ab16ea2 |
files | asf-enc.c asf.c asf.h audio.c avformat.h avi.h avidec.c avienc.c aviobuf.c barpainet.c cutils.c dc1394.c dv.c dv1394.c dv1394.h ffm.c flvdec.c flvenc.c gif.c gifdec.c grab.c matroska.c mov.c movenc.c mpegtsenc.c nsvdec.c nut.c ogg.c ogg2.c oggparsetheora.c raw.c rm.c rtpproto.c rtsp.c sierravmd.c swf.c utils.c wav.c wc3movie.c yuv4mpeg.c |
diffstat | 40 files changed, 1272 insertions(+), 1272 deletions(-) [+] |
line wrap: on
line diff
--- a/asf-enc.c Mon Dec 19 20:49:00 2005 +0000 +++ b/asf-enc.c Thu Dec 22 01:10:11 2005 +0000 @@ -26,14 +26,14 @@ #ifdef CONFIG_MUXERS -#define ASF_INDEXED_INTERVAL 10000000 -#define ASF_INDEX_BLOCK 600 +#define ASF_INDEXED_INTERVAL 10000000 +#define ASF_INDEX_BLOCK 600 #define ASF_PACKET_ERROR_CORRECTION_DATA_SIZE 0x2 #define ASF_PACKET_ERROR_CORRECTION_FLAGS (\ - ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT | \ - ASF_PACKET_ERROR_CORRECTION_DATA_SIZE\ - ) + ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT | \ + ASF_PACKET_ERROR_CORRECTION_DATA_SIZE\ + ) #if (ASF_PACKET_ERROR_CORRECTION_FLAGS != 0) # define ASF_PACKET_ERROR_CORRECTION_FLAGS_FIELD_SIZE 1 @@ -42,11 +42,11 @@ #endif #define ASF_PPI_PROPERTY_FLAGS (\ - ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_BYTE | \ - ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_DWORD | \ - ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_BYTE | \ - ASF_PL_FLAG_STREAM_NUMBER_LENGTH_FIELD_IS_BYTE \ - ) + ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_BYTE | \ + ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_DWORD | \ + ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_BYTE | \ + ASF_PL_FLAG_STREAM_NUMBER_LENGTH_FIELD_IS_BYTE \ + ) #define ASF_PPI_LENGTH_TYPE_FLAGS 0 @@ -142,50 +142,50 @@ #endif #define PACKET_HEADER_MIN_SIZE (\ - ASF_PACKET_ERROR_CORRECTION_FLAGS_FIELD_SIZE + \ - ASF_PACKET_ERROR_CORRECTION_DATA_SIZE + \ - 1 + /*Length Type Flags*/ \ - 1 + /*Property Flags*/ \ - ASF_PPI_PACKET_LENGTH_FIELD_SIZE + \ - ASF_PPI_SEQUENCE_FIELD_SIZE + \ - ASF_PPI_PADDING_LENGTH_FIELD_SIZE + \ - 4 + /*Send Time Field*/ \ - 2 /*Duration Field*/ \ - ) + ASF_PACKET_ERROR_CORRECTION_FLAGS_FIELD_SIZE + \ + ASF_PACKET_ERROR_CORRECTION_DATA_SIZE + \ + 1 + /*Length Type Flags*/ \ + 1 + /*Property Flags*/ \ + ASF_PPI_PACKET_LENGTH_FIELD_SIZE + \ + ASF_PPI_SEQUENCE_FIELD_SIZE + \ + ASF_PPI_PADDING_LENGTH_FIELD_SIZE + \ + 4 + /*Send Time Field*/ \ + 2 /*Duration Field*/ \ + ) // Replicated Data shall be at least 8 bytes long. #define ASF_PAYLOAD_REPLICATED_DATA_LENGTH 0x08 #define PAYLOAD_HEADER_SIZE_SINGLE_PAYLOAD (\ - 1 + /*Stream Number*/ \ - ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE + \ - ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE + \ - ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE + \ - ASF_PAYLOAD_REPLICATED_DATA_LENGTH \ - ) + 1 + /*Stream Number*/ \ + ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE + \ + ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE + \ + ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE + \ + ASF_PAYLOAD_REPLICATED_DATA_LENGTH \ + ) #define PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS (\ - 1 + /*Stream Number*/ \ - ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE + \ - ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE + \ - ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE + \ - ASF_PAYLOAD_REPLICATED_DATA_LENGTH + \ - ASF_PAYLOAD_LENGTH_FIELD_SIZE \ - ) + 1 + /*Stream Number*/ \ + ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE + \ + ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE + \ + ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE + \ + ASF_PAYLOAD_REPLICATED_DATA_LENGTH + \ + ASF_PAYLOAD_LENGTH_FIELD_SIZE \ + ) #define SINGLE_PAYLOAD_DATA_LENGTH (\ - PACKET_SIZE - \ - PACKET_HEADER_MIN_SIZE - \ - PAYLOAD_HEADER_SIZE_SINGLE_PAYLOAD \ - ) + PACKET_SIZE - \ + PACKET_HEADER_MIN_SIZE - \ + PAYLOAD_HEADER_SIZE_SINGLE_PAYLOAD \ + ) #define MULTI_PAYLOAD_CONSTANT (\ - PACKET_SIZE - \ - PACKET_HEADER_MIN_SIZE - \ - 1 - /*Payload Flags*/ \ - 2*PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS \ - ) + PACKET_SIZE - \ + PACKET_HEADER_MIN_SIZE - \ + 1 - /*Payload Flags*/ \ + 2*PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS \ + ) static int preroll_time = 2000; @@ -653,11 +653,11 @@ static void put_frame( AVFormatContext *s, ASFStream *stream, - int timestamp, + int timestamp, const uint8_t *buf, - int m_obj_size, + int m_obj_size, int flags - ) + ) { ASFContext *asf = s->priv_data; int m_obj_offset, payload_len, frag_len1;
--- a/asf.c Mon Dec 19 20:49:00 2005 +0000 +++ b/asf.c Thu Dec 22 01:10:11 2005 +0000 @@ -169,18 +169,18 @@ goto fail; if (!memcmp(&g, &file_header, sizeof(GUID))) { get_guid(pb, &asf->hdr.guid); - asf->hdr.file_size = get_le64(pb); - asf->hdr.create_time = get_le64(pb); - asf->hdr.packets_count = get_le64(pb); - asf->hdr.send_time = get_le64(pb); - asf->hdr.play_time = get_le64(pb); - asf->hdr.preroll = get_le32(pb); - asf->hdr.ignore = get_le32(pb); - asf->hdr.flags = get_le32(pb); - asf->hdr.min_pktsize = get_le32(pb); - asf->hdr.max_pktsize = get_le32(pb); - asf->hdr.max_bitrate = get_le32(pb); - asf->packet_size = asf->hdr.max_pktsize; + asf->hdr.file_size = get_le64(pb); + asf->hdr.create_time = get_le64(pb); + asf->hdr.packets_count = get_le64(pb); + asf->hdr.send_time = get_le64(pb); + asf->hdr.play_time = get_le64(pb); + asf->hdr.preroll = get_le32(pb); + asf->hdr.ignore = get_le32(pb); + asf->hdr.flags = get_le32(pb); + asf->hdr.min_pktsize = get_le32(pb); + asf->hdr.max_pktsize = get_le32(pb); + asf->hdr.max_bitrate = get_le32(pb); + asf->packet_size = asf->hdr.max_pktsize; asf->nb_packets = asf->hdr.packets_count; } else if (!memcmp(&g, &stream_header, sizeof(GUID))) { int type, total_size, type_specific_size, sizeX; @@ -214,32 +214,32 @@ total_size = get_le64(pb); type_specific_size = get_le32(pb); get_le32(pb); - st->id = get_le16(pb) & 0x7f; /* stream id */ + st->id = get_le16(pb) & 0x7f; /* stream id */ // mapping of asf ID to AV stream ID; asf->asfid2avid[st->id] = s->nb_streams - 1; get_le32(pb); - st->codec->codec_type = type; + st->codec->codec_type = type; if (type == CODEC_TYPE_AUDIO) { get_wav_header(pb, st->codec, type_specific_size); st->need_parsing = 1; - /* We have to init the frame size at some point .... */ - pos2 = url_ftell(pb); - if (gsize > (pos2 + 8 - pos1 + 24)) { - asf_st->ds_span = get_byte(pb); - asf_st->ds_packet_size = get_le16(pb); - asf_st->ds_chunk_size = get_le16(pb); - asf_st->ds_data_size = get_le16(pb); - asf_st->ds_silence_data = get_byte(pb); - } - //printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n", - // asf_st->ds_packet_size, asf_st->ds_chunk_size, - // asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data); - if (asf_st->ds_span > 1) { - if (!asf_st->ds_chunk_size - || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1)) - asf_st->ds_span = 0; // disable descrambling - } + /* We have to init the frame size at some point .... */ + pos2 = url_ftell(pb); + if (gsize > (pos2 + 8 - pos1 + 24)) { + asf_st->ds_span = get_byte(pb); + asf_st->ds_packet_size = get_le16(pb); + asf_st->ds_chunk_size = get_le16(pb); + asf_st->ds_data_size = get_le16(pb); + asf_st->ds_silence_data = get_byte(pb); + } + //printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n", + // asf_st->ds_packet_size, asf_st->ds_chunk_size, + // asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data); + if (asf_st->ds_span > 1) { + if (!asf_st->ds_chunk_size + || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1)) + asf_st->ds_span = 0; // disable descrambling + } switch (st->codec->codec_id) { case CODEC_ID_MP3: st->codec->frame_size = MPA_FRAME_SIZE; @@ -260,25 +260,25 @@ break; } } else { - get_le32(pb); + get_le32(pb); get_le32(pb); get_byte(pb); size = get_le16(pb); /* size */ sizeX= get_le32(pb); /* size */ st->codec->width = get_le32(pb); - st->codec->height = get_le32(pb); + st->codec->height = get_le32(pb); /* not available for asf */ get_le16(pb); /* panes */ - st->codec->bits_per_sample = get_le16(pb); /* depth */ + st->codec->bits_per_sample = get_le16(pb); /* depth */ tag1 = get_le32(pb); - url_fskip(pb, 20); + url_fskip(pb, 20); // av_log(NULL, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); size= sizeX; - if (size > 40) { - st->codec->extradata_size = size - 40; - st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(pb, st->codec->extradata, st->codec->extradata_size); - } + if (size > 40) { + st->codec->extradata_size = size - 40; + st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + get_buffer(pb, st->codec->extradata, st->codec->extradata_size); + } /* Extract palette from extradata if bpp <= 8 */ /* This code assumes that extradata contains only palette */ @@ -296,7 +296,7 @@ } st->codec->codec_tag = tag1; - st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1); + st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1); if(tag1 == MKTAG('D', 'V', 'R', ' ')) st->need_parsing = 1; } @@ -316,7 +316,7 @@ get_str16_nolen(pb, len2, s->author, sizeof(s->author)); get_str16_nolen(pb, len3, s->copyright, sizeof(s->copyright)); get_str16_nolen(pb, len4, s->comment, sizeof(s->comment)); - url_fskip(pb, len5); + url_fskip(pb, len5); } else if (!memcmp(&g, &extended_content_header, sizeof(GUID))) { int desc_count, i; @@ -399,10 +399,10 @@ fail: for(i=0;i<s->nb_streams;i++) { AVStream *st = s->streams[i]; - if (st) { - av_free(st->priv_data); + if (st) { + av_free(st->priv_data); av_free(st->codec->extradata); - } + } av_free(st); } return -1; @@ -430,19 +430,19 @@ c = get_byte(pb); if (c != 0x82) { if (!url_feof(pb)) - av_log(s, AV_LOG_ERROR, "ff asf bad header %x at:%"PRId64"\n", c, url_ftell(pb)); + av_log(s, AV_LOG_ERROR, "ff asf bad header %x at:%"PRId64"\n", c, url_ftell(pb)); } if ((c & 0x0f) == 2) { // always true for now - if (get_le16(pb) != 0) { + if (get_le16(pb) != 0) { if (!url_feof(pb)) - av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n"); - return AVERROR_IO; - } + av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n"); + return AVERROR_IO; + } rsize+=2; /* }else{ if (!url_feof(pb)) - printf("ff asf bad header %x at:%lld\n", c, url_ftell(pb)); - return AVERROR_IO;*/ + printf("ff asf bad header %x at:%lld\n", c, url_ftell(pb)); + return AVERROR_IO;*/ } asf->packet_flags = get_byte(pb); @@ -457,10 +457,10 @@ // rsize has at least 11 bytes which have to be present if (asf->packet_flags & 0x01) { - asf->packet_segsizetype = get_byte(pb); rsize++; + asf->packet_segsizetype = get_byte(pb); rsize++; asf->packet_segments = asf->packet_segsizetype & 0x3f; } else { - asf->packet_segments = 1; + asf->packet_segments = 1; asf->packet_segsizetype = 0x80; } asf->packet_size_left = packet_length - padsize - rsize; @@ -480,184 +480,184 @@ ByteIOContext *pb = &s->pb; //static int pc = 0; for (;;) { - int rsize = 0; - if (asf->packet_size_left < FRAME_HEADER_SIZE - || asf->packet_segments < 1) { - //asf->packet_size_left <= asf->packet_padsize) { - int ret = asf->packet_size_left + asf->packet_padsize; - //printf("PacketLeftSize:%d Pad:%d Pos:%Ld\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb)); + int rsize = 0; + if (asf->packet_size_left < FRAME_HEADER_SIZE + || asf->packet_segments < 1) { + //asf->packet_size_left <= asf->packet_padsize) { + int ret = asf->packet_size_left + asf->packet_padsize; + //printf("PacketLeftSize:%d Pad:%d Pos:%Ld\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb)); if((url_ftell(&s->pb) + ret - s->data_offset) % asf->packet_size) ret += asf->packet_size - ((url_ftell(&s->pb) + ret - s->data_offset) % asf->packet_size); - /* fail safe */ - url_fskip(pb, ret); + /* fail safe */ + url_fskip(pb, ret); asf->packet_pos= url_ftell(&s->pb); - ret = asf_get_packet(s); - //printf("READ ASF PACKET %d r:%d c:%d\n", ret, asf->packet_size_left, pc++); - if (ret < 0 || url_feof(pb)) - return AVERROR_IO; + ret = asf_get_packet(s); + //printf("READ ASF PACKET %d r:%d c:%d\n", ret, asf->packet_size_left, pc++); + if (ret < 0 || url_feof(pb)) + return AVERROR_IO; asf->packet_time_start = 0; continue; - } - if (asf->packet_time_start == 0) { - /* read frame header */ + } + if (asf->packet_time_start == 0) { + /* read frame header */ int num = get_byte(pb); - asf->packet_segments--; - rsize++; - asf->packet_key_frame = (num & 0x80) >> 7; - asf->stream_index = asf->asfid2avid[num & 0x7f]; - // sequence should be ignored! - DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0); - DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0); - DO_2BITS(asf->packet_property, asf->packet_replic_size, 0); + asf->packet_segments--; + rsize++; + asf->packet_key_frame = (num & 0x80) >> 7; + asf->stream_index = asf->asfid2avid[num & 0x7f]; + // sequence should be ignored! + DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0); + DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0); + DO_2BITS(asf->packet_property, asf->packet_replic_size, 0); //printf("key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, //asf->packet_frag_offset, asf->packet_replic_size); - if (asf->packet_replic_size > 1) { + if (asf->packet_replic_size > 1) { assert(asf->packet_replic_size >= 8); // it should be always at least 8 bytes - FIXME validate - asf->packet_obj_size = get_le32(pb); - asf->packet_frag_timestamp = get_le32(pb); // timestamp - if (asf->packet_replic_size > 8) - url_fskip(pb, asf->packet_replic_size - 8); - rsize += asf->packet_replic_size; // FIXME - check validity - } else if (asf->packet_replic_size==1){ - // multipacket - frag_offset is begining timestamp - asf->packet_time_start = asf->packet_frag_offset; + asf->packet_obj_size = get_le32(pb); + asf->packet_frag_timestamp = get_le32(pb); // timestamp + if (asf->packet_replic_size > 8) + url_fskip(pb, asf->packet_replic_size - 8); + rsize += asf->packet_replic_size; // FIXME - check validity + } else if (asf->packet_replic_size==1){ + // multipacket - frag_offset is begining timestamp + asf->packet_time_start = asf->packet_frag_offset; asf->packet_frag_offset = 0; - asf->packet_frag_timestamp = asf->packet_timestamp; + asf->packet_frag_timestamp = asf->packet_timestamp; asf->packet_time_delta = get_byte(pb); - rsize++; - }else{ + rsize++; + }else{ assert(asf->packet_replic_size==0); } - if (asf->packet_flags & 0x01) { - DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal + if (asf->packet_flags & 0x01) { + DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal #undef DO_2BITS - //printf("Fragsize %d\n", asf->packet_frag_size); - } else { - asf->packet_frag_size = asf->packet_size_left - rsize; - //printf("Using rest %d %d %d\n", asf->packet_frag_size, asf->packet_size_left, rsize); - } - if (asf->packet_replic_size == 1) { - asf->packet_multi_size = asf->packet_frag_size; - if (asf->packet_multi_size > asf->packet_size_left) { - asf->packet_segments = 0; + //printf("Fragsize %d\n", asf->packet_frag_size); + } else { + asf->packet_frag_size = asf->packet_size_left - rsize; + //printf("Using rest %d %d %d\n", asf->packet_frag_size, asf->packet_size_left, rsize); + } + if (asf->packet_replic_size == 1) { + asf->packet_multi_size = asf->packet_frag_size; + if (asf->packet_multi_size > asf->packet_size_left) { + asf->packet_segments = 0; continue; - } - } - asf->packet_size_left -= rsize; - //printf("___objsize____ %d %d rs:%d\n", asf->packet_obj_size, asf->packet_frag_offset, rsize); + } + } + asf->packet_size_left -= rsize; + //printf("___objsize____ %d %d rs:%d\n", asf->packet_obj_size, asf->packet_frag_offset, rsize); - if (asf->stream_index < 0 + if (asf->stream_index < 0 || s->streams[asf->stream_index]->discard >= AVDISCARD_ALL || (!asf->packet_key_frame && s->streams[asf->stream_index]->discard >= AVDISCARD_NONKEY) ) { asf->packet_time_start = 0; - /* unhandled packet (should not happen) */ - url_fskip(pb, asf->packet_frag_size); - asf->packet_size_left -= asf->packet_frag_size; + /* unhandled packet (should not happen) */ + url_fskip(pb, asf->packet_frag_size); + asf->packet_size_left -= asf->packet_frag_size; if(asf->stream_index < 0) av_log(s, AV_LOG_ERROR, "ff asf skip %d %d\n", asf->packet_frag_size, num & 0x7f); continue; - } - asf->asf_st = s->streams[asf->stream_index]->priv_data; - } - asf_st = asf->asf_st; + } + asf->asf_st = s->streams[asf->stream_index]->priv_data; + } + asf_st = asf->asf_st; - if ((asf->packet_frag_offset != asf_st->frag_offset - || (asf->packet_frag_offset - && asf->packet_seq != asf_st->seq)) // seq should be ignored - ) { - /* cannot continue current packet: free it */ - // FIXME better check if packet was already allocated - av_log(s, AV_LOG_INFO, "ff asf parser skips: %d - %d o:%d - %d %d %d fl:%d\n", - asf_st->pkt.size, - asf->packet_obj_size, - asf->packet_frag_offset, asf_st->frag_offset, - asf->packet_seq, asf_st->seq, asf->packet_frag_size); - if (asf_st->pkt.size) - av_free_packet(&asf_st->pkt); - asf_st->frag_offset = 0; - if (asf->packet_frag_offset != 0) { - url_fskip(pb, asf->packet_frag_size); - av_log(s, AV_LOG_INFO, "ff asf parser skipping %db\n", asf->packet_frag_size); - asf->packet_size_left -= asf->packet_frag_size; - continue; - } - } - if (asf->packet_replic_size == 1) { - // frag_offset is here used as the begining timestamp - asf->packet_frag_timestamp = asf->packet_time_start; - asf->packet_time_start += asf->packet_time_delta; - asf->packet_obj_size = asf->packet_frag_size = get_byte(pb); - asf->packet_size_left--; + if ((asf->packet_frag_offset != asf_st->frag_offset + || (asf->packet_frag_offset + && asf->packet_seq != asf_st->seq)) // seq should be ignored + ) { + /* cannot continue current packet: free it */ + // FIXME better check if packet was already allocated + av_log(s, AV_LOG_INFO, "ff asf parser skips: %d - %d o:%d - %d %d %d fl:%d\n", + asf_st->pkt.size, + asf->packet_obj_size, + asf->packet_frag_offset, asf_st->frag_offset, + asf->packet_seq, asf_st->seq, asf->packet_frag_size); + if (asf_st->pkt.size) + av_free_packet(&asf_st->pkt); + asf_st->frag_offset = 0; + if (asf->packet_frag_offset != 0) { + url_fskip(pb, asf->packet_frag_size); + av_log(s, AV_LOG_INFO, "ff asf parser skipping %db\n", asf->packet_frag_size); + asf->packet_size_left -= asf->packet_frag_size; + continue; + } + } + if (asf->packet_replic_size == 1) { + // frag_offset is here used as the begining timestamp + asf->packet_frag_timestamp = asf->packet_time_start; + asf->packet_time_start += asf->packet_time_delta; + asf->packet_obj_size = asf->packet_frag_size = get_byte(pb); + asf->packet_size_left--; asf->packet_multi_size--; - if (asf->packet_multi_size < asf->packet_obj_size) - { - asf->packet_time_start = 0; - url_fskip(pb, asf->packet_multi_size); - asf->packet_size_left -= asf->packet_multi_size; + if (asf->packet_multi_size < asf->packet_obj_size) + { + asf->packet_time_start = 0; + url_fskip(pb, asf->packet_multi_size); + asf->packet_size_left -= asf->packet_multi_size; continue; - } - asf->packet_multi_size -= asf->packet_obj_size; - //printf("COMPRESS size %d %d %d ms:%d\n", asf->packet_obj_size, asf->packet_frag_timestamp, asf->packet_size_left, asf->packet_multi_size); - } - if (asf_st->frag_offset == 0) { - /* new packet */ - av_new_packet(&asf_st->pkt, asf->packet_obj_size); - asf_st->seq = asf->packet_seq; - asf_st->pkt.pts = asf->packet_frag_timestamp; - asf_st->pkt.stream_index = asf->stream_index; + } + asf->packet_multi_size -= asf->packet_obj_size; + //printf("COMPRESS size %d %d %d ms:%d\n", asf->packet_obj_size, asf->packet_frag_timestamp, asf->packet_size_left, asf->packet_multi_size); + } + if (asf_st->frag_offset == 0) { + /* new packet */ + av_new_packet(&asf_st->pkt, asf->packet_obj_size); + asf_st->seq = asf->packet_seq; + asf_st->pkt.pts = asf->packet_frag_timestamp; + asf_st->pkt.stream_index = asf->stream_index; asf_st->pkt.pos = asf_st->packet_pos= asf->packet_pos; //printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n", //asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & PKT_FLAG_KEY, //s->streams[asf->stream_index]->codec->codec_type == CODEC_TYPE_AUDIO, asf->packet_obj_size); - if (s->streams[asf->stream_index]->codec->codec_type == CODEC_TYPE_AUDIO) - asf->packet_key_frame = 1; - if (asf->packet_key_frame) - asf_st->pkt.flags |= PKT_FLAG_KEY; - } + if (s->streams[asf->stream_index]->codec->codec_type == CODEC_TYPE_AUDIO) + asf->packet_key_frame = 1; + if (asf->packet_key_frame) + asf_st->pkt.flags |= PKT_FLAG_KEY; + } - /* read data */ - //printf("READ PACKET s:%d os:%d o:%d,%d l:%d DATA:%p\n", - // asf->packet_size, asf_st->pkt.size, asf->packet_frag_offset, - // asf_st->frag_offset, asf->packet_frag_size, asf_st->pkt.data); - asf->packet_size_left -= asf->packet_frag_size; - if (asf->packet_size_left < 0) + /* read data */ + //printf("READ PACKET s:%d os:%d o:%d,%d l:%d DATA:%p\n", + // asf->packet_size, asf_st->pkt.size, asf->packet_frag_offset, + // asf_st->frag_offset, asf->packet_frag_size, asf_st->pkt.data); + asf->packet_size_left -= asf->packet_frag_size; + if (asf->packet_size_left < 0) continue; - get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset, - asf->packet_frag_size); - asf_st->frag_offset += asf->packet_frag_size; - /* test if whole packet is read */ - if (asf_st->frag_offset == asf_st->pkt.size) { - /* return packet */ - if (asf_st->ds_span > 1) { - /* packet descrambling */ - char* newdata = av_malloc(asf_st->pkt.size); - if (newdata) { - int offset = 0; - while (offset < asf_st->pkt.size) { - int off = offset / asf_st->ds_chunk_size; - int row = off / asf_st->ds_span; - int col = off % asf_st->ds_span; - int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size; - //printf("off:%d row:%d col:%d idx:%d\n", off, row, col, idx); - memcpy(newdata + offset, - asf_st->pkt.data + idx * asf_st->ds_chunk_size, - asf_st->ds_chunk_size); - offset += asf_st->ds_chunk_size; - } - av_free(asf_st->pkt.data); - asf_st->pkt.data = newdata; - } - } - asf_st->frag_offset = 0; - memcpy(pkt, &asf_st->pkt, sizeof(AVPacket)); - //printf("packet %d %d\n", asf_st->pkt.size, asf->packet_frag_size); - asf_st->pkt.size = 0; - asf_st->pkt.data = 0; - break; // packet completed - } + get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset, + asf->packet_frag_size); + asf_st->frag_offset += asf->packet_frag_size; + /* test if whole packet is read */ + if (asf_st->frag_offset == asf_st->pkt.size) { + /* return packet */ + if (asf_st->ds_span > 1) { + /* packet descrambling */ + char* newdata = av_malloc(asf_st->pkt.size); + if (newdata) { + int offset = 0; + while (offset < asf_st->pkt.size) { + int off = offset / asf_st->ds_chunk_size; + int row = off / asf_st->ds_span; + int col = off % asf_st->ds_span; + int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size; + //printf("off:%d row:%d col:%d idx:%d\n", off, row, col, idx); + memcpy(newdata + offset, + asf_st->pkt.data + idx * asf_st->ds_chunk_size, + asf_st->ds_chunk_size); + offset += asf_st->ds_chunk_size; + } + av_free(asf_st->pkt.data); + asf_st->pkt.data = newdata; + } + } + asf_st->frag_offset = 0; + memcpy(pkt, &asf_st->pkt, sizeof(AVPacket)); + //printf("packet %d %d\n", asf_st->pkt.size, asf->packet_frag_size); + asf_st->pkt.size = 0; + asf_st->pkt.data = 0; + break; // packet completed + } } return 0; } @@ -667,9 +667,9 @@ int i; for(i=0;i<s->nb_streams;i++) { - AVStream *st = s->streams[i]; - av_free(st->priv_data); - av_free(st->codec->extradata); + AVStream *st = s->streams[i]; + av_free(st->priv_data); + av_free(st->codec->extradata); av_free(st->codec->palctrl); } return 0; @@ -738,7 +738,7 @@ for(;;){ if (av_read_frame(s, pkt) < 0){ av_log(s, AV_LOG_INFO, "seek failed\n"); - return AV_NOPTS_VALUE; + return AV_NOPTS_VALUE; } pts= pkt->pts * 1000 / AV_TIME_BASE;
--- a/asf.h Mon Dec 19 20:49:00 2005 +0000 +++ b/asf.h Thu Dec 22 01:10:11 2005 +0000 @@ -26,7 +26,7 @@ int timestamp; int64_t duration; - int ds_span; /* descrambling */ + int ds_span; /* descrambling */ int ds_packet_size; int ds_chunk_size; int ds_data_size; @@ -44,29 +44,29 @@ } GUID; typedef struct { - GUID guid; // generated by client computer - uint64_t file_size; // in bytes + GUID guid; // generated by client computer + uint64_t file_size; // in bytes // invalid if broadcasting - uint64_t create_time; // time of creation, in 100-nanosecond units since 1.1.1601 + uint64_t create_time; // time of creation, in 100-nanosecond units since 1.1.1601 // invalid if broadcasting - uint64_t packets_count; // how many packets are there in the file + uint64_t packets_count; // how many packets are there in the file // invalid if broadcasting - uint64_t play_time; // play time, in 100-nanosecond units + uint64_t play_time; // play time, in 100-nanosecond units // invalid if broadcasting - uint64_t send_time; // time to send file, in 100-nanosecond units + uint64_t send_time; // time to send file, in 100-nanosecond units // invalid if broadcasting (could be ignored) - uint32_t preroll; // timestamp of the first packet, in milliseconds - // if nonzero - substract from time + uint32_t preroll; // timestamp of the first packet, in milliseconds + // if nonzero - substract from time uint32_t ignore; // preroll is 64bit - but let's just ignore it - uint32_t flags; // 0x01 - broadcast - // 0x02 - seekable + uint32_t flags; // 0x01 - broadcast + // 0x02 - seekable // rest is reserved should be 0 - uint32_t min_pktsize; // size of a data packet + uint32_t min_pktsize; // size of a data packet // invalid if broadcasting - uint32_t max_pktsize; // shall be the same as for min_pktsize + uint32_t max_pktsize; // shall be the same as for min_pktsize // invalid if broadcasting - uint32_t max_bitrate; // bandwith of stream in bps - // should be the sum of bitrates of the + uint32_t max_bitrate; // bandwith of stream in bps + // should be the sum of bitrates of the // individual media streams } ASFMainHeader; @@ -82,7 +82,7 @@ unsigned int packet_size; int is_streamed; int asfid2avid[128]; /* conversion table from asf ID 2 AVStream ID */ - ASFStream streams[128]; /* it's max number and it's not that big */ + ASFStream streams[128]; /* it's max number and it's not that big */ /* non streamed additonnal info */ int64_t nb_packets; int64_t duration; /* in 100ns units */
--- a/audio.c Mon Dec 19 20:49:00 2005 +0000 +++ b/audio.c Thu Dec 22 01:10:11 2005 +0000 @@ -54,7 +54,7 @@ /* open linux audio device */ if (!audio_device) #ifdef __OpenBSD__ - audio_device = "/dev/sound"; + audio_device = "/dev/sound"; #else audio_device = "/dev/dsp"; #endif
--- a/avformat.h Mon Dec 19 20:49:00 2005 +0000 +++ b/avformat.h Thu Dec 22 01:10:11 2005 +0000 @@ -68,7 +68,7 @@ static inline void av_free_packet(AVPacket *pkt) { if (pkt && pkt->destruct) { - pkt->destruct(pkt); + pkt->destruct(pkt); } }
--- a/avi.h Mon Dec 19 20:49:00 2005 +0000 +++ b/avi.h Thu Dec 22 01:10:11 2005 +0000 @@ -3,12 +3,12 @@ #include "avcodec.h" -#define AVIF_HASINDEX 0x00000010 // Index at end of file? -#define AVIF_MUSTUSEINDEX 0x00000020 -#define AVIF_ISINTERLEAVED 0x00000100 -#define AVIF_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames? -#define AVIF_WASCAPTUREFILE 0x00010000 -#define AVIF_COPYRIGHTED 0x00020000 +#define AVIF_HASINDEX 0x00000010 // Index at end of file? +#define AVIF_MUSTUSEINDEX 0x00000020 +#define AVIF_ISINTERLEAVED 0x00000100 +#define AVIF_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames? +#define AVIF_WASCAPTUREFILE 0x00010000 +#define AVIF_COPYRIGHTED 0x00020000 #define AVI_MAX_RIFF_SIZE 0x40000000LL #define AVI_MASTER_INDEX_SIZE 256
--- a/avidec.c Mon Dec 19 20:49:00 2005 +0000 +++ b/avidec.c Thu Dec 22 01:10:11 2005 +0000 @@ -133,15 +133,15 @@ } break; case MKTAG('d', 'm', 'l', 'h'): - avi->is_odml = 1; - url_fskip(pb, size + (size & 1)); - break; + avi->is_odml = 1; + url_fskip(pb, size + (size & 1)); + break; case MKTAG('a', 'v', 'i', 'h'): - /* avi header */ + /* avi header */ /* using frame_period is bad idea */ frame_period = get_le32(pb); bit_rate = get_le32(pb) * 8; - url_fskip(pb, 4 * 4); + url_fskip(pb, 4 * 4); n = get_le32(pb); for(i=0;i<n;i++) { AVIStream *ast; @@ -153,7 +153,7 @@ if (!ast) goto fail; st->priv_data = ast; - } + } url_fskip(pb, size - 7 * 4); break; case MKTAG('s', 't', 'r', 'h'): @@ -166,30 +166,30 @@ #endif if(tag1 == MKTAG('i', 'a', 'v', 's') || tag1 == MKTAG('i', 'v', 'a', 's')){ /* - * After some consideration -- I don't think we - * have to support anything but DV in a type1 AVIs. - */ - if (s->nb_streams != 1) - goto fail; + * After some consideration -- I don't think we + * have to support anything but DV in a type1 AVIs. + */ + if (s->nb_streams != 1) + goto fail; - if (handler != MKTAG('d', 'v', 's', 'd') && - handler != MKTAG('d', 'v', 'h', 'd') && - handler != MKTAG('d', 'v', 's', 'l')) - goto fail; + if (handler != MKTAG('d', 'v', 's', 'd') && + handler != MKTAG('d', 'v', 'h', 'd') && + handler != MKTAG('d', 'v', 's', 'l')) + goto fail; - ast = s->streams[0]->priv_data; - av_freep(&s->streams[0]->codec->extradata); - av_freep(&s->streams[0]); - s->nb_streams = 0; - avi->dv_demux = dv_init_demux(s); - if (!avi->dv_demux) - goto fail; - s->streams[0]->priv_data = ast; - url_fskip(pb, 3 * 4); - ast->scale = get_le32(pb); - ast->rate = get_le32(pb); - stream_index = s->nb_streams - 1; - url_fskip(pb, size - 7*4); + ast = s->streams[0]->priv_data; + av_freep(&s->streams[0]->codec->extradata); + av_freep(&s->streams[0]); + s->nb_streams = 0; + avi->dv_demux = dv_init_demux(s); + if (!avi->dv_demux) + goto fail; + s->streams[0]->priv_data = ast; + url_fskip(pb, 3 * 4); + ast->scale = get_le32(pb); + ast->rate = get_le32(pb); + stream_index = s->nb_streams - 1; + url_fskip(pb, size - 7*4); break; } @@ -228,7 +228,7 @@ // av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size); switch(tag1) { - case MKTAG('v', 'i', 'd', 's'): + case MKTAG('v', 'i', 'd', 's'): codec_type = CODEC_TYPE_VIDEO; ast->sample_size = 0; @@ -361,8 +361,8 @@ if (avi->dv_demux) { size = dv_get_packet(avi->dv_demux, pkt); - if (size >= 0) - return size; + if (size >= 0) + return size; } if(avi->non_interleaved){ @@ -483,13 +483,13 @@ for(i=sync=url_ftell(pb); !url_feof(pb); i++) { int j; - if (i >= avi->movi_end) { - if (avi->is_odml) { - url_fskip(pb, avi->riff_end - i); - avi->riff_end = avi->movi_end = url_fsize(pb); - } else - break; - } + if (i >= avi->movi_end) { + if (avi->is_odml) { + url_fskip(pb, avi->riff_end - i); + avi->riff_end = avi->movi_end = url_fsize(pb); + } else + break; + } for(j=0; j<7; j++) d[j]= d[j+1]; @@ -509,7 +509,7 @@ //parse ix## if( (d[0] == 'i' && d[1] == 'x' && n < s->nb_streams) - //parse JUNK + //parse JUNK ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K')){ url_fskip(pb, size); //av_log(NULL, AV_LOG_DEBUG, "SKIP\n"); @@ -542,7 +542,7 @@ if( ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) || d[2]*256+d[3] == ast->prefix /*|| (d[2] == 'd' && d[3] == 'c') || - (d[2] == 'w' && d[3] == 'b')*/) { + (d[2] == 'w' && d[3] == 'b')*/) { //av_log(NULL, AV_LOG_DEBUG, "OK\n"); if(d[2]*256+d[3] == ast->prefix) @@ -571,8 +571,8 @@ first = get_byte(pb); clr = get_byte(pb); - if(!clr) /* all 256 colors used */ - clr = 256; + if(!clr) /* all 256 colors used */ + clr = 256; flags = get_le16(pb); p = 4; for (k = first; k < clr + first; k++) {
--- a/avienc.c Mon Dec 19 20:49:00 2005 +0000 +++ b/avienc.c Thu Dec 22 01:10:11 2005 +0000 @@ -357,14 +357,14 @@ if(video_enc){ put_le32(pb, (uint32_t)(int64_t_C(1000000) * video_enc->time_base.num / video_enc->time_base.den)); } else { - put_le32(pb, 0); + put_le32(pb, 0); } put_le32(pb, bitrate / 8); /* XXX: not quite exact */ put_le32(pb, 0); /* padding */ if (url_is_streamed(pb)) - put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */ + put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */ else - put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */ + put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */ avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */ put_le32(pb, nb_frames); /* nb frames, filled later */ put_le32(pb, 0); /* initial frame */ @@ -374,8 +374,8 @@ put_le32(pb, video_enc->width); put_le32(pb, video_enc->height); } else { - put_le32(pb, 0); - put_le32(pb, 0); + put_le32(pb, 0); + put_le32(pb, 0); } put_le32(pb, 0); /* reserved */ put_le32(pb, 0); /* reserved */ @@ -419,10 +419,10 @@ put_le32(pb, 0); /* start */ avi->frames_hdr_strm[i] = url_ftell(pb); /* remember this offset to fill later */ - if (url_is_streamed(pb)) - put_le32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */ - else - put_le32(pb, 0); /* length, XXX: filled later */ + if (url_is_streamed(pb)) + put_le32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */ + else + put_le32(pb, 0); /* length, XXX: filled later */ /* suggested buffer size */ //FIXME set at the end to largest chunk if(stream->codec_type == CODEC_TYPE_VIDEO) @@ -442,7 +442,7 @@ strf = start_tag(pb, "strf"); switch(stream->codec_type) { case CODEC_TYPE_VIDEO: - put_bmp_header(pb, stream, codec_bmp_tags, 0); + put_bmp_header(pb, stream, codec_bmp_tags, 0); break; case CODEC_TYPE_AUDIO: if (put_wav_header(pb, stream) < 0) { @@ -456,29 +456,29 @@ end_tag(pb, strf); } - if (!url_is_streamed(pb)) { - unsigned char tag[5]; - int j; + if (!url_is_streamed(pb)) { + unsigned char tag[5]; + int j; /* Starting to lay out AVI OpenDML master index. - * We want to make it JUNK entry for now, since we'd - * like to get away without making AVI an OpenDML one - * for compatibility reasons. - */ - avi->indexes[i].entry = avi->indexes[i].ents_allocated = 0; - avi->indexes[i].indx_start = start_tag(pb, "JUNK"); - put_le16(pb, 4); /* wLongsPerEntry */ - put_byte(pb, 0); /* bIndexSubType (0 == frame index) */ - put_byte(pb, 0); /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */ - put_le32(pb, 0); /* nEntriesInUse (will fill out later on) */ - put_tag(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type)); - /* dwChunkId */ - put_le64(pb, 0); /* dwReserved[3] - put_le32(pb, 0); Must be 0. */ - for (j=0; j < AVI_MASTER_INDEX_SIZE * 2; j++) - put_le64(pb, 0); - end_tag(pb, avi->indexes[i].indx_start); - } + * We want to make it JUNK entry for now, since we'd + * like to get away without making AVI an OpenDML one + * for compatibility reasons. + */ + avi->indexes[i].entry = avi->indexes[i].ents_allocated = 0; + avi->indexes[i].indx_start = start_tag(pb, "JUNK"); + put_le16(pb, 4); /* wLongsPerEntry */ + put_byte(pb, 0); /* bIndexSubType (0 == frame index) */ + put_byte(pb, 0); /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */ + put_le32(pb, 0); /* nEntriesInUse (will fill out later on) */ + put_tag(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type)); + /* dwChunkId */ + put_le64(pb, 0); /* dwReserved[3] + put_le32(pb, 0); Must be 0. */ + for (j=0; j < AVI_MASTER_INDEX_SIZE * 2; j++) + put_le64(pb, 0); + end_tag(pb, avi->indexes[i].indx_start); + } end_tag(pb, list2); } @@ -513,51 +513,51 @@ int i, j; if (url_is_streamed(pb)) - return -1; + return -1; if (avi->riff_id > AVI_MASTER_INDEX_SIZE) return -1; for (i=0;i<s->nb_streams;i++) { - offset_t ix, pos; + offset_t ix, pos; - avi_stream2fourcc(&tag[0], i, s->streams[i]->codec->codec_type); - ix_tag[3] = '0' + i; + avi_stream2fourcc(&tag[0], i, s->streams[i]->codec->codec_type); + ix_tag[3] = '0' + i; - /* Writing AVI OpenDML leaf index chunk */ - ix = url_ftell(pb); - put_tag(pb, &ix_tag[0]); /* ix?? */ - put_le32(pb, avi->indexes[i].entry * 8 + 24); - /* chunk size */ + /* Writing AVI OpenDML leaf index chunk */ + ix = url_ftell(pb); + put_tag(pb, &ix_tag[0]); /* ix?? */ + put_le32(pb, avi->indexes[i].entry * 8 + 24); + /* chunk size */ put_le16(pb, 2); /* wLongsPerEntry */ - put_byte(pb, 0); /* bIndexSubType (0 == frame index) */ - put_byte(pb, 1); /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */ - put_le32(pb, avi->indexes[i].entry); - /* nEntriesInUse */ - put_tag(pb, &tag[0]); /* dwChunkId */ - put_le64(pb, avi->movi_list);/* qwBaseOffset */ - put_le32(pb, 0); /* dwReserved_3 (must be 0) */ + put_byte(pb, 0); /* bIndexSubType (0 == frame index) */ + put_byte(pb, 1); /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */ + put_le32(pb, avi->indexes[i].entry); + /* nEntriesInUse */ + put_tag(pb, &tag[0]); /* dwChunkId */ + put_le64(pb, avi->movi_list);/* qwBaseOffset */ + put_le32(pb, 0); /* dwReserved_3 (must be 0) */ for (j=0; j<avi->indexes[i].entry; j++) { AVIIentry* ie = avi_get_ientry(&avi->indexes[i], j); - put_le32(pb, ie->pos + 8); - put_le32(pb, ((uint32_t)ie->len & ~0x80000000) | - (ie->flags & 0x10 ? 0 : 0x80000000)); + put_le32(pb, ie->pos + 8); + put_le32(pb, ((uint32_t)ie->len & ~0x80000000) | + (ie->flags & 0x10 ? 0 : 0x80000000)); } - put_flush_packet(pb); + put_flush_packet(pb); pos = url_ftell(pb); - /* Updating one entry in the AVI OpenDML master index */ - url_fseek(pb, avi->indexes[i].indx_start - 8, SEEK_SET); - put_tag(pb, "indx"); /* enabling this entry */ - url_fskip(pb, 8); - put_le32(pb, avi->riff_id); /* nEntriesInUse */ - url_fskip(pb, 16*avi->riff_id); - put_le64(pb, ix); /* qwOffset */ - put_le32(pb, pos - ix); /* dwSize */ - put_le32(pb, avi->indexes[i].entry); /* dwDuration */ + /* Updating one entry in the AVI OpenDML master index */ + url_fseek(pb, avi->indexes[i].indx_start - 8, SEEK_SET); + put_tag(pb, "indx"); /* enabling this entry */ + url_fskip(pb, 8); + put_le32(pb, avi->riff_id); /* nEntriesInUse */ + url_fskip(pb, 16*avi->riff_id); + put_le64(pb, ix); /* qwOffset */ + put_le32(pb, pos - ix); /* dwSize */ + put_le32(pb, avi->indexes[i].entry); /* dwDuration */ - url_fseek(pb, pos, SEEK_SET); + url_fseek(pb, pos, SEEK_SET); } return 0; } @@ -572,39 +572,39 @@ unsigned char tag[5]; if (!url_is_streamed(pb)) { - AVIIentry* ie = 0, *tie; - int entry[MAX_STREAMS]; - int empty, stream_id = -1; + AVIIentry* ie = 0, *tie; + int entry[MAX_STREAMS]; + int empty, stream_id = -1; - idx_chunk = start_tag(pb, "idx1"); - memset(&entry[0], 0, sizeof(entry)); - do { - empty = 1; - for (i=0; i<s->nb_streams; i++) { - if (avi->indexes[i].entry <= entry[i]) - continue; + idx_chunk = start_tag(pb, "idx1"); + memset(&entry[0], 0, sizeof(entry)); + do { + empty = 1; + for (i=0; i<s->nb_streams; i++) { + if (avi->indexes[i].entry <= entry[i]) + continue; - tie = avi_get_ientry(&avi->indexes[i], entry[i]); - if (empty || tie->pos < ie->pos) { - ie = tie; - stream_id = i; - } - empty = 0; - } - if (!empty) { - avi_stream2fourcc(&tag[0], stream_id, - s->streams[stream_id]->codec->codec_type); - put_tag(pb, &tag[0]); - put_le32(pb, ie->flags); + tie = avi_get_ientry(&avi->indexes[i], entry[i]); + if (empty || tie->pos < ie->pos) { + ie = tie; + stream_id = i; + } + empty = 0; + } + if (!empty) { + avi_stream2fourcc(&tag[0], stream_id, + s->streams[stream_id]->codec->codec_type); + put_tag(pb, &tag[0]); + put_le32(pb, ie->flags); put_le32(pb, ie->pos); put_le32(pb, ie->len); - entry[stream_id]++; - } - } while (!empty); - end_tag(pb, idx_chunk); + entry[stream_id]++; + } + } while (!empty); + end_tag(pb, idx_chunk); /* Fill in frame/sample counters */ - file_size = url_ftell(pb); + file_size = url_ftell(pb); nb_frames = 0; for(n=0;n<s->nb_streams;n++) { if (avi->frames_hdr_strm[n] != 0) { @@ -653,16 +653,16 @@ // Make sure to put an OpenDML chunk when the file size exceeds the limits if (!url_is_streamed(pb) && - (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) { + (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) { avi_write_ix(s); end_tag(pb, avi->movi_list); - if (avi->riff_id == 1) - avi_write_idx1(s); + if (avi->riff_id == 1) + avi_write_idx1(s); - end_tag(pb, avi->riff_start); - avi->movi_list = avi_start_new_riff(avi, pb, "AVIX", "movi"); + end_tag(pb, avi->riff_start); + avi->movi_list = avi_start_new_riff(avi, pb, "AVIX", "movi"); } avi_stream2fourcc(&tag[0], stream_index, enc->codec_type); @@ -674,22 +674,22 @@ if (!url_is_streamed(&s->pb)) { AVIIndex* idx = &avi->indexes[stream_index]; - int cl = idx->entry / AVI_INDEX_CLUSTER_SIZE; - int id = idx->entry % AVI_INDEX_CLUSTER_SIZE; + int cl = idx->entry / AVI_INDEX_CLUSTER_SIZE; + int id = idx->entry % AVI_INDEX_CLUSTER_SIZE; if (idx->ents_allocated <= idx->entry) { - idx->cluster = av_realloc(idx->cluster, (cl+1)*sizeof(void*)); - if (!idx->cluster) - return -1; + idx->cluster = av_realloc(idx->cluster, (cl+1)*sizeof(void*)); + if (!idx->cluster) + return -1; idx->cluster[cl] = av_malloc(AVI_INDEX_CLUSTER_SIZE*sizeof(AVIIentry)); - if (!idx->cluster[cl]) - return -1; - idx->ents_allocated += AVI_INDEX_CLUSTER_SIZE; - } + if (!idx->cluster[cl]) + return -1; + idx->ents_allocated += AVI_INDEX_CLUSTER_SIZE; + } - idx->cluster[cl][id].flags = flags; + idx->cluster[cl][id].flags = flags; idx->cluster[cl][id].pos = url_ftell(pb) - avi->movi_list; idx->cluster[cl][id].len = size; - idx->entry++; + idx->entry++; } put_buffer(pb, tag, 4); @@ -715,16 +715,16 @@ if (avi->riff_id == 1) { end_tag(pb, avi->movi_list); res = avi_write_idx1(s); - end_tag(pb, avi->riff_start); + end_tag(pb, avi->riff_start); } else { avi_write_ix(s); end_tag(pb, avi->movi_list); - end_tag(pb, avi->riff_start); + end_tag(pb, avi->riff_start); file_size = url_ftell(pb); - url_fseek(pb, avi->odml_list - 8, SEEK_SET); - put_tag(pb, "LIST"); /* Making this AVI OpenDML one */ - url_fskip(pb, 16); + url_fseek(pb, avi->odml_list - 8, SEEK_SET); + put_tag(pb, "LIST"); /* Making this AVI OpenDML one */ + url_fskip(pb, 16); for (n=nb_frames=0;n<s->nb_streams;n++) { AVCodecContext *stream = s->streams[n]->codec; @@ -737,18 +737,18 @@ } } } - put_le32(pb, nb_frames); - url_fseek(pb, file_size, SEEK_SET); + put_le32(pb, nb_frames); + url_fseek(pb, file_size, SEEK_SET); } } put_flush_packet(pb); for (i=0; i<MAX_STREAMS; i++) { - for (j=0; j<avi->indexes[i].ents_allocated/AVI_INDEX_CLUSTER_SIZE; j++) + for (j=0; j<avi->indexes[i].ents_allocated/AVI_INDEX_CLUSTER_SIZE; j++) av_free(avi->indexes[i].cluster[j]); - av_free(avi->indexes[i].cluster); - avi->indexes[i].cluster = NULL; - avi->indexes[i].ents_allocated = avi->indexes[i].entry = 0; + av_free(avi->indexes[i].cluster); + avi->indexes[i].cluster = NULL; + avi->indexes[i].ents_allocated = avi->indexes[i].entry = 0; } return res;
--- a/aviobuf.c Mon Dec 19 20:49:00 2005 +0000 +++ b/aviobuf.c Thu Dec 22 01:10:11 2005 +0000 @@ -470,7 +470,7 @@ return url_write(h, buf, buf_size); } #else -#define url_write_packet NULL +#define url_write_packet NULL #endif //CONFIG_MUXERS static int url_read_packet(void *opaque, uint8_t *buf, int buf_size)
--- a/barpainet.c Mon Dec 19 20:49:00 2005 +0000 +++ b/barpainet.c Thu Dec 22 01:10:11 2005 +0000 @@ -4,22 +4,22 @@ #include "barpainet.h" int inet_aton (const char * str, struct in_addr * add) { - const char * pch = str; - unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0; + const char * pch = str; + unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0; - add1 = atoi(pch); - pch = strpbrk(pch,"."); - if (pch == 0 || ++pch == 0) goto done; - add2 = atoi(pch); - pch = strpbrk(pch,"."); - if (pch == 0 || ++pch == 0) goto done; - add3 = atoi(pch); - pch = strpbrk(pch,"."); - if (pch == 0 || ++pch == 0) goto done; - add4 = atoi(pch); + add1 = atoi(pch); + pch = strpbrk(pch,"."); + if (pch == 0 || ++pch == 0) goto done; + add2 = atoi(pch); + pch = strpbrk(pch,"."); + if (pch == 0 || ++pch == 0) goto done; + add3 = atoi(pch); + pch = strpbrk(pch,"."); + if (pch == 0 || ++pch == 0) goto done; + add4 = atoi(pch); done: - add->s_addr=(add4<<24)+(add3<<16)+(add2<<8)+add1; + add->s_addr=(add4<<24)+(add3<<16)+(add2<<8)+add1; - return 1; + return 1; }
--- a/cutils.c Mon Dec 19 20:49:00 2005 +0000 +++ b/cutils.c Thu Dec 22 01:10:11 2005 +0000 @@ -59,7 +59,7 @@ p = str; q = val; while (*q != '\0') { - if (toupper(*(const unsigned char *)p) != toupper(*(const unsigned char *)q)) + if (toupper(*(const unsigned char *)p) != toupper(*(const unsigned char *)q)) return 0; p++; q++; @@ -166,13 +166,13 @@ /* oh well, may be someone some day will invent a formula for this stuff */ y = 1970; /* start "guessing" */ while (days >= (ISLEAP(y)?366:365)) { - ny = (y + days/366); - days -= (ny - y) * 365 + LEAPS_COUNT(ny - 1) - LEAPS_COUNT(y - 1); - y = ny; + ny = (y + days/366); + days -= (ny - y) * 365 + LEAPS_COUNT(ny - 1) - LEAPS_COUNT(y - 1); + y = ny; } md[1] = ISLEAP(y)?29:28; for (m=0; days >= md[m]; m++) - days -= md[m]; + days -= md[m]; tm->tm_year = y; /* unlike gmtime_r we store complete year here */ tm->tm_mon = m+1; /* unlike gmtime_r tm_mon is from 1 to 12 */
--- a/dc1394.c Mon Dec 19 20:49:00 2005 +0000 +++ b/dc1394.c Thu Dec 22 01:10:11 2005 +0000 @@ -69,16 +69,16 @@ for (fmt = dc1394_frame_formats; fmt->width; fmt++) if (fmt->pix_fmt == ap->pix_fmt && fmt->width == ap->width && fmt->height == ap->height) - break; + break; for (fps = dc1394_frame_rates; fps->frame_rate; fps++) if (fps->frame_rate == av_rescale(1000, ap->time_base.den, ap->time_base.num)) - break; + break; /* create a video stream */ vst = av_new_stream(c, 0); if (!vst) - return -1; + return -1; av_set_pts_info(vst, 64, 1, 1000); vst->codec->codec_type = CODEC_TYPE_VIDEO; vst->codec->codec_id = CODEC_ID_RAWVIDEO; @@ -102,7 +102,7 @@ /* Now lets prep the hardware */ dc1394->handle = dc1394_create_handle(0); /* FIXME: gotta have ap->port */ if (!dc1394->handle) { - av_log(c, AV_LOG_ERROR, "Can't acquire dc1394 handle on port %d\n", 0 /* ap->port */); + av_log(c, AV_LOG_ERROR, "Can't acquire dc1394 handle on port %d\n", 0 /* ap->port */); goto out; } camera_nodes = dc1394_get_camera_nodes(dc1394->handle, &res, 1); @@ -111,23 +111,23 @@ goto out_handle; } res = dc1394_dma_setup_capture(dc1394->handle, camera_nodes[ap->channel], - 0, - FORMAT_VGA_NONCOMPRESSED, - fmt->frame_size_id, - SPEED_400, - fps->frame_rate_id, 8, 1, - ap->device, - &dc1394->camera); + 0, + FORMAT_VGA_NONCOMPRESSED, + fmt->frame_size_id, + SPEED_400, + fps->frame_rate_id, 8, 1, + ap->device, + &dc1394->camera); dc1394_free_camera_nodes(camera_nodes); if (res != DC1394_SUCCESS) { av_log(c, AV_LOG_ERROR, "Can't prepare camera for the DMA capture\n"); - goto out_handle; + goto out_handle; } res = dc1394_start_iso_transmission(dc1394->handle, dc1394->camera.node); if (res != DC1394_SUCCESS) { av_log(c, AV_LOG_ERROR, "Can't start isochronous transmission\n"); - goto out_handle_dma; + goto out_handle_dma; } return 0; @@ -148,7 +148,7 @@ /* discard stale frame */ if (dc1394->current_frame++) { - if (dc1394_dma_done_with_buffer(&dc1394->camera) != DC1394_SUCCESS) + if (dc1394_dma_done_with_buffer(&dc1394->camera) != DC1394_SUCCESS) av_log(c, AV_LOG_ERROR, "failed to release %d frame\n", dc1394->current_frame); } @@ -157,7 +157,7 @@ if (res == DC1394_SUCCESS) { dc1394->packet.data = (uint8_t *)(dc1394->camera.capture_buffer); dc1394->packet.pts = (dc1394->current_frame * 1000000) / dc1394->fps; - res = dc1394->packet.size; + res = dc1394->packet.size; } else { av_log(c, AV_LOG_ERROR, "DMA capture failed\n"); dc1394->packet.data = NULL;
--- a/dv.c Mon Dec 19 20:49:00 2005 +0000 +++ b/dv.c Thu Dec 22 01:10:11 2005 +0000 @@ -153,13 +153,13 @@ shift = (sample & 0xf00) >> 8; if (shift < 0x2 || shift > 0xd) { - result = sample; + result = sample; } else if (shift < 0x8) { shift--; - result = (sample - (256 * shift)) << shift; + result = (sample - (256 * shift)) << shift; } else { - shift = 0xe - shift; - result = ((sample + ((256 * shift) + 1)) << shift) - 1; + shift = 0xe - shift; + result = ((sample + ((256 * shift) + 1)) << shift) - 1; } return result; @@ -168,7 +168,7 @@ static int dv_audio_frame_size(const DVprofile* sys, int frame) { return sys->audio_samples_dist[frame % (sizeof(sys->audio_samples_dist)/ - sizeof(sys->audio_samples_dist[0]))]; + sizeof(sys->audio_samples_dist[0]))]; } static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* buf) @@ -182,17 +182,17 @@ case dv_header525: /* I can't imagine why these two weren't defined as real */ case dv_header625: /* packs in SMPTE314M -- they definitely look like ones */ buf[1] = 0xf8 | /* reserved -- always 1 */ - (0 & 0x07); /* APT: Track application ID */ + (0 & 0x07); /* APT: Track application ID */ buf[2] = (0 << 7) | /* TF1: audio data is 0 - valid; 1 - invalid */ - (0x0f << 3) | /* reserved -- always 1 */ - (0 & 0x07); /* AP1: Audio application ID */ + (0x0f << 3) | /* reserved -- always 1 */ + (0 & 0x07); /* AP1: Audio application ID */ buf[3] = (0 << 7) | /* TF2: video data is 0 - valid; 1 - invalid */ - (0x0f << 3) | /* reserved -- always 1 */ - (0 & 0x07); /* AP2: Video application ID */ + (0x0f << 3) | /* reserved -- always 1 */ + (0 & 0x07); /* AP2: Video application ID */ buf[4] = (0 << 7) | /* TF3: subcode(SSYB) is 0 - valid; 1 - invalid */ - (0x0f << 3) | /* reserved -- always 1 */ - (0 & 0x07); /* AP3: Subcode application ID */ - break; + (0x0f << 3) | /* reserved -- always 1 */ + (0 & 0x07); /* AP3: Subcode application ID */ + break; case dv_timecode: ct = (time_t)(c->frames / ((float)c->sys->frame_rate / (float)c->sys->frame_rate_base)); @@ -202,109 +202,109 @@ * minute, unless it is exactly divisible by 10 */ ltc_frame = (c->frames + 2*ct/60 - 2*ct/600) % c->sys->ltc_divisor; - buf[1] = (0 << 7) | /* Color fame: 0 - unsync; 1 - sync mode */ - (1 << 6) | /* Drop frame timecode: 0 - nondrop; 1 - drop */ - ((ltc_frame / 10) << 4) | /* Tens of frames */ - (ltc_frame % 10); /* Units of frames */ - buf[2] = (1 << 7) | /* Biphase mark polarity correction: 0 - even; 1 - odd */ - ((tc.tm_sec / 10) << 4) | /* Tens of seconds */ - (tc.tm_sec % 10); /* Units of seconds */ - buf[3] = (1 << 7) | /* Binary group flag BGF0 */ - ((tc.tm_min / 10) << 4) | /* Tens of minutes */ - (tc.tm_min % 10); /* Units of minutes */ - buf[4] = (1 << 7) | /* Binary group flag BGF2 */ - (1 << 6) | /* Binary group flag BGF1 */ - ((tc.tm_hour / 10) << 4) | /* Tens of hours */ - (tc.tm_hour % 10); /* Units of hours */ + buf[1] = (0 << 7) | /* Color fame: 0 - unsync; 1 - sync mode */ + (1 << 6) | /* Drop frame timecode: 0 - nondrop; 1 - drop */ + ((ltc_frame / 10) << 4) | /* Tens of frames */ + (ltc_frame % 10); /* Units of frames */ + buf[2] = (1 << 7) | /* Biphase mark polarity correction: 0 - even; 1 - odd */ + ((tc.tm_sec / 10) << 4) | /* Tens of seconds */ + (tc.tm_sec % 10); /* Units of seconds */ + buf[3] = (1 << 7) | /* Binary group flag BGF0 */ + ((tc.tm_min / 10) << 4) | /* Tens of minutes */ + (tc.tm_min % 10); /* Units of minutes */ + buf[4] = (1 << 7) | /* Binary group flag BGF2 */ + (1 << 6) | /* Binary group flag BGF1 */ + ((tc.tm_hour / 10) << 4) | /* Tens of hours */ + (tc.tm_hour % 10); /* Units of hours */ break; case dv_audio_source: /* AAUX source pack */ buf[1] = (0 << 7) | /* locked mode */ (1 << 6) | /* reserved -- always 1 */ - (dv_audio_frame_size(c->sys, c->frames) - - c->sys->audio_min_samples[0]); - /* # of samples */ + (dv_audio_frame_size(c->sys, c->frames) - + c->sys->audio_min_samples[0]); + /* # of samples */ buf[2] = (0 << 7) | /* multi-stereo */ (0 << 5) | /* #of audio channels per block: 0 -- 1 channel */ (0 << 4) | /* pair bit: 0 -- one pair of channels */ - 0; /* audio mode */ + 0; /* audio mode */ buf[3] = (1 << 7) | /* res */ (1 << 6) | /* multi-language flag */ - (c->sys->dsf << 5) | /* system: 60fields/50fields */ - 0; /* definition: 0 -- SD (525/625) */ + (c->sys->dsf << 5) | /* system: 60fields/50fields */ + 0; /* definition: 0 -- SD (525/625) */ buf[4] = (1 << 7) | /* emphasis: 1 -- off */ (0 << 6) | /* emphasis time constant: 0 -- reserved */ - (0 << 3) | /* frequency: 0 -- 48Khz, 1 -- 44,1Khz, 2 -- 32Khz */ + (0 << 3) | /* frequency: 0 -- 48Khz, 1 -- 44,1Khz, 2 -- 32Khz */ 0; /* quantization: 0 -- 16bit linear, 1 -- 12bit nonlinear */ break; case dv_audio_control: buf[1] = (0 << 6) | /* copy protection: 0 -- unrestricted */ (1 << 4) | /* input source: 1 -- digital input */ - (3 << 2) | /* compression: 3 -- no information */ - 0; /* misc. info/SMPTE emphasis off */ + (3 << 2) | /* compression: 3 -- no information */ + 0; /* misc. info/SMPTE emphasis off */ buf[2] = (1 << 7) | /* recording start point: 1 -- no */ (1 << 6) | /* recording end point: 1 -- no */ - (1 << 3) | /* recording mode: 1 -- original */ - 7; + (1 << 3) | /* recording mode: 1 -- original */ + 7; buf[3] = (1 << 7) | /* direction: 1 -- forward */ 0x20; /* speed */ buf[4] = (1 << 7) | /* reserved -- always 1 */ 0x7f; /* genre category */ - break; + break; case dv_audio_recdate: case dv_video_recdate: /* VAUX recording date */ ct = c->start_time + (time_t)(c->frames / - ((float)c->sys->frame_rate / (float)c->sys->frame_rate_base)); + ((float)c->sys->frame_rate / (float)c->sys->frame_rate_base)); brktimegm(ct, &tc); - buf[1] = 0xff; /* ds, tm, tens of time zone, units of time zone */ - /* 0xff is very likely to be "unknown" */ - buf[2] = (3 << 6) | /* reserved -- always 1 */ - ((tc.tm_mday / 10) << 4) | /* Tens of day */ - (tc.tm_mday % 10); /* Units of day */ - buf[3] = /* we set high 4 bits to 0, shouldn't we set them to week? */ - ((tc.tm_mon / 10) << 4) | /* Tens of month */ - (tc.tm_mon % 10); /* Units of month */ - buf[4] = (((tc.tm_year % 100) / 10) << 4) | /* Tens of year */ - (tc.tm_year % 10); /* Units of year */ + buf[1] = 0xff; /* ds, tm, tens of time zone, units of time zone */ + /* 0xff is very likely to be "unknown" */ + buf[2] = (3 << 6) | /* reserved -- always 1 */ + ((tc.tm_mday / 10) << 4) | /* Tens of day */ + (tc.tm_mday % 10); /* Units of day */ + buf[3] = /* we set high 4 bits to 0, shouldn't we set them to week? */ + ((tc.tm_mon / 10) << 4) | /* Tens of month */ + (tc.tm_mon % 10); /* Units of month */ + buf[4] = (((tc.tm_year % 100) / 10) << 4) | /* Tens of year */ + (tc.tm_year % 10); /* Units of year */ break; case dv_audio_rectime: /* AAUX recording time */ case dv_video_rectime: /* VAUX recording time */ ct = c->start_time + (time_t)(c->frames / - ((float)c->sys->frame_rate / (float)c->sys->frame_rate_base)); - brktimegm(ct, &tc); - buf[1] = (3 << 6) | /* reserved -- always 1 */ - 0x3f; /* tens of frame, units of frame: 0x3f - "unknown" ? */ - buf[2] = (1 << 7) | /* reserved -- always 1 */ - ((tc.tm_sec / 10) << 4) | /* Tens of seconds */ - (tc.tm_sec % 10); /* Units of seconds */ - buf[3] = (1 << 7) | /* reserved -- always 1 */ - ((tc.tm_min / 10) << 4) | /* Tens of minutes */ - (tc.tm_min % 10); /* Units of minutes */ - buf[4] = (3 << 6) | /* reserved -- always 1 */ - ((tc.tm_hour / 10) << 4) | /* Tens of hours */ - (tc.tm_hour % 10); /* Units of hours */ - break; + ((float)c->sys->frame_rate / (float)c->sys->frame_rate_base)); + brktimegm(ct, &tc); + buf[1] = (3 << 6) | /* reserved -- always 1 */ + 0x3f; /* tens of frame, units of frame: 0x3f - "unknown" ? */ + buf[2] = (1 << 7) | /* reserved -- always 1 */ + ((tc.tm_sec / 10) << 4) | /* Tens of seconds */ + (tc.tm_sec % 10); /* Units of seconds */ + buf[3] = (1 << 7) | /* reserved -- always 1 */ + ((tc.tm_min / 10) << 4) | /* Tens of minutes */ + (tc.tm_min % 10); /* Units of minutes */ + buf[4] = (3 << 6) | /* reserved -- always 1 */ + ((tc.tm_hour / 10) << 4) | /* Tens of hours */ + (tc.tm_hour % 10); /* Units of hours */ + break; case dv_video_source: - buf[1] = 0xff; /* reserved -- always 1 */ - buf[2] = (1 << 7) | /* B/W: 0 - b/w, 1 - color */ - (1 << 6) | /* following CLF is valid - 0, invalid - 1 */ - (3 << 4) | /* CLF: color frames id (see ITU-R BT.470-4) */ - 0xf; /* reserved -- always 1 */ - buf[3] = (3 << 6) | /* reserved -- always 1 */ - (c->sys->dsf << 5) | /* system: 60fields/50fields */ - 0; /* signal type video compression */ - buf[4] = 0xff; /* VISC: 0xff -- no information */ + buf[1] = 0xff; /* reserved -- always 1 */ + buf[2] = (1 << 7) | /* B/W: 0 - b/w, 1 - color */ + (1 << 6) | /* following CLF is valid - 0, invalid - 1 */ + (3 << 4) | /* CLF: color frames id (see ITU-R BT.470-4) */ + 0xf; /* reserved -- always 1 */ + buf[3] = (3 << 6) | /* reserved -- always 1 */ + (c->sys->dsf << 5) | /* system: 60fields/50fields */ + 0; /* signal type video compression */ + buf[4] = 0xff; /* VISC: 0xff -- no information */ break; case dv_video_control: - buf[1] = (0 << 6) | /* Copy generation management (CGMS) 0 -- free */ - 0x3f; /* reserved -- always 1 */ - buf[2] = 0xc8 | /* reserved -- always b11001xxx */ - c->aspect; - buf[3] = (1 << 7) | /* Frame/field flag 1 -- frame, 0 -- field */ - (1 << 6) | /* First/second field flag 0 -- field 2, 1 -- field 1 */ - (1 << 5) | /* Frame change flag 0 -- same picture as before, 1 -- different */ - (1 << 4) | /* 1 - interlaced, 0 - noninterlaced */ - 0xc; /* reserved -- always b1100 */ - buf[4] = 0xff; /* reserved -- always 1 */ + buf[1] = (0 << 6) | /* Copy generation management (CGMS) 0 -- free */ + 0x3f; /* reserved -- always 1 */ + buf[2] = 0xc8 | /* reserved -- always b11001xxx */ + c->aspect; + buf[3] = (1 << 7) | /* Frame/field flag 1 -- frame, 0 -- field */ + (1 << 6) | /* First/second field flag 0 -- field 2, 1 -- field 1 */ + (1 << 5) | /* Frame change flag 0 -- same picture as before, 1 -- different */ + (1 << 4) | /* 1 - interlaced, 0 - noninterlaced */ + 0xc; /* reserved -- always b1100 */ + buf[4] = 0xff; /* reserved -- always 1 */ break; default: buf[1] = buf[2] = buf[3] = buf[4] = 0xff; @@ -317,8 +317,8 @@ { buf[0] = (uint8_t)t; /* Section type */ buf[1] = (seq_num<<4) | /* DIF seq number 0-9 for 525/60; 0-11 for 625/50 */ - (0 << 3) | /* FSC: for 50Mb/s 0 - first channel; 1 - second */ - 7; /* reserved -- always 1 */ + (0 << 3) | /* FSC: for 50Mb/s 0 - first channel; 1 - second */ + 7; /* reserved -- always 1 */ buf[2] = dif_num; /* DIF block number Video: 0-134, Audio: 0-8 */ return 3; } @@ -326,18 +326,18 @@ static inline int dv_write_ssyb_id(uint8_t syb_num, uint8_t fr, uint8_t* buf) { if (syb_num == 0 || syb_num == 6) { - buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */ - (0<<4) | /* AP3 (Subcode application ID) */ - 0x0f; /* reserved -- always 1 */ + buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */ + (0<<4) | /* AP3 (Subcode application ID) */ + 0x0f; /* reserved -- always 1 */ } else if (syb_num == 11) { - buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */ + buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */ 0x7f; /* reserved -- always 1 */ } else { - buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */ + buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */ (0<<4) | /* APT (Track application ID) */ - 0x0f; /* reserved -- always 1 */ + 0x0f; /* reserved -- always 1 */ } buf[1] = 0xf0 | /* reserved -- always 1 */ (syb_num & 0x0f); /* SSYB number 0 - 11 */ @@ -360,33 +360,33 @@ /* DV subcode: 2DIFs */ for (j = 0; j < 2; j++) { buf += dv_write_dif_id( dv_sect_subcode, i, j, buf); - for (k = 0; k < 6; k++) { - buf += dv_write_ssyb_id(k, (i < c->sys->difseg_size/2), buf); - buf += dv_write_pack(dv_ssyb_packs_dist[i][k], c, buf); - } - buf += 29; /* unused bytes */ + for (k = 0; k < 6; k++) { + buf += dv_write_ssyb_id(k, (i < c->sys->difseg_size/2), buf); + buf += dv_write_pack(dv_ssyb_packs_dist[i][k], c, buf); + } + buf += 29; /* unused bytes */ } /* DV VAUX: 3DIFs */ for (j = 0; j < 3; j++) { - buf += dv_write_dif_id(dv_sect_vaux, i, j, buf); - for (k = 0; k < 15 ; k++) - buf += dv_write_pack(dv_vaux_packs_dist[i][k], c, buf); - buf += 2; /* unused bytes */ + buf += dv_write_dif_id(dv_sect_vaux, i, j, buf); + for (k = 0; k < 15 ; k++) + buf += dv_write_pack(dv_vaux_packs_dist[i][k], c, buf); + buf += 2; /* unused bytes */ } /* DV Audio/Video: 135 Video DIFs + 9 Audio DIFs */ for (j = 0; j < 135; j++) { if (j%15 == 0) { - memset(buf, 0xff, 80); - buf += dv_write_dif_id(dv_sect_audio, i, j/15, buf); + memset(buf, 0xff, 80); + buf += dv_write_dif_id(dv_sect_audio, i, j/15, buf); buf += 77; /* audio control & shuffled PCM audio */ - } - buf += dv_write_dif_id(dv_sect_video, i, j, buf); - buf += 77; /* 1 video macro block: 1 bytes control - 4 * 14 bytes Y 8x8 data - 10 bytes Cr 8x8 data - 10 bytes Cb 8x8 data */ + } + buf += dv_write_dif_id(dv_sect_video, i, j, buf); + buf += 77; /* 1 video macro block: 1 bytes control + 4 * 14 bytes Y 8x8 data + 10 bytes Cr 8x8 data + 10 bytes Cb 8x8 data */ } } } @@ -398,14 +398,14 @@ for (i = 0; i < c->sys->difseg_size; i++) { frame_ptr += 6 * 80; /* skip DIF segment header */ for (j = 0; j < 9; j++) { - dv_write_pack(dv_aaux_packs_dist[i][j], c, &frame_ptr[3]); + dv_write_pack(dv_aaux_packs_dist[i][j], c, &frame_ptr[3]); for (d = 8; d < 80; d+=2) { - of = c->sys->audio_shuffle[i][j] + (d - 8)/2 * c->sys->audio_stride; - if (of*2 >= size) - continue; + of = c->sys->audio_shuffle[i][j] + (d - 8)/2 * c->sys->audio_stride; + if (of*2 >= size) + continue; - frame_ptr[d] = pcm[of*2+1]; // FIXME: may be we have to admit - frame_ptr[d+1] = pcm[of*2]; // that DV is a big endian PCM + frame_ptr[d] = pcm[of*2+1]; // FIXME: may be we have to admit + frame_ptr[d+1] = pcm[of*2]; // that DV is a big endian PCM } frame_ptr += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */ } @@ -421,10 +421,10 @@ ptr += 6 * 80; /* skip DIF segment header */ for (j = 0; j < 135; j++) { if (j%15 == 0) - ptr += 80; /* skip Audio DIF */ - ptr += 3; - memcpy(frame_ptr + ptr, video_data + ptr, 77); - ptr += 77; + ptr += 80; /* skip Audio DIF */ + ptr += 3; + memcpy(frame_ptr + ptr, video_data + ptr, 77); + ptr += 77; } } } @@ -441,10 +441,10 @@ switch (t) { case dv_audio_source: offs = (80*6 + 80*16*3 + 3); - break; + break; case dv_audio_control: offs = (80*6 + 80*16*4 + 3); - break; + break; case dv_video_control: offs = (80*5 + 48 + 5); break; @@ -472,7 +472,7 @@ as_pack = dv_extract_pack(frame, dv_audio_source); if (!as_pack) /* No audio ? */ - return 0; + return 0; sys = dv_frame_profile(frame); smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */ @@ -480,7 +480,7 @@ quant = as_pack[4] & 0x07; /* 0 - 16bit linear, 1 - 12bit nonlinear */ if (quant > 1) - return -1; /* Unsupported quantization */ + return -1; /* Unsupported quantization */ size = (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */ half_ch = sys->difseg_size/2; @@ -497,38 +497,38 @@ for (j = 0; j < 9; j++) { for (d = 8; d < 80; d += 2) { - if (quant == 0) { /* 16bit quantization */ - of = sys->audio_shuffle[i][j] + (d - 8)/2 * sys->audio_stride; + if (quant == 0) { /* 16bit quantization */ + of = sys->audio_shuffle[i][j] + (d - 8)/2 * sys->audio_stride; if (of*2 >= size) - continue; + continue; - pcm[of*2] = frame[d+1]; // FIXME: may be we have to admit - pcm[of*2+1] = frame[d]; // that DV is a big endian PCM - if (pcm[of*2+1] == 0x80 && pcm[of*2] == 0x00) - pcm[of*2+1] = 0; - } else { /* 12bit quantization */ - lc = ((uint16_t)frame[d] << 4) | - ((uint16_t)frame[d+2] >> 4); - rc = ((uint16_t)frame[d+1] << 4) | - ((uint16_t)frame[d+2] & 0x0f); - lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc)); - rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc)); + pcm[of*2] = frame[d+1]; // FIXME: may be we have to admit + pcm[of*2+1] = frame[d]; // that DV is a big endian PCM + if (pcm[of*2+1] == 0x80 && pcm[of*2] == 0x00) + pcm[of*2+1] = 0; + } else { /* 12bit quantization */ + lc = ((uint16_t)frame[d] << 4) | + ((uint16_t)frame[d+2] >> 4); + rc = ((uint16_t)frame[d+1] << 4) | + ((uint16_t)frame[d+2] & 0x0f); + lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc)); + rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc)); - of = sys->audio_shuffle[i%half_ch][j] + (d - 8)/3 * sys->audio_stride; + of = sys->audio_shuffle[i%half_ch][j] + (d - 8)/3 * sys->audio_stride; if (of*2 >= size) - continue; + continue; - pcm[of*2] = lc & 0xff; // FIXME: may be we have to admit - pcm[of*2+1] = lc >> 8; // that DV is a big endian PCM - of = sys->audio_shuffle[i%half_ch+half_ch][j] + - (d - 8)/3 * sys->audio_stride; - pcm[of*2] = rc & 0xff; // FIXME: may be we have to admit - pcm[of*2+1] = rc >> 8; // that DV is a big endian PCM - ++d; - } - } + pcm[of*2] = lc & 0xff; // FIXME: may be we have to admit + pcm[of*2+1] = lc >> 8; // that DV is a big endian PCM + of = sys->audio_shuffle[i%half_ch+half_ch][j] + + (d - 8)/3 * sys->audio_stride; + pcm[of*2] = rc & 0xff; // FIXME: may be we have to admit + pcm[of*2+1] = rc >> 8; // that DV is a big endian PCM + ++d; + } + } - frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */ + frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */ } } @@ -545,7 +545,7 @@ as_pack = dv_extract_pack(frame, dv_audio_source); if (!as_pack || !sys) { /* No audio ? */ c->ach = 0; - return 0; + return 0; } smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */ @@ -557,11 +557,11 @@ for (i=0; i<ach; i++) { if (!c->ast[i]) { c->ast[i] = av_new_stream(c->fctx, 0); - if (!c->ast[i]) - break; - av_set_pts_info(c->ast[i], 64, 1, 30000); - c->ast[i]->codec->codec_type = CODEC_TYPE_AUDIO; - c->ast[i]->codec->codec_id = CODEC_ID_PCM_S16LE; + if (!c->ast[i]) + break; + av_set_pts_info(c->ast[i], 64, 1, 30000); + c->ast[i]->codec->codec_type = CODEC_TYPE_AUDIO; + c->ast[i]->codec->codec_id = CODEC_ID_PCM_S16LE; av_init_packet(&c->audio_pkt[i]); c->audio_pkt[i].size = 0; @@ -599,14 +599,14 @@ } avctx->pix_fmt = sys->pix_fmt; - /* finding out SAR is a little bit messy */ - vsc_pack = dv_extract_pack(frame, dv_video_control); + /* finding out SAR is a little bit messy */ + vsc_pack = dv_extract_pack(frame, dv_video_control); apt = frame[4] & 0x07; - is16_9 = (vsc_pack && ((vsc_pack[2] & 0x07) == 0x02 || - (!apt && (vsc_pack[2] & 0x07) == 0x07))); - avctx->sample_aspect_ratio = sys->sar[is16_9]; + is16_9 = (vsc_pack && ((vsc_pack[2] & 0x07) == 0x02 || + (!apt && (vsc_pack[2] & 0x07) == 0x07))); + avctx->sample_aspect_ratio = sys->sar[is16_9]; - size = sys->frame_size; + size = sys->frame_size; } return size; } @@ -624,44 +624,44 @@ *frame = &c->frame_buf[0]; if (c->has_audio && c->has_video) { /* must be a stale frame */ dv_format_frame(c, *frame); - c->frames++; - if (c->has_audio > 0) - c->has_audio = 0; - c->has_video = 0; + c->frames++; + if (c->has_audio > 0) + c->has_audio = 0; + c->has_video = 0; } if (st->codec->codec_type == CODEC_TYPE_VIDEO) { /* FIXME: we have to have more sensible approach than this one */ - if (c->has_video) - av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient audio data or severe sync problem.\n", c->frames); + if (c->has_video) + av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient audio data or severe sync problem.\n", c->frames); dv_inject_video(c, data, *frame); - c->has_video = 1; - data_size = 0; - if (c->has_audio < 0) - goto out; + c->has_video = 1; + data_size = 0; + if (c->has_audio < 0) + goto out; } reqasize = 4 * dv_audio_frame_size(c->sys, c->frames); fsize = fifo_size(&c->audio_data, c->audio_data.rptr); if (st->codec->codec_type == CODEC_TYPE_AUDIO || (c->has_video && fsize >= reqasize)) { - if (fsize + data_size >= reqasize && !c->has_audio) { + if (fsize + data_size >= reqasize && !c->has_audio) { if (fsize >= reqasize) { - fifo_read(&c->audio_data, &pcm[0], reqasize, &c->audio_data.rptr); + fifo_read(&c->audio_data, &pcm[0], reqasize, &c->audio_data.rptr); } else { - fifo_read(&c->audio_data, &pcm[0], fsize, &c->audio_data.rptr); + fifo_read(&c->audio_data, &pcm[0], fsize, &c->audio_data.rptr); memcpy(&pcm[fsize], &data[0], reqasize - fsize); - data += reqasize - fsize; - data_size -= reqasize - fsize; - } - dv_inject_audio(c, &pcm[0], *frame); - c->has_audio = 1; - } + data += reqasize - fsize; + data_size -= reqasize - fsize; + } + dv_inject_audio(c, &pcm[0], *frame); + c->has_audio = 1; + } /* FIXME: we have to have more sensible approach than this one */ if (fifo_size(&c->audio_data, c->audio_data.rptr) + data_size >= 100*AVCODEC_MAX_AUDIO_FRAME_SIZE) - av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames); - fifo_write(&c->audio_data, (uint8_t *)data, data_size, &c->audio_data.wptr); + av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames); + fifo_write(&c->audio_data, (uint8_t *)data, data_size, &c->audio_data.wptr); } out: @@ -685,27 +685,27 @@ /* We have to sort out where audio and where video stream is */ for (i=0; i<s->nb_streams; i++) { switch (s->streams[i]->codec->codec_type) { - case CODEC_TYPE_VIDEO: - vst = s->streams[i]; - break; - case CODEC_TYPE_AUDIO: - ast = s->streams[i]; - break; - default: - goto bail_out; - } + case CODEC_TYPE_VIDEO: + vst = s->streams[i]; + break; + case CODEC_TYPE_AUDIO: + ast = s->streams[i]; + break; + default: + goto bail_out; + } } /* Some checks -- DV format is very picky about its incoming streams */ if (!vst || vst->codec->codec_id != CODEC_ID_DVVIDEO) goto bail_out; if (ast && (ast->codec->codec_id != CODEC_ID_PCM_S16LE || - ast->codec->sample_rate != 48000 || - ast->codec->channels != 2)) - goto bail_out; + ast->codec->sample_rate != 48000 || + ast->codec->channels != 2)) + goto bail_out; c->sys = dv_codec_profile(vst->codec); if (!c->sys) - goto bail_out; + goto bail_out; /* Ok, everything seems to be in working order */ c->frames = 0; @@ -769,9 +769,9 @@ for (i=0; i<c->ach; i++) { if (c->ast[i] && c->audio_pkt[i].size) { *pkt = c->audio_pkt[i]; - c->audio_pkt[i].size = 0; - size = pkt->size; - break; + c->audio_pkt[i].size = 0; + size = pkt->size; + break; } } @@ -874,9 +874,9 @@ size = dv_frame_profile(c->buf)->frame_size; if (get_buffer(&s->pb, c->buf + 4, size - 4) <= 0) - return AVERROR_IO; + return AVERROR_IO; - size = dv_produce_packet(c->dv_demux, pkt, c->buf, size); + size = dv_produce_packet(c->dv_demux, pkt, c->buf, size); } return size; @@ -912,9 +912,9 @@ s->priv_data = dv_init_mux(s); if (!s->priv_data) { av_log(s, AV_LOG_ERROR, "Can't initialize DV format!\n" - "Make sure that you supply exactly two streams:\n" - " video: 25fps or 29.97fps, audio: 2ch/48Khz/PCM\n"); - return -1; + "Make sure that you supply exactly two streams:\n" + " video: 25fps or 29.97fps, audio: 2ch/48Khz/PCM\n"); + return -1; } return 0; }
--- a/dv1394.c Mon Dec 19 20:49:00 2005 +0000 +++ b/dv1394.c Thu Dec 22 01:10:11 2005 +0000 @@ -88,9 +88,9 @@ goto failed; if (ap->standard && !strcasecmp(ap->standard, "pal")) - dv->format = DV1394_PAL; + dv->format = DV1394_PAL; else - dv->format = DV1394_NTSC; + dv->format = DV1394_NTSC; if (ap->channel) dv->channel = ap->channel; @@ -202,7 +202,7 @@ size = dv_produce_packet(dv->dv_demux, pkt, dv->ring + (dv->index * DV1394_PAL_FRAME_SIZE), - DV1394_PAL_FRAME_SIZE); + DV1394_PAL_FRAME_SIZE); dv->index = (dv->index + 1) % DV1394_RING_FRAMES; dv->done++; dv->avail--;
--- a/dv1394.h Mon Dec 19 20:49:00 2005 +0000 +++ b/dv1394.h Thu Dec 22 01:10:11 2005 +0000 @@ -60,21 +60,21 @@ Example 1: To play a raw .DV file: cat foo.DV > /dev/dv1394 - (cat will use write() internally) + (cat will use write() internally) Example 2: static struct dv1394_init init = { - 0x63, (broadcast channel) + 0x63, (broadcast channel) 4, (four-frame ringbuffer) - DV1394_NTSC, (send NTSC video) - 0, 0 (default empty packet rate) + DV1394_NTSC, (send NTSC video) + 0, 0 (default empty packet rate) } - ioctl(fd, DV1394_INIT, &init); + ioctl(fd, DV1394_INIT, &init); - while(1) { - read( <a raw DV file>, buf, DV1394_NTSC_FRAME_SIZE ); - write( <the dv1394 FD>, buf, DV1394_NTSC_FRAME_SIZE ); + while(1) { + read( <a raw DV file>, buf, DV1394_NTSC_FRAME_SIZE ); + write( <the dv1394 FD>, buf, DV1394_NTSC_FRAME_SIZE ); } 2) @@ -104,12 +104,12 @@ frame 0 frame 1 frame 2 frame 3 - *--------------------------------------* + *--------------------------------------* | CLEAR | DV data | DV data | CLEAR | *--------------------------------------* <ACTIVE> - transmission goes in this direction --->>> + transmission goes in this direction --->>> The DV hardware is currently transmitting the data in frame 1. @@ -123,9 +123,9 @@ receive the following values: n_frames = 4 - active_frame = 1 - first_clear_frame = 3 - n_clear_frames = 2 + active_frame = 1 + first_clear_frame = 3 + n_clear_frames = 2 At this point, you should write new DV data into frame 3 and optionally frame 0. Then call DV1394_SUBMIT_FRAMES to inform the device that @@ -170,11 +170,11 @@ ioctl(dv1394_fd, DV1394_GET_STATUS, &status); - if(status.dropped_frames > 0) { - reset_dv1394(); + if(status.dropped_frames > 0) { + reset_dv1394(); } else { for(int i = 0; i < status.n_clear_frames; i++) { - copy_DV_frame(); + copy_DV_frame(); } } } @@ -210,51 +210,51 @@ /* ioctl() commands */ enum { - /* I don't like using 0 as a valid ioctl() */ - DV1394_INVALID = 0, + /* I don't like using 0 as a valid ioctl() */ + DV1394_INVALID = 0, - /* get the driver ready to transmit video. - pass a struct dv1394_init* as the parameter (see below), - or NULL to get default parameters */ - DV1394_INIT, + /* get the driver ready to transmit video. + pass a struct dv1394_init* as the parameter (see below), + or NULL to get default parameters */ + DV1394_INIT, - /* stop transmitting video and free the ringbuffer */ - DV1394_SHUTDOWN, + /* stop transmitting video and free the ringbuffer */ + DV1394_SHUTDOWN, - /* submit N new frames to be transmitted, where - the index of the first new frame is first_clear_buffer, - and the index of the last new frame is - (first_clear_buffer + N) % n_frames */ - DV1394_SUBMIT_FRAMES, + /* submit N new frames to be transmitted, where + the index of the first new frame is first_clear_buffer, + and the index of the last new frame is + (first_clear_buffer + N) % n_frames */ + DV1394_SUBMIT_FRAMES, - /* block until N buffers are clear (pass N as the parameter) - Because we re-transmit the last frame on underrun, there - will at most be n_frames - 1 clear frames at any time */ - DV1394_WAIT_FRAMES, + /* block until N buffers are clear (pass N as the parameter) + Because we re-transmit the last frame on underrun, there + will at most be n_frames - 1 clear frames at any time */ + DV1394_WAIT_FRAMES, - /* capture new frames that have been received, where - the index of the first new frame is first_clear_buffer, - and the index of the last new frame is - (first_clear_buffer + N) % n_frames */ - DV1394_RECEIVE_FRAMES, + /* capture new frames that have been received, where + the index of the first new frame is first_clear_buffer, + and the index of the last new frame is + (first_clear_buffer + N) % n_frames */ + DV1394_RECEIVE_FRAMES, - DV1394_START_RECEIVE, + DV1394_START_RECEIVE, - /* pass a struct dv1394_status* as the parameter (see below) */ - DV1394_GET_STATUS, + /* pass a struct dv1394_status* as the parameter (see below) */ + DV1394_GET_STATUS, }; enum pal_or_ntsc { - DV1394_NTSC = 0, - DV1394_PAL + DV1394_NTSC = 0, + DV1394_PAL }; @@ -262,29 +262,29 @@ /* this is the argument to DV1394_INIT */ struct dv1394_init { - /* DV1394_API_VERSION */ - unsigned int api_version; + /* DV1394_API_VERSION */ + unsigned int api_version; - /* isochronous transmission channel to use */ - unsigned int channel; + /* isochronous transmission channel to use */ + unsigned int channel; - /* number of frames in the ringbuffer. Must be at least 2 - and at most DV1394_MAX_FRAMES. */ - unsigned int n_frames; + /* number of frames in the ringbuffer. Must be at least 2 + and at most DV1394_MAX_FRAMES. */ + unsigned int n_frames; - /* send/receive PAL or NTSC video format */ - enum pal_or_ntsc format; + /* send/receive PAL or NTSC video format */ + enum pal_or_ntsc format; - /* the following are used only for transmission */ + /* the following are used only for transmission */ - /* set these to zero unless you want a - non-default empty packet rate (see below) */ - unsigned long cip_n; - unsigned long cip_d; + /* set these to zero unless you want a + non-default empty packet rate (see below) */ + unsigned long cip_n; + unsigned long cip_d; - /* set this to zero unless you want a - non-default SYT cycle offset (default = 3 cycles) */ - unsigned int syt_offset; + /* set this to zero unless you want a + non-default SYT cycle offset (default = 3 cycles) */ + unsigned int syt_offset; }; /* NOTE: you may only allocate the DV frame ringbuffer once each time @@ -322,32 +322,32 @@ struct dv1394_status { - /* this embedded init struct returns the current dv1394 - parameters in use */ - struct dv1394_init init; + /* this embedded init struct returns the current dv1394 + parameters in use */ + struct dv1394_init init; - /* the ringbuffer frame that is currently being - displayed. (-1 if the device is not transmitting anything) */ - int active_frame; + /* the ringbuffer frame that is currently being + displayed. (-1 if the device is not transmitting anything) */ + int active_frame; - /* index of the first buffer (ahead of active_frame) that - is ready to be filled with data */ - unsigned int first_clear_frame; + /* index of the first buffer (ahead of active_frame) that + is ready to be filled with data */ + unsigned int first_clear_frame; - /* how many buffers, including first_clear_buffer, are - ready to be filled with data */ - unsigned int n_clear_frames; + /* how many buffers, including first_clear_buffer, are + ready to be filled with data */ + unsigned int n_clear_frames; - /* how many times the DV stream has underflowed, overflowed, - or otherwise encountered an error, since the previous call - to DV1394_GET_STATUS */ - unsigned int dropped_frames; + /* how many times the DV stream has underflowed, overflowed, + or otherwise encountered an error, since the previous call + to DV1394_GET_STATUS */ + unsigned int dropped_frames; - /* N.B. The dropped_frames counter is only a lower bound on the actual - number of dropped frames, with the special case that if dropped_frames - is zero, then it is guaranteed that NO frames have been dropped - since the last call to DV1394_GET_STATUS. - */ + /* N.B. The dropped_frames counter is only a lower bound on the actual + number of dropped frames, with the special case that if dropped_frames + is zero, then it is guaranteed that NO frames have been dropped + since the last call to DV1394_GET_STATUS. + */ };
--- a/ffm.c Mon Dec 19 20:49:00 2005 +0000 +++ b/ffm.c Thu Dec 22 01:10:11 2005 +0000 @@ -159,7 +159,7 @@ put_be32(pb, codec->codec_id); put_byte(pb, codec->codec_type); put_be32(pb, codec->bit_rate); - put_be32(pb, st->quality); + put_be32(pb, st->quality); put_be32(pb, codec->flags); put_be32(pb, codec->flags2); put_be32(pb, codec->debug);
--- a/flvdec.c Mon Dec 19 20:49:00 2005 +0000 +++ b/flvdec.c Thu Dec 22 01:10:11 2005 +0000 @@ -155,25 +155,25 @@ else st->codec->sample_rate = (44100<<((flags>>2)&3))>>3; switch(flags >> 4){/* 0: uncompressed 1: ADPCM 2: mp3 5: Nellymoser 8kHz mono 6: Nellymoser*/ - case 0: if (flags&2) st->codec->codec_id = CODEC_ID_PCM_S16BE; - else st->codec->codec_id = CODEC_ID_PCM_S8; break; - case 1: st->codec->codec_id = CODEC_ID_ADPCM_SWF; break; + case 0: if (flags&2) st->codec->codec_id = CODEC_ID_PCM_S16BE; + else st->codec->codec_id = CODEC_ID_PCM_S8; break; + case 1: st->codec->codec_id = CODEC_ID_ADPCM_SWF; break; case 2: st->codec->codec_id = CODEC_ID_MP3; break; - // this is not listed at FLV but at SWF, strange... - case 3: if (flags&2) st->codec->codec_id = CODEC_ID_PCM_S16LE; - else st->codec->codec_id = CODEC_ID_PCM_S8; break; + // this is not listed at FLV but at SWF, strange... + case 3: if (flags&2) st->codec->codec_id = CODEC_ID_PCM_S16LE; + else st->codec->codec_id = CODEC_ID_PCM_S8; break; default: - av_log(s, AV_LOG_INFO, "Unsupported audio codec (%x)\n", flags >> 4); + av_log(s, AV_LOG_INFO, "Unsupported audio codec (%x)\n", flags >> 4); st->codec->codec_tag= (flags >> 4); } - st->codec->bits_per_sample = (flags & 2) ? 16 : 8; + st->codec->bits_per_sample = (flags & 2) ? 16 : 8; } }else{ st->codec->codec_type = CODEC_TYPE_VIDEO; switch(flags & 0xF){ case 2: st->codec->codec_id = CODEC_ID_FLV1; break; default: - av_log(s, AV_LOG_INFO, "Unsupported video codec (%x)\n", flags & 0xf); + av_log(s, AV_LOG_INFO, "Unsupported video codec (%x)\n", flags & 0xf); st->codec->codec_tag= flags & 0xF; } } @@ -189,7 +189,7 @@ pkt->stream_index = st->index; if (is_audio || ((flags >> 4)==1)) - pkt->flags |= PKT_FLAG_KEY; + pkt->flags |= PKT_FLAG_KEY; return ret; }
--- a/flvenc.c Mon Dec 19 20:49:00 2005 +0000 +++ b/flvenc.c Thu Dec 22 01:10:11 2005 +0000 @@ -58,16 +58,16 @@ flags |= 0x20 | 0x2; break; case CODEC_ID_PCM_S8: - break; + break; case CODEC_ID_PCM_S16BE: - flags |= 0x60 | 0x2; - break; + flags |= 0x60 | 0x2; + break; case CODEC_ID_PCM_S16LE: - flags |= 0x2; - break; + flags |= 0x2; + break; case CODEC_ID_ADPCM_SWF: - flags |= 0x10; - break; + flags |= 0x10; + break; case 0: flags |= enc->codec_tag<<4; break;
--- a/gif.c Mon Dec 19 20:49:00 2005 +0000 +++ b/gif.c Thu Dec 22 01:10:11 2005 +0000 @@ -199,24 +199,24 @@ } } - /* update: this is the 'NETSCAPE EXTENSION' that allows for looped animated gif - see http://members.aol.com/royalef/gifabout.htm#net-extension + /* update: this is the 'NETSCAPE EXTENSION' that allows for looped animated gif + see http://members.aol.com/royalef/gifabout.htm#net-extension - byte 1 : 33 (hex 0x21) GIF Extension code - byte 2 : 255 (hex 0xFF) Application Extension Label - byte 3 : 11 (hex (0x0B) Length of Application Block - (eleven bytes of data to follow) - bytes 4 to 11 : "NETSCAPE" - bytes 12 to 14 : "2.0" - byte 15 : 3 (hex 0x03) Length of Data Sub-Block - (three bytes of data to follow) - byte 16 : 1 (hex 0x01) - bytes 17 to 18 : 0 to 65535, an unsigned integer in - lo-hi byte format. This indicate the - number of iterations the loop should - be executed. - bytes 19 : 0 (hex 0x00) a Data Sub-block Terminator - */ + byte 1 : 33 (hex 0x21) GIF Extension code + byte 2 : 255 (hex 0xFF) Application Extension Label + byte 3 : 11 (hex (0x0B) Length of Application Block + (eleven bytes of data to follow) + bytes 4 to 11 : "NETSCAPE" + bytes 12 to 14 : "2.0" + byte 15 : 3 (hex 0x03) Length of Data Sub-Block + (three bytes of data to follow) + byte 16 : 1 (hex 0x01) + bytes 17 to 18 : 0 to 65535, an unsigned integer in + lo-hi byte format. This indicate the + number of iterations the loop should + be executed. + bytes 19 : 0 (hex 0x00) a Data Sub-block Terminator + */ /* application extension header */ #ifdef GIF_ADD_APP_HEADER
--- a/gifdec.c Mon Dec 19 20:49:00 2005 +0000 +++ b/gifdec.c Thu Dec 22 01:10:11 2005 +0000 @@ -22,8 +22,8 @@ //#define DEBUG -#define MAXBITS 12 -#define SIZTABLE (1<<MAXBITS) +#define MAXBITS 12 +#define SIZTABLE (1<<MAXBITS) #define GCE_DISPOSAL_NONE 0 #define GCE_DISPOSAL_INPLACE 1 @@ -54,14 +54,14 @@ int bbits; unsigned int bbuf; - int cursize; /* The current code size */ + int cursize; /* The current code size */ int curmask; int codesize; int clear_code; int end_code; - int newcodes; /* First available code */ - int top_slot; /* Highest code for current size */ - int slot; /* Last read code */ + int newcodes; /* First available code */ + int top_slot; /* Highest code for current size */ + int slot; /* Last read code */ int fc, oc; uint8_t *sp; uint8_t stack[SIZTABLE]; @@ -97,7 +97,7 @@ int gce_flags, gce_disposal; if (pd->buf_size < 24 || - memcmp(pd->buf, gif89a_sig, 6) != 0) + memcmp(pd->buf, gif89a_sig, 6) != 0) return 0; p_end = pd->buf + pd->buf_size; p = pd->buf + 6; @@ -145,11 +145,11 @@ static int gif_image_probe(AVProbeData * pd) { if (pd->buf_size >= 24 && - (memcmp(pd->buf, gif87a_sig, 6) == 0 || - memcmp(pd->buf, gif89a_sig, 6) == 0)) - return AVPROBE_SCORE_MAX - 1; + (memcmp(pd->buf, gif87a_sig, 6) == 0 || + memcmp(pd->buf, gif89a_sig, 6) == 0)) + return AVPROBE_SCORE_MAX - 1; else - return 0; + return 0; } @@ -198,7 +198,7 @@ s->bbuf |= ptr[0] << s->bbits; ptr++; s->pbuf = ptr; - s->bbits += 8; + s->bbits += 8; } c = s->bbuf & s->curmask; s->bbuf >>= s->cursize; @@ -223,61 +223,61 @@ fc = s->fc; while (sp > s->stack) { - *buf++ = *(--sp); - if ((--l) == 0) - goto the_end; + *buf++ = *(--sp); + if ((--l) == 0) + goto the_end; } for (;;) { - c = GetCode(s); - if (c == s->end_code) { - s->end_code = -1; - break; - } else if (c == s->clear_code) { - s->cursize = s->codesize + 1; - s->curmask = mask[s->cursize]; - s->slot = s->newcodes; - s->top_slot = 1 << s->cursize; - while ((c = GetCode(s)) == s->clear_code); - if (c == s->end_code) { - s->end_code = -1; - break; - } - /* test error */ - if (c >= s->slot) - c = 0; - fc = oc = c; - *buf++ = c; - if ((--l) == 0) - break; - } else { - code = c; - if (code >= s->slot) { - *sp++ = fc; - code = oc; - } - while (code >= s->newcodes) { - *sp++ = s->suffix[code]; - code = s->prefix[code]; - } - *sp++ = code; - if (s->slot < s->top_slot) { - s->suffix[s->slot] = fc = code; - s->prefix[s->slot++] = oc; - oc = c; - } - if (s->slot >= s->top_slot) { - if (s->cursize < MAXBITS) { - s->top_slot <<= 1; - s->curmask = mask[++s->cursize]; - } - } - while (sp > s->stack) { - *buf++ = *(--sp); - if ((--l) == 0) + c = GetCode(s); + if (c == s->end_code) { + s->end_code = -1; + break; + } else if (c == s->clear_code) { + s->cursize = s->codesize + 1; + s->curmask = mask[s->cursize]; + s->slot = s->newcodes; + s->top_slot = 1 << s->cursize; + while ((c = GetCode(s)) == s->clear_code); + if (c == s->end_code) { + s->end_code = -1; + break; + } + /* test error */ + if (c >= s->slot) + c = 0; + fc = oc = c; + *buf++ = c; + if ((--l) == 0) + break; + } else { + code = c; + if (code >= s->slot) { + *sp++ = fc; + code = oc; + } + while (code >= s->newcodes) { + *sp++ = s->suffix[code]; + code = s->prefix[code]; + } + *sp++ = code; + if (s->slot < s->top_slot) { + s->suffix[s->slot] = fc = code; + s->prefix[s->slot++] = oc; + oc = c; + } + if (s->slot >= s->top_slot) { + if (s->cursize < MAXBITS) { + s->top_slot <<= 1; + s->curmask = mask[++s->cursize]; + } + } + while (sp > s->stack) { + *buf++ = *(--sp); + if ((--l) == 0) goto the_end; - } - } + } + } } the_end: s->sp = sp; @@ -306,7 +306,7 @@ #endif if (has_local_palette) { - get_buffer(f, s->local_palette, 3 * (1 << bits_per_pixel)); + get_buffer(f, s->local_palette, 3 * (1 << bits_per_pixel)); palette = s->local_palette; } else { palette = s->global_palette; @@ -465,10 +465,10 @@ /* read gif signature */ ret = get_buffer(f, sig, 6); if (ret != 6) - return -1; + return -1; if (memcmp(sig, gif87a_sig, 6) != 0 && - memcmp(sig, gif89a_sig, 6) != 0) - return -1; + memcmp(sig, gif89a_sig, 6) != 0) + return -1; /* read screen header */ s->transparent_color_index = -1; @@ -485,15 +485,15 @@ has_global_palette = (v & 0x80); s->bits_per_pixel = (v & 0x07) + 1; s->background_color_index = get_byte(f); - get_byte(f); /* ignored */ + get_byte(f); /* ignored */ #ifdef DEBUG printf("gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\n", - s->screen_width, s->screen_height, s->bits_per_pixel, - has_global_palette); + s->screen_width, s->screen_height, s->bits_per_pixel, + has_global_palette); #endif if (has_global_palette) { - n = 1 << s->bits_per_pixel; - get_buffer(f, s->global_palette, n * 3); + n = 1 << s->bits_per_pixel; + get_buffer(f, s->global_palette, n * 3); } return 0; } @@ -504,37 +504,37 @@ int ret, code; for (;;) { - code = url_fgetc(f); + code = url_fgetc(f); #ifdef DEBUG - printf("gif: code=%02x '%c'\n", code, code); + printf("gif: code=%02x '%c'\n", code, code); #endif - switch (code) { - case ',': - if (gif_read_image(s) < 0) - return AVERROR_IO; - ret = 0; - goto the_end; - case ';': - /* end of image */ - ret = AVERROR_IO; - goto the_end; - case '!': + switch (code) { + case ',': + if (gif_read_image(s) < 0) + return AVERROR_IO; + ret = 0; + goto the_end; + case ';': + /* end of image */ + ret = AVERROR_IO; + goto the_end; + case '!': if (gif_read_extension(s) < 0) return AVERROR_IO; - break; - case EOF: - default: - /* error or errneous EOF */ - ret = AVERROR_IO; - goto the_end; - } + break; + case EOF: + default: + /* error or errneous EOF */ + ret = AVERROR_IO; + goto the_end; + } } the_end: return ret; } static int gif_read_header(AVFormatContext * s1, - AVFormatParameters * ap) + AVFormatParameters * ap) { GifState *s = s1->priv_data; ByteIOContext *f = &s1->pb; @@ -553,7 +553,7 @@ /* now we are ready: build format streams */ st = av_new_stream(s1, 0); if (!st) - return -1; + return -1; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_RAWVIDEO; @@ -567,7 +567,7 @@ } static int gif_read_packet(AVFormatContext * s1, - AVPacket * pkt) + AVPacket * pkt) { GifState *s = s1->priv_data; int ret; @@ -578,7 +578,7 @@ /* XXX: avoid copying */ if (av_new_packet(pkt, s->screen_width * s->screen_height * 3)) { - return AVERROR_IO; + return AVERROR_IO; } pkt->stream_index = 0; memcpy(pkt->data, s->image_buf, s->screen_width * s->screen_height * 3);
--- a/grab.c Mon Dec 19 20:49:00 2005 +0000 +++ b/grab.c Thu Dec 22 01:10:11 2005 +0000 @@ -104,7 +104,7 @@ } if (!(s->video_cap.type & VID_TYPE_CAPTURE)) { - av_log(s1, AV_LOG_ERROR, "Fatal: grab device does not handle capture\n"); + av_log(s1, AV_LOG_ERROR, "Fatal: grab device does not handle capture\n"); goto fail; } @@ -119,13 +119,13 @@ /* set tv standard */ if (ap->standard && !ioctl(video_fd, VIDIOCGTUNER, &tuner)) { - if (!strcasecmp(ap->standard, "pal")) - tuner.mode = VIDEO_MODE_PAL; - else if (!strcasecmp(ap->standard, "secam")) - tuner.mode = VIDEO_MODE_SECAM; - else - tuner.mode = VIDEO_MODE_NTSC; - ioctl(video_fd, VIDIOCSTUNER, &tuner); + if (!strcasecmp(ap->standard, "pal")) + tuner.mode = VIDEO_MODE_PAL; + else if (!strcasecmp(ap->standard, "secam")) + tuner.mode = VIDEO_MODE_SECAM; + else + tuner.mode = VIDEO_MODE_NTSC; + ioctl(video_fd, VIDIOCSTUNER, &tuner); } /* unmute audio */ @@ -234,10 +234,10 @@ } goto fail; } - for (j = 1; j < s->gb_buffers.frames; j++) { - s->gb_buf.frame = j; - ioctl(video_fd, VIDIOCMCAPTURE, &s->gb_buf); - } + for (j = 1; j < s->gb_buffers.frames; j++) { + s->gb_buf.frame = j; + ioctl(video_fd, VIDIOCMCAPTURE, &s->gb_buf); + } s->frame_format = s->gb_buf.format; s->use_mmap = 1; }
--- a/matroska.c Mon Dec 19 20:49:00 2005 +0000 +++ b/matroska.c Thu Dec 22 01:10:11 2005 +0000 @@ -597,8 +597,8 @@ static int ebml_read_float (MatroskaDemuxContext *matroska, - uint32_t *id, - double *num) + uint32_t *id, + double *num) { ByteIOContext *pb = &matroska->ctx->pb; int size, res; @@ -905,7 +905,7 @@ if (num > sizeof(uint32_t)) { av_log(matroska->ctx, AV_LOG_ERROR, "IDs of size %"PRIu64" (> %zu) not supported\n", - num, sizeof(uint32_t)); + num, sizeof(uint32_t)); return AVERROR_INVALIDDATA; } break;
--- a/mov.c Mon Dec 19 20:49:00 2005 +0000 +++ b/mov.c Thu Dec 22 01:10:11 2005 +0000 @@ -77,7 +77,7 @@ /* some streams in QT (and in MP4 mostly) aren't either video nor audio */ /* so we first list them as this, then clean up the list of streams we give back, */ /* getting rid of these */ -#define CODEC_TYPE_MOV_OTHER (enum CodecType) 2 +#define CODEC_TYPE_MOV_OTHER (enum CodecType) 2 static const CodecTag mov_video_tags[] = { /* { CODEC_ID_, MKTAG('c', 'v', 'i', 'd') }, *//* Cinepak */ @@ -179,25 +179,25 @@ /* 0x03 ESDescrTag */ uint16_t es_id; -#define MP4ODescrTag 0x01 -#define MP4IODescrTag 0x02 -#define MP4ESDescrTag 0x03 -#define MP4DecConfigDescrTag 0x04 -#define MP4DecSpecificDescrTag 0x05 -#define MP4SLConfigDescrTag 0x06 -#define MP4ContentIdDescrTag 0x07 -#define MP4SupplContentIdDescrTag 0x08 -#define MP4IPIPtrDescrTag 0x09 -#define MP4IPMPPtrDescrTag 0x0A -#define MP4IPMPDescrTag 0x0B -#define MP4RegistrationDescrTag 0x0D -#define MP4ESIDIncDescrTag 0x0E -#define MP4ESIDRefDescrTag 0x0F -#define MP4FileIODescrTag 0x10 -#define MP4FileODescrTag 0x11 -#define MP4ExtProfileLevelDescrTag 0x13 -#define MP4ExtDescrTagsStart 0x80 -#define MP4ExtDescrTagsEnd 0xFE +#define MP4ODescrTag 0x01 +#define MP4IODescrTag 0x02 +#define MP4ESDescrTag 0x03 +#define MP4DecConfigDescrTag 0x04 +#define MP4DecSpecificDescrTag 0x05 +#define MP4SLConfigDescrTag 0x06 +#define MP4ContentIdDescrTag 0x07 +#define MP4SupplContentIdDescrTag 0x08 +#define MP4IPIPtrDescrTag 0x09 +#define MP4IPMPPtrDescrTag 0x0A +#define MP4IPMPDescrTag 0x0B +#define MP4RegistrationDescrTag 0x0D +#define MP4ESIDIncDescrTag 0x0E +#define MP4ESIDRefDescrTag 0x0F +#define MP4FileIODescrTag 0x10 +#define MP4FileODescrTag 0x11 +#define MP4ExtProfileLevelDescrTag 0x13 +#define MP4ExtDescrTagsStart 0x80 +#define MP4ExtDescrTagsEnd 0xFE uint8_t stream_priority; /* 0x04 DecConfigDescrTag */ @@ -322,7 +322,7 @@ (tag >> 16) & 0xff, (tag >> 24) & 0xff, (unsigned int)atom.offset, - (unsigned int)atom.size); + (unsigned int)atom.size); assert((unsigned int)atom.size < 0x7fffffff);// catching errors } #else @@ -355,57 +355,57 @@ a.offset = atom.offset; if (atom.size < 0) - atom.size = 0x7fffffffffffffffLL; + atom.size = 0x7fffffffffffffffLL; while(((total_size + 8) < atom.size) && !url_feof(pb) && !err) { - a.size = atom.size; - a.type=0L; + a.size = atom.size; + a.type=0L; if(atom.size >= 8) { - a.size = get_be32(pb); + a.size = get_be32(pb); a.type = get_le32(pb); } - total_size += 8; + total_size += 8; a.offset += 8; - //av_log(NULL, AV_LOG_DEBUG, "type: %08x %.4s sz: %Lx %Lx %Lx\n", type, (char*)&type, size, atom.size, total_size); + //av_log(NULL, AV_LOG_DEBUG, "type: %08x %.4s sz: %Lx %Lx %Lx\n", type, (char*)&type, size, atom.size, total_size); if (a.size == 1) { /* 64 bit extended size */ - a.size = get_be64(pb) - 8; + a.size = get_be64(pb) - 8; a.offset += 8; total_size += 8; } - if (a.size == 0) { - a.size = atom.size - total_size; - if (a.size <= 8) + if (a.size == 0) { + a.size = atom.size - total_size; + if (a.size <= 8) break; - } - for (i = 0; c->parse_table[i].type != 0L - && c->parse_table[i].type != a.type; i++) - /* empty */; + } + for (i = 0; c->parse_table[i].type != 0L + && c->parse_table[i].type != a.type; i++) + /* empty */; - a.size -= 8; + a.size -= 8; if(a.size < 0) break; // av_log(NULL, AV_LOG_DEBUG, " i=%ld\n", i); - if (c->parse_table[i].type == 0) { /* skip leaf atoms data */ + if (c->parse_table[i].type == 0) { /* skip leaf atoms data */ // url_seek(pb, atom.offset+atom.size, SEEK_SET); #ifdef DEBUG print_atom("unknown", a); #endif url_fskip(pb, a.size); - } else { + } else { #ifdef DEBUG - //char b[5] = { type & 0xff, (type >> 8) & 0xff, (type >> 16) & 0xff, (type >> 24) & 0xff, 0 }; - //print_atom(b, type, offset, size); + //char b[5] = { type & 0xff, (type >> 8) & 0xff, (type >> 16) & 0xff, (type >> 24) & 0xff, 0 }; + //print_atom(b, type, offset, size); #endif - err = (c->parse_table[i].func)(c, pb, a); - } + err = (c->parse_table[i].func)(c, pb, a); + } - a.offset += a.size; + a.offset += a.size; total_size += a.size; } if (!err && total_size < atom.size && atom.size < 0x7ffff) { - //av_log(NULL, AV_LOG_DEBUG, "RESET %Ld %Ld err:%d\n", atom.size, total_size, err); + //av_log(NULL, AV_LOG_DEBUG, "RESET %Ld %Ld err:%d\n", atom.size, total_size, err); url_fskip(pb, atom.size - total_size); } @@ -430,9 +430,9 @@ t->size = get_be16(pb) + 1; len = 2 * t->size * 4; if (len > 0) { - t->clrs = av_malloc(len); // 16bit A R G B - if (t->clrs) - get_buffer(pb, t->clrs, len); + t->clrs = av_malloc(len); // 16bit A R G B + if (t->clrs) + get_buffer(pb, t->clrs, len); } #endif @@ -512,15 +512,15 @@ #endif len = get_byte(pb); #ifdef DEBUG - buf = (uint8_t*) av_malloc(len+1); - if (buf) { - get_buffer(pb, buf, len); - buf[len] = '\0'; - av_log(NULL, AV_LOG_DEBUG, "**buf='%s'\n", buf); - av_free(buf); - } else + buf = (uint8_t*) av_malloc(len+1); + if (buf) { + get_buffer(pb, buf, len); + buf[len] = '\0'; + av_log(NULL, AV_LOG_DEBUG, "**buf='%s'\n", buf); + av_free(buf); + } else #endif - url_fskip(pb, len); + url_fskip(pb, len); } url_fskip(pb, atom.size - (url_ftell(pb) - atom.offset)); @@ -533,9 +533,9 @@ int count = 4; while (count--) { int c = get_byte(pb); - len = (len << 7) | (c & 0x7f); - if (!(c & 0x80)) - break; + len = (len << 7) | (c & 0x7f); + if (!(c & 0x80)) + break; } return len; } @@ -564,31 +564,31 @@ get_be32(pb); /* version + flags */ len = mov_mp4_read_descr(pb, &tag); if (tag == MP4ESDescrTag) { - get_be16(pb); /* ID */ - get_byte(pb); /* priority */ + get_be16(pb); /* ID */ + get_byte(pb); /* priority */ } else - get_be16(pb); /* ID */ + get_be16(pb); /* ID */ len = mov_mp4_read_descr(pb, &tag); if (tag == MP4DecConfigDescrTag) { - sc->esds.object_type_id = get_byte(pb); - sc->esds.stream_type = get_byte(pb); - sc->esds.buffer_size_db = get_be24(pb); - sc->esds.max_bitrate = get_be32(pb); - sc->esds.avg_bitrate = get_be32(pb); + sc->esds.object_type_id = get_byte(pb); + sc->esds.stream_type = get_byte(pb); + sc->esds.buffer_size_db = get_be24(pb); + sc->esds.max_bitrate = get_be32(pb); + sc->esds.avg_bitrate = get_be32(pb); - len = mov_mp4_read_descr(pb, &tag); - //av_log(NULL, AV_LOG_DEBUG, "LEN %d TAG %d m:%d a:%d\n", len, tag, sc->esds.max_bitrate, sc->esds.avg_bitrate); - if (tag == MP4DecSpecificDescrTag) { + len = mov_mp4_read_descr(pb, &tag); + //av_log(NULL, AV_LOG_DEBUG, "LEN %d TAG %d m:%d a:%d\n", len, tag, sc->esds.max_bitrate, sc->esds.avg_bitrate); + if (tag == MP4DecSpecificDescrTag) { #ifdef DEBUG - av_log(NULL, AV_LOG_DEBUG, "Specific MPEG4 header len=%d\n", len); + av_log(NULL, AV_LOG_DEBUG, "Specific MPEG4 header len=%d\n", len); #endif - st->codec->extradata = (uint8_t*) av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); - if (st->codec->extradata) { - get_buffer(pb, st->codec->extradata, len); - st->codec->extradata_size = len; - } - } + st->codec->extradata = (uint8_t*) av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); + if (st->codec->extradata) { + get_buffer(pb, st->codec->extradata, len); + st->codec->extradata_size = len; + } + } } /* in any case, skip garbage */ url_fskip(pb, atom.size - ((url_ftell(pb) - start_pos))); @@ -701,11 +701,11 @@ st->codec->extradata = (uint8_t*) av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (st->codec->extradata) { - strcpy(st->codec->extradata, "SVQ3"); // fake - get_buffer(pb, st->codec->extradata + 0x5a, atom.size); - //av_log(NULL, AV_LOG_DEBUG, "Reading SMI %Ld %s\n", atom.size, (char*)st->codec->extradata + 0x5a); + strcpy(st->codec->extradata, "SVQ3"); // fake + get_buffer(pb, st->codec->extradata + 0x5a, atom.size); + //av_log(NULL, AV_LOG_DEBUG, "Reading SMI %Ld %s\n", atom.size, (char*)st->codec->extradata + 0x5a); } else - url_fskip(pb, atom.size); + url_fskip(pb, atom.size); return 0; } @@ -723,10 +723,10 @@ st->codec->extradata = (uint8_t*) av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (st->codec->extradata) { - get_buffer(pb, st->codec->extradata, atom.size); - //av_log(NULL, AV_LOG_DEBUG, "Reading frma %Ld %s\n", atom.size, (char*)st->codec->extradata); + get_buffer(pb, st->codec->extradata, atom.size); + //av_log(NULL, AV_LOG_DEBUG, "Reading frma %Ld %s\n", atom.size, (char*)st->codec->extradata); } else - url_fskip(pb, atom.size); + url_fskip(pb, atom.size); return 0; } @@ -744,9 +744,9 @@ st->codec->extradata = (uint8_t*) av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (st->codec->extradata) { - get_buffer(pb, st->codec->extradata, atom.size); + get_buffer(pb, st->codec->extradata, atom.size); } else - url_fskip(pb, atom.size); + url_fskip(pb, atom.size); return 0; } @@ -830,7 +830,7 @@ while(entries--) { //Parsing Sample description table enum CodecID id; - int size = get_be32(pb); /* size */ + int size = get_be32(pb); /* size */ format = get_le32(pb); /* data format */ get_be32(pb); /* reserved */ @@ -841,9 +841,9 @@ id = codec_get_id(mov_video_tags, format); if (id >= 0) { AVCodec *codec; - codec = avcodec_find_decoder(id); + codec = avcodec_find_decoder(id); if (codec) - st->codec->codec_type = codec->type; + st->codec->codec_type = codec->type; } #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "size=%d 4CC= %c%c%c%c codec_type=%d\n", @@ -854,9 +854,9 @@ (format >> 24) & 0xff, st->codec->codec_type); #endif - st->codec->codec_tag = format; - if(st->codec->codec_type==CODEC_TYPE_VIDEO) { - MOV_atom_t a = { 0, 0, 0 }; + st->codec->codec_tag = format; + if(st->codec->codec_type==CODEC_TYPE_VIDEO) { + MOV_atom_t a = { 0, 0, 0 }; st->codec->codec_id = id; get_be16(pb); /* version */ get_be16(pb); /* revision level */ @@ -875,7 +875,7 @@ get_be32(pb); /* data size, always 0 */ frames_per_sample = get_be16(pb); /* frames per samples */ #ifdef DEBUG - av_log(NULL, AV_LOG_DEBUG, "frames/samples = %d\n", frames_per_sample); + av_log(NULL, AV_LOG_DEBUG, "frames/samples = %d\n", frames_per_sample); #endif get_buffer(pb, codec_name, 32); /* codec name, pascal string (FIXME: true for mp4?) */ if (codec_name[0] <= 31) { @@ -883,50 +883,50 @@ st->codec->codec_name[codec_name[0]] = 0; } - st->codec->bits_per_sample = get_be16(pb); /* depth */ + st->codec->bits_per_sample = get_be16(pb); /* depth */ st->codec->color_table_id = get_be16(pb); /* colortable id */ /* These are set in mov_read_stts and might already be set! st->codec->time_base.den = 25; st->codec->time_base.num = 1; */ - size -= (16+8*4+2+32+2*2); + size -= (16+8*4+2+32+2*2); #if 0 - while (size >= 8) { - MOV_atom_t a; + while (size >= 8) { + MOV_atom_t a; int64_t start_pos; - a.size = get_be32(pb); - a.type = get_le32(pb); - size -= 8; + a.size = get_be32(pb); + a.type = get_le32(pb); + size -= 8; #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "VIDEO: atom_type=%c%c%c%c atom.size=%Ld size_left=%d\n", (a.type >> 0) & 0xff, (a.type >> 8) & 0xff, (a.type >> 16) & 0xff, (a.type >> 24) & 0xff, - a.size, size); + a.size, size); #endif start_pos = url_ftell(pb); - switch(a.type) { + switch(a.type) { case MKTAG('e', 's', 'd', 's'): { int tag, len; /* Well, broken but suffisant for some MP4 streams */ get_be32(pb); /* version + flags */ - len = mov_mp4_read_descr(pb, &tag); + len = mov_mp4_read_descr(pb, &tag); if (tag == 0x03) { /* MP4ESDescrTag */ get_be16(pb); /* ID */ get_byte(pb); /* priority */ - len = mov_mp4_read_descr(pb, &tag); + len = mov_mp4_read_descr(pb, &tag); if (tag != 0x04) goto fail; /* MP4DecConfigDescrTag */ get_byte(pb); /* objectTypeId */ get_be32(pb); /* streamType + buffer size */ - get_be32(pb); /* max bit rate */ + get_be32(pb); /* max bit rate */ get_be32(pb); /* avg bit rate */ len = mov_mp4_read_descr(pb, &tag); if (tag != 0x05) @@ -938,7 +938,7 @@ sc->header_data = av_mallocz(len); if (sc->header_data) { get_buffer(pb, sc->header_data, len); - sc->header_len = len; + sc->header_len = len; } } /* in any case, skip garbage */ @@ -947,14 +947,14 @@ default: break; } - fail: - av_log(NULL, AV_LOG_DEBUG, "ATOMENEWSIZE %Ld %d\n", atom.size, url_ftell(pb) - start_pos); - if (atom.size > 8) { - url_fskip(pb, (atom.size - 8) - - ((url_ftell(pb) - start_pos))); - size -= atom.size - 8; - } - } + fail: + av_log(NULL, AV_LOG_DEBUG, "ATOMENEWSIZE %Ld %d\n", atom.size, url_ftell(pb) - start_pos); + if (atom.size > 8) { + url_fskip(pb, (atom.size - 8) - + ((url_ftell(pb) - start_pos))); + size -= atom.size - 8; + } + } if (size > 0) { /* unknown extension */ url_fskip(pb, size); @@ -1032,12 +1032,12 @@ st->codec->palctrl = NULL; a.size = size; - mov_read_default(c, pb, a); + mov_read_default(c, pb, a); #endif - } else { + } else { st->codec->codec_id = codec_get_id(mov_audio_tags, format); - if(st->codec->codec_id==CODEC_ID_AMR_NB || st->codec->codec_id==CODEC_ID_AMR_WB) //from TS26.244 - { + if(st->codec->codec_id==CODEC_ID_AMR_NB || st->codec->codec_id==CODEC_ID_AMR_WB) //from TS26.244 + { #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "AMR-NB or AMR-WB audio identified!!\n"); #endif @@ -1072,7 +1072,7 @@ st->codec->bits_per_sample=16; st->codec->bit_rate=0; /*It is not possible to tell this before we have an audio frame and even then every frame can be different*/ - } + } else if( st->codec->codec_tag == MKTAG( 'm', 'p', '4', 's' )) { //This is some stuff for the hint track, lets ignore it! @@ -1143,8 +1143,8 @@ av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); get_buffer(pb, st->codec->extradata, st->codec->extradata_size); } - else if(size>=(16+20)) - {//16 bytes read, reading atleast 20 more + else if(size>=(16+20)) + {//16 bytes read, reading atleast 20 more uint16_t version; #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "audio size=0x%X\n",size); @@ -1153,27 +1153,27 @@ get_be16(pb); /* revision level */ get_be32(pb); /* vendor */ - st->codec->channels = get_be16(pb); /* channel count */ - st->codec->bits_per_sample = get_be16(pb); /* sample size */ + st->codec->channels = get_be16(pb); /* channel count */ + st->codec->bits_per_sample = get_be16(pb); /* sample size */ /* handle specific s8 codec */ get_be16(pb); /* compression id = 0*/ get_be16(pb); /* packet size = 0 */ st->codec->sample_rate = ((get_be32(pb) >> 16)); - //av_log(NULL, AV_LOG_DEBUG, "CODECID %d %d %.4s\n", st->codec->codec_id, CODEC_ID_PCM_S16BE, (char*)&format); + //av_log(NULL, AV_LOG_DEBUG, "CODECID %d %d %.4s\n", st->codec->codec_id, CODEC_ID_PCM_S16BE, (char*)&format); - switch (st->codec->codec_id) { - case CODEC_ID_PCM_S16BE: - if (st->codec->bits_per_sample == 8) - st->codec->codec_id = CODEC_ID_PCM_S8; + switch (st->codec->codec_id) { + case CODEC_ID_PCM_S16BE: + if (st->codec->bits_per_sample == 8) + st->codec->codec_id = CODEC_ID_PCM_S8; /* fall */ - case CODEC_ID_PCM_U8: - st->codec->bit_rate = st->codec->sample_rate * 8; - break; - default: + case CODEC_ID_PCM_U8: + st->codec->bit_rate = st->codec->sample_rate * 8; + break; + default: ; - } + } //Read QT version 1 fields. In version 0 theese dont exist #ifdef DEBUG @@ -1412,7 +1412,7 @@ if (!st) return -2; sc = (MOVStreamContext*) av_mallocz(sizeof(MOVStreamContext)); if (!sc) { - av_free(st); + av_free(st); return -1; } @@ -1738,9 +1738,9 @@ mov->mp4 = 1; #endif if(!url_is_streamed(pb)) /* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */ - atom.size = url_fsize(pb); + atom.size = url_fsize(pb); else - atom.size = 0x7FFFFFFFFFFFFFFFLL; + atom.size = 0x7FFFFFFFFFFFFFFFLL; #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "filesz=%Ld\n", atom.size); @@ -1749,9 +1749,9 @@ /* check MOV header */ err = mov_read_default(mov, pb, atom); if (err<0 || (!mov->found_moov && !mov->found_mdat)) { - av_log(s, AV_LOG_ERROR, "mov: header not found !!! (err:%d, moov:%d, mdat:%d) pos:%"PRId64"\n", - err, mov->found_moov, mov->found_mdat, url_ftell(pb)); - return -1; + av_log(s, AV_LOG_ERROR, "mov: header not found !!! (err:%d, moov:%d, mdat:%d) pos:%"PRId64"\n", + err, mov->found_moov, mov->found_mdat, url_ftell(pb)); + return -1; } #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "on_parse_exit_offset=%d\n", (int) url_ftell(pb)); @@ -1809,8 +1809,8 @@ #ifdef MOV_SPLIT_CHUNKS if (mov->partial) { - sc = mov->partial; - idx = sc->sample_to_chunk_index; + sc = mov->partial; + idx = sc->sample_to_chunk_index; if (idx < 0) return 0; #ifdef DEBUG @@ -1838,7 +1838,7 @@ if(offset == INT64_MAX) best_dts= INT64_MAX; for(i=0; i<mov->total_streams; i++) { - MOVStreamContext *msc = mov->streams[i]; + MOVStreamContext *msc = mov->streams[i]; if ((msc->next_chunk < msc->chunk_count) && msc->next_chunk >= 0){ if (msc->sample_to_time_index < msc->stts_count && mov->ni) { @@ -1873,7 +1873,7 @@ } } if (!sc || offset==INT64_MAX) - return -1; + return -1; sc->next_chunk++; @@ -1886,18 +1886,18 @@ if(!sc->is_ff_stream || (s->streams[sc->ffindex]->discard >= AVDISCARD_ALL)) { url_fskip(&s->pb, (offset - mov->next_chunk_offset)); mov->next_chunk_offset = offset; - offset = INT64_MAX; + offset = INT64_MAX; goto again; } /* now get the chunk size... */ for(i=0; i<mov->total_streams; i++) { - MOVStreamContext *msc = mov->streams[i]; - if ((msc->next_chunk < msc->chunk_count) + MOVStreamContext *msc = mov->streams[i]; + if ((msc->next_chunk < msc->chunk_count) && msc->chunk_offsets[msc->next_chunk] - offset < size && msc->chunk_offsets[msc->next_chunk] > offset) - size = msc->chunk_offsets[msc->next_chunk] - offset; + size = msc->chunk_offsets[msc->next_chunk] - offset; } #ifdef MOV_MINOLTA_FIX @@ -1910,13 +1910,13 @@ for(i=0; i<(sc->sample_to_chunk_sz); i++) { if( (sc->sample_to_chunk[i].first)<=(sc->next_chunk) ) { - // I can't figure out why for PCM audio sample_size is always 1 - // (it should actually be channels*bits_per_second/8) but it is. - AVCodecContext* cod = s->streams[sc->ffindex]->codec; + // I can't figure out why for PCM audio sample_size is always 1 + // (it should actually be channels*bits_per_second/8) but it is. + AVCodecContext* cod = s->streams[sc->ffindex]->codec; if (sc->sample_size == 1 && (cod->codec_id == CODEC_ID_PCM_S16BE || cod->codec_id == CODEC_ID_PCM_S16LE)) - foundsize=(sc->sample_to_chunk[i].count*cod->channels*cod->bits_per_sample)/8; - else - foundsize=sc->sample_to_chunk[i].count*sc->sample_size; + foundsize=(sc->sample_to_chunk[i].count*cod->channels*cod->bits_per_sample)/8; + else + foundsize=sc->sample_to_chunk[i].count*sc->sample_size; } #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "sample_to_chunk first=%ld count=%ld, id=%ld\n", sc->sample_to_chunk[i].first, sc->sample_to_chunk[i].count, sc->sample_to_chunk[i].id); @@ -1940,7 +1940,7 @@ /* split chunks into samples */ if (sc->sample_size == 0 || sc->sample_size > 100) { if (idx >= 0 && sc->sample_to_chunk[idx].count != 1) { - mov->partial = sc; + mov->partial = sc; /* we'll have to get those samples before next chunk */ sc->left_in_chunk = sc->sample_to_chunk[idx].count - 1; size = (sc->sample_size > 1)?sc->sample_size:sc->sample_sizes[sc->current_sample]; @@ -2274,7 +2274,7 @@ mov_free_stream_context(mov->streams[i]); /* free color tabs */ for(i=0; i<mov->ctab_size; i++) - av_freep(&mov->ctab[i]); + av_freep(&mov->ctab[i]); av_freep(&mov->ctab); return 0; }
--- a/movenc.c Mon Dec 19 20:49:00 2005 +0000 +++ b/movenc.c Thu Dec 22 01:10:11 2005 +0000 @@ -287,7 +287,7 @@ // if no mac fcc found, try with Microsoft tags if (!tag) { - int tmp = codec_get_tag(codec_wav_tags, track->enc->codec_id); + int tmp = codec_get_tag(codec_wav_tags, track->enc->codec_id); tag = MKTAG('m', 's', ((tmp >> 8) & 0xff), (tmp & 0xff)); } put_le32(pb, tag); // store it byteswapped @@ -515,7 +515,7 @@ tag = codec_get_tag(codec_movvideo_tags, track->enc->codec_id); // if no mac fcc found, try with Microsoft tags if (!tag) - tag = codec_get_tag(codec_bmp_tags, track->enc->codec_id); + tag = codec_get_tag(codec_bmp_tags, track->enc->codec_id); put_le32(pb, tag); // store it byteswapped put_be32(pb, 0); /* Reserved */ @@ -649,18 +649,18 @@ int pos = url_ftell(pb); if (!track) { /* no media --> data handler */ - hdlr = "dhlr"; - hdlr_type = "url "; - descr = "DataHandler"; + hdlr = "dhlr"; + hdlr_type = "url "; + descr = "DataHandler"; } else { - hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0"; - if (track->enc->codec_type == CODEC_TYPE_VIDEO) { - hdlr_type = "vide"; - descr = "VideoHandler"; - } else { - hdlr_type = "soun"; - descr = "SoundHandler"; - } + hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0"; + if (track->enc->codec_type == CODEC_TYPE_VIDEO) { + hdlr_type = "vide"; + descr = "VideoHandler"; + } else { + hdlr_type = "soun"; + descr = "SoundHandler"; + } } put_be32(pb, 0); /* size */ @@ -1394,8 +1394,8 @@ else if(enc->codec_id == CODEC_ID_PCM_ALAW) { samplesInChunk = size/enc->channels; } - else if(enc->codec_id == CODEC_ID_PCM_S16BE || enc->codec_id == CODEC_ID_PCM_S16LE) { - samplesInChunk = size/(2*enc->channels); + else if(enc->codec_id == CODEC_ID_PCM_S16BE || enc->codec_id == CODEC_ID_PCM_S16LE) { + samplesInChunk = size/(2*enc->channels); } else { samplesInChunk = 1;
--- a/mpegtsenc.c Mon Dec 19 20:49:00 2005 +0000 +++ b/mpegtsenc.c Thu Dec 22 01:10:11 2005 +0000 @@ -23,49 +23,49 @@ /* write DVB SI sections */ static const uint32_t crc_table[256] = { - 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, - 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, - 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, - 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, - 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, - 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, - 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, - 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, - 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, - 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, - 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, - 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, - 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, - 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, - 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, - 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, - 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, - 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, - 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, - 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, - 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, - 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, - 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, - 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, - 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, - 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, - 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, - 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, - 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, - 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, - 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, - 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, - 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, - 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, - 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, - 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, - 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, - 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, - 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, - 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, - 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, - 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, - 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 + 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, + 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, + 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, + 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, + 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, + 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, + 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, + 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, + 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, + 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, + 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, + 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, + 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, + 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, + 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, + 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, + 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, + 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, + 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, + 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, + 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, + 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, + 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, + 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, + 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, + 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, + 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, + 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, + 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, + 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, + 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, + 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, + 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, + 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, + 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, + 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, + 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, + 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, + 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, + 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, + 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, + 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, + 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 }; unsigned int mpegts_crc32(const uint8_t *data, int len)
--- a/nsvdec.c Mon Dec 19 20:49:00 2005 +0000 +++ b/nsvdec.c Thu Dec 22 01:10:11 2005 +0000 @@ -663,7 +663,7 @@ /* now pick one of the plates */ for (i = 0; i < 2; i++) { if (nsv->ahead[i].data) { - PRINT(("%s: using cached packet[%d]\n", __FUNCTION__, i)); + PRINT(("%s: using cached packet[%d]\n", __FUNCTION__, i)); /* avoid the cost of new_packet + memcpy(->data) */ memcpy(pkt, &nsv->ahead[i], sizeof(AVPacket)); nsv->ahead[i].data = NULL; /* we ate that one */
--- a/nut.c Mon Dec 19 20:49:00 2005 +0000 +++ b/nut.c Thu Dec 22 01:10:11 2005 +0000 @@ -92,23 +92,23 @@ } NUTContext; static char *info_table[][2]={ - {NULL , NULL }, // end - {NULL , NULL }, - {NULL , "UTF8"}, - {NULL , "v"}, - {NULL , "s"}, - {"StreamId" , "v"}, - {"SegmentId" , "v"}, - {"StartTimestamp" , "v"}, - {"EndTimestamp" , "v"}, - {"Author" , "UTF8"}, - {"Title" , "UTF8"}, - {"Description" , "UTF8"}, - {"Copyright" , "UTF8"}, - {"Encoder" , "UTF8"}, - {"Keyword" , "UTF8"}, - {"Cover" , "JPEG"}, - {"Cover" , "PNG"}, + {NULL , NULL }, // end + {NULL , NULL }, + {NULL , "UTF8"}, + {NULL , "v"}, + {NULL , "s"}, + {"StreamId" , "v"}, + {"SegmentId" , "v"}, + {"StartTimestamp" , "v"}, + {"EndTimestamp" , "v"}, + {"Author" , "UTF8"}, + {"Title" , "UTF8"}, + {"Description" , "UTF8"}, + {"Copyright" , "UTF8"}, + {"Encoder" , "UTF8"}, + {"Keyword" , "UTF8"}, + {"Cover" , "JPEG"}, + {"Cover" , "PNG"}, }; void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale); @@ -244,13 +244,13 @@ for(;;) { - int tmp = get_byte(bc); + int tmp = get_byte(bc); - if (tmp&0x80) - val= (val<<7) + tmp - 0x80; - else{ + if (tmp&0x80) + val= (val<<7) + tmp - 0x80; + else{ //av_log(NULL, AV_LOG_DEBUG, "get_v()= %lld\n", (val<<7) + tmp); - return (val<<7) + tmp; + return (val<<7) + tmp; } } return -1; @@ -405,7 +405,7 @@ i= get_length(val); for (i-=7; i>0; i-=7){ - put_byte(bc, 0x80 | (val>>i)); + put_byte(bc, 0x80 | (val>>i)); } put_byte(bc, val&0x7f); @@ -516,7 +516,7 @@ nut->avf= s; nut->stream = - av_mallocz(sizeof(StreamContext)*s->nb_streams); + av_mallocz(sizeof(StreamContext)*s->nb_streams); put_buffer(bc, ID_STRING, strlen(ID_STRING)); @@ -580,13 +580,13 @@ /* stream headers */ for (i = 0; i < s->nb_streams; i++) { - int nom, denom, ssize; + int nom, denom, ssize; - codec = s->streams[i]->codec; + codec = s->streams[i]->codec; - put_be64(bc, STREAM_STARTCODE); - put_packetheader(nut, bc, 120 + codec->extradata_size, 1); - put_v(bc, i /*s->streams[i]->index*/); + put_be64(bc, STREAM_STARTCODE); + put_packetheader(nut, bc, 120 + codec->extradata_size, 1); + put_v(bc, i /*s->streams[i]->index*/); switch(codec->codec_type){ case CODEC_TYPE_VIDEO: put_v(bc, 0); break; case CODEC_TYPE_AUDIO: put_v(bc, 1); break; @@ -594,16 +594,16 @@ case CODEC_TYPE_DATA : put_v(bc, 3); break; default: return -1; } - if (codec->codec_tag) - put_vb(bc, codec->codec_tag); - else if (codec->codec_type == CODEC_TYPE_VIDEO) - { - put_vb(bc, codec_get_bmp_tag(codec->codec_id)); - } - else if (codec->codec_type == CODEC_TYPE_AUDIO) - { - put_vb(bc, codec_get_wav_tag(codec->codec_id)); - } + if (codec->codec_tag) + put_vb(bc, codec->codec_tag); + else if (codec->codec_type == CODEC_TYPE_VIDEO) + { + put_vb(bc, codec_get_bmp_tag(codec->codec_id)); + } + else if (codec->codec_type == CODEC_TYPE_AUDIO) + { + put_vb(bc, codec_get_wav_tag(codec->codec_id)); + } else put_vb(bc, 0); @@ -613,42 +613,42 @@ nut->stream[i].rate_den= denom; av_set_pts_info(s->streams[i], 60, denom, nom); - put_v(bc, codec->bit_rate); - put_vb(bc, 0); /* no language code */ - put_v(bc, nom); - put_v(bc, denom); + put_v(bc, codec->bit_rate); + put_vb(bc, 0); /* no language code */ + put_v(bc, nom); + put_v(bc, denom); if(nom / denom < 1000) - nut->stream[i].msb_timestamp_shift = 7; + nut->stream[i].msb_timestamp_shift = 7; else - nut->stream[i].msb_timestamp_shift = 14; - put_v(bc, nut->stream[i].msb_timestamp_shift); + nut->stream[i].msb_timestamp_shift = 14; + put_v(bc, nut->stream[i].msb_timestamp_shift); put_v(bc, codec->has_b_frames); - put_byte(bc, 0); /* flags: 0x1 - fixed_fps, 0x2 - index_present */ + put_byte(bc, 0); /* flags: 0x1 - fixed_fps, 0x2 - index_present */ if(codec->extradata_size){ put_v(bc, 1); put_v(bc, codec->extradata_size); put_buffer(bc, codec->extradata, codec->extradata_size); } - put_v(bc, 0); /* end of codec specific headers */ + put_v(bc, 0); /* end of codec specific headers */ - switch(codec->codec_type) - { - case CODEC_TYPE_AUDIO: - put_v(bc, codec->sample_rate); - put_v(bc, 1); - put_v(bc, codec->channels); - break; - case CODEC_TYPE_VIDEO: - put_v(bc, codec->width); - put_v(bc, codec->height); - put_v(bc, codec->sample_aspect_ratio.num); - put_v(bc, codec->sample_aspect_ratio.den); - put_v(bc, 0); /* csp type -- unknown */ - break; + switch(codec->codec_type) + { + case CODEC_TYPE_AUDIO: + put_v(bc, codec->sample_rate); + put_v(bc, 1); + put_v(bc, codec->channels); + break; + case CODEC_TYPE_VIDEO: + put_v(bc, codec->width); + put_v(bc, codec->height); + put_v(bc, codec->sample_aspect_ratio.num); + put_v(bc, codec->sample_aspect_ratio.den); + put_v(bc, 0); /* csp type -- unknown */ + break; default: break; - } + } update_packetheader(nut, bc, 0, 1); } @@ -722,7 +722,7 @@ if(frame_type>1){ int64_t global_ts= av_rescale(pts, stream->rate_den*(int64_t)nut->rate_num, stream->rate_num*(int64_t)nut->rate_den); reset(s, global_ts); - put_be64(bc, KEYFRAME_STARTCODE); + put_be64(bc, KEYFRAME_STARTCODE); put_v(bc, global_ts); } assert(stream->last_pts != AV_NOPTS_VALUE); @@ -829,10 +829,10 @@ for (i = 0; s->nb_streams; i++) { - put_be64(bc, INDEX_STARTCODE); - put_packetheader(nut, bc, 64, 1); - put_v(bc, s->streams[i]->id); - put_v(bc, ...); + put_be64(bc, INDEX_STARTCODE); + put_packetheader(nut, bc, 64, 1); + put_v(bc, s->streams[i]->id); + put_v(bc, ...); update_packetheader(nut, bc, 0, 1); } #endif @@ -868,7 +868,7 @@ tmp = get_v(bc); if (tmp != 2){ - av_log(s, AV_LOG_ERROR, "bad version (%"PRId64")\n", tmp); + av_log(s, AV_LOG_ERROR, "bad version (%"PRId64")\n", tmp); return -1; } @@ -883,7 +883,7 @@ nut->rate_den= get_v(bc); nut->short_startcode= get_v(bc); if(nut->short_startcode>>16 != 'N'){ - av_log(s, AV_LOG_ERROR, "invalid short startcode %X\n", nut->short_startcode); + av_log(s, AV_LOG_ERROR, "invalid short startcode %X\n", nut->short_startcode); return -1; } @@ -994,7 +994,7 @@ return -1; st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); get_buffer(bc, st->codec->extradata, st->codec->extradata_size); -// url_fskip(bc, get_v(bc)); +// url_fskip(bc, get_v(bc)); } if (st->codec->codec_type == CODEC_TYPE_VIDEO) /* VIDEO */ @@ -1242,7 +1242,7 @@ av_get_packet(bc, pkt, size); pkt->stream_index = stream_id; if (key_frame) - pkt->flags |= PKT_FLAG_KEY; + pkt->flags |= PKT_FLAG_KEY; pkt->pts = pts; return 0;
--- a/ogg.c Mon Dec 19 20:49:00 2005 +0000 +++ b/ogg.c Thu Dec 22 01:10:11 2005 +0000 @@ -73,7 +73,7 @@ op->packetno++; //FIXME multiple streams } - context->header_handled = 0 ; + context->header_handled = 0 ; } return 0 ; @@ -94,12 +94,12 @@ /* flush header packets so audio starts on a new page */ if(!context->header_handled) { - while(ogg_stream_flush(&context->os, &og)) { - put_buffer(&avfcontext->pb, og.header, og.header_len) ; - put_buffer(&avfcontext->pb, og.body, og.body_len) ; - put_flush_packet(&avfcontext->pb); - } - context->header_handled = 1 ; + while(ogg_stream_flush(&context->os, &og)) { + put_buffer(&avfcontext->pb, og.header, og.header_len) ; + put_buffer(&avfcontext->pb, og.body, og.body_len) ; + put_flush_packet(&avfcontext->pb); + } + context->header_handled = 1 ; } op->packet = (uint8_t*) pkt->data; @@ -113,8 +113,8 @@ while(ogg_stream_pageout(&context->os, &og)) { put_buffer(&avfcontext->pb, og.header, og.header_len); - put_buffer(&avfcontext->pb, og.body, og.body_len); - put_flush_packet(&avfcontext->pb); + put_buffer(&avfcontext->pb, og.body, og.body_len); + put_flush_packet(&avfcontext->pb); } op->packetno++; @@ -127,9 +127,9 @@ ogg_page og ; while(ogg_stream_flush(&context->os, &og)) { - put_buffer(&avfcontext->pb, og.header, og.header_len) ; - put_buffer(&avfcontext->pb, og.body, og.body_len) ; - put_flush_packet(&avfcontext->pb); + put_buffer(&avfcontext->pb, og.header, og.header_len) ; + put_buffer(&avfcontext->pb, og.body, og.body_len) ; + put_flush_packet(&avfcontext->pb); } ogg_stream_clear(&context->os) ; @@ -159,17 +159,17 @@ while(ogg_stream_packetout(&context->os, op) != 1) { - /* while no pages are available, read in more data to the sync */ - while(ogg_sync_pageout(&context->oy, &og) != 1) { - buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ; - if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0) - return 1 ; - ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ; - } + /* while no pages are available, read in more data to the sync */ + while(ogg_sync_pageout(&context->oy, &og) != 1) { + buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ; + if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0) + return 1 ; + ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ; + } - /* got a page. Feed it into the stream and get the packet */ - if(ogg_stream_pagein(&context->os, &og) != 0) - return 1 ; + /* got a page. Feed it into the stream and get the packet */ + if(ogg_stream_pagein(&context->os, &og) != 0) + return 1 ; } return 0 ; @@ -191,7 +191,7 @@ buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ; if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0) - return AVERROR_IO ; + return AVERROR_IO ; ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ; ogg_sync_pageout(&context->oy, &og) ; @@ -202,7 +202,7 @@ ast = av_new_stream(avfcontext, 0) ; if(!ast) - return AVERROR_NOMEM ; + return AVERROR_NOMEM ; av_set_pts_info(ast, 60, 1, AV_TIME_BASE); codec= &ast->codec; @@ -231,9 +231,9 @@ ogg_packet op ; if(next_packet(avfcontext, &op)) - return AVERROR_IO ; + return AVERROR_IO ; if(av_new_packet(pkt, op.bytes) < 0) - return AVERROR_IO ; + return AVERROR_IO ; pkt->stream_index = 0 ; memcpy(pkt->data, op.packet, op.bytes); if(avfcontext->streams[0]->codec.sample_rate && op.granulepos!=-1)
--- a/ogg2.c Mon Dec 19 20:49:00 2005 +0000 +++ b/ogg2.c Thu Dec 22 01:10:11 2005 +0000 @@ -434,7 +434,7 @@ uint64_t pts = AV_NOPTS_VALUE; if(os->codec->gptopts){ - pts = os->codec->gptopts(s, i, gp); + pts = os->codec->gptopts(s, i, gp); } else if (codec->codec_type == CODEC_TYPE_AUDIO){ pts = gp * 1000000LL / codec->sample_rate; }else if (codec->codec_type == CODEC_TYPE_VIDEO){
--- a/oggparsetheora.c Mon Dec 19 20:49:00 2005 +0000 +++ b/oggparsetheora.c Thu Dec 22 01:10:11 2005 +0000 @@ -47,8 +47,8 @@ return 0; if(!thp){ - thp = av_mallocz(sizeof(*thp)); - os->private = thp; + thp = av_mallocz(sizeof(*thp)); + os->private = thp; } if (os->buf[os->pstart] == 0x80) { @@ -74,7 +74,7 @@ skip_bits(&gb, 38); thp->gpshift = get_bits(&gb, 5); - thp->gpmask = (1 << thp->gpshift) - 1; + thp->gpmask = (1 << thp->gpshift) - 1; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_THEORA;
--- a/raw.c Mon Dec 19 20:49:00 2005 +0000 +++ b/raw.c Thu Dec 22 01:10:11 2005 +0000 @@ -127,7 +127,7 @@ int ret, size, w, h, unk1, unk2; if (get_le32(&s->pb) != MKTAG('M', 'J', 'P', 'G')) - return AVERROR_IO; // FIXME + return AVERROR_IO; // FIXME size = get_le32(&s->pb); @@ -141,7 +141,7 @@ url_fskip(&s->pb, 22); // ascii timestamp av_log(NULL, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n", - size, w, h, unk1, unk2); + size, w, h, unk1, unk2); if (av_new_packet(pkt, size) < 0) return AVERROR_IO; @@ -283,9 +283,9 @@ return 0; } -#define SEQ_START_CODE 0x000001b3 -#define GOP_START_CODE 0x000001b8 -#define PICTURE_START_CODE 0x00000100 +#define SEQ_START_CODE 0x000001b3 +#define GOP_START_CODE 0x000001b8 +#define PICTURE_START_CODE 0x00000100 /* XXX: improve that by looking at several start codes */ static int mpegvideo_probe(AVProbeData *p)
--- a/rm.c Mon Dec 19 20:49:00 2005 +0000 +++ b/rm.c Thu Dec 22 01:10:11 2005 +0000 @@ -538,15 +538,15 @@ st->codec->channels = get_be16(pb); if (((version >> 16) & 0xff) == 5) { get_be32(pb); - buf[0] = get_byte(pb); - buf[1] = get_byte(pb); - buf[2] = get_byte(pb); - buf[3] = get_byte(pb); - buf[4] = 0; - } else { + buf[0] = get_byte(pb); + buf[1] = get_byte(pb); + buf[2] = get_byte(pb); + buf[3] = get_byte(pb); + buf[4] = 0; + } else { get_str8(pb, buf, sizeof(buf)); /* desc */ get_str8(pb, buf, sizeof(buf)); /* desc */ - } + } st->codec->codec_type = CODEC_TYPE_AUDIO; if (!strcmp(buf, "dnet")) { st->codec->codec_id = CODEC_ID_AC3;
--- a/rtpproto.c Mon Dec 19 20:49:00 2005 +0000 +++ b/rtpproto.c Thu Dec 22 01:10:11 2005 +0000 @@ -87,8 +87,8 @@ } static void build_udp_url(char *buf, int buf_size, - const char *hostname, int port, - int local_port, int multicast, int ttl) + const char *hostname, int port, + int local_port, int multicast, int ttl) { snprintf(buf, buf_size, "udp://%s:%d", hostname, port); if (local_port >= 0)
--- a/rtsp.c Mon Dec 19 20:49:00 2005 +0000 +++ b/rtsp.c Thu Dec 22 01:10:11 2005 +0000 @@ -296,7 +296,7 @@ get_word_sep(value, sizeof(value), ";", &p); if (*p == ';') p++; - /* grab the codec extra_data from the config parameter of the fmtp line */ + /* grab the codec extra_data from the config parameter of the fmtp line */ sdp_parse_fmtp_config(codec, attr, value); /* Looking for a known attribute */ for (i = 0; attr_names[i].str; ++i) { @@ -305,7 +305,7 @@ *(int *)((char *)rtp_payload_data + attr_names[i].offset) = atoi(value); else if (attr_names[i].type == ATTR_NAME_TYPE_STR) *(char **)((char *)rtp_payload_data + attr_names[i].offset) = av_strdup(value); - } + } } } }
--- a/sierravmd.c Mon Dec 19 20:49:00 2005 +0000 +++ b/sierravmd.c Thu Dec 22 01:10:11 2005 +0000 @@ -186,7 +186,7 @@ /* each on-disk VMD frame has an audio part and a video part; demuxer * accounts them separately */ if(vmd->sample_rate) - vmd->frame_count *= 2; + vmd->frame_count *= 2; raw_frame_table = NULL; vmd->frame_table = NULL; raw_frame_table_size = vmd->frame_count * BYTES_PER_FRAME_RECORD;
--- a/swf.c Mon Dec 19 20:49:00 2005 +0000 +++ b/swf.c Thu Dec 22 01:10:11 2005 +0000 @@ -35,7 +35,7 @@ #define TAG_JPEG2 21 #define TAG_PLACEOBJECT2 26 #define TAG_STREAMHEAD2 45 -#define TAG_VIDEOSTREAM 60 +#define TAG_VIDEOSTREAM 60 #define TAG_VIDEOFRAME 61 #define TAG_LONG 0x100 @@ -45,7 +45,7 @@ #define FLAG_SETFILL0 0x02 #define FLAG_SETFILL1 0x04 -#define SWF_VIDEO_CODEC_FLV1 0x02 +#define SWF_VIDEO_CODEC_FLV1 0x02 #define AUDIO_FIFO_SIZE 65536 @@ -749,7 +749,7 @@ if (tag == MKBETAG('C', 'W', 'S', 0)) { - av_log(s, AV_LOG_ERROR, "Compressed SWF format not supported\n"); + av_log(s, AV_LOG_ERROR, "Compressed SWF format not supported\n"); return AVERROR_IO; } if (tag != MKBETAG('F', 'W', 'S', 0)) @@ -862,7 +862,7 @@ return AVERROR_IO; if (tag == TAG_VIDEOFRAME) { for( i=0; i<s->nb_streams; i++ ) { - st = s->streams[i]; + st = s->streams[i]; if (st->id == 0) { if ( get_le16(pb) == swf->ch_id ) { frame = get_le16(pb); @@ -879,7 +879,7 @@ url_fskip(pb, len); } else if (tag == TAG_STREAMBLOCK) { for( i=0; i<s->nb_streams; i++ ) { - st = s->streams[i]; + st = s->streams[i]; if (st->id == 1) { av_get_packet(pb, pkt, len); pkt->stream_index = st->index;
--- a/utils.c Mon Dec 19 20:49:00 2005 +0000 +++ b/utils.c Thu Dec 22 01:10:11 2005 +0000 @@ -2696,10 +2696,10 @@ /* First, we check our abbreviation table */ for (i = 0; i < sizeof(frame_abvs)/sizeof(*frame_abvs); ++i) if (!strcmp(frame_abvs[i].abv, arg)) { - *frame_rate = frame_abvs[i].frame_rate; - *frame_rate_base = frame_abvs[i].frame_rate_base; - return 0; - } + *frame_rate = frame_abvs[i].frame_rate; + *frame_rate_base = frame_abvs[i].frame_rate_base; + return 0; + } /* Then, we try to parse it as fraction */ cp = strchr(arg, '/'); @@ -2707,11 +2707,11 @@ cp = strchr(arg, ':'); if (cp) { char* cpp; - *frame_rate = strtol(arg, &cpp, 10); - if (cpp != arg || cpp == cp) - *frame_rate_base = strtol(cp+1, &cpp, 10); - else - *frame_rate = 0; + *frame_rate = strtol(arg, &cpp, 10); + if (cpp != arg || cpp == cp) + *frame_rate_base = strtol(cp+1, &cpp, 10); + else + *frame_rate = 0; } else { /* Finally we give up and parse it as double */ @@ -2801,10 +2801,10 @@ } } } else { - if (p[0] == '-') { - negative = 1; - ++p; - } + if (p[0] == '-') { + negative = 1; + ++p; + } q = small_strptime(p, time_fmt[0], &dt); if (!q) { dt.tm_sec = strtol(p, (char **)&q, 10);
--- a/wav.c Mon Dec 19 20:49:00 2005 +0000 +++ b/wav.c Thu Dec 22 01:10:11 2005 +0000 @@ -163,18 +163,18 @@ codec->codec_id = wav_codec_get_id(id, codec->bits_per_sample); if (size > 16) { /* We're obviously dealing with WAVEFORMATEX */ - codec->extradata_size = get_le16(pb); - if (codec->extradata_size > 0) { - if (codec->extradata_size > size - 18) - codec->extradata_size = size - 18; + codec->extradata_size = get_le16(pb); + if (codec->extradata_size > 0) { + if (codec->extradata_size > size - 18) + codec->extradata_size = size - 18; codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); get_buffer(pb, codec->extradata, codec->extradata_size); } else - codec->extradata_size = 0; + codec->extradata_size = 0; - /* It is possible for the chunk to contain garbage at the end */ - if (size - codec->extradata_size - 18 > 0) - url_fskip(pb, size - codec->extradata_size - 18); + /* It is possible for the chunk to contain garbage at the end */ + if (size - codec->extradata_size - 18 > 0) + url_fskip(pb, size - codec->extradata_size - 18); } }
--- a/wc3movie.c Mon Dec 19 20:49:00 2005 +0000 +++ b/wc3movie.c Thu Dec 22 01:10:11 2005 +0000 @@ -360,7 +360,7 @@ break; default: - av_log (s, AV_LOG_ERROR, " unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\n", + av_log (s, AV_LOG_ERROR, " unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\n", preamble[0], preamble[1], preamble[2], preamble[3], preamble[0], preamble[1], preamble[2], preamble[3]); ret = AVERROR_INVALIDDATA;
--- a/yuv4mpeg.c Mon Dec 19 20:49:00 2005 +0000 +++ b/yuv4mpeg.c Thu Dec 22 01:10:11 2005 +0000 @@ -96,12 +96,12 @@ /* for the first packet we have to output the header as well */ if (*first_pkt) { *first_pkt = 0; - if (yuv4_generate_header(s, buf2) < 0) { - av_log(s, AV_LOG_ERROR, "Error. YUV4MPEG stream header write failed.\n"); - return AVERROR_IO; - } else { - put_buffer(pb, buf2, strlen(buf2)); - } + if (yuv4_generate_header(s, buf2) < 0) { + av_log(s, AV_LOG_ERROR, "Error. YUV4MPEG stream header write failed.\n"); + return AVERROR_IO; + } else { + put_buffer(pb, buf2, strlen(buf2)); + } } /* construct frame header */ @@ -126,11 +126,11 @@ ptr1 = picture->data[1]; ptr2 = picture->data[2]; - for(i=0;i<height;i++) { /* Cb */ + for(i=0;i<height;i++) { /* Cb */ put_buffer(pb, ptr1, width); ptr1 += picture->linesize[1]; } - for(i=0;i<height;i++) { /* Cr */ + for(i=0;i<height;i++) { /* Cr */ put_buffer(pb, ptr2, width); ptr2 += picture->linesize[2]; } @@ -154,7 +154,7 @@ (s->streams[0]->codec->pix_fmt != PIX_FMT_GRAY8) && (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV444P)) { av_log(s, AV_LOG_ERROR, "ERROR: yuv4mpeg only handles yuv444p, yuv422p, yuv420p, yuv411p and gray pixel formats. Use -pix_fmt to select one.\n"); - return AVERROR_IO; + return AVERROR_IO; } *first_pkt = 1; @@ -197,11 +197,11 @@ for (i=0; i<MAX_YUV4_HEADER; i++) { header[i] = get_byte(pb); - if (header[i] == '\n') { - header[i+1] = 0x20; // Add a space after last option. Makes parsing "444" vs "444alpha" easier. - header[i+2] = 0; - break; - } + if (header[i] == '\n') { + header[i+1] = 0x20; // Add a space after last option. Makes parsing "444" vs "444alpha" easier. + header[i+2] = 0; + break; + } } if (i == MAX_YUV4_HEADER) return -1; if (strncmp(header, Y4M_MAGIC, strlen(Y4M_MAGIC))) return -1; @@ -341,10 +341,10 @@ for (i=0; i<MAX_FRAME_HEADER; i++) { header[i] = get_byte(&s->pb); - if (header[i] == '\n') { - header[i+1] = 0; - break; - } + if (header[i] == '\n') { + header[i+1] = 0; + break; + } } if (i == MAX_FRAME_HEADER) return -1; if (strncmp(header, Y4M_FRAME_MAGIC, strlen(Y4M_FRAME_MAGIC))) return -1;