[FFmpeg-soc] [soc]: r5082 - in concat: ffmpeg.c.diff libavcodec/avcodec.h.diff libavformat/concatgen.c libavformat/utils.c.diff
gkovacs
subversion at mplayerhq.hu
Thu Aug 13 21:28:01 CEST 2009
Author: gkovacs
Date: Thu Aug 13 21:28:01 2009
New Revision: 5082
Log:
removed index_offset from AVPacket
Modified:
concat/ffmpeg.c.diff
concat/libavcodec/avcodec.h.diff
concat/libavformat/concatgen.c
concat/libavformat/utils.c.diff
Modified: concat/ffmpeg.c.diff
==============================================================================
--- concat/ffmpeg.c.diff Thu Aug 13 21:12:24 2009 (r5081)
+++ concat/ffmpeg.c.diff Thu Aug 13 21:28:01 2009 (r5082)
@@ -1,8 +1,16 @@
diff --git a/ffmpeg.c b/ffmpeg.c
-index e899180..51f100e 100644
+index e899180..289bfa2 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
-@@ -1237,7 +1237,8 @@ static void print_report(AVFormatContext **output_files,
+@@ -40,6 +40,7 @@
+ #include "libavutil/fifo.h"
+ #include "libavutil/avstring.h"
+ #include "libavformat/os_support.h"
++#include "libavformat/concat.h"
+
+ #if HAVE_SYS_RESOURCE_H
+ #include <sys/types.h>
+@@ -1237,7 +1238,8 @@ static void print_report(AVFormatContext **output_files,
/* pkt = NULL means EOF (needed to flush decoder buffers) */
static int output_packet(AVInputStream *ist, int ist_index,
AVOutputStream **ost_table, int nb_ostreams,
@@ -12,22 +20,23 @@ index e899180..51f100e 100644
{
AVFormatContext *os;
AVOutputStream *ost;
-@@ -1249,8 +1250,14 @@ static int output_packet(AVInputStream *ist, int ist_index,
+@@ -1249,8 +1251,15 @@ static int output_packet(AVInputStream *ist, int ist_index,
static unsigned int samples_size= 0;
AVSubtitle subtitle, *subtitle_to_free;
int got_subtitle;
-+ int offset = 0;
++ int stream_offset = 0;
AVPacket avpkt;
++ PlaylistContext *pl_ctx = ff_playlist_get_context(is);
-+ if (pkt) {
++ if (pl_ctx && pkt) {
+ ist->st = is->streams[pkt->stream_index];
-+ offset = pkt->index_offset;
++ stream_offset = pkt->stream_index - ff_playlist_localstidx_from_streamidx(pl_ctx, pkt->stream_index);
+ }
+
if(ist->next_pts == AV_NOPTS_VALUE)
ist->next_pts= ist->pts;
-@@ -1292,6 +1299,15 @@ static int output_packet(AVInputStream *ist, int ist_index,
+@@ -1292,6 +1301,15 @@ static int output_packet(AVInputStream *ist, int ist_index,
endianness as CPU */
ret = avcodec_decode_audio3(ist->st->codec, samples, &data_size,
&avpkt);
@@ -43,7 +52,7 @@ index e899180..51f100e 100644
if (ret < 0)
goto fail_decode;
avpkt.data += ret;
-@@ -1314,6 +1330,12 @@ static int output_packet(AVInputStream *ist, int ist_index,
+@@ -1314,6 +1332,12 @@ static int output_packet(AVInputStream *ist, int ist_index,
ret = avcodec_decode_video2(ist->st->codec,
&picture, &got_picture, &avpkt);
ist->st->quality= picture.quality;
@@ -56,43 +65,57 @@ index e899180..51f100e 100644
if (ret < 0)
goto fail_decode;
if (!got_picture) {
-@@ -1398,7 +1420,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
+@@ -1398,7 +1422,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
int frame_size;
ost = ost_table[i];
- if (ost->source_index == ist_index) {
-+ if (ost->source_index == ist_index - offset) {
++ if (ost->source_index == ist_index - stream_offset) {
os = output_files[ost->file_index];
#if 0
-@@ -2241,12 +2263,39 @@ static int av_encode(AVFormatContext **output_files,
+@@ -2156,6 +2180,8 @@ static int av_encode(AVFormatContext **output_files,
+ AVPacket pkt;
+ double ipts_min;
+ double opts_min;
++ PlaylistContext *pl_ctx;
++ int stream_offset;
+
+ redo:
+ ipts_min= 1e100;
+@@ -2241,12 +2267,44 @@ static int av_encode(AVFormatContext **output_files,
if (do_pkt_dump) {
av_pkt_dump_log(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump);
}
+
-+ if (pkt.stream_index >= nb_istreams &&
-+ pkt.stream_index < is->nb_streams &&
-+ pkt.stream_index > 0 &&
-+ is->streams[pkt.stream_index]) {
-+ ist_table = av_realloc(ist_table, sizeof(*ist_table) * (pkt.stream_index + 1));
-+ for (i = nb_istreams; i < pkt.stream_index + 1; ++i)
-+ ist_table[i] = NULL;
-+ file_table[file_index].nb_streams = file_table[file_index].ist_index + pkt.stream_index + 1;
-+ nb_istreams = file_table[file_index].ist_index + pkt.stream_index + 1;
-+ }
-+
-+ if (!ist_table[pkt.stream_index]) {
-+ ist = ist_table[pkt.stream_index] = av_mallocz(sizeof(AVInputStream));
-+ ist->st = is->streams[pkt.stream_index];
-+ ist->file_index = file_index;
-+ ist->decoding_needed = 1;
-+ ist->is_start = 1;
-+ ist->discard = 0;
-+ ist->sample_index = 0;
-+ ist->index = file_table[file_index].ist_index + pkt.stream_index;
-+ ist->pts = 0;
-+ ist->next_pts = AV_NOPTS_VALUE;
-+ input_files_ts_scale[file_index][pkt.stream_index] = 0.0L;
++ pl_ctx = ff_playlist_get_context(is);
++ if (pl_ctx) {
++ if (pkt.stream_index >= nb_istreams &&
++ pkt.stream_index < is->nb_streams &&
++ pkt.stream_index > 0 &&
++ is->streams[pkt.stream_index]) {
++ ist_table = av_realloc(ist_table, sizeof(*ist_table) * (pkt.stream_index + 1));
++ for (i = nb_istreams; i < pkt.stream_index + 1; ++i)
++ ist_table[i] = NULL;
++ file_table[file_index].nb_streams = file_table[file_index].ist_index + pkt.stream_index + 1;
++ nb_istreams = file_table[file_index].ist_index + pkt.stream_index + 1;
++ }
++ if (!ist_table[pkt.stream_index]) {
++ ist = ist_table[pkt.stream_index] = av_mallocz(sizeof(AVInputStream));
++ ist->st = is->streams[pkt.stream_index];
++ ist->file_index = file_index;
++ ist->decoding_needed = 1;
++ ist->is_start = 1;
++ ist->discard = 0;
++ ist->sample_index = 0;
++ ist->index = file_table[file_index].ist_index + pkt.stream_index;
++ ist->pts = 0;
++ ist->next_pts = AV_NOPTS_VALUE;
++ input_files_ts_scale[file_index][pkt.stream_index] = 0.0L;
++ }
++ stream_offset = pkt.stream_index - ff_playlist_localstidx_from_streamidx(pl_ctx, pkt.stream_index);
++ } else {
++ stream_offset = 0;
+ }
+
/* the following test is needed in case new streams appear
@@ -102,11 +125,11 @@ index e899180..51f100e 100644
+
ist_index = file_table[file_index].ist_index + pkt.stream_index;
- ist = ist_table[ist_index];
-+ ist = ist_table[ist_index - pkt.index_offset];
++ ist = ist_table[ist_index - stream_offset];
if (ist->discard)
goto discard_packet;
-@@ -2278,8 +2327,7 @@ static int av_encode(AVFormatContext **output_files,
+@@ -2278,8 +2336,7 @@ static int av_encode(AVFormatContext **output_files,
}
//fprintf(stderr,"read #%d.%d size=%d\n", ist->file_index, ist->index, pkt.size);
@@ -116,7 +139,7 @@ index e899180..51f100e 100644
if (verbose >= 0)
fprintf(stderr, "Error while decoding stream #%d.%d\n",
ist->file_index, ist->index);
-@@ -2300,7 +2348,7 @@ static int av_encode(AVFormatContext **output_files,
+@@ -2300,7 +2357,7 @@ static int av_encode(AVFormatContext **output_files,
for(i=0;i<nb_istreams;i++) {
ist = ist_table[i];
if (ist->decoding_needed) {
Modified: concat/libavcodec/avcodec.h.diff
==============================================================================
--- concat/libavcodec/avcodec.h.diff Thu Aug 13 21:12:24 2009 (r5081)
+++ concat/libavcodec/avcodec.h.diff Thu Aug 13 21:28:01 2009 (r5082)
@@ -1,16 +1,8 @@
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
-index 8eb7c3c..b239418 100644
+index 8eb7c3c..bcc942a 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
-@@ -951,6 +951,7 @@ typedef struct AVPacket {
- * subtitles are correctly displayed after seeking.
- */
- int64_t convergence_duration;
-+ int index_offset;
- } AVPacket;
- #define AV_PKT_FLAG_KEY 0x0001
- #if LIBAVCODEC_VERSION_MAJOR < 53
-@@ -3714,6 +3715,7 @@ int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
+@@ -3714,6 +3714,7 @@ int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
#define AVERROR_NOTSUPP AVERROR(ENOSYS) /**< Operation not supported. */
#define AVERROR_NOENT AVERROR(ENOENT) /**< No such file or directory. */
#define AVERROR_EOF AVERROR(EPIPE) /**< End of file. */
Modified: concat/libavformat/concatgen.c
==============================================================================
--- concat/libavformat/concatgen.c Thu Aug 13 21:12:24 2009 (r5081)
+++ concat/libavformat/concatgen.c Thu Aug 13 21:28:01 2009 (r5082)
@@ -53,8 +53,7 @@ int ff_concatgen_read_packet(AVFormatCon
if (ret >= 0) {
if (pkt) {
stream_index = pkt->stream_index;
- pkt->index_offset = ff_playlist_streams_offset_from_playidx(ctx, ctx->pe_curidx);
- pkt->stream_index += pkt->index_offset;
+ pkt->stream_index += ff_playlist_streams_offset_from_playidx(ctx, ctx->pe_curidx);
if (!ic->streams[stream_index]->codec->has_b_frames) {
pkt->dts += av_rescale_q(ff_playlist_time_offset(ctx->durations, ctx->pe_curidx),
AV_TIME_BASE_Q,
Modified: concat/libavformat/utils.c.diff
==============================================================================
--- concat/libavformat/utils.c.diff Thu Aug 13 21:12:24 2009 (r5081)
+++ concat/libavformat/utils.c.diff Thu Aug 13 21:28:01 2009 (r5082)
@@ -1,5 +1,5 @@
diff --git a/libavformat/utils.c b/libavformat/utils.c
-index 0c1a50d..85c8ec0 100644
+index 0c1a50d..f1b86a3 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -27,6 +27,7 @@
@@ -46,41 +46,34 @@ index 0c1a50d..85c8ec0 100644
/* Do not open file if the format does not need it. XXX: specific
hack needed to handle RTSP/TCP */
if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {
-@@ -909,7 +932,12 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
- static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
+@@ -910,6 +933,8 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
{
AVStream *st;
-- int len, ret, i;
-+ int len, ret, i, offset;
+ int len, ret, i;
+ int stream_index;
-+ AVStream *stream;
+ stream_index = 0;
-+ stream = 0;
-+ offset = 0;
av_init_packet(pkt);
-@@ -943,8 +971,9 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
+@@ -943,8 +968,8 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
/* return packet if any */
if (pkt->size) {
got_packet:
+ pkt->stream_index = stream_index;
-+ pkt->index_offset = offset;
pkt->duration = 0;
- pkt->stream_index = st->index;
pkt->pts = st->parser->pts;
pkt->dts = st->parser->dts;
pkt->pos = st->parser->pos;
-@@ -968,6 +997,8 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
+@@ -968,6 +993,7 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
AVPacket cur_pkt;
/* read next packet */
ret = av_read_packet(s, &cur_pkt);
-+ offset = cur_pkt.index_offset;
+ stream_index = cur_pkt.stream_index;
if (ret < 0) {
if (ret == AVERROR(EAGAIN))
return ret;
-@@ -980,8 +1011,9 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
+@@ -980,8 +1006,9 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
NULL, 0,
AV_NOPTS_VALUE, AV_NOPTS_VALUE,
AV_NOPTS_VALUE);
More information about the FFmpeg-soc
mailing list