[FFmpeg-soc] [soc]: r4899 - in concat: ffmpeg.c.diff libavformat/utils.c.diff
gkovacs
subversion at mplayerhq.hu
Sun Aug 2 03:16:46 CEST 2009
Author: gkovacs
Date: Sun Aug 2 03:16:46 2009
New Revision: 4899
Log:
moved comma-based playlist detection from opt_input_file in ffmpeg.c to av_open_input_file utils.c for reusability
Modified:
concat/ffmpeg.c.diff
concat/libavformat/utils.c.diff
Modified: concat/ffmpeg.c.diff
==============================================================================
--- concat/ffmpeg.c.diff Sun Aug 2 03:08:31 2009 (r4898)
+++ concat/ffmpeg.c.diff Sun Aug 2 03:16:46 2009 (r4899)
@@ -1,17 +1,8 @@
diff --git a/ffmpeg.c b/ffmpeg.c
-index e899180..d9b2691 100644
+index e899180..e5f27cd 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
-@@ -70,6 +70,8 @@
-
- #undef exit
-
-+#include "libavformat/concat.h"
-+
- const char program_name[] = "FFmpeg";
- const int program_birth_year = 2000;
-
-@@ -1237,7 +1239,8 @@ static void print_report(AVFormatContext **output_files,
+@@ -1237,7 +1237,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,
@@ -21,7 +12,7 @@ index e899180..d9b2691 100644
{
AVFormatContext *os;
AVOutputStream *ost;
-@@ -1250,7 +1253,24 @@ static int output_packet(AVInputStream *ist, int ist_index,
+@@ -1250,7 +1251,24 @@ static int output_packet(AVInputStream *ist, int ist_index,
AVSubtitle subtitle, *subtitle_to_free;
int got_subtitle;
AVPacket avpkt;
@@ -47,7 +38,7 @@ index e899180..d9b2691 100644
if(ist->next_pts == AV_NOPTS_VALUE)
ist->next_pts= ist->pts;
-@@ -2278,8 +2298,7 @@ static int av_encode(AVFormatContext **output_files,
+@@ -2278,8 +2296,7 @@ static int av_encode(AVFormatContext **output_files,
}
//fprintf(stderr,"read #%d.%d size=%d\n", ist->file_index, ist->index, pkt.size);
@@ -57,7 +48,7 @@ index e899180..d9b2691 100644
if (verbose >= 0)
fprintf(stderr, "Error while decoding stream #%d.%d\n",
ist->file_index, ist->index);
-@@ -2300,7 +2319,7 @@ static int av_encode(AVFormatContext **output_files,
+@@ -2300,7 +2317,7 @@ static int av_encode(AVFormatContext **output_files,
for(i=0;i<nb_istreams;i++) {
ist = ist_table[i];
if (ist->decoding_needed) {
@@ -66,39 +57,9 @@ index e899180..d9b2691 100644
}
}
-@@ -2849,6 +2868,7 @@ static enum CodecID find_codec_or_die(const char *name, int type, int encoder)
- static void opt_input_file(const char *filename)
- {
- AVFormatContext *ic;
-+ PlaylistContext *playlist_ctx;
- AVFormatParameters params, *ap = ¶ms;
- int err, i, ret, rfps, rfps_base;
- int64_t timestamp;
-@@ -2886,12 +2906,24 @@ static void opt_input_file(const char *filename)
- ic->subtitle_codec_id= find_codec_or_die(subtitle_codec_name, CODEC_TYPE_SUBTITLE, 0);
- ic->flags |= AVFMT_FLAG_NONBLOCK;
-
-- /* open the input file with generic libav function */
-- err = av_open_input_file(&ic, filename, file_iformat, 0, ap);
-- if (err < 0) {
-- print_error(filename, err);
-- av_exit(1);
-+ playlist_ctx = ff_playlist_from_encodedstring(filename, ',');
-+ if (playlist_ctx) {
-+ av_log(ic, AV_LOG_DEBUG, "Generating playlist from %s\n", filename);
-+ av_strlcpy(ic->filename, filename, sizeof(ic->filename));
-+ ic->iformat = ff_concat_alloc_demuxer();
-+ ff_playlist_set_context(ic, playlist_ctx);
-+ ff_playlist_populate_context(playlist_ctx, playlist_ctx->pe_curidx);
-+ ff_playlist_set_streams(ic);
-+ err = 0;
-+ } else {
-+ /* open the input file with generic libav function */
-+ err = av_open_input_file(&ic, filename, file_iformat, 0, ap);
-+ if (err < 0) {
-+ print_error(filename, err);
-+ av_exit(1);
-+ }
+@@ -2892,6 +2909,7 @@ static void opt_input_file(const char *filename)
+ print_error(filename, err);
+ av_exit(1);
}
+
if(opt_programid) {
Modified: concat/libavformat/utils.c.diff
==============================================================================
--- concat/libavformat/utils.c.diff Sun Aug 2 03:08:31 2009 (r4898)
+++ concat/libavformat/utils.c.diff Sun Aug 2 03:16:46 2009 (r4899)
@@ -1,8 +1,42 @@
diff --git a/libavformat/utils.c b/libavformat/utils.c
-index 0c1a50d..280bcb7 100644
+index 0c1a50d..be7a0fd 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
-@@ -910,6 +910,10 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
+@@ -27,6 +27,7 @@
+ #include <sys/time.h>
+ #include <time.h>
+ #include <strings.h>
++#include "concat.h"
+
+ #undef NDEBUG
+ #include <assert.h>
+@@ -433,6 +434,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
+ AVFormatParameters *ap)
+ {
+ int err, probe_size;
++ PlaylistContext *playlist_ctx;
+ AVProbeData probe_data, *pd = &probe_data;
+ ByteIOContext *pb = NULL;
+
+@@ -442,6 +444,17 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
+ pd->buf = NULL;
+ pd->buf_size = 0;
+
++ playlist_ctx = ff_playlist_from_encodedstring(filename, ',');
++ if (playlist_ctx) {
++ av_log((*ic_ptr), AV_LOG_DEBUG, "Generating playlist from %s\n", filename);
++ av_strlcpy((*ic_ptr)->filename, filename, sizeof((*ic_ptr)->filename));
++ (*ic_ptr)->iformat = ff_concat_alloc_demuxer();
++ ff_playlist_set_context((*ic_ptr), playlist_ctx);
++ ff_playlist_populate_context(playlist_ctx, playlist_ctx->pe_curidx);
++ ff_playlist_set_streams((*ic_ptr));
++ return 0;
++ }
++
+ if (!fmt) {
+ /* guess format if no file can be opened */
+ fmt = av_probe_input_format(pd, 0);
+@@ -910,6 +923,10 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
{
AVStream *st;
int len, ret, i;
@@ -13,7 +47,7 @@ index 0c1a50d..280bcb7 100644
av_init_packet(pkt);
-@@ -943,8 +947,14 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
+@@ -943,8 +960,14 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
/* return packet if any */
if (pkt->size) {
got_packet:
@@ -29,7 +63,7 @@ index 0c1a50d..280bcb7 100644
pkt->pts = st->parser->pts;
pkt->dts = st->parser->dts;
pkt->pos = st->parser->pos;
-@@ -980,8 +990,11 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
+@@ -980,8 +1003,11 @@ 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