FFmpeg-soc
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
June 2010
- 16 participants
- 56 discussions
Author: spyfeng
Date: Sat Jun 19 17:55:49 2010
New Revision: 5839
Log:
reindent the code.
Modified:
mms/mmsh.c
Modified: mms/mmsh.c
==============================================================================
--- mms/mmsh.c Sat Jun 19 17:52:02 2010 (r5838)
+++ mms/mmsh.c Sat Jun 19 17:55:49 2010 (r5839)
@@ -509,30 +509,30 @@ static int mmsh_read(URLContext *h, uint
MMSHContext *mms = h->priv_data;
do{
- if (mms->asf_header_read_size < mms->asf_header_size) {
- // copy asf header into buffer
- char *pos;
- int size_to_copy;
- int remaining_size = mms->asf_header_size - mms->asf_header_read_size;
- size_to_copy = FFMIN(size, remaining_size);
- pos = mms->asf_header + mms->asf_header_read_size;
- memcpy(buf, pos, size_to_copy);
- mms->asf_header_read_size += size_to_copy;
- res = size_to_copy;
- if (mms->asf_header_read_size == mms->asf_header_size) {
- av_freep(&mms->asf_header); // which contains asf header
- }
- } else if (mms->asf_data_remaining_len){
- res =read_data(mms, buf, size);
- } else {
- // read data packet from network
- res = handle_chunk_type(mms);
- if (res == 0) {
- res = read_data(mms, buf, size);
+ if (mms->asf_header_read_size < mms->asf_header_size) {
+ // copy asf header into buffer
+ char *pos;
+ int size_to_copy;
+ int remaining_size = mms->asf_header_size - mms->asf_header_read_size;
+ size_to_copy = FFMIN(size, remaining_size);
+ pos = mms->asf_header + mms->asf_header_read_size;
+ memcpy(buf, pos, size_to_copy);
+ mms->asf_header_read_size += size_to_copy;
+ res = size_to_copy;
+ if (mms->asf_header_read_size == mms->asf_header_size) {
+ av_freep(&mms->asf_header); // which contains asf header
+ }
+ } else if (mms->asf_data_remaining_len){
+ res =read_data(mms, buf, size);
} else {
- dprintf(NULL, "other situation!\n");
+ // read data packet from network
+ res = handle_chunk_type(mms);
+ if (res == 0) {
+ res = read_data(mms, buf, size);
+ } else {
+ dprintf(NULL, "other situation!\n");
+ }
}
- }
}while(!res);
return res;
}
1
0
Author: spyfeng
Date: Sat Jun 19 17:52:02 2010
New Revision: 5838
Log:
fix a bug for read packet.
now it works with the testlink mmsh://210.75.225.191:1755.
Modified:
mms/mmsh.c
Modified: mms/mmsh.c
==============================================================================
--- mms/mmsh.c Fri Jun 18 22:25:33 2010 (r5837)
+++ mms/mmsh.c Sat Jun 19 17:52:02 2010 (r5838)
@@ -508,6 +508,7 @@ static int mmsh_read(URLContext *h, uint
int res = 0;
MMSHContext *mms = h->priv_data;
+ do{
if (mms->asf_header_read_size < mms->asf_header_size) {
// copy asf header into buffer
char *pos;
@@ -517,6 +518,7 @@ static int mmsh_read(URLContext *h, uint
pos = mms->asf_header + mms->asf_header_read_size;
memcpy(buf, pos, size_to_copy);
mms->asf_header_read_size += size_to_copy;
+ res = size_to_copy;
if (mms->asf_header_read_size == mms->asf_header_size) {
av_freep(&mms->asf_header); // which contains asf header
}
@@ -531,6 +533,7 @@ static int mmsh_read(URLContext *h, uint
dprintf(NULL, "other situation!\n");
}
}
+ }while(!res);
return res;
}
1
0
Author: mchinen
Date: Wed Jun 9 15:42:08 2010
New Revision: 5826
Log:
creating seek2010 dir for my soc proj and adding current patch
Added:
seek2010/
seek2010/seek2010.patch
Added: seek2010/seek2010.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ seek2010/seek2010.patch Wed Jun 9 15:42:08 2010 (r5826)
@@ -0,0 +1,648 @@
+Index: ffplay.c
+===================================================================
+--- ffplay.c (revision 23548)
++++ ffplay.c (working copy)
+@@ -2501,6 +2501,8 @@
+ goto fail;
+ }
+
++ av_build_index(ic, 0);
++
+ for(;;) {
+ if (is->abort_request)
+ break;
+Index: libavformat/mov.c
+===================================================================
+--- libavformat/mov.c (revision 23548)
++++ libavformat/mov.c (working copy)
+@@ -2495,7 +2495,10 @@
+ int sample, time_sample;
+ int i;
+
+- sample = av_index_search_timestamp(st, timestamp, flags);
++ if(st->seek_table.flags&AV_SEEKTABLE_FINISHED)
++ sample = av_table_search_timestamp(st, timestamp, flags);
++ else
++ sample = av_index_search_timestamp(st, timestamp, flags);
+ dprintf(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample);
+ if (sample < 0) /* not sure what to do */
+ return -1;
+@@ -2523,6 +2526,7 @@
+ int64_t seek_timestamp, timestamp;
+ int sample;
+ int i;
++ AVIndexEntry* entries;
+
+ if (stream_index >= s->nb_streams)
+ return -1;
+@@ -2530,12 +2534,13 @@
+ sample_time = 0;
+
+ st = s->streams[stream_index];
++ entries = (st->seek_table.flags&AV_SEEKTABLE_FINISHED)?st->seek_table.index_entries:st->index_entries;
+ sample = mov_seek_stream(s, st, sample_time, flags);
+ if (sample < 0)
+ return -1;
+
+ /* adjust seek timestamp to found sample timestamp */
+- seek_timestamp = st->index_entries[sample].timestamp;
++ seek_timestamp = entries[sample].timestamp;
+
+ for (i = 0; i < s->nb_streams; i++) {
+ st = s->streams[i];
+Index: libavformat/avidec.c
+===================================================================
+--- libavformat/avidec.c (revision 23548)
++++ libavformat/avidec.c (working copy)
+@@ -1084,7 +1084,8 @@
+ int i, index;
+ int64_t pos;
+ AVIStream *ast;
+-
++ AVIndexEntry* entries;
++ int (*search_func)(AVStream*, int64_t, int);
+ if (!avi->index_loaded) {
+ /* we only load the index on demand */
+ avi_load_index(s);
+@@ -1094,13 +1095,22 @@
+
+ st = s->streams[stream_index];
+ ast= st->priv_data;
+- index= av_index_search_timestamp(st, timestamp * FFMAX(ast->sample_size, 1), flags);
++ if(st->seek_table.flags&AV_SEEKTABLE_FINISHED) {
++ search_func = &av_table_search_timestamp;
++ entries = st->seek_table.index_entries;
++ } else {
++ search_func = &av_index_search_timestamp;
++ entries = st->index_entries;
++ }
++
++ index = search_func(st, timestamp * FFMAX(ast->sample_size, 1), flags);
++
+ if(index<0)
+ return -1;
+
+ /* find the position */
+- pos = st->index_entries[index].pos;
+- timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1);
++ pos = entries[index].pos;
++ timestamp = entries[index].timestamp / FFMAX(ast->sample_size, 1);
+
+ // av_log(s, AV_LOG_DEBUG, "XX %"PRId64" %d %"PRId64"\n", timestamp, index, st->index_entries[index].timestamp);
+
+@@ -1122,16 +1132,17 @@
+ for(i = 0; i < s->nb_streams; i++) {
+ AVStream *st2 = s->streams[i];
+ AVIStream *ast2 = st2->priv_data;
+-
++ int nb_entries_st2 = st2->seek_table.index_entries?st->seek_table.nb_index_entries:st->nb_index_entries;
++ entries = st->seek_table.index_entries?st->seek_table.index_entries:st->index_entries;
+ ast2->packet_size=
+ ast2->remaining= 0;
+
+- if (st2->nb_index_entries <= 0)
++ if (nb_entries_st2 <= 0)
+ continue;
+
+ // assert(st2->codec->block_align);
+ assert((int64_t)st2->time_base.num*ast2->rate == (int64_t)st2->time_base.den*ast2->scale);
+- index = av_index_search_timestamp(
++ index = search_func(
+ st2,
+ av_rescale_q(timestamp, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1),
+ flags | AVSEEK_FLAG_BACKWARD);
+@@ -1139,9 +1150,9 @@
+ index=0;
+
+ if(!avi->non_interleaved){
+- while(index>0 && st2->index_entries[index].pos > pos)
++ while(index>0 && entries[index].pos > pos)
+ index--;
+- while(index+1 < st2->nb_index_entries && st2->index_entries[index].pos < pos)
++ while(index+1 < nb_entries_st2 && entries[index].pos < pos)
+ index++;
+ }
+
+Index: libavformat/avformat.h
+===================================================================
+--- libavformat/avformat.h (revision 23548)
++++ libavformat/avformat.h (working copy)
+@@ -390,6 +390,21 @@
+ int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */
+ } AVIndexEntry;
+
++#define AV_SEEKTABLE_BUILDING 0x0001
++#define AV_SEEKTABLE_CBR 0x0002
++#define AV_SEEKTABLE_FINISHED 0x0004
++#define AV_SEEKTABLE_COPIED 0x0008
++
++
++typedef struct AVSeekTable {
++ AVIndexEntry *index_entries; /**< Only used if the format does not
++ support seeking natively. */
++ int nb_index_entries;
++ unsigned int index_entries_allocated_size;
++ int flags;
++} AVSeekTable;
++
++
+ #define AV_DISPOSITION_DEFAULT 0x0001
+ #define AV_DISPOSITION_DUB 0x0002
+ #define AV_DISPOSITION_ORIGINAL 0x0004
+@@ -531,6 +546,9 @@
+ * Number of frames that have been demuxed during av_find_stream_info()
+ */
+ int codec_info_nb_frames;
++
++ /* new av_seek_frame() support */
++ AVSeekTable seek_table;
+ } AVStream;
+
+ #define AV_PROGRAM_RUNNING 1
+@@ -1131,6 +1149,23 @@
+ int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags);
+
+ /**
++ * Gets the index for a specific timestamp using the table.
++ * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond
++ * to the timestamp which is <= the requested one, if backward
++ * is 0, then it will be >=
++ * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise
++ * @return < 0 if no such timestamp could be found
++ */
++int av_table_search_timestamp(AVStream *st, int64_t wanted_timestamp, int flags);
++
++/**
++ * Builds a complete index for seeking in each stream where it is possible.
++ * Requires that the streams have been opened.
++ * Part of the new seeking api. incomplete.
++ */
++int av_build_index(AVFormatContext *s, int flags);
++
++/**
+ * Ensures the index uses less memory than the maximum specified in
+ * AVFormatContext.max_index_size by discarding entries if it grows
+ * too large.
+@@ -1149,6 +1184,15 @@
+ int size, int distance, int flags);
+
+ /**
++ * Does a dictionary search on the seek table.
++ * av_build_index must be successfully called before using this function.
++ * @param timestamp target timestamp in the time base of the given stream
++ * @param stream_index stream number
++ */
++int av_seek_frame_table(AVFormatContext *s,
++ int stream_index, int64_t timestamp, int flags);
++
++/**
+ * Does a binary search using av_index_search_timestamp() and
+ * AVCodec.read_timestamp().
+ * This is not supposed to be called directly by a user application,
+Index: libavformat/utils.c
+===================================================================
+--- libavformat/utils.c (revision 23548)
++++ libavformat/utils.c (working copy)
+@@ -1001,7 +1001,38 @@
+ pkt->convergence_duration = pc->convergence_duration;
+ }
+
++static int av_add_table_entry(AVStream *st,
++ int64_t pos, int64_t timestamp, int size, int distance, int flags)
++{
++ AVIndexEntry *entries, *ie;
++ int index;
+
++ if((unsigned)st->nb_index_entries + 1 >= UINT_MAX / sizeof(AVIndexEntry))
++ return -1;
++
++ entries = av_fast_realloc(st->seek_table.index_entries,
++ &st->seek_table.index_entries_allocated_size,
++ (st->seek_table.nb_index_entries + 1) *
++ sizeof(AVIndexEntry));
++ if(!entries)
++ return -1;
++
++ st->seek_table.index_entries= entries;
++
++ /* we assume the indecies are placed in order */
++ ie = &st->seek_table.index_entries[st->seek_table.nb_index_entries++];
++ assert(index==0 || ie[-1].timestamp < timestamp);
++
++ ie->pos = pos;
++ ie->timestamp = timestamp;
++ ie->min_distance= distance;
++ ie->size= size;
++ ie->flags = flags;
++
++ return st->seek_table.nb_index_entries;
++}
++
++
+ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
+ {
+ AVStream *st;
+@@ -1359,6 +1390,7 @@
+ int a, b, m;
+ int64_t timestamp;
+
++
+ a = - 1;
+ b = nb_entries;
+
+@@ -1675,6 +1707,11 @@
+ timestamp = av_rescale(timestamp, st->time_base.den, AV_TIME_BASE * (int64_t)st->time_base.num);
+ }
+
++ /* if we've built a seek table, use it. */
++ st = s->streams[stream_index];
++ if (st->seek_table.flags & AV_SEEKTABLE_FINISHED)
++ return av_seek_frame_table(s, stream_index, timestamp, flags);
++
+ /* first, we try the format specific seek */
+ if (s->iformat->read_seek)
+ ret = s->iformat->read_seek(s, stream_index, timestamp, flags);
+@@ -1712,9 +1749,367 @@
+ // try some generic seek like av_seek_frame_generic() but with new ts semantics
+ }
+
++
+ /*******************************************************/
++int av_table_search_timestamp(AVStream *st, int64_t wanted_timestamp,
++ int flags)
++{
++ AVIndexEntry *entries= st->seek_table.index_entries;
++ int nb_entries= st->seek_table.nb_index_entries;
++ int a, b, m;
++ int64_t timestamp;
+
++ a = - 1;
++ b = nb_entries;
++
++ //optimize appending index entries at the end
++ if(b && entries[b-1].timestamp < wanted_timestamp)
++ a= b-1;
++
++ while (b - a > 1) {
++ //TODO: since we have a lot of contiguous entries in the table, we can use something more
++ //like dictionary search, which will speed things up quite a bit.
++ m = (a + b) >> 1;
++ timestamp = entries[m].timestamp;
++ if(timestamp >= wanted_timestamp)
++ b = m;
++ if(timestamp <= wanted_timestamp)
++ a = m;
++ }
++ m= (flags & AVSEEK_FLAG_BACKWARD) ? a : b;
++
++ if(!(flags & AVSEEK_FLAG_ANY)){
++ while(m>=0 && m<nb_entries && !(entries[m].flags & AVINDEX_KEYFRAME)){
++ m += (flags & AVSEEK_FLAG_BACKWARD) ? -1 : 1;
++ }
++ }
++
++ if(m == nb_entries)
++ return -1;
++ return m;
++}
++
++int av_seek_frame_table(AVFormatContext *s,
++ int stream_index, int64_t timestamp, int flags)
++{
++ int index;
++ int64_t ret;
++ AVStream *st;
++ AVIndexEntry *ie;
++ AVSeekTable *tbl;
++
++ //TODO: see if we can do something with the CBR field.
++ if(tbl->flags & AV_SEEKTABLE_CBR){
++ ;
++ }
++
++ st = s->streams[stream_index];
++ tbl = &st->seek_table;
++ index = av_table_search_timestamp(st, timestamp, flags);
++
++ /* this function should only be called after the table is complete. */
++ if(index < 0 || index>=tbl->nb_index_entries-1){
++ return -1;
++ }
++
++ ff_read_frame_flush(s);
++ /* we use the native seek function if it exists, (still have to modify them to use seek_table) */
++ if (s->iformat->read_seek){
++ if(s->iformat->read_seek(s, stream_index, timestamp, flags) >= 0) {
++ printf("SEEK_TABLE_DEBUG: table seeked using native function\n");
++ return 0;
++ }
++ }
++
++ ie = &tbl->index_entries[index];
++ if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0)
++ return ret;
++ av_update_cur_dts(s, st, ie->timestamp);
++
++ {
++ float request_time = (((float)timestamp/st->time_base.den)*st->time_base.num);
++ float actual_time = (((float)ie->timestamp/st->time_base.den)*st->time_base.num);
++ printf("SEEK_TABLE_DEBUG: table seeked to %.2fs (actual request was %.2fs)\n",actual_time, request_time );
++ }
++ return 0;
++}
++
++static int av_fill_table_internal(AVFormatContext *s, AVPacket *pkt, ByteIOContext *pb)
++{
++ AVStream *st;
++ int len, ret, i;
++
++ av_init_packet(pkt);
++
++ for(;;) {
++ /* select current input stream component */
++ st = s->cur_st;
++ if (st) {
++ if (!st->need_parsing || !st->parser) {
++ /* no parsing needed: we just output the packet as is */
++ /* raw data support */
++ *pkt = st->cur_pkt; st->cur_pkt.data= NULL;
++ compute_pkt_fields(s, st, NULL, pkt);
++ s->cur_st = NULL;
++ if ((s->iformat->flags & AVFMT_GENERIC_INDEX) &&
++ (pkt->flags & AV_PKT_FLAG_KEY) && pkt->dts != AV_NOPTS_VALUE) {
++ av_add_table_entry(st, pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME);
++ }
++ break;
++ } else if (st->cur_len > 0 && st->discard < AVDISCARD_ALL) {
++ len = av_parser_parse2(st->parser, st->codec, &pkt->data, &pkt->size,
++ st->cur_ptr, st->cur_len,
++ st->cur_pkt.pts, st->cur_pkt.dts,
++ st->cur_pkt.pos);
++ st->cur_pkt.pts = AV_NOPTS_VALUE;
++ st->cur_pkt.dts = AV_NOPTS_VALUE;
++ /* increment read pointer */
++ st->cur_ptr += len;
++ st->cur_len -= len;
++
++ /* return packet if any */
++ if (pkt->size) {
++ got_packet:
++ pkt->duration = 0;
++ pkt->stream_index = st->index;
++ pkt->pts = st->parser->pts;
++ pkt->dts = st->parser->dts;
++ pkt->pos = st->parser->pos;
++ pkt->destruct = NULL;
++ compute_pkt_fields(s, st, st->parser, pkt);
++
++ if((s->iformat->flags & AVFMT_GENERIC_INDEX) && pkt->flags & AV_PKT_FLAG_KEY){
++ av_add_table_entry(st, st->parser->frame_offset, pkt->dts,
++ 0, 0, AVINDEX_KEYFRAME);
++ }
++
++ break;
++ }
++ } else {
++ /* free packet */
++ av_free_packet(&st->cur_pkt);
++ s->cur_st = NULL;
++ }
++ } else {
++ AVPacket cur_pkt;
++ /* read next packet */
++ ret = av_read_packet(s, &cur_pkt);
++ if (ret < 0) {
++ if (ret == AVERROR(EAGAIN))
++ return ret;
++ /* return the last frames, if any */
++ for(i = 0; i < s->nb_streams; i++) {
++ st = s->streams[i];
++ if (st->parser && st->need_parsing) {
++ av_parser_parse2(st->parser, st->codec,
++ &pkt->data, &pkt->size,
++ NULL, 0,
++ AV_NOPTS_VALUE, AV_NOPTS_VALUE,
++ AV_NOPTS_VALUE);
++ if (pkt->size)
++ goto got_packet;
++ }
++ }
++ /* no more packets: really terminate parsing */
++ return ret;
++ }
++ st = s->streams[cur_pkt.stream_index];
++ st->cur_pkt= cur_pkt;
++
++ if(st->cur_pkt.pts != AV_NOPTS_VALUE &&
++ st->cur_pkt.dts != AV_NOPTS_VALUE &&
++ st->cur_pkt.pts < st->cur_pkt.dts){
++ av_log(s, AV_LOG_WARNING, "Invalid timestamps stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d\n",
++ st->cur_pkt.stream_index,
++ st->cur_pkt.pts,
++ st->cur_pkt.dts,
++ st->cur_pkt.size);
++// av_free_packet(&st->cur_pkt);
++// return -1;
++ }
++
++ if(s->debug & FF_FDEBUG_TS)
++ av_log(s, AV_LOG_DEBUG, "av_read_packet stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
++ st->cur_pkt.stream_index,
++ st->cur_pkt.pts,
++ st->cur_pkt.dts,
++ st->cur_pkt.size,
++ st->cur_pkt.duration,
++ st->cur_pkt.flags);
++
++ s->cur_st = st;
++ st->cur_ptr = st->cur_pkt.data;
++ st->cur_len = st->cur_pkt.size;
++ if (st->need_parsing && !st->parser && !(s->flags & AVFMT_FLAG_NOPARSE)) {
++ st->parser = av_parser_init(st->codec->codec_id);
++ if (!st->parser) {
++ /* no parser available: just output the raw packets */
++ st->need_parsing = AVSTREAM_PARSE_NONE;
++ }else if(st->need_parsing == AVSTREAM_PARSE_HEADERS){
++ st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
++ }
++ if(st->parser && (s->iformat->flags & AVFMT_GENERIC_INDEX)){
++ st->parser->next_frame_offset=
++ st->parser->cur_offset= st->cur_pkt.pos;
++ }
++ }
++ }
++ }
++ if(s->debug & FF_FDEBUG_TS)
++ av_log(s, AV_LOG_DEBUG, "av_read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
++ pkt->stream_index,
++ pkt->pts,
++ pkt->dts,
++ pkt->size,
++ pkt->duration,
++ pkt->flags);
++
++ return 0;
++}
++
++static int av_fill_table_frame(AVFormatContext *s, AVPacket *pkt, ByteIOContext *pb)
++{
++ AVPacketList *pktl;
++ int eof=0;
++ /* adapted from av_read_frame */
++ for(;;){
++ pktl = s->packet_buffer;
++ if (pktl) {
++ AVPacket *next_pkt= &pktl->pkt;
++ if(next_pkt->dts != AV_NOPTS_VALUE){
++ while(pktl && next_pkt->pts == AV_NOPTS_VALUE){
++ if( pktl->pkt.stream_index == next_pkt->stream_index
++ && next_pkt->dts < pktl->pkt.dts
++ && pktl->pkt.pts != pktl->pkt.dts //not b frame
++ /*&& pktl->pkt.dts != AV_NOPTS_VALUE*/){
++ next_pkt->pts= pktl->pkt.dts;
++ }
++ pktl= pktl->next;
++ }
++ pktl = s->packet_buffer;
++ }
++
++ if( next_pkt->pts != AV_NOPTS_VALUE
++ || next_pkt->dts == AV_NOPTS_VALUE
++ || eof){
++ /* read packet from packet buffer, if there is data */
++ *pkt = *next_pkt;
++ s->packet_buffer = pktl->next;
++ av_free(pktl);
++ return 0;
++ }
++ }
++ {
++ int ret= av_fill_table_internal(s, pkt, pb);
++ if(ret<0){
++ if(pktl && ret != AVERROR(EAGAIN)){
++ eof=1;
++ continue;
++ }else
++ return ret;
++ }
++
++ if(av_dup_packet(add_to_pktbuf(&s->packet_buffer, pkt,
++ &s->packet_buffer_end)) < 0)
++ return AVERROR(ENOMEM);
++ }
++ }
++}
++
++
+ /**
++ * Starts building a index for seeking.
++ * TODO: use a different file pointer so we can do this in a thread-safe manner,
++ * as there are cases when the user will want to playback while building the index
++ **/
++int av_build_index(AVFormatContext *s, int flags)
++{
++ AVStream *st;
++ int ret;
++ int stream_index;
++ int i;
++ printf("SEEK_TABLE_DEBUG: starting building index\n");
++ stream_index = av_find_default_stream_index(s);
++ if(stream_index < 0)
++ return -1;
++
++ st = s->streams[stream_index];
++ /* TODO: check if this stream is CBR and the codec has a seek by timestamp. */
++ /* if this is true then we can set a flag and exit here. */
++ if(0) {
++ st->seek_table.flags |= AV_SEEKTABLE_CBR;
++ } else if(0) {
++ /* TODO: for this case see if we have a special method for generating the table */
++ /* specific to a given format. */
++ } else if(0 && st->nb_index_entries) {
++ /* some demuxers load an index upon file open. */
++ /* copy the data. maybe we should borrow it instead?*/
++ int sz;
++ printf("SEEK_TABLE_DEBUG: building index from copy\n");
++ for(i=0; i<s->nb_streams;i++){
++ sz = s->streams[i]->nb_index_entries;
++ s->streams[i]->seek_table.nb_index_entries=sz;
++ sz *= sizeof(AVIndexEntry);
++ s->streams[i]->seek_table.index_entries = av_malloc(sz);
++ memcpy(s->streams[i]->seek_table.index_entries,s->streams[i]->index_entries,sz);
++ s->streams[i]->seek_table.index_entries_allocated_size = sz;
++ s->streams[i]->seek_table.flags |= AV_SEEKTABLE_COPIED;
++ }
++ } else {
++ AVPacket pkt;
++
++ /* default table generation behavior from av_seek_frame_generic */
++ /* TODO: see why s->data_offset is the file length for avi/mp4 and others */
++
++ /* use an independent file pointer so that we can use this call in multithreaded contexts*/
++ /* not complete yet - see av_read_packet to see how we need to swap out the old file pointers*/
++ ByteIOContext* pb;
++
++ printf("SEEK_TABLE_DEBUG: building index from scratch\n");
++
++ if ((ret=url_fopen(&pb, s->filename, URL_RDONLY)) < 0) {
++ return ret;
++ }
++
++ if ((ret = url_fseek(pb, 0/*s->data_offset*/, SEEK_SET)) < 0){
++ printf("SEEK_TABLE_DEBUG: error building index: %i\n",ret);
++ return ret;
++ }
++
++ for(i=0;; i++) {
++ do{
++ ret = av_fill_table_frame(s, &pkt, pb);
++ }while(ret == AVERROR(EAGAIN));
++ if(ret<0)
++ break;
++ av_free_packet(&pkt);
++ }
++ if (pb)
++ url_fclose(pb);
++ }
++
++ /* return seek to start of stream. Not sure if this the desired behavior. */
++ ff_read_frame_flush(s);
++
++ for(i=0; i<s->nb_streams;i++)
++ if(s->streams[i]->seek_table.nb_index_entries)
++ s->streams[i]->seek_table.flags |= AV_SEEKTABLE_FINISHED;
++
++ if( (ret = av_seek_frame(s, stream_index, st->start_time, 0) ) < 0 ) {
++ printf("SEEK_TABLE_DEBUG: finished building index but error seeking: %i,trying url_fseek\n",ret);
++ /* last ditch effort to seek using the file pointer. */
++ if ((ret = url_fseek(s->pb, 0, SEEK_SET)) < 0) {
++ printf("SEEK_TABLE_DEBUG: error seeking with url_fseek: %i\n",ret);
++ return ret;
++ }
++ }
++ printf("SEEK_TABLE_DEBUG: finished building index\n");
++ return 0;
++}
++
++/*******************************************************/
++
++/**
+ * Returns TRUE if the stream has accurate duration in any stream.
+ *
+ * @return TRUE if the stream has accurate duration for at least one component.
+@@ -2422,6 +2817,7 @@
+ }
+ av_metadata_free(&st->metadata);
+ av_free(st->index_entries);
++ av_free(st->seek_table.index_entries);
+ av_free(st->codec->extradata);
+ av_free(st->codec);
+ #if LIBAVFORMAT_VERSION_INT < (53<<16)
+@@ -2971,6 +3367,7 @@
+ for(i=0;i<s->nb_streams;i++) {
+ av_freep(&s->streams[i]->priv_data);
+ av_freep(&s->streams[i]->index_entries);
++ av_freep(&s->streams[i]->seek_table.index_entries);
+ }
+ av_freep(&s->priv_data);
+ return ret;
3
7
Author: mchinen
Date: Fri Jun 18 22:25:33 2010
New Revision: 5837
Log:
Applying MN's patch comments on naming/documentation/av_log usage
Added:
seek2010/seek2010_06_18_r23644.patch
Added: seek2010/seek2010_06_18_r23644.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ seek2010/seek2010_06_18_r23644.patch Fri Jun 18 22:25:33 2010 (r5837)
@@ -0,0 +1,704 @@
+Index: ffplay.c
+===================================================================
+--- ffplay.c (revision 23644)
++++ ffplay.c (working copy)
+@@ -2501,6 +2501,7 @@
+ goto fail;
+ }
+
++ av_build_index(ic, AV_BUILD_INDEX_PARALLEL);
+ for(;;) {
+ if (is->abort_request)
+ break;
+Index: libavformat/mov.c
+===================================================================
+--- libavformat/mov.c (revision 23644)
++++ libavformat/mov.c (working copy)
+@@ -2495,7 +2495,10 @@
+ int sample, time_sample;
+ int i;
+
+- sample = av_index_search_timestamp(st, timestamp, flags);
++ if(st->seek_table.flags&AV_SEEKTABLE_FINISHED)
++ sample = av_table_search_timestamp(st, timestamp, flags);
++ else
++ sample = av_index_search_timestamp(st, timestamp, flags);
+ dprintf(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample);
+ if (sample < 0) /* not sure what to do */
+ return -1;
+@@ -2523,6 +2526,7 @@
+ int64_t seek_timestamp, timestamp;
+ int sample;
+ int i;
++ AVIndexEntry* entries;
+
+ if (stream_index >= s->nb_streams)
+ return -1;
+@@ -2530,12 +2534,13 @@
+ sample_time = 0;
+
+ st = s->streams[stream_index];
++ entries = (st->seek_table.flags&AV_SEEKTABLE_FINISHED)?st->seek_table.index_entries:st->index_entries;
+ sample = mov_seek_stream(s, st, sample_time, flags);
+ if (sample < 0)
+ return -1;
+
+ /* adjust seek timestamp to found sample timestamp */
+- seek_timestamp = st->index_entries[sample].timestamp;
++ seek_timestamp = entries[sample].timestamp;
+
+ for (i = 0; i < s->nb_streams; i++) {
+ st = s->streams[i];
+Index: libavformat/avidec.c
+===================================================================
+--- libavformat/avidec.c (revision 23644)
++++ libavformat/avidec.c (working copy)
+@@ -1084,7 +1084,8 @@
+ int i, index;
+ int64_t pos;
+ AVIStream *ast;
+-
++ AVIndexEntry* entries;
++ int (*search_func)(AVStream*, int64_t, int);
+ if (!avi->index_loaded) {
+ /* we only load the index on demand */
+ avi_load_index(s);
+@@ -1094,13 +1095,22 @@
+
+ st = s->streams[stream_index];
+ ast= st->priv_data;
+- index= av_index_search_timestamp(st, timestamp * FFMAX(ast->sample_size, 1), flags);
++ if(st->seek_table.flags&AV_SEEKTABLE_FINISHED) {
++ search_func = &av_table_search_timestamp;
++ entries = st->seek_table.index_entries;
++ } else {
++ search_func = &av_index_search_timestamp;
++ entries = st->index_entries;
++ }
++
++ index = search_func(st, timestamp * FFMAX(ast->sample_size, 1), flags);
++
+ if(index<0)
+ return -1;
+
+ /* find the position */
+- pos = st->index_entries[index].pos;
+- timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1);
++ pos = entries[index].pos;
++ timestamp = entries[index].timestamp / FFMAX(ast->sample_size, 1);
+
+ // av_log(s, AV_LOG_DEBUG, "XX %"PRId64" %d %"PRId64"\n", timestamp, index, st->index_entries[index].timestamp);
+
+@@ -1122,16 +1132,17 @@
+ for(i = 0; i < s->nb_streams; i++) {
+ AVStream *st2 = s->streams[i];
+ AVIStream *ast2 = st2->priv_data;
+-
++ int nb_entries_st2 = st2->seek_table.index_entries?st->seek_table.nb_index_entries:st->nb_index_entries;
++ entries = st->seek_table.index_entries?st->seek_table.index_entries:st->index_entries;
+ ast2->packet_size=
+ ast2->remaining= 0;
+
+- if (st2->nb_index_entries <= 0)
++ if (nb_entries_st2 <= 0)
+ continue;
+
+ // assert(st2->codec->block_align);
+ assert((int64_t)st2->time_base.num*ast2->rate == (int64_t)st2->time_base.den*ast2->scale);
+- index = av_index_search_timestamp(
++ index = search_func(
+ st2,
+ av_rescale_q(timestamp, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1),
+ flags | AVSEEK_FLAG_BACKWARD);
+@@ -1139,9 +1150,9 @@
+ index=0;
+
+ if(!avi->non_interleaved){
+- while(index>0 && st2->index_entries[index].pos > pos)
++ while(index>0 && entries[index].pos > pos)
+ index--;
+- while(index+1 < st2->nb_index_entries && st2->index_entries[index].pos < pos)
++ while(index+1 < nb_entries_st2 && entries[index].pos < pos)
+ index++;
+ }
+
+Index: libavformat/avformat.h
+===================================================================
+--- libavformat/avformat.h (revision 23644)
++++ libavformat/avformat.h (working copy)
+@@ -390,6 +390,20 @@
+ int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */
+ } AVIndexEntry;
+
++#define AV_SEEKTABLE_BUILDING 0x0001 ///< a flag set by av_build_index to mark that the index is being built
++#define AV_SEEKTABLE_CBR 0x0002 ///< a flag set by av_build_index to note that the file is constant bit rate
++#define AV_SEEKTABLE_FINISHED 0x0004 ///< a flag set by av_build_index to note that the complete index table is ready to use
++#define AV_SEEKTABLE_COPIED 0x0008 ///< a flag to note that the seek table has been copied.
++
++typedef struct AVSeekTable {
++ AVIndexEntry *index_entries; /**< Only used if the format does not
++ support seeking natively. */
++ int nb_index_entries;
++ unsigned int index_entries_allocated_size;
++ int flags;
++} AVSeekTable;
++
++
+ #define AV_DISPOSITION_DEFAULT 0x0001
+ #define AV_DISPOSITION_DUB 0x0002
+ #define AV_DISPOSITION_ORIGINAL 0x0004
+@@ -531,6 +545,9 @@
+ * Number of frames that have been demuxed during av_find_stream_info()
+ */
+ int codec_info_nb_frames;
++
++ /* new av_seek_frame() support */
++ AVSeekTable seek_table;
+ } AVStream;
+
+ #define AV_PROGRAM_RUNNING 1
+@@ -1129,6 +1146,24 @@
+ int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags);
+
+ /**
++ * Gets the index for a specific timestamp using the table.
++ * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond
++ * to the timestamp which is <= the requested one, if backward
++ * is 0, then it will be >=
++ * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise
++ * @return < 0 if no such timestamp could be found
++ */
++int av_table_search_timestamp(AVStream *st, int64_t wanted_timestamp, int flags);
++
++/**
++ * Builds a complete index for seeking in each stream where it is possible.
++ * Requires that the streams have been opened.
++ * Part of the new seeking api. incomplete.
++ */
++int av_build_index(AVFormatContext *s, int flags);
++#define AV_BUILD_INDEX_PARALLEL 0x0001 ///< Builds the index via a copied demuxer streams. av_build_index with this flag can be called on a seperate thread while decoding is happening on another.
++
++/**
+ * Ensures the index uses less memory than the maximum specified in
+ * AVFormatContext.max_index_size by discarding entries if it grows
+ * too large.
+@@ -1136,7 +1171,6 @@
+ * by demuxers.
+ */
+ void ff_reduce_index(AVFormatContext *s, int stream_index);
+-
+ /**
+ * Adds an index entry into a sorted list. Updates the entry if the list
+ * already contains it.
+@@ -1147,6 +1181,15 @@
+ int size, int distance, int flags);
+
+ /**
++ * Does a dictionary search on the seek table.
++ * av_build_index must be successfully called before using this function.
++ * @param timestamp target timestamp in the time base of the given stream
++ * @param stream_index stream number
++ */
++int av_seek_frame_table(AVFormatContext *s,
++ int stream_index, int64_t timestamp, int flags);
++
++/**
+ * Does a binary search using av_index_search_timestamp() and
+ * AVCodec.read_timestamp().
+ * This is not supposed to be called directly by a user application,
+Index: libavformat/utils.c
+===================================================================
+--- libavformat/utils.c (revision 23644)
++++ libavformat/utils.c (working copy)
+@@ -1031,7 +1031,38 @@
+ pkt->convergence_duration = pc->convergence_duration;
+ }
+
++static int av_add_table_entry(AVStream *st,
++ int64_t pos, int64_t timestamp, int size, int distance, int flags)
++{
++ AVIndexEntry *entries, *ie;
++ int index;
+
++ if((unsigned)st->nb_index_entries + 1 >= UINT_MAX / sizeof(AVIndexEntry))
++ return -1;
++
++ entries = av_fast_realloc(st->seek_table.index_entries,
++ &st->seek_table.index_entries_allocated_size,
++ (st->seek_table.nb_index_entries + 1) *
++ sizeof(AVIndexEntry));
++ if(!entries)
++ return -1;
++
++ st->seek_table.index_entries= entries;
++
++ /* we assume the indecies are placed in order */
++ ie = &st->seek_table.index_entries[st->seek_table.nb_index_entries++];
++ assert(index==0 || ie[-1].timestamp < timestamp);
++
++ ie->pos = pos;
++ ie->timestamp = timestamp;
++ ie->min_distance= distance;
++ ie->size= size;
++ ie->flags = flags;
++
++ return st->seek_table.nb_index_entries;
++}
++
++
+ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
+ {
+ AVStream *st;
+@@ -1389,6 +1420,7 @@
+ int a, b, m;
+ int64_t timestamp;
+
++
+ a = - 1;
+ b = nb_entries;
+
+@@ -1705,6 +1737,11 @@
+ timestamp = av_rescale(timestamp, st->time_base.den, AV_TIME_BASE * (int64_t)st->time_base.num);
+ }
+
++ /* if we've built a seek table, use it. */
++ st = s->streams[stream_index];
++ if (st->seek_table.flags & AV_SEEKTABLE_FINISHED)
++ return av_seek_frame_table(s, stream_index, timestamp, flags);
++
+ /* first, we try the format specific seek */
+ if (s->iformat->read_seek)
+ ret = s->iformat->read_seek(s, stream_index, timestamp, flags);
+@@ -1742,9 +1779,416 @@
+ // try some generic seek like av_seek_frame_generic() but with new ts semantics
+ }
+
++
+ /*******************************************************/
++int av_table_search_timestamp(AVStream *st, int64_t wanted_timestamp,
++ int flags)
++{
++ AVIndexEntry *entries= st->seek_table.index_entries;
++ int nb_entries= st->seek_table.nb_index_entries;
++ int a, b, m;
++ int64_t timestamp;
+
++ a = - 1;
++ b = nb_entries;
++
++ //optimize appending index entries at the end
++ if(b && entries[b-1].timestamp < wanted_timestamp)
++ a= b-1;
++
++ while (b - a > 1) {
++ //TODO: since we have a lot of contiguous entries in the table, we can use something more
++ //like dictionary search, which will speed things up quite a bit.
++ m = (a + b) >> 1;
++ timestamp = entries[m].timestamp;
++ if(timestamp >= wanted_timestamp)
++ b = m;
++ if(timestamp <= wanted_timestamp)
++ a = m;
++ }
++ m= (flags & AVSEEK_FLAG_BACKWARD) ? a : b;
++
++ if(!(flags & AVSEEK_FLAG_ANY)){
++ while(m>=0 && m<nb_entries && !(entries[m].flags & AVINDEX_KEYFRAME)){
++ m += (flags & AVSEEK_FLAG_BACKWARD) ? -1 : 1;
++ }
++ }
++
++ if(m == nb_entries)
++ return -1;
++ return m;
++}
++
++int av_seek_frame_table(AVFormatContext *s,
++ int stream_index, int64_t timestamp, int flags)
++{
++ int index;
++ int64_t ret;
++ AVStream *st;
++ AVIndexEntry *ie;
++ AVSeekTable *tbl;
++
++ //TODO: see if we can do something with the CBR field.
++ if(tbl->flags & AV_SEEKTABLE_CBR){
++ ;
++ }
++
++ st = s->streams[stream_index];
++ tbl = &st->seek_table;
++ index = av_table_search_timestamp(st, timestamp, flags);
++
++ /* this function should only be called after the table is complete. */
++ if(index < 0 || index>=tbl->nb_index_entries-1){
++ return -1;
++ }
++
++ ff_read_frame_flush(s);
++ /* we use the native seek function if it exists, (still have to modify them to use seek_table) */
++ if (s->iformat->read_seek){
++ if(s->iformat->read_seek(s, stream_index, timestamp, flags) >= 0) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: table seeked using native function\n");
++ return 0;
++ }
++ }
++
++ ie = &tbl->index_entries[index];
++ if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0)
++ return ret;
++ av_update_cur_dts(s, st, ie->timestamp);
++
++ {
++ float request_time = (((float)timestamp/st->time_base.den)*st->time_base.num);
++ float actual_time = (((float)ie->timestamp/st->time_base.den)*st->time_base.num);
++ float time_base_inv = ((float)st->time_base.den/st->time_base.num);
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: table seeked to %.2fs (actual request was %.2fs), timebaseinv %f, samplerate of %d\n",actual_time, request_time, time_base_inv, st->codec->sample_rate );
++ }
++ return 0;
++}
++
++static int av_fill_table_internal(AVFormatContext *s, AVPacket *pkt)
++{
++ AVStream *st;
++ int len, ret, i;
++
++ av_init_packet(pkt);
++
++ for(;;) {
++ /* select current input stream component */
++ st = s->cur_st;
++ if (st) {
++ if (!st->need_parsing || !st->parser) {
++ /* no parsing needed: we just output the packet as is */
++ /* raw data support */
++ *pkt = st->cur_pkt; st->cur_pkt.data= NULL;
++ compute_pkt_fields(s, st, NULL, pkt);
++ s->cur_st = NULL;
++ if ((s->iformat->flags & AVFMT_GENERIC_INDEX) &&
++ (pkt->flags & AV_PKT_FLAG_KEY) && pkt->dts != AV_NOPTS_VALUE) {
++ av_add_table_entry(st, pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME);
++ }
++ break;
++ } else if (st->cur_len > 0 && st->discard < AVDISCARD_ALL) {
++ len = av_parser_parse2(st->parser, st->codec, &pkt->data, &pkt->size,
++ st->cur_ptr, st->cur_len,
++ st->cur_pkt.pts, st->cur_pkt.dts,
++ st->cur_pkt.pos);
++ st->cur_pkt.pts = AV_NOPTS_VALUE;
++ st->cur_pkt.dts = AV_NOPTS_VALUE;
++ /* increment read pointer */
++ st->cur_ptr += len;
++ st->cur_len -= len;
++
++ /* return packet if any */
++ if (pkt->size) {
++ got_packet:
++ pkt->duration = 0;
++ pkt->stream_index = st->index;
++ pkt->pts = st->parser->pts;
++ pkt->dts = st->parser->dts;
++ pkt->pos = st->parser->pos;
++ pkt->destruct = NULL;
++ compute_pkt_fields(s, st, st->parser, pkt);
++
++ if((s->iformat->flags & AVFMT_GENERIC_INDEX) && pkt->flags & AV_PKT_FLAG_KEY){
++ av_add_table_entry(st, st->parser->frame_offset, pkt->dts,
++ 0, 0, AVINDEX_KEYFRAME);
++ }
++
++ break;
++ }
++ } else {
++ /* free packet */
++ av_free_packet(&st->cur_pkt);
++ s->cur_st = NULL;
++ }
++ } else {
++ AVPacket cur_pkt;
++ /* read next packet */
++ ret = av_read_packet(s, &cur_pkt);
++ if (ret < 0) {
++ if (ret == AVERROR(EAGAIN))
++ return ret;
++ /* return the last frames, if any */
++ for(i = 0; i < s->nb_streams; i++) {
++ st = s->streams[i];
++ if (st->parser && st->need_parsing) {
++ av_parser_parse2(st->parser, st->codec,
++ &pkt->data, &pkt->size,
++ NULL, 0,
++ AV_NOPTS_VALUE, AV_NOPTS_VALUE,
++ AV_NOPTS_VALUE);
++ if (pkt->size)
++ goto got_packet;
++ }
++ }
++ /* no more packets: really terminate parsing */
++ return ret;
++ }
++ st = s->streams[cur_pkt.stream_index];
++ st->cur_pkt= cur_pkt;
++
++ if(st->cur_pkt.pts != AV_NOPTS_VALUE &&
++ st->cur_pkt.dts != AV_NOPTS_VALUE &&
++ st->cur_pkt.pts < st->cur_pkt.dts){
++ av_log(s, AV_LOG_WARNING, "Invalid timestamps stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d\n",
++ st->cur_pkt.stream_index,
++ st->cur_pkt.pts,
++ st->cur_pkt.dts,
++ st->cur_pkt.size);
++// av_free_packet(&st->cur_pkt);
++// return -1;
++ }
++
++ if(s->debug & FF_FDEBUG_TS)
++ av_log(s, AV_LOG_DEBUG, "av_read_packet stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
++ st->cur_pkt.stream_index,
++ st->cur_pkt.pts,
++ st->cur_pkt.dts,
++ st->cur_pkt.size,
++ st->cur_pkt.duration,
++ st->cur_pkt.flags);
++
++ s->cur_st = st;
++ st->cur_ptr = st->cur_pkt.data;
++ st->cur_len = st->cur_pkt.size;
++ if (st->need_parsing && !st->parser && !(s->flags & AVFMT_FLAG_NOPARSE)) {
++ st->parser = av_parser_init(st->codec->codec_id);
++ if (!st->parser) {
++ /* no parser available: just output the raw packets */
++ st->need_parsing = AVSTREAM_PARSE_NONE;
++ }else if(st->need_parsing == AVSTREAM_PARSE_HEADERS){
++ st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
++ }
++ if(st->parser && (s->iformat->flags & AVFMT_GENERIC_INDEX)){
++ st->parser->next_frame_offset=
++ st->parser->cur_offset= st->cur_pkt.pos;
++ }
++ }
++ }
++ }
++ if(s->debug & FF_FDEBUG_TS)
++ av_log(s, AV_LOG_DEBUG, "av_read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
++ pkt->stream_index,
++ pkt->pts,
++ pkt->dts,
++ pkt->size,
++ pkt->duration,
++ pkt->flags);
++
++ return 0;
++}
++
++static int av_fill_table_frame(AVFormatContext *s, AVPacket *pkt)
++{
++ AVPacketList *pktl;
++ int eof=0;
++ /* adapted from av_read_frame */
++ for(;;){
++ pktl = s->packet_buffer;
++ if (pktl) {
++ AVPacket *next_pkt= &pktl->pkt;
++ if(next_pkt->dts != AV_NOPTS_VALUE){
++ while(pktl && next_pkt->pts == AV_NOPTS_VALUE){
++ if( pktl->pkt.stream_index == next_pkt->stream_index
++ && next_pkt->dts < pktl->pkt.dts
++ && pktl->pkt.pts != pktl->pkt.dts //not b frame
++ /*&& pktl->pkt.dts != AV_NOPTS_VALUE*/){
++ next_pkt->pts= pktl->pkt.dts;
++ }
++ pktl= pktl->next;
++ }
++ pktl = s->packet_buffer;
++ }
++
++ if( next_pkt->pts != AV_NOPTS_VALUE
++ || next_pkt->dts == AV_NOPTS_VALUE
++ || eof){
++ /* read packet from packet buffer, if there is data */
++ *pkt = *next_pkt;
++ s->packet_buffer = pktl->next;
++ av_free(pktl);
++ return 0;
++ }
++ }
++ {
++ int ret = av_fill_table_internal(s, pkt);
++ if(ret<0){
++ if(pktl && ret != AVERROR(EAGAIN)){
++ eof=1;
++ continue;
++ }else
++ return ret;
++ }
++
++ if(av_dup_packet(add_to_pktbuf(&s->packet_buffer, pkt,
++ &s->packet_buffer_end)) < 0)
++ return AVERROR(ENOMEM);
++ }
++ }
++}
++
++
+ /**
++ * Starts building a index for seeking.
++ * TODO: use a different file pointer so we can do this in a thread-safe manner,
++ * as there are cases when the user will want to playback while building the index
++ **/
++int av_build_index(AVFormatContext *s, int flags)
++{
++ AVStream *st;
++ int ret;
++ int stream_index;
++ int i;
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: starting building index\n");
++ stream_index = av_find_default_stream_index(s);
++ if(stream_index < 0)
++ return -1;
++
++ st = s->streams[stream_index];
++ /* TODO: check if this stream is CBR and the codec has a seek by timestamp. */
++ /* if this is true then we can set a flag and exit here. */
++ if(0) {
++ st->seek_table.flags |= AV_SEEKTABLE_CBR;
++ } else if(0) {
++ /* TODO: for this case see if we have a special method for generating the table */
++ /* specific to a given format. */
++ } else if(st->nb_frames!=0 && st->nb_index_entries > st->nb_frames/2) {
++ /* some demuxers load an index upon file open. */
++ /* copy the data. maybe we should borrow it instead?*/
++ int sz;
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: building index from copy\n");
++ for(i=0; i<s->nb_streams;i++){
++ sz = s->streams[i]->nb_index_entries;
++ s->streams[i]->seek_table.nb_index_entries=sz;
++ sz *= sizeof(AVIndexEntry);
++ s->streams[i]->seek_table.index_entries = av_malloc(sz);
++ memcpy(s->streams[i]->seek_table.index_entries,s->streams[i]->index_entries,sz);
++ s->streams[i]->seek_table.index_entries_allocated_size = sz;
++ s->streams[i]->seek_table.flags |= AV_SEEKTABLE_COPIED;
++ }
++ } else {
++ AVFormatContext *build_ic;
++ AVPacket pkt;
++
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: building index from scratch\n");
++
++ /* if the client needs it to be threadsafe, create a new format context to read from. */
++ if(flags & AV_BUILD_INDEX_PARALLEL) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: making thread-safe copy of streams\n");
++ build_ic = avformat_alloc_context();
++ ret = av_open_input_file(&build_ic, s->filename, s->iformat, 0, NULL);
++
++ if(ret < 0) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: error re-opening file/streams: %i\n", ret);
++ goto cleanup;
++ }
++ if(build_ic->nb_streams != s->nb_streams) {
++ ret = -1;
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: cloned AVFormatContext has different number of streams!");
++ goto cleanup;
++ }
++
++ for(i = 0; i < build_ic->nb_streams; i++) {
++ AVStream *build_st= build_ic->streams[i];
++ AVCodecContext *avctx = build_st->codec;
++ AVCodec *pCodec;
++ build_ic->streams[i]->discard = AVDISCARD_DEFAULT;
++
++ //compare with the orignal stream's context, and if opened, copy settings and open the clone
++ if(s->streams[i]->codec->priv_data) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: copying stream based on priv_data\n");
++ if((ret = avcodec_copy_context(avctx, s->streams[i]->codec)) < 0) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: error copying codec:%i\n", ret);
++ goto cleanup;
++ }
++ pCodec = avcodec_find_decoder(avctx->codec_id);
++ if((ret = avcodec_open(avctx,pCodec)) < 0) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: error opening codec:%i\n", ret);
++ goto cleanup;
++ }
++ }
++ }
++ } else {
++ build_ic = s;
++ }
++
++ /* default table generation behavior from av_seek_frame_generic */
++ /* TODO: see why s->data_offset is the file length for avi/mp4 and others */
++ if ((ret = url_fseek(build_ic->pb, 0/*s->data_offset*/, SEEK_SET)) < 0){
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: error building index: %i\n", ret);
++ goto cleanup;
++ }
++
++ for(i=0;; i++) {
++ do{
++ ret = av_fill_table_frame(build_ic, &pkt);
++ }while(ret == AVERROR(EAGAIN));
++ if(ret<0)
++ break;
++ av_free_packet(&pkt);
++ }
++ ret = 0;
++ cleanup:
++ if(flags & AV_BUILD_INDEX_PARALLEL) {
++ if(build_ic) {
++ //take the index over from our clone
++ for(i = 0; i < build_ic->nb_streams; i++) {
++ if(ret >= 0) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: copying over %i frames from clone stream\n", build_ic->streams[i]->seek_table.nb_index_entries);
++ s->streams[i]->seek_table = build_ic->streams[i]->seek_table;
++ memset(&build_ic->streams[i]->seek_table,0,sizeof(AVSeekTable));
++ }
++ avcodec_close(build_ic->streams[i]->codec);
++ }
++ av_close_input_file(build_ic);
++ }
++ }
++ if(ret < 0)
++ return ret;
++ }
++
++ /* return seek to start of stream. Not sure if this the desired behavior. */
++ ff_read_frame_flush(s);
++
++ for(i=0; i<s->nb_streams;i++)
++ if(s->streams[i]->seek_table.nb_index_entries)
++ s->streams[i]->seek_table.flags |= AV_SEEKTABLE_FINISHED;
++
++ if( (ret = av_seek_frame(s, stream_index, st->start_time, 0) ) < 0 ) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: finished building index but error seeking: %i,trying url_fseek\n", ret);
++ /* last ditch effort to seek using the file pointer. */
++ if ((ret = url_fseek(s->pb, 0, SEEK_SET)) < 0) {
++ av_log(s,AV_LOG_DEBUG,"SEEK_TABLE_DEBUG: error seeking with url_fseek: %i\n", ret);
++ return ret;
++ }
++ }
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: finished building index");
++ return 0;
++}
++
++/*******************************************************/
++
++/**
+ * Returns TRUE if the stream has accurate duration in any stream.
+ *
+ * @return TRUE if the stream has accurate duration for at least one component.
+@@ -2452,6 +2896,7 @@
+ }
+ av_metadata_free(&st->metadata);
+ av_free(st->index_entries);
++ av_free(st->seek_table.index_entries);
+ av_free(st->codec->extradata);
+ av_free(st->codec);
+ #if LIBAVFORMAT_VERSION_INT < (53<<16)
+@@ -3001,6 +3446,7 @@
+ for(i=0;i<s->nb_streams;i++) {
+ av_freep(&s->streams[i]->priv_data);
+ av_freep(&s->streams[i]->index_entries);
++ av_freep(&s->streams[i]->seek_table.index_entries);
+ }
+ av_freep(&s->priv_data);
+ return ret;
1
0
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "AMR-WB decoder".
The branch, master has been updated
via 16c2032735c2e55fb9fa7e05cb07ca9d6e0328a1 (commit)
via 0079e92838741498d8da7d84368a46e76461f4e7 (commit)
via f315877d0421432edb36cd79672a7a00906e5db9 (commit)
via 497360e375aa2d986a8007bdd736610b2916c506 (commit)
via 9efe75861d952664834aea52ef9dcd6e89dc7f71 (commit)
via 8f724c921dfe0a4caab03f1b791827c957dd6dde (commit)
via d4f413cb78eee1bcf7754bc1be08ddddbb8edb42 (commit)
via 723ee2b5cd06425cb75858e8b94dc7864df0f68f (commit)
via bb34c669ac1ac5d25c3977fcbb927de9b89d9bb0 (commit)
via 75c639fd9c5c7ad8d93fd5dae8c3897d8172166c (commit)
via 5b63633df73dda53fa5eb792455ce77bfc372095 (commit)
via 7b5420ce5e1738bc394e89d8eb065f71d46f40dc (commit)
via 00f78043ab906b85ab4d3d6db8ae300e0d8cca94 (commit)
via 47389eb404ad0afd575c08c6157e391e6714cd6a (commit)
via 0594cfcdc79925e58337a96174df11cca93acf35 (commit)
via 2fb30a18d3e917303c42c6cd2aa030b63a61a293 (commit)
via 29d187222e77617a93b46780c50c7f318324e3f1 (commit)
via 29a4c928408ea9ec5698d688b68eb0422549a66b (commit)
via 40b6319e9a2cfbdd687f2454dc99a57a4c08945d (commit)
via 641ec5edf539ddd0b640b14405958063227bb170 (commit)
via 9cd115509f3a2ef1b757a60465e7c80737f7574c (commit)
via 60e5cc31c7a2e62480b361ccc43e1b0ea6dc964a (commit)
via d949c53484dc1fc9eed2db96ebc3f26908e10f4a (commit)
via 11711871ef5ae74a4cc4ed315353fd51fd845640 (commit)
via 7aa57da06029047432509f9a5ef097e917ed0e38 (commit)
via ec32fcae405ccb32067124beb748a1fd422c2bb6 (commit)
via 574ec8caf8233a77b91e73876b400844693aa92d (commit)
via 3eb776965cd0dc69de0ca7cc2d2f4617a8d76866 (commit)
via 55da8ddcb4a95b2400770f2269a4b67e25962828 (commit)
via 591f4c038c71198f35b970bdbcfeb44b9d3784ba (commit)
via b5bfc9b798d22b36cb1e0234f7f4dfd37c8fbec8 (commit)
via c3a5b00cbb5403bd00fbd44587bf4d53b0af841f (commit)
via 1274d19ce7c9639df80c6fcfa1738faef5e7124b (commit)
via 7a221e4fa1c82868bd74b2ab221e275dbe6634df (commit)
via e53c45906db346f19d5f56590456c6a90d0ce2c5 (commit)
via ae502da148224da37436102cab13db356ad7f9d1 (commit)
via 8a3f077cd909dbc54d7b344de9db955fdb6baf77 (commit)
via 7ab1972d3218be24090783e44c1ec3f60e7b9be8 (commit)
via db8d20dfc31cf18221a15e949da3f281636fb0f5 (commit)
via b8a84f11e7d8b4582e0cdd19eb90ab49fdb6423b (commit)
via 5942bd0c30876df657df9d95d230c83700103b3a (commit)
via 583923e104c7f51e4dd2a4b0509fbf240ea7b891 (commit)
via 13856d5d6c1f66c3370190d061cb32d326830939 (commit)
via 08c0efd4b31a2f76fd68d54c7cbe12106e6410b5 (commit)
via 4079f1d24a77f68cad34092a7cde2d31fd5eac49 (commit)
via 7f00882d58388a07e2ddbaa7e082baf74fc892a0 (commit)
via c4c747d25026f701f2876a948a997f638f0ec6ea (commit)
via a0d6062bfd62dce15776caa88ee23df72e6ceb4f (commit)
from 9b41a124e681ac5c18a84d933aaf890dd25d27a4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 16c2032735c2e55fb9fa7e05cb07ca9d6e0328a1
Author: Marcelo Povoa <marspeoplester(a)gmail.com>
Date: Fri Jun 18 12:15:49 2010 -0300
Generate LP coefficients for subframes
diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c
index b2682ed..d2a264f 100644
--- a/libavcodec/amrwbdec.c
+++ b/libavcodec/amrwbdec.c
@@ -21,6 +21,7 @@
#include "avcodec.h"
#include "get_bits.h"
+#include "lsp.h"
#include "amrwbdata.h"
@@ -35,6 +36,8 @@ typedef struct {
float isf_q_past[LP_ORDER]; ///< quantized ISF vector of the previous frame
double isp[4][LP_ORDER]; ///< ISP vectors from current frame
double isp_sub4_past[LP_ORDER]; ///< ISP vector for the 4th subframe of the previous frame
+
+ float lp_coef[4][LP_ORDER]; ///< Linear Prediction Coefficients from ISP vector
} AMRWBContext;
@@ -250,6 +253,38 @@ static void interpolate_isp(double isp_q[4][LP_ORDER], double *isp4_past)
isp_q[2][i] = 0.04 * isp4_past[i] + 0.96 * isp_q[3][i];
}
+/**
+ * Convert a ISP vector to LP coefficient domain {a_k}
+ * Equations from TS 26.190 section 5.2.4
+ *
+ * @param isp [in] ISP vector for a subframe
+ * @param lp [out] LP coefficients
+ * @param lp_half_order [in] Half the number of LPs to construct
+ */
+static void isp2lp(double isp[LP_ORDER], float *lp, int lp_half_order) {
+ double pa[MAX_LP_HALF_ORDER+1], qa[MAX_LP_HALF_ORDER+1];
+ float *lp2 = lp + (lp_half_order << 1);
+ double last_isp = isp[2 * lp_half_order - 1];
+ double qa_old = 0; /* qa[i-2] assuming qa[-1] = 0, not mentioned in document */
+ int i;
+
+ ff_lsp2polyf(isp, pa, lp_half_order);
+ ff_lsp2polyf(isp + 1, qa, lp_half_order);
+
+ for (i=1; i<lp_half_order; i++) {
+ double paf = (1 + last_isp) * pa[i];
+ double qaf = (1 - last_isp) * (qa[i] - qa_old);
+
+ qa_old = qa[i-1];
+
+ lp[i] = 0.5 * (paf + qaf);
+ lp2[i] = 0.5 * (paf - qaf);
+ }
+
+ lp2[0] = 0.5 * (1 + last_isp) * pa[lp_half_order] * lp_half_order;
+ lp2[lp_half_order] = last_isp;
+}
+
static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AVPacket *avpkt)
{
@@ -257,6 +292,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AMRWBFrame *cf = &ctx->frame;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
+ int i;
ctx->fr_cur_mode = unpack_bitstream(ctx, buf, buf_size);
@@ -283,6 +319,9 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
/* Generate a ISP vector for each subframe */
interpolate_isp(ctx->isp, ctx->isp_sub4_past);
+ for (i=0; i<4; i++)
+ isp2lp(ctx->isp[i], ctx->lp_coef[i], LP_ORDER/2);
+
//update state for next frame
memcpy(ctx->isp_sub4_past, ctx->isp[3], LP_ORDER * sizeof(ctx->isp[3][0]));
commit 0079e92838741498d8da7d84368a46e76461f4e7
Merge: 75c639f f315877
Author: Marcelo Povoa <marspeoplester(a)gmail.com>
Date: Fri Jun 18 10:42:23 2010 -0300
Merge branch 'master' of git://git.ffmpeg.org/ffmpeg
commit f315877d0421432edb36cd79672a7a00906e5db9
Author: mstorsjo <mstorsjo@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Fri Jun 18 12:02:51 2010 +0000
RTMP: Return from rtmp_read as soon as some data is available
Earlier, the function only returned when the enough data to fill the
requested buffer was available. This lead to high latency when receiving
low-bandwidth streams.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23642 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 1f57232..f76cf0f 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -915,6 +915,7 @@ static int rtmp_read(URLContext *s, uint8_t *buf, int size)
buf += data_left;
size -= data_left;
rt->flv_off = rt->flv_size;
+ return data_left;
}
if ((ret = get_packet(s, 0)) < 0)
return ret;
commit 497360e375aa2d986a8007bdd736610b2916c506
Author: cehoyos <cehoyos@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Fri Jun 18 07:54:45 2010 +0000
Add IEC958 data_types for Atrac* and WMA Pro.
Data-burst is described in IEC 61937-7 (Atrac) and IEC 61937-8 (WMA Pro).
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23641 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavformat/spdif.c b/libavformat/spdif.c
index 1c53f73..cb2756f 100644
--- a/libavformat/spdif.c
+++ b/libavformat/spdif.c
@@ -61,6 +61,10 @@ enum IEC958DataType {
IEC958_DTS1 = 0x0B, ///< DTS type I (512 samples)
IEC958_DTS2 = 0x0C, ///< DTS type II (1024 samples)
IEC958_DTS3 = 0x0D, ///< DTS type III (2048 samples)
+ IEC958_ATRAC = 0x0E, ///< Atrac data
+ IEC958_ATRAC3 = 0x0F, ///< Atrac 3 data
+ IEC958_ATRACX = 0x10, ///< Atrac 3 plus data
+ IEC958_WMAPRO = 0x12, ///< WMA 9 Professional data
IEC958_MPEG2_AAC_LSF_2048 = 0x13, ///< MPEG-2 AAC ADTS half-rate low sampling frequency
IEC958_MPEG2_AAC_LSF_4096 = 0x13 | 0x20, ///< MPEG-2 AAC ADTS quarter-rate low sampling frequency
};
commit 9efe75861d952664834aea52ef9dcd6e89dc7f71
Author: cehoyos <cehoyos@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Thu Jun 17 22:33:42 2010 +0000
Use enum PixelFormat to silence one icc warning:
warning #188: enumerated type mixed with another type
enum PixelFormat pix_fmts[] = { c->pix_fmt, PIX_FMT_NONE };
^
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23640 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c
index 17e56ee..98f2e37 100644
--- a/libavfilter/vsrc_buffer.c
+++ b/libavfilter/vsrc_buffer.c
@@ -26,7 +26,8 @@ typedef struct {
int64_t pts;
AVFrame frame;
int has_frame;
- int h, w, pix_fmt;
+ int h, w;
+ enum PixelFormat pix_fmt;
AVRational pixel_aspect;
} BufferSourceContext;
commit 8f724c921dfe0a4caab03f1b791827c957dd6dde
Author: maxim <maxim@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Thu Jun 17 10:59:49 2010 +0000
Add metadata support. Patch by Michael Karcher.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23639 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 4b8103f..156cd14 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -158,7 +158,7 @@ OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \
vorbiscomment.o
OBJS-$(CONFIG_OGG_MUXER) += oggenc.o \
vorbiscomment.o
-OBJS-$(CONFIG_OMA_DEMUXER) += oma.o raw.o
+OBJS-$(CONFIG_OMA_DEMUXER) += oma.o raw.o id3v2.o
OBJS-$(CONFIG_PCM_ALAW_DEMUXER) += raw.o
OBJS-$(CONFIG_PCM_ALAW_MUXER) += raw.o
OBJS-$(CONFIG_PCM_F32BE_DEMUXER) += raw.o
diff --git a/libavformat/oma.c b/libavformat/oma.c
index c12365e..a47fde0 100644
--- a/libavformat/oma.c
+++ b/libavformat/oma.c
@@ -27,7 +27,8 @@
*
* Known file extensions: ".oma", "aa3"
* The format of such files consists of three parts:
- * - "ea3" header carrying overall info and metadata.
+ * - "ea3" header carrying overall info and metadata. Except for starting with
+ * "ea" instead of "ID", it's an ID3v2 header.
* - "EA3" header is a Sony-specific header containing information about
* the OpenMG file: codec type (usually ATRAC, can also be MP3 or WMA),
* codec specific info (packet size, sample rate, channels and so on)
@@ -46,6 +47,7 @@
#include "libavutil/intreadwrite.h"
#include "raw.h"
#include "riff.h"
+#include "id3v2.h"
#define EA3_HEADER_SIZE 96
@@ -63,36 +65,21 @@ static const AVCodecTag codec_oma_tags[] = {
{ CODEC_ID_MP3, OMA_CODECID_MP3 },
};
+#define ID3v2_EA3_MAGIC "ea3"
+
static int oma_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
static const uint16_t srate_tab[6] = {320,441,480,882,960,0};
- int ret, ea3_taglen, EA3_pos, framesize, jsflag, samplerate;
+ int ret, framesize, jsflag, samplerate;
uint32_t codec_params;
int16_t eid;
uint8_t buf[EA3_HEADER_SIZE];
uint8_t *edata;
AVStream *st;
- ret = get_buffer(s->pb, buf, 10);
- if (ret != 10)
- return -1;
-
- if(!memcmp(buf, "ea3", 3)) {
- ea3_taglen = ((buf[6] & 0x7f) << 21) | ((buf[7] & 0x7f) << 14) | ((buf[8] & 0x7f) << 7) | (buf[9] & 0x7f);
-
- EA3_pos = ea3_taglen + 10;
- if (buf[5] & 0x10)
- EA3_pos += 10;
-
- url_fseek(s->pb, EA3_pos, SEEK_SET);
- ret = get_buffer(s->pb, buf, EA3_HEADER_SIZE);
- if (ret != EA3_HEADER_SIZE)
- return -1;
- } else {
- ret = get_buffer(s->pb, buf + 10, EA3_HEADER_SIZE - 10);
- EA3_pos = 0;
- }
+ ff_id3v2_read(s, ID3v2_EA3_MAGIC);
+ ret = get_buffer(s->pb, buf, EA3_HEADER_SIZE);
if (memcmp(buf, ((const uint8_t[]){'E', 'A', '3'}),3) || buf[4] != 0 || buf[5] != EA3_HEADER_SIZE) {
av_log(s, AV_LOG_ERROR, "Couldn't find the EA3 header !\n");
@@ -163,7 +150,6 @@ static int oma_read_header(AVFormatContext *s,
}
st->codec->block_align = framesize;
- url_fseek(s->pb, EA3_pos + EA3_HEADER_SIZE, SEEK_SET);
return 0;
}
@@ -182,9 +168,21 @@ static int oma_read_packet(AVFormatContext *s, AVPacket *pkt)
static int oma_read_probe(AVProbeData *p)
{
- if (!memcmp(p->buf, ((const uint8_t[]){'e', 'a', '3', 3, 0}), 5) ||
- (!memcmp(p->buf, "EA3", 3) &&
- !p->buf[4] && p->buf[5] == EA3_HEADER_SIZE))
+ const uint8_t *buf;
+ unsigned tag_len = 0;
+
+ buf = p->buf;
+ /* version must be 3 and flags byte zero */
+ if (ff_id3v2_match(buf, ID3v2_EA3_MAGIC) && buf[3] == 3 && !buf[4])
+ tag_len = ff_id3v2_tag_len(buf);
+
+ // This check cannot overflow as tag_len has at most 28 bits
+ if (p->buf_size < tag_len + 5)
+ return 0;
+
+ buf += tag_len;
+
+ if (!memcmp(buf, "EA3", 3) && !buf[4] && buf[5] == EA3_HEADER_SIZE)
return AVPROBE_SCORE_MAX;
else
return 0;
@@ -203,5 +201,6 @@ AVInputFormat oma_demuxer = {
.flags= AVFMT_GENERIC_INDEX,
.extensions = "oma,aa3",
.codec_tag= (const AVCodecTag* const []){codec_oma_tags, 0},
+ .metadata_conv = ff_id3v2_metadata_conv,
};
commit d4f413cb78eee1bcf7754bc1be08ddddbb8edb42
Author: lucabe <lucabe@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Thu Jun 17 10:30:52 2010 +0000
Simplify (no need to check for st->codec->extradata) and correct
(extradata_size must be at least 5 bytes) the H.264 MP4 syntax check
in rtpenc.c
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23638 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 5abd490..3a541dd 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -133,8 +133,7 @@ static int rtp_write_header(AVFormatContext *s1)
break;
case CODEC_ID_H264:
/* check for H.264 MP4 syntax */
- if (st->codec->extradata_size > 0 && st->codec->extradata &&
- st->codec->extradata[0] == 1) {
+ if (st->codec->extradata_size > 4 && st->codec->extradata[0] == 1) {
s->nal_length_size = (st->codec->extradata[4] & 0x03) + 1;
}
break;
commit 723ee2b5cd06425cb75858e8b94dc7864df0f68f
Author: michael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Thu Jun 17 10:13:11 2010 +0000
add #include so make checkheaders passes
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23637 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavfilter/vsrc_buffer.h b/libavfilter/vsrc_buffer.h
index 071403c..fa20443 100644
--- a/libavfilter/vsrc_buffer.h
+++ b/libavfilter/vsrc_buffer.h
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "avfilter.h"
+
int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
int64_t pts, AVRational pixel_aspect);
commit bb34c669ac1ac5d25c3977fcbb927de9b89d9bb0
Author: mstorsjo <mstorsjo@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Thu Jun 17 09:39:42 2010 +0000
Add the necessary includes, add an extra empty line for cosmetics
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23636 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavformat/http.h b/libavformat/http.h
index 5cd1629..fe5539a 100644
--- a/libavformat/http.h
+++ b/libavformat/http.h
@@ -18,9 +18,12 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
#ifndef AVFORMAT_HTTP_H
#define AVFORMAT_HTTP_H
+#include "avio.h"
+
/**
* Sets custom HTTP headers.
* A trailing CRLF ("\r\n") is required for custom headers.
commit 75c639fd9c5c7ad8d93fd5dae8c3897d8172166c
Merge: 9b41a12 5b63633
Author: Marcelo Póvoa <marspeople(a)MacBook61.local>
Date: Wed Jun 16 21:48:41 2010 -0300
Merge branch 'master' of git://git.ffmpeg.org/ffmpeg
commit 5b63633df73dda53fa5eb792455ce77bfc372095
Author: stefano <stefano@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Wed Jun 16 22:36:52 2010 +0000
Add more tests to eval, help detecting some of the more apparent
errors, far from being a complete test system.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23635 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavutil/eval.c b/libavutil/eval.c
index 065625c..6e03498 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -532,6 +532,44 @@ int main(void)
{
int i;
double d;
+ const char **expr, *exprs[] = {
+ "",
+ "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)",
+ "80G/80Gi"
+ "1k",
+ "1Gi",
+ "1gi",
+ "1GiFoo",
+ "1k+1k",
+ "1Gi*3foo",
+ "foo",
+ "foo(",
+ "foo()",
+ "foo)",
+ "sin",
+ "sin(",
+ "sin()",
+ "sin)",
+ "sin 10",
+ "sin(1,2,3)",
+ "sin(1 )",
+ "1",
+ "1foo",
+ "bar + PI + E + 100f*2 + foo",
+ "13k + 12f - foo(1, 2)",
+ "1gi",
+ "1Gi",
+ NULL
+ };
+
+ for (expr = exprs; *expr; expr++) {
+ printf("Evaluating '%s'\n", *expr);
+ av_parse_and_eval_expr(&d, *expr,
+ const_names, const_values,
+ NULL, NULL, NULL, NULL, NULL, 0, NULL);
+ printf("'%s' -> %f\n\n", *expr, d);
+ }
+
av_parse_and_eval_expr(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)",
const_names, const_values,
NULL, NULL, NULL, NULL, NULL, 0, NULL);
commit 7b5420ce5e1738bc394e89d8eb065f71d46f40dc
Author: michael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Wed Jun 16 19:31:05 2010 +0000
Marking what should be removed in relation to MAX_STREAMS.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23634 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 57a6bce..520750b 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -569,8 +569,6 @@ typedef struct AVChapter {
#if LIBAVFORMAT_VERSION_MAJOR < 53
#define MAX_STREAMS 20
-#else
-#define MAX_STREAMS 100
#endif
/**
commit 00f78043ab906b85ab4d3d6db8ae300e0d8cca94
Author: stefano <stefano@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Wed Jun 16 19:16:23 2010 +0000
Document terminal coloring in the -loglevel option.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23633 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi
index 992008c..618441e 100644
--- a/doc/fftools-common-opts.texi
+++ b/doc/fftools-common-opts.texi
@@ -82,4 +82,8 @@ Set the logging level used by the library.
@item debug
@end table
+By default the program logs to stderr, if coloring is supported by the
+terminal, colors are used to mark errors and warnings. Log coloring
+can be disabled setting the environment variable @env{NO_COLOR}.
+
@end table
commit 47389eb404ad0afd575c08c6157e391e6714cd6a
Author: stefano <stefano@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Wed Jun 16 19:16:20 2010 +0000
Document how to set boolean options.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23632 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi
index b011e73..992008c 100644
--- a/doc/fftools-common-opts.texi
+++ b/doc/fftools-common-opts.texi
@@ -6,6 +6,11 @@ powers of 10. The 'B' postfix multiplies the value for 8, and can be
appended after another postfix or used alone. This allows using for
example 'KB', 'MiB', 'G' and 'B' as postfix.
+Options which do not take arguments are boolean options, and set the
+corresponding value to true. They can be set to false by prefixing
+with "no" the option name, for example using "-nofoo" in the
+commandline will set to false the boolean option with name "foo".
+
@section Generic options
These options are shared amongst the ff* tools.
commit 0594cfcdc79925e58337a96174df11cca93acf35
Author: mstorsjo <mstorsjo@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Wed Jun 16 19:03:54 2010 +0000
libvorbis: Use memmove instead of memcpy for shifting data
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23631 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c
index f9a1b32..a7044a2 100644
--- a/libavcodec/libvorbis.c
+++ b/libavcodec/libvorbis.c
@@ -192,7 +192,7 @@ static int oggvorbis_encode_frame(AVCodecContext *avccontext,
memcpy(packets, op2->packet, l);
context->buffer_index -= l + sizeof(ogg_packet);
- memcpy(context->buffer, context->buffer + l + sizeof(ogg_packet), context->buffer_index);
+ memmove(context->buffer, context->buffer + l + sizeof(ogg_packet), context->buffer_index);
// av_log(avccontext, AV_LOG_DEBUG, "E%d\n", l);
}
commit 2fb30a18d3e917303c42c6cd2aa030b63a61a293
Author: stefano <stefano@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Wed Jun 16 18:41:26 2010 +0000
Name the default configure log filename as "config.log" rather than
"config.err". The former name was misleading, as the file contains
useful information not necessarily related to errors.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23630 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/configure b/configure
index 70ad8a5..4f6bb0a 100755
--- a/configure
+++ b/configure
@@ -61,7 +61,7 @@ Options: [defaults in brackets after descriptions]
Standard options:
--help print this message
- --logfile=FILE log tests and output to FILE [config.err]
+ --logfile=FILE log tests and output to FILE [config.log]
--disable-logging do not log configure debug information
--prefix=PREFIX install in PREFIX [$prefix]
--bindir=DIR install binaries in DIR [PREFIX/bin]
@@ -1440,7 +1440,7 @@ doc_deps="texi2html"
# default parameters
-logfile="config.err"
+logfile="config.log"
# installation paths
prefix_default="/usr/local"
commit 29d187222e77617a93b46780c50c7f318324e3f1
Author: stefano <stefano@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Wed Jun 16 18:27:55 2010 +0000
Make av_parse_expr() fail if there are trailing chars at the end of
the provided expression.
Allow detection of mistyped expressions.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23629 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavutil/eval.c b/libavutil/eval.c
index 530e79a..065625c 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -448,6 +448,7 @@ int av_parse_expr(AVExpr **expr, const char *s,
AVExpr *e = NULL;
char *w = av_malloc(strlen(s) + 1);
char *wp = w;
+ const char *s0 = s;
int ret = 0;
if (!w)
@@ -470,6 +471,11 @@ int av_parse_expr(AVExpr **expr, const char *s,
if ((ret = parse_expr(&e, &p)) < 0)
goto end;
+ if (*p.s) {
+ av_log(&p, AV_LOG_ERROR, "Invalid chars '%s' at the end of expression '%s'\n", p.s, s0);
+ ret = AVERROR(EINVAL);
+ goto end;
+ }
if (!verify_expr(e)) {
av_free_expr(e);
ret = AVERROR(EINVAL);
commit 29a4c928408ea9ec5698d688b68eb0422549a66b
Author: stefano <stefano@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Wed Jun 16 18:27:52 2010 +0000
Remove the "b" from "Mb" in -b values for the dnxhd tests.
They are just ignored, and tend to confuse both machines and humans.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23628 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/tests/codec-regression.sh b/tests/codec-regression.sh
index faa066b..ea49155 100755
--- a/tests/codec-regression.sh
+++ b/tests/codec-regression.sh
@@ -219,17 +219,17 @@ fi
if [ -n "$do_dnxhd_1080i" ] ; then
# FIXME: interlaced raw DNxHD decoding is broken
-do_video_encoding dnxhd-1080i.mov "" "-vcodec dnxhd -flags +ildct -s hd1080 -b 120Mb -pix_fmt yuv422p -vframes 5 -an"
+do_video_encoding dnxhd-1080i.mov "" "-vcodec dnxhd -flags +ildct -s hd1080 -b 120M -pix_fmt yuv422p -vframes 5 -an"
do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p"
fi
if [ -n "$do_dnxhd_720p" ] ; then
-do_video_encoding dnxhd-720p.dnxhd "" "-s hd720 -b 90Mb -pix_fmt yuv422p -vframes 5 -an"
+do_video_encoding dnxhd-720p.dnxhd "" "-s hd720 -b 90M -pix_fmt yuv422p -vframes 5 -an"
do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p"
fi
if [ -n "$do_dnxhd_720p_rd" ] ; then
-do_video_encoding dnxhd-720p-rd.dnxhd "" "-threads 4 -mbd rd -s hd720 -b 90Mb -pix_fmt yuv422p -vframes 5 -an"
+do_video_encoding dnxhd-720p-rd.dnxhd "" "-threads 4 -mbd rd -s hd720 -b 90M -pix_fmt yuv422p -vframes 5 -an"
do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p"
fi
commit 40b6319e9a2cfbdd687f2454dc99a57a4c08945d
Author: stefano <stefano@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Wed Jun 16 18:27:46 2010 +0000
Improve av_parse_eval() error reporting.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23627 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavutil/eval.c b/libavutil/eval.c
index 59ebd94..530e79a 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -182,7 +182,7 @@ void av_free_expr(AVExpr *e)
static int parse_primary(AVExpr **e, Parser *p)
{
AVExpr *d = av_mallocz(sizeof(AVExpr));
- char *next= p->s;
+ char *next = p->s, *s0 = p->s;
int ret, i;
if (!d)
@@ -211,7 +211,7 @@ static int parse_primary(AVExpr **e, Parser *p)
p->s= strchr(p->s, '(');
if (p->s==NULL) {
- av_log(p, AV_LOG_ERROR, "undefined constant or missing (\n");
+ av_log(p, AV_LOG_ERROR, "Undefined constant or missing '(' in '%s'\n", s0);
p->s= next;
av_free_expr(d);
return AVERROR(EINVAL);
@@ -222,7 +222,7 @@ static int parse_primary(AVExpr **e, Parser *p)
if ((ret = parse_expr(&d, p)) < 0)
return ret;
if (p->s[0] != ')') {
- av_log(p, AV_LOG_ERROR, "missing )\n");
+ av_log(p, AV_LOG_ERROR, "Missing ')' in '%s'\n", s0);
av_free_expr(d);
return AVERROR(EINVAL);
}
@@ -239,7 +239,7 @@ static int parse_primary(AVExpr **e, Parser *p)
parse_expr(&d->param[1], p);
}
if (p->s[0] != ')') {
- av_log(p, AV_LOG_ERROR, "missing )\n");
+ av_log(p, AV_LOG_ERROR, "Missing ')' or too many args in '%s'\n", s0);
av_free_expr(d);
return AVERROR(EINVAL);
}
@@ -290,7 +290,7 @@ static int parse_primary(AVExpr **e, Parser *p)
}
}
- av_log(p, AV_LOG_ERROR, "unknown function\n");
+ av_log(p, AV_LOG_ERROR, "Unknown function in '%s'\n", s0);
av_free_expr(d);
return AVERROR(EINVAL);
}
commit 641ec5edf539ddd0b640b14405958063227bb170
Author: janne <janne@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Wed Jun 16 13:07:12 2010 +0000
dvbsub: parse display definition segment
The display definition segment is used to properly display SD DVB subtitles in
HD video streams.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23626 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 54c74b5..a815056 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -22,6 +22,7 @@
#include "dsputil.h"
#include "get_bits.h"
#include "colorspace.h"
+#include "bytestream.h"
//#define DEBUG
//#define DEBUG_PACKET_CONTENTS
@@ -31,6 +32,7 @@
#define DVBSUB_REGION_SEGMENT 0x11
#define DVBSUB_CLUT_SEGMENT 0x12
#define DVBSUB_OBJECT_SEGMENT 0x13
+#define DVBSUB_DISPLAYDEFINITION_SEGMENT 0x14
#define DVBSUB_DISPLAY_SEGMENT 0x80
#define cm (ff_cropTbl + MAX_NEG_CROP)
@@ -216,6 +218,15 @@ typedef struct DVBSubRegion {
struct DVBSubRegion *next;
} DVBSubRegion;
+typedef struct DVBSubDisplayDefinition {
+ int version;
+
+ int x;
+ int y;
+ int width;
+ int height;
+} DVBSubDisplayDefinition;
+
typedef struct DVBSubContext {
int composition_id;
int ancillary_id;
@@ -227,6 +238,7 @@ typedef struct DVBSubContext {
int display_list_size;
DVBSubRegionDisplay *display_list;
+ DVBSubDisplayDefinition *display_definition;
} DVBSubContext;
@@ -334,6 +346,8 @@ static void delete_state(DVBSubContext *ctx)
av_free(clut);
}
+ av_freep(&ctx->display_definition);
+
/* Should already be null */
if (ctx->object_list)
av_log(0, AV_LOG_ERROR, "Memory deallocation error!\n");
@@ -1254,10 +1268,51 @@ static void save_display_set(DVBSubContext *ctx)
}
#endif
+static void dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
+ const uint8_t *buf,
+ int buf_size)
+{
+ DVBSubContext *ctx = avctx->priv_data;
+ DVBSubDisplayDefinition *display_def = ctx->display_definition;
+ int dds_version, info_byte;
+
+ if (buf_size < 5)
+ return;
+
+ info_byte = bytestream_get_byte(&buf);
+ dds_version = info_byte >> 4;
+ if (display_def && display_def->version == dds_version)
+ return; // already have this display definition version
+
+ if (!display_def) {
+ display_def = av_mallocz(sizeof(*display_def));
+ ctx->display_definition = display_def;
+ }
+ if (!display_def)
+ return;
+
+ display_def->version = dds_version;
+ display_def->x = 0;
+ display_def->y = 0;
+ display_def->width = bytestream_get_be16(&buf) + 1;
+ display_def->height = bytestream_get_be16(&buf) + 1;
+
+ if (buf_size < 13)
+ return;
+
+ if (info_byte & 1<<3) { // display_window_flag
+ display_def->x = bytestream_get_be16(&buf);
+ display_def->y = bytestream_get_be16(&buf);
+ display_def->width = bytestream_get_be16(&buf) - display_def->x + 1;
+ display_def->height = bytestream_get_be16(&buf) - display_def->y + 1;
+ }
+}
+
static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
int buf_size, AVSubtitle *sub)
{
DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
+ DVBSubDisplayDefinition *display_def = ctx->display_definition;
DVBSubRegion *region;
DVBSubRegionDisplay *display;
@@ -1265,12 +1320,18 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
DVBSubCLUT *clut;
uint32_t *clut_table;
int i;
+ int offset_x=0, offset_y=0;
sub->rects = NULL;
sub->start_display_time = 0;
sub->end_display_time = ctx->time_out * 1000;
sub->format = 0;
+ if (display_def) {
+ offset_x = display_def->x;
+ offset_y = display_def->y;
+ }
+
sub->num_rects = ctx->display_list_size;
if (sub->num_rects > 0){
@@ -1288,8 +1349,8 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
if (!region)
continue;
- rect->x = display->x_pos;
- rect->y = display->y_pos;
+ rect->x = display->x_pos + offset_x;
+ rect->y = display->y_pos + offset_y;
rect->w = region->width;
rect->h = region->height;
rect->nb_colors = 16;
@@ -1389,6 +1450,8 @@ static int dvbsub_decode(AVCodecContext *avctx,
case DVBSUB_OBJECT_SEGMENT:
dvbsub_parse_object_segment(avctx, p, segment_length);
break;
+ case DVBSUB_DISPLAYDEFINITION_SEGMENT:
+ dvbsub_parse_display_definition_segment(avctx, p, segment_length);
case DVBSUB_DISPLAY_SEGMENT:
*data_size = dvbsub_display_end_segment(avctx, p, segment_length, sub);
break;
commit 9cd115509f3a2ef1b757a60465e7c80737f7574c
Author: lucabe <lucabe@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Wed Jun 16 12:59:47 2010 +0000
If the video stream is H.264 with MP4 syntax, store the NAL lenght size in
the RTP muxer context (it will be used later for splitting frames in NALs)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23625 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 3111c2b..5abd490 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -131,6 +131,13 @@ static int rtp_write_header(AVFormatContext *s1)
s->max_payload_size = n * TS_PACKET_SIZE;
s->buf_ptr = s->buf;
break;
+ case CODEC_ID_H264:
+ /* check for H.264 MP4 syntax */
+ if (st->codec->extradata_size > 0 && st->codec->extradata &&
+ st->codec->extradata[0] == 1) {
+ s->nal_length_size = (st->codec->extradata[4] & 0x03) + 1;
+ }
+ break;
case CODEC_ID_AMR_NB:
case CODEC_ID_AMR_WB:
if (!s->max_frames_per_packet)
diff --git a/libavformat/rtpenc.h b/libavformat/rtpenc.h
index 5710160..95e70c1 100644
--- a/libavformat/rtpenc.h
+++ b/libavformat/rtpenc.h
@@ -50,6 +50,12 @@ struct RTPMuxContext {
uint8_t *buf_ptr;
int max_frames_per_packet;
+
+ /**
+ * Number of bytes used for H.264 NAL length, if the MP4 syntax is used
+ * (1, 2 or 4)
+ */
+ int nal_length_size;
};
typedef struct RTPMuxContext RTPMuxContext;
commit 60e5cc31c7a2e62480b361ccc43e1b0ea6dc964a
Author: cehoyos <cehoyos@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Wed Jun 16 10:35:56 2010 +0000
icc 12 finally fixed attribute(used) so gcc's DECLARE_ASM_CONST can be used.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23624 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavutil/mem.h b/libavutil/mem.h
index 1488792..561def5 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -28,7 +28,7 @@
#include "attributes.h"
-#if defined(__ICC) || defined(__SUNPRO_C)
+#if defined(__ICC) && _ICC < 1200 || defined(__SUNPRO_C)
#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
#define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
#elif defined(__TI_COMPILER_VERSION__)
commit d949c53484dc1fc9eed2db96ebc3f26908e10f4a
Author: michael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Wed Jun 16 04:53:09 2010 +0000
Document FF_SYMVER and attribute_used
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23622 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavutil/internal.h b/libavutil/internal.h
index b361f72..08a34a6 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -46,6 +46,12 @@
#endif
#endif
+
+/**
+ * Marks a variable as used and prevents the compiler from optimizing it away.
+ * This is usefull for asm that accesses varibles in ways that the compiler doesnt
+ * understand
+ */
#ifndef attribute_used
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define attribute_used __attribute__((used))
@@ -196,6 +202,15 @@
# define NULL_IF_CONFIG_SMALL(x) x
#endif
+
+/**
+ * Create a non default alias for a function with specified version.
+ * This is needed when symbols are moved from a lib to a dependancy of the lib
+ * because the gnu linker as of 2010 is buggy and fails to dynamicaly link if a symbol
+ * is not found in the lib in which it was during link time with enabled versioning
+ * even if a correctly versioned and matching symbol exists in another lib and
+ * even if it did find that would it not contain an explicit check to fail
+ */
#if HAVE_SYMVER_ASM_LABEL
# define FF_SYMVER(type, name, args, ver) \
type ff_##name args __asm__ (EXTERN_PREFIX #name "@" ver); \
commit 11711871ef5ae74a4cc4ed315353fd51fd845640
Author: hyc <hyc@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Wed Jun 16 01:12:26 2010 +0000
When reading a stream, should retry on EAGAIN instead of just failing. Also,
when reading a live feed, should retry regardless of whether any client has
opened the stream.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23621 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/ffserver.c b/ffserver.c
index 77340af..31d0268 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -2306,12 +2306,16 @@ static int http_prepare_data(HTTPContext *c)
else {
AVPacket pkt;
redo:
- if (av_read_frame(c->fmt_in, &pkt) < 0) {
- if (c->stream->feed && c->stream->feed->feed_opened) {
+ ret = av_read_frame(c->fmt_in, &pkt);
+ if (ret < 0) {
+ if (c->stream->feed) {
/* if coming from feed, it means we reached the end of the
ffm file, so must wait for more data */
c->state = HTTPSTATE_WAIT_FEED;
return 1; /* state changed */
+ } else if (ret == AVERROR(EAGAIN)) {
+ /* input not ready, come back later */
+ return 0;
} else {
if (c->stream->loop) {
av_close_input_file(c->fmt_in);
commit 7aa57da06029047432509f9a5ef097e917ed0e38
Author: bcoudurier <bcoudurier@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Tue Jun 15 22:38:16 2010 +0000
Fix svq3 watermark log uncompress on 64bit, probably fixes issue 1263
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23620 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index bf7659a..df2acd8 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -886,7 +886,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
int u2 = get_bits(&gb, 8);
int u3 = get_bits(&gb, 2);
int u4 = svq3_get_ue_golomb(&gb);
- unsigned buf_len = watermark_width*watermark_height*4;
+ unsigned long buf_len = watermark_width*watermark_height*4;
int offset = (get_bits_count(&gb)+7)>>3;
uint8_t *buf;
@@ -896,7 +896,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
buf = av_malloc(buf_len);
av_log(avctx, AV_LOG_DEBUG, "watermark size: %dx%d\n", watermark_width, watermark_height);
av_log(avctx, AV_LOG_DEBUG, "u1: %x u2: %x u3: %x compressed data size: %d offset: %d\n", u1, u2, u3, u4, offset);
- if (uncompress(buf, (uLong*)&buf_len, extradata + 8 + offset, size - offset) != Z_OK) {
+ if (uncompress(buf, &buf_len, extradata + 8 + offset, size - offset) != Z_OK) {
av_log(avctx, AV_LOG_ERROR, "could not uncompress watermark logo\n");
av_free(buf);
return -1;
commit ec32fcae405ccb32067124beb748a1fd422c2bb6
Author: aurel <aurel@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Tue Jun 15 19:53:15 2010 +0000
matroskadec : propagate AVERROR to the caller
based on a patch by Jai Menon
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23619 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 7995ce5..69c81b0 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1158,7 +1158,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
uint64_t max_start = 0;
Ebml ebml = { 0 };
AVStream *st;
- int i, j;
+ int i, j, res;
matroska->ctx = s;
@@ -1182,8 +1182,8 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
ebml_free(ebml_syntax, &ebml);
/* The next thing is a segment. */
- if (ebml_parse(matroska, matroska_segments, matroska) < 0)
- return -1;
+ if ((res = ebml_parse(matroska, matroska_segments, matroska)) < 0)
+ return res;
matroska_execute_seekhead(matroska);
if (!matroska->time_scale)
commit 574ec8caf8233a77b91e73876b400844693aa92d
Author: mru <mru@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Tue Jun 15 18:06:28 2010 +0000
configure: fix symver detection with icc 10
Apparently the compiler sometimes bypasses the normal assembler, in
which case the asm label variant works. If the file contains any
inline asm, this bypassing is not done, and the assembler chokes on
invalid syntax. Inserting a dummy asm() statement in the test when
the compiler supports it makes sure no shortcuts are taken and the
test fails as it should.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23616 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/configure b/configure
index 7016e5b..70ad8a5 100755
--- a/configure
+++ b/configure
@@ -252,6 +252,8 @@ EOF
exit 0
}
+quotes='""'
+
log(){
echo "$@" >> $logfile
}
@@ -2723,7 +2725,7 @@ if test_ldflags -Wl,--version-script,$TMPV; then
append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
check_cc <<EOF && enable symver_asm_label
void ff_foo(void) __asm__ ("av_foo@VERSION");
-void ff_foo(void) {}
+void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
EOF
check_cc <<EOF && enable symver_gnu_asm
__asm__(".symver ff_foo,av_foo@VERSION");
commit 3eb776965cd0dc69de0ca7cc2d2f4617a8d76866
Author: mru <mru@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Tue Jun 15 15:24:28 2010 +0000
Fix symbol version compat wrappers on systems with export prefixes
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23615 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 2d744df..b361f72 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -197,13 +197,13 @@
#endif
#if HAVE_SYMVER_ASM_LABEL
-# define FF_SYMVER(type, name, args, ver) \
- type ff_##name args __asm__ (#name "@" ver); \
+# define FF_SYMVER(type, name, args, ver) \
+ type ff_##name args __asm__ (EXTERN_PREFIX #name "@" ver); \
type ff_##name args
#elif HAVE_SYMVER_GNU_ASM
-# define FF_SYMVER(type, name, args, ver) \
- __asm__ (".symver ff_" #name "," #name "@" ver); \
- type ff_##name args; \
+# define FF_SYMVER(type, name, args, ver) \
+ __asm__ (".symver ff_" #name "," EXTERN_PREFIX #name "@" ver); \
+ type ff_##name args; \
type ff_##name args
#endif
commit 55da8ddcb4a95b2400770f2269a4b67e25962828
Author: rbultje <rbultje@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Tue Jun 15 14:24:19 2010 +0000
Fix missing logging context in a series of dprintf()s. Partially based on
patch by Zhentan Feng <spyfeng gmail com>.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23614 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavformat/mmst.c b/libavformat/mmst.c
index 9b2e497..c19a68f 100644
--- a/libavformat/mmst.c
+++ b/libavformat/mmst.c
@@ -258,7 +258,7 @@ static MMSSCPacketType get_tcp_server_response(MMSContext *mms)
// read the rest of the packet.
if (length_remaining < 0
|| length_remaining > sizeof(mms->in_buffer) - 12) {
- dprintf("Incoming message len %d exceeds buffer len %d\n",
+ dprintf(NULL, "Incoming message len %d exceeds buffer len %d\n",
length_remaining, sizeof(mms->in_buffer) - 12);
return -1;
}
@@ -291,7 +291,7 @@ static MMSSCPacketType get_tcp_server_response(MMSContext *mms)
if (length_remaining < 0
|| length_remaining > sizeof(mms->in_buffer) - 8) {
- dprintf("Incoming data len %d exceeds buffer len %d\n",
+ dprintf(NULL, "Incoming data len %d exceeds buffer len %d\n",
length_remaining, sizeof(mms->in_buffer));
return -1;
}
@@ -431,7 +431,7 @@ static int asf_header_parser(MMSContext *mms)
while(end - p >= sizeof(ff_asf_guid) + 8) {
uint64_t chunksize = AV_RL64(p + sizeof(ff_asf_guid));
if (!chunksize || chunksize > end - p) {
- dprintf("chunksize is exceptional value:%d!\n", chunksize);
+ dprintf(NULL, "chunksize is exceptional value:%d!\n", chunksize);
return -1;
}
if (!memcmp(p, ff_asf_file_header, sizeof(ff_asf_guid))) {
@@ -455,7 +455,7 @@ static int asf_header_parser(MMSContext *mms)
mms->streams[mms->stream_num].id = stream_id;
mms->stream_num++;
} else {
- dprintf("Too many streams.\n");
+ dprintf(NULL, "Too many streams.\n");
return -1;
}
}
commit 591f4c038c71198f35b970bdbcfeb44b9d3784ba
Author: mru <mru@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Tue Jun 15 13:26:52 2010 +0000
Add compatibility wrappers for functions moved from lavf to lavc
When symbol versioning is enabled, moving symbols from one library to
another breaks binary compatibility. This adds wrappers with the old
version tag for the av_*packet functions recently moved to lavc.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23611 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/configure b/configure
index 2083217..7016e5b 100755
--- a/configure
+++ b/configure
@@ -1084,6 +1084,9 @@ HAVE_LIST="
struct_sockaddr_in6
struct_sockaddr_sa_len
struct_sockaddr_storage
+ symver
+ symver_gnu_asm
+ symver_asm_label
sys_mman_h
sys_resource_h
sys_select_h
@@ -1198,6 +1201,8 @@ fast_unaligned_if_any="armv6 ppc x86"
need_memalign="altivec neon sse"
inline_asm_deps="!tms470"
+symver_if_any="symver_asm_label symver_gnu_asm"
+
# subsystems
mdct_select="fft"
rdft_select="fft"
@@ -2714,8 +2719,17 @@ check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUI
check_ldflags -Wl,-Bsymbolic
echo "X{};" > $TMPV
-test_ldflags -Wl,--version-script,$TMPV &&
+if test_ldflags -Wl,--version-script,$TMPV; then
append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
+ check_cc <<EOF && enable symver_asm_label
+void ff_foo(void) __asm__ ("av_foo@VERSION");
+void ff_foo(void) {}
+EOF
+ check_cc <<EOF && enable symver_gnu_asm
+__asm__(".symver ff_foo,av_foo@VERSION");
+void ff_foo(void) {}
+EOF
+fi
if enabled small; then
add_cflags $size_cflags
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 6365f3e..9faa566 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -283,8 +283,38 @@ AVInputFormat *av_find_input_format(const char *short_name)
return NULL;
}
-/* memory handling */
+#if LIBAVFORMAT_VERSION_MAJOR < 53 && CONFIG_SHARED && HAVE_SYMVER
+FF_SYMVER(void, av_destruct_packet_nofree, (AVPacket *pkt), "LIBAVFORMAT_52")
+{
+ av_destruct_packet_nofree(pkt);
+}
+
+FF_SYMVER(void, av_destruct_packet, (AVPacket *pkt), "LIBAVFORMAT_52")
+{
+ av_destruct_packet(pkt);
+}
+
+FF_SYMVER(int, av_new_packet, (AVPacket *pkt, int size), "LIBAVFORMAT_52")
+{
+ return av_new_packet(pkt, size);
+}
+
+FF_SYMVER(int, av_dup_packet, (AVPacket *pkt), "LIBAVFORMAT_52")
+{
+ return av_dup_packet(pkt);
+}
+
+FF_SYMVER(void, av_free_packet, (AVPacket *pkt), "LIBAVFORMAT_52")
+{
+ av_free_packet(pkt);
+}
+FF_SYMVER(void, av_init_packet, (AVPacket *pkt), "LIBAVFORMAT_52")
+{
+ av_log(NULL, AV_LOG_WARNING, "Diverting av_*_packet function calls to libavcodec. Recompile to improve performance\n");
+ av_init_packet(pkt);
+}
+#endif
int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size)
{
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 2faafc9..2d744df 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -196,4 +196,15 @@
# define NULL_IF_CONFIG_SMALL(x) x
#endif
+#if HAVE_SYMVER_ASM_LABEL
+# define FF_SYMVER(type, name, args, ver) \
+ type ff_##name args __asm__ (#name "@" ver); \
+ type ff_##name args
+#elif HAVE_SYMVER_GNU_ASM
+# define FF_SYMVER(type, name, args, ver) \
+ __asm__ (".symver ff_" #name "," #name "@" ver); \
+ type ff_##name args; \
+ type ff_##name args
+#endif
+
#endif /* AVUTIL_INTERNAL_H */
commit b5bfc9b798d22b36cb1e0234f7f4dfd37c8fbec8
Author: mru <mru@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Tue Jun 15 10:14:19 2010 +0000
FATE: update vc1 reference output
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23609 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/tests/ref/fate/vc1 b/tests/ref/fate/vc1
index 737dad0..d8b8f93 100644
--- a/tests/ref/fate/vc1
+++ b/tests/ref/fate/vc1
@@ -1,2 +1,15 @@
0, 0, 38016, 0xf1b25db5
-0, 0, 38016, 0xf1b25db5
+0, 3600, 38016, 0xf1b25db5
+0, 7200, 38016, 0xf1b25db5
+0, 10800, 38016, 0x9ed7f0de
+0, 14400, 38016, 0x5a0b2cf6
+0, 18000, 38016, 0x5e3ed87b
+0, 21600, 38016, 0xe2e3432d
+0, 25200, 38016, 0xe2e3432d
+0, 28800, 38016, 0x76854773
+0, 32400, 38016, 0x76854773
+0, 36000, 38016, 0xefbb2133
+0, 39600, 38016, 0xefbb2133
+0, 43200, 38016, 0xefbb2133
+0, 46800, 38016, 0xefbb2133
+0, 50400, 38016, 0xefbb2133
commit c3a5b00cbb5403bd00fbd44587bf4d53b0af841f
Author: bcoudurier <bcoudurier@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Tue Jun 15 09:14:00 2010 +0000
Support gray16be and rgb48be in mov
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23608 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index 41f5c90..1fbf4d2 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -127,6 +127,8 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = {
{ PIX_FMT_BGRA, MKTAG('B', 'G', 'R', 'A') },
{ PIX_FMT_RGBA, MKTAG('R', 'G', 'B', 'A') },
{ PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') },
+ { PIX_FMT_GRAY16BE,MKTAG('b', '1', '6', 'g') },
+ { PIX_FMT_RGB48BE, MKTAG('b', '4', '8', 'r') },
/* special */
{ PIX_FMT_RGB565LE,MKTAG( 3 , 0 , 0 , 0 ) }, /* flipped RGB565LE */
diff --git a/libavformat/isom.c b/libavformat/isom.c
index fd0d456..bf2d3b1 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -74,6 +74,8 @@ const AVCodecTag codec_movvideo_tags[] = {
{ CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 'A') },
{ CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 'A') },
{ CODEC_ID_RAWVIDEO, MKTAG('A', 'B', 'G', 'R') },
+ { CODEC_ID_RAWVIDEO, MKTAG('b', '1', '6', 'g') },
+ { CODEC_ID_RAWVIDEO, MKTAG('b', '4', '8', 'r') },
{ CODEC_ID_R210, MKTAG('r', '2', '1', '0') }, /* UNCOMPRESSED 10BIT RGB */
{ CODEC_ID_V210, MKTAG('v', '2', '1', '0') }, /* UNCOMPRESSED 10BIT 4:2:2 */
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 3495eb0..c401862 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -626,12 +626,14 @@ static const struct {
{ PIX_FMT_RGB555LE,MKTAG('L','5','5','5'), 16 },
{ PIX_FMT_RGB565LE,MKTAG('L','5','6','5'), 16 },
{ PIX_FMT_RGB565BE,MKTAG('B','5','6','5'), 16 },
+ { PIX_FMT_GRAY16BE,MKTAG('b','1','6','g'), 16 },
{ PIX_FMT_RGB24, MKTAG('r','a','w',' '), 24 },
{ PIX_FMT_BGR24, MKTAG('2','4','B','G'), 24 },
{ PIX_FMT_ARGB, MKTAG('r','a','w',' '), 32 },
{ PIX_FMT_BGRA, MKTAG('B','G','R','A'), 32 },
{ PIX_FMT_RGBA, MKTAG('R','G','B','A'), 32 },
{ PIX_FMT_ABGR, MKTAG('A','B','G','R'), 32 },
+ { PIX_FMT_RGB48BE, MKTAG('b','4','8','r'), 48 },
};
static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track)
commit 1274d19ce7c9639df80c6fcfa1738faef5e7124b
Author: michael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Mon Jun 14 17:35:46 2010 +0000
Deprecate -crop* arguments, they currently are buggy (issue1957) and probably
will be fixed by removing them.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23607 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/ffmpeg.c b/ffmpeg.c
index 96f1780..b8dbe36 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2770,6 +2770,7 @@ static void opt_frame_crop_top(const char *arg)
fprintf(stderr, "Vertical crop dimensions are outside the range of the original image.\nRemember to crop first and scale second.\n");
av_exit(1);
}
+ fprintf(stderr, "-crop* is deprecated in favor of the crop avfilter\n");
frame_height -= frame_topBand;
}
@@ -2784,6 +2785,7 @@ static void opt_frame_crop_bottom(const char *arg)
fprintf(stderr, "Vertical crop dimensions are outside the range of the original image.\nRemember to crop first and scale second.\n");
av_exit(1);
}
+ fprintf(stderr, "-crop* is deprecated in favor of the crop avfilter\n");
frame_height -= frame_bottomBand;
}
@@ -2798,6 +2800,7 @@ static void opt_frame_crop_left(const char *arg)
fprintf(stderr, "Horizontal crop dimensions are outside the range of the original image.\nRemember to crop first and scale second.\n");
av_exit(1);
}
+ fprintf(stderr, "-crop* is deprecated in favor of the crop avfilter\n");
frame_width -= frame_leftBand;
}
@@ -2812,6 +2815,7 @@ static void opt_frame_crop_right(const char *arg)
fprintf(stderr, "Horizontal crop dimensions are outside the range of the original image.\nRemember to crop first and scale second.\n");
av_exit(1);
}
+ fprintf(stderr, "-crop* is deprecated in favor of the crop avfilter\n");
frame_width -= frame_rightBand;
}
@@ -4198,10 +4202,10 @@ static const OptionDef options[] = {
{ "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
{ "aspect", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
{ "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format, 'list' as argument shows all the pixel formats supported", "format" },
- { "croptop", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_top}, "set top crop band size (in pixels)", "size" },
- { "cropbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_bottom}, "set bottom crop band size (in pixels)", "size" },
- { "cropleft", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_left}, "set left crop band size (in pixels)", "size" },
- { "cropright", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_right}, "set right crop band size (in pixels)", "size" },
+ { "croptop", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_top}, "Deprecated, please use the crop avfilter", "size" },
+ { "cropbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_bottom}, "Deprecated, please use the crop avfilter", "size" },
+ { "cropleft", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_left}, "Deprecated, please use the crop avfilter", "size" },
+ { "cropright", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_right}, "Deprecated, please use the crop avfilter", "size" },
{ "padtop", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "set top pad band size (in pixels)", "size" },
{ "padbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "set bottom pad band size (in pixels)", "size" },
{ "padleft", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "set left pad band size (in pixels)", "size" },
commit 7a221e4fa1c82868bd74b2ab221e275dbe6634df
Author: mstorsjo <mstorsjo@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Mon Jun 14 14:09:00 2010 +0000
nellymoserdec: Increase the log level of messages when failing to decode data
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23606 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
index 7b973c0..8976467 100644
--- a/libavcodec/nellymoserdec.c
+++ b/libavcodec/nellymoserdec.c
@@ -167,7 +167,7 @@ static int decode_tag(AVCodecContext * avctx,
return buf_size;
if (buf_size % 64) {
- av_log(avctx, AV_LOG_DEBUG, "Tag size %d.\n", buf_size);
+ av_log(avctx, AV_LOG_ERROR, "Tag size %d.\n", buf_size);
return buf_size;
}
blocks = buf_size / 64;
commit e53c45906db346f19d5f56590456c6a90d0ce2c5
Author: mstorsjo <mstorsjo@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Mon Jun 14 14:07:22 2010 +0000
Reindent
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23605 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
index b51be86..7b973c0 100644
--- a/libavcodec/nellymoserdec.c
+++ b/libavcodec/nellymoserdec.c
@@ -166,11 +166,11 @@ static int decode_tag(AVCodecContext * avctx,
if (buf_size < avctx->block_align)
return buf_size;
- if (buf_size % 64) {
- av_log(avctx, AV_LOG_DEBUG, "Tag size %d.\n", buf_size);
- return buf_size;
- }
- blocks = buf_size / 64;
+ if (buf_size % 64) {
+ av_log(avctx, AV_LOG_DEBUG, "Tag size %d.\n", buf_size);
+ return buf_size;
+ }
+ blocks = buf_size / 64;
/* Normal numbers of blocks for sample rates:
* 8000 Hz - 1
* 11025 Hz - 2
commit ae502da148224da37436102cab13db356ad7f9d1
Author: mstorsjo <mstorsjo@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Mon Jun 14 14:06:38 2010 +0000
nellymoserdec: Simplify calculation of numbers of blocks
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23604 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
index 2ada6fd..b51be86 100644
--- a/libavcodec/nellymoserdec.c
+++ b/libavcodec/nellymoserdec.c
@@ -166,25 +166,18 @@ static int decode_tag(AVCodecContext * avctx,
if (buf_size < avctx->block_align)
return buf_size;
- switch (buf_size) {
- case 64: // 8000Hz
- blocks = 1; break;
- case 128: // 11025Hz
- blocks = 2; break;
- case 192: // 16000Hz
- blocks = 3; break;
- case 256: // 22050Hz
- blocks = 4; break;
- case 512: // 44100Hz
- blocks = 8; break;
- default:
if (buf_size % 64) {
av_log(avctx, AV_LOG_DEBUG, "Tag size %d.\n", buf_size);
return buf_size;
}
blocks = buf_size / 64;
- break;
- }
+ /* Normal numbers of blocks for sample rates:
+ * 8000 Hz - 1
+ * 11025 Hz - 2
+ * 16000 Hz - 3
+ * 22050 Hz - 4
+ * 44100 Hz - 8
+ */
for (i=0 ; i<blocks ; i++) {
nelly_decode_block(s, &buf[i*NELLY_BLOCK_LEN], s->float_buf);
commit 8a3f077cd909dbc54d7b344de9db955fdb6baf77
Author: mstorsjo <mstorsjo@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Mon Jun 14 12:35:28 2010 +0000
Reindent
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23603 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
index cda8d11..2ada6fd 100644
--- a/libavcodec/nellymoserdec.c
+++ b/libavcodec/nellymoserdec.c
@@ -179,8 +179,8 @@ static int decode_tag(AVCodecContext * avctx,
blocks = 8; break;
default:
if (buf_size % 64) {
- av_log(avctx, AV_LOG_DEBUG, "Tag size %d.\n", buf_size);
- return buf_size;
+ av_log(avctx, AV_LOG_DEBUG, "Tag size %d.\n", buf_size);
+ return buf_size;
}
blocks = buf_size / 64;
break;
commit 7ab1972d3218be24090783e44c1ec3f60e7b9be8
Author: mstorsjo <mstorsjo@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Mon Jun 14 12:34:55 2010 +0000
nellymoserdec: Allow using unusual input block sizes
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23602 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
index 82a3f07..cda8d11 100644
--- a/libavcodec/nellymoserdec.c
+++ b/libavcodec/nellymoserdec.c
@@ -178,8 +178,12 @@ static int decode_tag(AVCodecContext * avctx,
case 512: // 44100Hz
blocks = 8; break;
default:
+ if (buf_size % 64) {
av_log(avctx, AV_LOG_DEBUG, "Tag size %d.\n", buf_size);
return buf_size;
+ }
+ blocks = buf_size / 64;
+ break;
}
for (i=0 ; i<blocks ; i++) {
commit db8d20dfc31cf18221a15e949da3f281636fb0f5
Author: mstorsjo <mstorsjo@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Mon Jun 14 09:09:59 2010 +0000
Cosmetics: Change connexion to connection in code comments
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23601 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index f1bd870..e762f61 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1617,7 +1617,7 @@ redirect:
ff_http_set_chunked_transfer_encoding(rtsp_hd_out, 0);
} else {
- /* open the tcp connexion */
+ /* open the tcp connection */
ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL);
if (url_open(&rtsp_hd, tcpname, URL_RDWR) < 0) {
err = AVERROR(EIO);
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index d646045..61b688d 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -190,7 +190,7 @@ enum RTSPServerType {
* @todo Use ByteIOContext instead of URLContext
*/
typedef struct RTSPState {
- URLContext *rtsp_hd; /* RTSP TCP connexion handle */
+ URLContext *rtsp_hd; /* RTSP TCP connection handle */
/** number of items in the 'rtsp_streams' variable */
int nb_rtsp_streams;
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 0ec24cd..fd6b5c1 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -279,7 +279,7 @@ int udp_set_remote_url(URLContext *h, const char *uri)
}
/**
- * Return the local port used by the UDP connexion
+ * Return the local port used by the UDP connection
* @param s1 media file context
* @return the local port number
*/
commit b8a84f11e7d8b4582e0cdd19eb90ab49fdb6423b
Author: mstorsjo <mstorsjo@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Mon Jun 14 08:51:46 2010 +0000
Fix compilation on windows CE
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23600 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavutil/log.c b/libavutil/log.c
index 9e09a10..5f7034b 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -34,7 +34,7 @@ static
#endif
int av_log_level = AV_LOG_INFO;
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__MINGW32CE__)
#include <windows.h>
static const uint8_t color[] = {12,12,12,14,7,7,7};
static int16_t background, attr_orig;
@@ -51,7 +51,7 @@ static int use_color=-1;
#undef fprintf
static void colored_fputs(int level, const char *str){
if(use_color<0){
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__MINGW32CE__)
CONSOLE_SCREEN_BUFFER_INFO con_info;
con = GetStdHandle(STD_ERROR_HANDLE);
use_color = (con != INVALID_HANDLE_VALUE) && !getenv("NO_COLOR");
commit 5942bd0c30876df657df9d95d230c83700103b3a
Author: mstorsjo <mstorsjo@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Mon Jun 14 08:23:59 2010 +0000
RTSP: Shrink SDP fmtp parsing buffer size
Since the parsing of Vorbis/Theora fmtp headers is handled by the
parse_sdp_a_line function pointer now, the buffer in sdp_parse_fmtp
doesn't need to be this large any longer.
Patch by Josh Allmann, joshua dot allmann at gmail
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23599 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index fc422aa..f1bd870 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -273,9 +273,7 @@ int ff_rtsp_next_attr_and_value(const char **p, char *attr, int attr_size,
static void sdp_parse_fmtp(AVStream *st, const char *p)
{
char attr[256];
- /* Vorbis setup headers can be up to 12KB and are sent base64
- * encoded, giving a 12KB * (4/3) = 16KB FMTP line. */
- char value[16384];
+ char value[4096];
int i;
RTSPStream *rtsp_st = st->priv_data;
AVCodecContext *codec = st->codec;
@@ -541,7 +539,8 @@ static int sdp_parse(AVFormatContext *s, const char *content)
* "rulebooks" describing their properties. Therefore, the SDP line
* buffer is large.
*
- * The Vorbis FMTP line can be up to 16KB - see sdp_parse_fmtp. */
+ * The Vorbis FMTP line can be up to 16KB - see xiph_parse_sdp_line
+ * in rtpdec_xiph.c. */
char buf[16384], *q;
SDPParseState sdp_parse_state, *s1 = &sdp_parse_state;
commit 583923e104c7f51e4dd2a4b0509fbf240ea7b891
Author: mstorsjo <mstorsjo@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Mon Jun 14 08:12:40 2010 +0000
Reindent
Patch by Josh Allmann, joshua dot allmann at gmail
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23598 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index aa8f31b..fc422aa 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1618,13 +1618,13 @@ redirect:
ff_http_set_chunked_transfer_encoding(rtsp_hd_out, 0);
} else {
- /* open the tcp connexion */
- ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL);
- if (url_open(&rtsp_hd, tcpname, URL_RDWR) < 0) {
- err = AVERROR(EIO);
- goto fail;
- }
- rtsp_hd_out = rtsp_hd;
+ /* open the tcp connexion */
+ ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL);
+ if (url_open(&rtsp_hd, tcpname, URL_RDWR) < 0) {
+ err = AVERROR(EIO);
+ goto fail;
+ }
+ rtsp_hd_out = rtsp_hd;
}
rt->rtsp_hd = rtsp_hd;
rt->rtsp_hd_out = rtsp_hd_out;
commit 13856d5d6c1f66c3370190d061cb32d326830939
Author: ramiro <ramiro@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Mon Jun 14 07:05:59 2010 +0000
output-example: Set sample_fmt to SAMPLE_FMT_S16.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23597 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavformat/output-example.c b/libavformat/output-example.c
index dd61cfe..15e2d9a 100644
--- a/libavformat/output-example.c
+++ b/libavformat/output-example.c
@@ -68,6 +68,7 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
c->codec_type = AVMEDIA_TYPE_AUDIO;
/* put sample parameters */
+ c->sample_fmt = SAMPLE_FMT_S16;
c->bit_rate = 64000;
c->sample_rate = 44100;
c->channels = 2;
commit 08c0efd4b31a2f76fd68d54c7cbe12106e6410b5
Author: stefano <stefano@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Sun Jun 13 09:32:03 2010 +0000
Document what av_get_token() returns in case of allocation failure.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23596 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavfilter/parseutils.h b/libavfilter/parseutils.h
index 7b78d89..8ad7b8b 100644
--- a/libavfilter/parseutils.h
+++ b/libavfilter/parseutils.h
@@ -38,7 +38,7 @@
* terminating char
* @param term a 0-terminated list of terminating chars
* @return the malloced unescaped string, which must be av_freed by
- * the user
+ * the user, NULL in case of allocation failure
*/
char *av_get_token(const char **buf, const char *term);
commit 4079f1d24a77f68cad34092a7cde2d31fd5eac49
Author: stefano <stefano@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Sun Jun 13 09:32:01 2010 +0000
Resort @param in av_get_token() doxy to reflect the same order they
have in the function.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23595 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavfilter/parseutils.h b/libavfilter/parseutils.h
index b5b494e..7b78d89 100644
--- a/libavfilter/parseutils.h
+++ b/libavfilter/parseutils.h
@@ -34,9 +34,9 @@
* The normal \ and ' escaping is supported. Leading and trailing
* whitespaces are removed.
*
- * @param term a 0-terminated list of terminating chars
* @param buf the buffer to parse, buf will be updated to point to the
* terminating char
+ * @param term a 0-terminated list of terminating chars
* @return the malloced unescaped string, which must be av_freed by
* the user
*/
commit 7f00882d58388a07e2ddbaa7e082baf74fc892a0
Author: stefano <stefano@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Sun Jun 13 09:27:09 2010 +0000
Add missing check to av_get_token().
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23594 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavfilter/parseutils.c b/libavfilter/parseutils.c
index 9ac61d8..53f03dc 100644
--- a/libavfilter/parseutils.c
+++ b/libavfilter/parseutils.c
@@ -34,6 +34,7 @@ char *av_get_token(const char **buf, const char *term)
char *out = av_malloc(strlen(*buf) + 1);
char *ret= out, *end= out;
const char *p = *buf;
+ if (!out) return NULL;
p += strspn(p, WHITESPACES);
while(*p && !strspn(p, term)) {
commit c4c747d25026f701f2876a948a997f638f0ec6ea
Author: stefano <stefano@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Sun Jun 13 09:06:50 2010 +0000
Fix av_compare_mod() doxy.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23593 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/libavutil/mathematics.h b/libavutil/mathematics.h
index 889ce95..eb78890 100644
--- a/libavutil/mathematics.h
+++ b/libavutil/mathematics.h
@@ -95,12 +95,14 @@ int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
/**
- * Compare 2 integers modulo mod.
- * That is we compare integers a and b for which only the least significant log2(mod) bits are known
+ * Compares 2 integers modulo mod.
+ * That is we compare integers a and b for which only the least
+ * significant log2(mod) bits are known.
+ *
* @param mod must be a power of 2
- * @returns a negative value if a is smaller than b
- * a positiv value if a is greater than b
- * 0 if a equals b
+ * @return a negative value if a is smaller than b
+ * a positive value if a is greater than b
+ * 0 if a equals b
*/
int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
commit a0d6062bfd62dce15776caa88ee23df72e6ceb4f
Author: stefano <stefano@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Date: Sun Jun 13 09:04:36 2010 +0000
Add APIchanges entry and bump minor after av_compare_mod() addition.
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23592 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
diff --git a/doc/APIchanges b/doc/APIchanges
index 2337f33..518331b 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -12,6 +12,9 @@ libavutil: 2009-03-08
API changes, most recent first:
+2010-06-09 - r23551 - lavu 50.19.0 - av_compare_mod()
+ Add av_compare_mod() to libavutil/mathematics.h.
+
2010-06-05 - r23485 - lavu 50.18.0 - eval API
Make the eval API public.
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index 663b386..5deaf06 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -40,7 +40,7 @@
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 50
-#define LIBAVUTIL_VERSION_MINOR 18
+#define LIBAVUTIL_VERSION_MINOR 19
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-----------------------------------------------------------------------
Summary of changes:
configure | 22 ++++++++++++--
doc/APIchanges | 3 ++
doc/fftools-common-opts.texi | 9 +++++
ffmpeg.c | 12 +++++--
ffserver.c | 8 ++++-
libavcodec/amrwbdec.c | 39 ++++++++++++++++++++++++
libavcodec/dvbsubdec.c | 67 ++++++++++++++++++++++++++++++++++++++++-
libavcodec/libvorbis.c | 2 +-
libavcodec/nellymoserdec.c | 25 +++++++---------
libavcodec/raw.c | 2 +
libavcodec/svq3.c | 4 +-
libavfilter/parseutils.c | 1 +
libavfilter/parseutils.h | 4 +-
libavfilter/vsrc_buffer.c | 3 +-
libavfilter/vsrc_buffer.h | 2 +
libavformat/Makefile | 2 +-
libavformat/avformat.h | 2 -
libavformat/http.h | 3 ++
libavformat/isom.c | 2 +
libavformat/matroskadec.c | 6 ++--
libavformat/mmst.c | 8 ++--
libavformat/movenc.c | 2 +
libavformat/oma.c | 49 +++++++++++++++---------------
libavformat/output-example.c | 1 +
libavformat/rtmpproto.c | 1 +
libavformat/rtpenc.c | 6 ++++
libavformat/rtpenc.h | 6 ++++
libavformat/rtsp.c | 21 ++++++-------
libavformat/rtsp.h | 2 +-
libavformat/spdif.c | 4 ++
libavformat/udp.c | 2 +-
libavformat/utils.c | 32 +++++++++++++++++++-
libavutil/avutil.h | 2 +-
libavutil/eval.c | 54 ++++++++++++++++++++++++++++++---
libavutil/internal.h | 26 ++++++++++++++++
libavutil/log.c | 4 +-
libavutil/mathematics.h | 12 ++++---
libavutil/mem.h | 2 +-
tests/codec-regression.sh | 6 ++--
tests/ref/fate/vc1 | 15 +++++++++-
40 files changed, 375 insertions(+), 98 deletions(-)
hooks/post-receive
--
AMR-WB decoder
3
2
Author: spyfeng
Date: Thu Jun 17 17:32:35 2010
New Revision: 5836
Log:
fix a bug for cann't build connections with other links.
eg:
mmsh://wm-live.sr.se/SR-P3-High/
mmsh://vipnrj.yacast.net/nrj_webtv02
mmsh://livewm.orange.fr/live-multicanaux
Modified:
mms/mmsh.c
Modified: mms/mmsh.c
==============================================================================
--- mms/mmsh.c Wed Jun 16 17:31:36 2010 (r5835)
+++ mms/mmsh.c Thu Jun 17 17:32:35 2010 (r5836)
@@ -337,7 +337,7 @@ static int get_http_header_data(MMSHCont
if (!mms->is_header_parsed) {
res = asf_header_parser(mms);
mms->is_header_parsed = 1;
- //return res;
+ return res;
}
} else if (chunk_type == CHUNK_TYPE_DATA) {
// read data packet and do padding
1
0
Author: mchinen
Date: Tue Jun 15 18:52:35 2010
New Revision: 5831
Log:
adding thread-safe (optional flag) support for av_build_index
Modified:
seek2010/seek2010.patch
Modified: seek2010/seek2010.patch
==============================================================================
--- seek2010/seek2010.patch Sat Jun 12 19:10:27 2010 (r5830)
+++ seek2010/seek2010.patch Tue Jun 15 18:52:35 2010 (r5831)
@@ -1,19 +1,19 @@
Index: ffplay.c
===================================================================
---- ffplay.c (revision 23548)
+--- ffplay.c (revision 23615)
+++ ffplay.c (working copy)
@@ -2501,6 +2501,8 @@
goto fail;
}
-+ av_build_index(ic, 0);
++ av_build_index(ic, AV_BUILD_INDEX_THREADSAFE);
+
for(;;) {
if (is->abort_request)
break;
Index: libavformat/mov.c
===================================================================
---- libavformat/mov.c (revision 23548)
+--- libavformat/mov.c (revision 23615)
+++ libavformat/mov.c (working copy)
@@ -2495,7 +2495,10 @@
int sample, time_sample;
@@ -52,7 +52,7 @@ Index: libavformat/mov.c
st = s->streams[i];
Index: libavformat/avidec.c
===================================================================
---- libavformat/avidec.c (revision 23548)
+--- libavformat/avidec.c (revision 23615)
+++ libavformat/avidec.c (working copy)
@@ -1084,7 +1084,8 @@
int i, index;
@@ -125,7 +125,7 @@ Index: libavformat/avidec.c
Index: libavformat/avformat.h
===================================================================
---- libavformat/avformat.h (revision 23548)
+--- libavformat/avformat.h (revision 23615)
+++ libavformat/avformat.h (working copy)
@@ -390,6 +390,21 @@
int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */
@@ -159,7 +159,7 @@ Index: libavformat/avformat.h
} AVStream;
#define AV_PROGRAM_RUNNING 1
-@@ -1131,6 +1149,23 @@
+@@ -1131,6 +1149,24 @@
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags);
/**
@@ -178,12 +178,13 @@ Index: libavformat/avformat.h
+ * Part of the new seeking api. incomplete.
+ */
+int av_build_index(AVFormatContext *s, int flags);
++#define AV_BUILD_INDEX_THREADSAFE 0x0001
+
+/**
* Ensures the index uses less memory than the maximum specified in
* AVFormatContext.max_index_size by discarding entries if it grows
* too large.
-@@ -1149,6 +1184,15 @@
+@@ -1149,6 +1185,15 @@
int size, int distance, int flags);
/**
@@ -201,9 +202,9 @@ Index: libavformat/avformat.h
* This is not supposed to be called directly by a user application,
Index: libavformat/utils.c
===================================================================
---- libavformat/utils.c (revision 23548)
+--- libavformat/utils.c (revision 23615)
+++ libavformat/utils.c (working copy)
-@@ -1001,7 +1001,38 @@
+@@ -1031,7 +1031,38 @@
pkt->convergence_duration = pc->convergence_duration;
}
@@ -242,7 +243,7 @@ Index: libavformat/utils.c
static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
{
AVStream *st;
-@@ -1359,6 +1390,7 @@
+@@ -1389,6 +1420,7 @@
int a, b, m;
int64_t timestamp;
@@ -250,7 +251,7 @@ Index: libavformat/utils.c
a = - 1;
b = nb_entries;
-@@ -1675,6 +1707,11 @@
+@@ -1705,6 +1737,11 @@
timestamp = av_rescale(timestamp, st->time_base.den, AV_TIME_BASE * (int64_t)st->time_base.num);
}
@@ -262,7 +263,7 @@ Index: libavformat/utils.c
/* first, we try the format specific seek */
if (s->iformat->read_seek)
ret = s->iformat->read_seek(s, stream_index, timestamp, flags);
-@@ -1712,9 +1749,368 @@
+@@ -1742,9 +1779,416 @@
// try some generic seek like av_seek_frame_generic() but with new ts semantics
}
@@ -352,7 +353,7 @@ Index: libavformat/utils.c
+ return 0;
+}
+
-+static int av_fill_table_internal(AVFormatContext *s, AVPacket *pkt, ByteIOContext *pb)
++static int av_fill_table_internal(AVFormatContext *s, AVPacket *pkt)
+{
+ AVStream *st;
+ int len, ret, i;
@@ -485,7 +486,7 @@ Index: libavformat/utils.c
+ return 0;
+}
+
-+static int av_fill_table_frame(AVFormatContext *s, AVPacket *pkt, ByteIOContext *pb)
++static int av_fill_table_frame(AVFormatContext *s, AVPacket *pkt)
+{
+ AVPacketList *pktl;
+ int eof=0;
@@ -518,7 +519,7 @@ Index: libavformat/utils.c
+ }
+ }
+ {
-+ int ret= av_fill_table_internal(s, pkt, pb);
++ int ret = av_fill_table_internal(s, pkt);
+ if(ret<0){
+ if(pktl && ret != AVERROR(EAGAIN)){
+ eof=1;
@@ -574,36 +575,84 @@ Index: libavformat/utils.c
+ s->streams[i]->seek_table.flags |= AV_SEEKTABLE_COPIED;
+ }
+ } else {
++ AVFormatContext *build_ic;
+ AVPacket pkt;
+
-+ /* default table generation behavior from av_seek_frame_generic */
-+ /* TODO: see why s->data_offset is the file length for avi/mp4 and others */
-+
-+ /* use an independent file pointer so that we can use this call in multithreaded contexts*/
-+ /* not complete yet - see av_read_packet to see how we need to swap out the old file pointers*/
-+ ByteIOContext* pb;
-+
+ printf("SEEK_TABLE_DEBUG: building index from scratch\n");
+
-+ if ((ret=url_fopen(&pb, s->filename, URL_RDONLY)) < 0) {
-+ return ret;
++ /* if the client needs it to be threadsafe, create a new format context to read from. */
++ if(flags & AV_BUILD_INDEX_THREADSAFE) {
++ printf("SEEK_TABLE_DEBUG: making thread-safe copy of streams\n");
++ build_ic = avformat_alloc_context();
++ ret = av_open_input_file(&build_ic, s->filename, s->iformat, 0, NULL);
++
++ if(ret < 0) {
++ printf("SEEK_TABLE_DEBUG: error re-opening file/streams: %i\n",ret);
++ goto cleanup;
++ }
++ if(build_ic->nb_streams != s->nb_streams) {
++ ret = -1;
++ printf("SEEK_TABLE_DEBUG: cloned AVFormatContext has different number of streams!");
++ goto cleanup;
++ }
++
++ for(i = 0; i < build_ic->nb_streams; i++) {
++ AVStream *build_st= build_ic->streams[i];
++ AVCodecContext *avctx = build_st->codec;
++ AVCodec *pCodec;
++ build_ic->streams[i]->discard = AVDISCARD_DEFAULT;
++
++ //compare with the orignal stream's context, and if opened, copy settings and open the clone
++ if(s->streams[i]->codec->priv_data) {
++ printf("SEEK_TABLE_DEBUG: copying stream based on priv_data\n");
++ if((ret = avcodec_copy_context(avctx, s->streams[i]->codec)) < 0) {
++ printf("SEEK_TABLE_DEBUG: error copying codec:%i\n",ret);
++ goto cleanup;
++ }
++ pCodec = avcodec_find_decoder(avctx->codec_id);
++ if((ret = avcodec_open(avctx,pCodec)) < 0) {
++ printf("SEEK_TABLE_DEBUG: error opening codec:%i\n",ret);
++ goto cleanup;
++ }
++ }
++ }
++ } else {
++ build_ic = s;
+ }
-+
-+ if ((ret = url_fseek(pb, 0/*s->data_offset*/, SEEK_SET)) < 0){
++
++ /* default table generation behavior from av_seek_frame_generic */
++ /* TODO: see why s->data_offset is the file length for avi/mp4 and others */
++ if ((ret = url_fseek(build_ic->pb, 0/*s->data_offset*/, SEEK_SET)) < 0){
+ printf("SEEK_TABLE_DEBUG: error building index: %i\n",ret);
-+ return ret;
++ goto cleanup;
+ }
+
+ for(i=0;; i++) {
+ do{
-+ ret = av_fill_table_frame(s, &pkt, pb);
++ ret = av_fill_table_frame(build_ic, &pkt);
+ }while(ret == AVERROR(EAGAIN));
+ if(ret<0)
+ break;
+ av_free_packet(&pkt);
-+ }
-+ if (pb)
-+ url_fclose(pb);
++ }
++ ret = 0;
++ cleanup:
++ if(flags & AV_BUILD_INDEX_THREADSAFE) {
++ if(build_ic) {
++ //take the index over from our clone
++ for(i = 0; i < build_ic->nb_streams; i++) {
++ if(ret >= 0) {
++ printf("SEEK_TABLE_DEBUG: copying over %i frames from clone stream\n",build_ic->streams[i]->seek_table.nb_index_entries);
++ s->streams[i]->seek_table = build_ic->streams[i]->seek_table;
++ memset(&build_ic->streams[i]->seek_table,0,sizeof(AVSeekTable));
++ }
++ avcodec_close(build_ic->streams[i]->codec);
++ }
++ av_close_input_file(build_ic);
++ }
++ }
++ if(ret < 0)
++ return ret;
+ }
+
+ /* return seek to start of stream. Not sure if this the desired behavior. */
@@ -621,7 +670,7 @@ Index: libavformat/utils.c
+ return ret;
+ }
+ }
-+ printf("SEEK_TABLE_DEBUG: finished building index\n");
++ printf("SEEK_TABLE_DEBUG: finished building index");
+ return 0;
+}
+
@@ -631,7 +680,7 @@ Index: libavformat/utils.c
* Returns TRUE if the stream has accurate duration in any stream.
*
* @return TRUE if the stream has accurate duration for at least one component.
-@@ -2422,6 +2818,7 @@
+@@ -2452,6 +2896,7 @@
}
av_metadata_free(&st->metadata);
av_free(st->index_entries);
@@ -639,7 +688,7 @@ Index: libavformat/utils.c
av_free(st->codec->extradata);
av_free(st->codec);
#if LIBAVFORMAT_VERSION_INT < (53<<16)
-@@ -2971,6 +3368,7 @@
+@@ -3001,6 +3446,7 @@
for(i=0;i<s->nb_streams;i++) {
av_freep(&s->streams[i]->priv_data);
av_freep(&s->streams[i]->index_entries);
3
3
Author: spyfeng
Date: Wed Jun 16 17:31:36 2010
New Revision: 5835
Log:
modify libavformat/Makfile and allforamts.c for MMSH protocol.
Added:
mms/Makefile_mmsh.patch
Added: mms/Makefile_mmsh.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ mms/Makefile_mmsh.patch Wed Jun 16 17:31:36 2010 (r5835)
@@ -0,0 +1,26 @@
+Index: libavformat/Makefile
+===================================================================
+--- libavformat/Makefile (revision 23550)
++++ libavformat/Makefile (working copy)
+@@ -279,6 +279,8 @@
+ OBJS-$(CONFIG_FILE_PROTOCOL) += file.o
+ OBJS-$(CONFIG_GOPHER_PROTOCOL) += gopher.o
+ OBJS-$(CONFIG_HTTP_PROTOCOL) += http.o httpauth.o
++OBJS-$(CONFIG_MMS_PROTOCOL) += mmsh.o
++OBJS-$(CONFIG_MMSH_PROTOCOL) += mmsh.o
+ OBJS-$(CONFIG_MMST_PROTOCOL) += mmst.o asf.o
+ OBJS-$(CONFIG_PIPE_PROTOCOL) += file.o
+
+Index: libavformat/allformats.c
+===================================================================
+--- libavformat/allformats.c (revision 23550)
++++ libavformat/allformats.c (working copy)
+@@ -221,6 +221,8 @@
+ REGISTER_PROTOCOL (FILE, file);
+ REGISTER_PROTOCOL (GOPHER, gopher);
+ REGISTER_PROTOCOL (HTTP, http);
++ REGISTER_PROTOCOL (MMS, mms);
++ REGISTER_PROTOCOL (MMSH, mmsh);
+ REGISTER_PROTOCOL (MMST, mmst);
+ REGISTER_PROTOCOL (PIPE, pipe);
+ REGISTER_PROTOCOL (RTMP, rtmp);
1
0
Author: spyfeng
Date: Wed Jun 16 17:29:21 2010
New Revision: 5834
Log:
fix some bugs. get header and data correctly but cannot generate output files.
test command:
./ffmpeg_g -i mmsh://210.75.225.191:1755 test.wmv
Modified:
mms/mmsh.c
Modified: mms/mmsh.c
==============================================================================
--- mms/mmsh.c Wed Jun 16 12:02:08 2010 (r5833)
+++ mms/mmsh.c Wed Jun 16 17:29:21 2010 (r5834)
@@ -77,8 +77,8 @@ typedef struct {
typedef struct
{
URLContext *mms_hd;
- uint8_t out_buffer[1024]; ///< Buffer for outgoing packet.
- uint8_t in_buffer[1024]; //TODO, maybe reused by out_buffer.
+ uint8_t out_buffer[8192]; ///< Buffer for outgoing packet.
+ uint8_t in_buffer[8192]; //TODO, maybe reused by out_buffer.
uint8_t *read_in_ptr;
MMSStream streams[MAX_STREAMS];
@@ -137,8 +137,8 @@ static int get_and_parse_http_header(MMS
int http_code;
char content_type[128]={'\0'};
char *p, *pos;
- uint8_t tmp_buf[8192];
- url_read_complete(mms->mms_hd, tmp_buf, sizeof(tmp_buf));
+ //uint8_t tmp_buf[8192];
+ //url_read_complete(mms->mms_hd, tmp_buf, sizeof(tmp_buf));
for(;;) {
if(url_read(mms->mms_hd, &mms->in_buffer[len], 1) != 1) {
dprintf(NULL, "recv http header failed!\n");
@@ -276,7 +276,7 @@ static int get_chunk_header(MMSHContext
return -1;
}
*len = chunk_len - ext_header_len;
- if (chunk_type == CHUNK_TYPE_ASF_HEADER || chunk_type == CHUNK_TYPE_DATA)
+ if (chunk_type == CHUNK_TYPE_END || chunk_type == CHUNK_TYPE_DATA)
mms->chunk_seq = AV_RL32(ext_header);
return chunk_type;
}
@@ -315,17 +315,17 @@ static int get_http_header_data(MMSHCont
} else if (chunk_type == CHUNK_TYPE_ASF_HEADER){
// get asf header and stored it
if (!mms->is_header_parsed) {
- if (!mms->asf_header) {
+ if (mms->asf_header) {
if (len != mms->asf_header_size) {
mms->asf_header_size = len;
dprintf(NULL, "header len changed form %d to %d\n",
mms->asf_header_size, len);
av_freep(&mms->asf_header);
}
- mms->asf_header = av_mallocz(len);
- if (!mms->asf_header) {
- return AVERROR(ENOMEM);
- }
+ }
+ mms->asf_header = av_mallocz(len);
+ if (!mms->asf_header) {
+ return AVERROR(ENOMEM);
}
}
res = url_read_complete(mms->mms_hd, mms->asf_header, len);
@@ -337,7 +337,7 @@ static int get_http_header_data(MMSHCont
if (!mms->is_header_parsed) {
res = asf_header_parser(mms);
mms->is_header_parsed = 1;
- return res;
+ //return res;
}
} else if (chunk_type == CHUNK_TYPE_DATA) {
// read data packet and do padding
@@ -381,6 +381,7 @@ static int mmsh_open_cnx(MMSHContext *mm
int i, port, err, offset = 0;
char tcpname[256], path[256], host[128];
char stream_selection[10 * MAX_STREAMS];
+
if (mms->mms_hd) {
url_close(mms->mms_hd);
}
@@ -402,6 +403,8 @@ static int mmsh_open_cnx(MMSHContext *mm
err = get_http_answer(mms); // TODO match with the first request
if(err)
return err;
+ // close the socket and then reopen it for sending the second play request.
+ url_close(mms->mms_hd);
for (i = 0; i < mms->stream_num; i++) {
err = snprintf(stream_selection + offset, sizeof(stream_selection) - offset,
@@ -423,6 +426,12 @@ static int mmsh_open_cnx(MMSHContext *mm
dprintf(NULL, "build play request failed!\n");
return err;
}
+ dprintf(NULL, "out_buffer is %s", mms->out_buffer);
+
+ //reopen the connection.
+ err = url_open(&mms->mms_hd, tcpname, URL_RDWR);
+ if (err)
+ return err;
err = send_pack(mms);
if (err)
return err;
@@ -486,7 +495,7 @@ static int handle_chunk_type(MMSHContext
return res;
}
} else if (chunk_type == CHUNK_TYPE_DATA) {
- read_data_packet(mms, len);
+ return read_data_packet(mms, len);
} else {
dprintf(NULL, "recv other type packet %d\n", chunk_type);
return -1;
1
0
16 Jun '10
- Log -----------------------------------------------------------------
commit 57a9ec97a9febb4244437c1ff2bdf0150ce4e8c7
Author: Naufal <naufal11(a)gmail.com>
Date: Tue Jun 15 18:40:52 2010 +0530
Perform LSP interpolation, compute LPC coeffs
diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c
index f1bef98..1abf8aa 100755
--- a/libavcodec/g723_1.c
+++ b/libavcodec/g723_1.c
@@ -1,6 +1,8 @@
#include "avcodec.h"
#define ALT_BITSTREAM_READER_LE
#include "get_bits.h"
+#include "acelp_vectors.h"
+#include "lsp.h"
#include "g723_1_data.h"
typedef struct g723_1_context {
@@ -218,6 +220,44 @@ static void inverse_quant(int16_t *cur_lsp, int16_t *prev_lsp, int8_t *lsp_index
memcpy(cur_lsp, prev_lsp, LPC_ORDER * sizeof(int16_t));
}
+/*
+ * Quantize LSP frequencies by interpolation and convert them to
+ * the corresponding LPC coefficients.
+ *
+ * @param lpc buffer for LPC coefficients
+ * @param cur_lsp the current LSP vector
+ * @param prev_lsp the previous LSP vector
+ */
+static void lsp_interpolate(int16_t *lpc, int16_t *cur_lsp, int16_t *prev_lsp)
+{
+ int i, j;
+ int16_t *ptr = lpc;
+
+ // cur_lsp * 0.25 + prev_lsp * 0.75
+ ff_acelp_weighted_vector_sum(&lpc[1], cur_lsp, prev_lsp,
+ 4096, 12288, 1 << 13, 14, LPC_ORDER);
+ ff_acelp_weighted_vector_sum(&lpc[LPC_ORDER + 1], cur_lsp, prev_lsp,
+ 8192, 8192, 1 << 13, 14, LPC_ORDER);
+ ff_acelp_weighted_vector_sum(&lpc[LPC_ORDER * 2 + 2], cur_lsp, prev_lsp,
+ 12288, 4096, 1 << 13, 14, LPC_ORDER);
+ memcpy(&lpc[LPC_ORDER * 3 + 3], cur_lsp, LPC_ORDER * sizeof(int16_t));
+
+ for (i = 0; i < SUBFRAMES; i++) {
+ // Calculate cosine
+ for (j = 1; j <= LPC_ORDER; j++) {
+ int index = ptr[j] >> 7;
+ int offset = ptr[j] & 0x7f;
+ int64_t temp1 = cos_tab[index] << 16;
+ int temp2 = (cos_tab[index + 1] - cos_tab[index]) *
+ ((offset << 8) + 0x80) << 1;
+ ptr[j] = av_clipl_int32(((temp1 + temp2) << 1) + (1 << 15)) >> 16;
+ }
+
+ ff_acelp_lsp2lpc(ptr, ptr, LPC_ORDER >> 1);
+ ptr += LPC_ORDER + 1;
+ }
+}
+
static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
{
@@ -226,6 +266,7 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
int buf_size = avpkt->size;
int16_t cur_lsp[LPC_ORDER];
+ int16_t lpc[SUBFRAMES * LPC_ORDER + 4];
int bad_frame, erased_frames;
if (!buf_size || buf_size < frame_size[buf[0] & 3]) {
@@ -246,6 +287,7 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
erased_frames++;
inverse_quant(cur_lsp, p->prev_lsp, p->lsp_index, bad_frame);
+ lsp_interpolate(lpc, cur_lsp, p->prev_lsp);
}
return frame_size[p->cur_frame_type];
diff --git a/libavcodec/g723_1_data.h b/libavcodec/g723_1_data.h
index b67e6c6..4d6a9f0 100644
--- a/libavcodec/g723_1_data.h
+++ b/libavcodec/g723_1_data.h
@@ -53,6 +53,77 @@ static const int16_t dc_lsp[LPC_ORDER] = {
};
/*
+ * Cosine table scaled by 2^14
+ * FIXME: move elsewhere?
+ */
+static const int16_t cos_tab[512] = {
+ 16384, 16383, 16379, 16373, 16364, 16353, 16340, 16324,
+ 16305, 16284, 16261, 16235, 16207, 16176, 16143, 16107,
+ 16069, 16029, 15986, 15941, 15893, 15843, 15791, 15736,
+ 15679, 15619, 15557, 15493, 15426, 15357, 15286, 15213,
+ 15137, 15059, 14978, 14896, 14811, 14724, 14635, 14543,
+ 14449, 14354, 14256, 14155, 14053, 13949, 13842, 13733,
+ 13623, 13510, 13395, 13279, 13160, 13039, 12916, 12792,
+ 12665, 12537, 12406, 12274, 12140, 12004, 11866, 11727,
+ 11585, 11442, 11297, 11151, 11003, 10853, 10702, 10549,
+ 10394, 10238, 10080, 9921, 9760, 9598, 9434, 9269,
+ 9102, 8935, 8765, 8595, 8423, 8250, 8076, 7900,
+ 7723, 7545, 7366, 7186, 7005, 6823, 6639, 6455,
+ 6270, 6084, 5897, 5708, 5520, 5330, 5139, 4948,
+ 4756, 4563, 4370, 4176, 3981, 3786, 3590, 3393,
+ 3196, 2999, 2801, 2603, 2404, 2205, 2006, 1806,
+ 1606, 1406, 1205, 1005, 804, 603, 402, 201,
+ 0, -201, -402, -603, -804, -100, -1205, -1406,
+ -1606, -1806, -2006, -2205, -2404, -2603, -2801, -2999,
+ -3196, -3393, -3590, -3786, -3981, -4176, -4370, -4563,
+ -4756, -4948, -5139, -5330, -5520, -5708, -5897, -6084,
+ -6270, -6455, -6639, -6823, -7005, -7186, -7366, -7545,
+ -7723, -7900, -8076, -8250, -8423, -8595, -8765, -8935,
+ -9102, -9269, -9434, -9598, -9760, -9921, -10080, -10238,
+ -10394, -10549, -10702, -10853, -11003, -11151, -11297, -11442,
+ -11585, -11727, -11866, -12004, -12140, -12274, -12406, -12537,
+ -12665, -12792, -12916, -13039, -13160, -13279, -13395, -13510,
+ -13623, -13733, -13842, -13949, -14053, -14155, -14256, -14354,
+ -14449, -14543, -14635, -14724, -14811, -14896, -14978, -15059,
+ -15137, -15213, -15286, -15357, -15426, -15493, -15557, -15619,
+ -15679, -15736, -15791, -15843, -15893, -15941, -15986, -16029,
+ -16069, -16107, -16143, -16176, -16207, -16235, -16261, -16284,
+ -16305, -16324, -16340, -16353, -16364, -16373, -16379, -16383,
+ -16384, -16383, -16379, -16373, -16364, -16353, -16340, -16324,
+ -16305, -16284, -16261, -16235, -16207, -16176, -16143, -16107,
+ -16069, -16029, -15986, -15941, -15893, -15843, -15791, -15736,
+ -15679, -15619, -15557, -15493, -15426, -15357, -15286, -15213,
+ -15137, -15059, -14978, -14896, -14811, -14724, -14635, -14543,
+ -14449, -14354, -14256, -14155, -14053, -13949, -13842, -13733,
+ -13623, -13510, -13395, -13279, -13160, -13039, -12916, -12792,
+ -12665, -12537, -12406, -12274, -12140, -12004, -11866, -11727,
+ -11585, -11442, -11297, -11151, -11003, -10853, -10702, -10549,
+ -10394, -10238, -10080, -9921, -9760, -9598, -9434, -9269,
+ -9102, -8935, -8765, -8595, -8423, -8250, -8076, -7900,
+ -7723, -7545, -7366, -7186, -7005, -6823, -6639, -6455,
+ -6270, -6084, -5897, -5708, -5520, -5330, -5139, -4948,
+ -4756, -4563, -4370, -4176, -3981, -3786, -3590, -3393,
+ -3196, -2999, -2801, -2603, -2404, -2205, -2006, -1806,
+ -1606, -1406, -1205, -1005, -804, -603, -402, -201,
+ 0, 201, 402, 603, 804, 1005, 1205, 1406,
+ 1606, 1806, 2006, 2205, 2404, 2603, 2801, 2999,
+ 3196, 3393, 3590, 3786, 3981, 4176, 4370, 4563,
+ 4756, 4948, 5139, 5330, 5520, 5708, 5897, 6084,
+ 6270, 6455, 6639, 6823, 7005, 7186, 7366, 7545,
+ 7723, 7900, 8076, 8250, 8423, 8595, 8765, 8935,
+ 9102, 9269, 9434, 9598, 9760, 9921, 10080, 10238,
+ 10394, 10549, 10702, 10853, 11003, 11151, 11297, 11442,
+ 11585, 11727, 11866, 12004, 12140, 12274, 12406, 12537,
+ 12665, 12792, 12916, 13039, 13160, 13279, 13395, 13510,
+ 13623, 13733, 13842, 13949, 14053, 14155, 14256, 14354,
+ 14449, 14543, 14635, 14724, 14811, 14896, 14978, 15059,
+ 15137, 15213, 15286, 15357, 15426, 15493, 15557, 15619,
+ 15679, 15736, 15791, 15843, 15893, 15941, 15986, 16029,
+ 16069, 16107, 16143, 16176, 16207, 16235, 16261, 16284,
+ 16305, 16324, 16340, 16353, 16364, 16373, 16379, 16383,
+};
+
+/*
* LSP VQ tables
*/
static const int16_t lsp_band0[LSP_CB_SIZE * 3] = {
-----------------------------------------------------------------------
Summary of changes:
libavcodec/g723_1.c | 42 +++++++++++++++++++++++++++
libavcodec/g723_1_data.h | 71 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 113 insertions(+), 0 deletions(-)
--
http://github.com/naufal/ffmpeg-soc
3
2