[FFmpeg-soc] [soc]: r5294 - in concat: ffmpeg.c.diff libavformat/avplaylist.c libavformat/avplaylist.h libavformat/concatgen.c libavformat/playlist.c libavformat/playlist.h

gkovacs subversion at mplayerhq.hu
Wed Aug 26 08:42:54 CEST 2009


Author: gkovacs
Date: Wed Aug 26 08:42:54 2009
New Revision: 5294

Log:
move localstidx_from_streamidx out of public header

Modified:
   concat/ffmpeg.c.diff
   concat/libavformat/avplaylist.c
   concat/libavformat/avplaylist.h
   concat/libavformat/concatgen.c
   concat/libavformat/playlist.c
   concat/libavformat/playlist.h

Modified: concat/ffmpeg.c.diff
==============================================================================
--- concat/ffmpeg.c.diff	Wed Aug 26 08:32:17 2009	(r5293)
+++ concat/ffmpeg.c.diff	Wed Aug 26 08:42:54 2009	(r5294)
@@ -1,5 +1,5 @@
 diff --git a/ffmpeg.c b/ffmpeg.c
-index 2686e1d..b2bbcd6 100644
+index 2686e1d..9b6eac3 100644
 --- a/ffmpeg.c
 +++ b/ffmpeg.c
 @@ -40,6 +40,7 @@
@@ -20,7 +20,7 @@ index 2686e1d..b2bbcd6 100644
  {
      AVFormatContext *os;
      AVOutputStream *ost;
-@@ -1248,8 +1250,16 @@ static int output_packet(AVInputStream *ist, int ist_index,
+@@ -1248,8 +1250,20 @@ static int output_packet(AVInputStream *ist, int ist_index,
      static unsigned int samples_size= 0;
      AVSubtitle subtitle, *subtitle_to_free;
      int got_subtitle;
@@ -32,13 +32,17 @@ index 2686e1d..b2bbcd6 100644
 +        !strncmp(ic->iformat->long_name, "CONCAT", 6))
 +        pl_ctx = ic->priv_data;
 +    if (pl_ctx && pkt) {
++        unsigned int stream_total = 0;
++        for (i = 0; pkt->stream_index >= stream_total; ++i) {
++            stream_offset = stream_total;
++            stream_total = pl_ctx->nb_streams_list[i];
++        }
 +        ist->st = ic->streams[pkt->stream_index];
-+        stream_offset = pkt->stream_index - av_playlist_localstidx_from_streamidx(pl_ctx, pkt->stream_index);
 +    }
      if(ist->next_pts == AV_NOPTS_VALUE)
          ist->next_pts= ist->pts;
  
-@@ -1397,7 +1407,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
+@@ -1397,7 +1411,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
                  int frame_size;
  
                  ost = ost_table[i];
@@ -47,25 +51,26 @@ index 2686e1d..b2bbcd6 100644
                      os = output_files[ost->file_index];
  
                      /* set the input output pts pairs */
-@@ -2149,6 +2159,8 @@ static int av_encode(AVFormatContext **output_files,
+@@ -2149,6 +2163,8 @@ static int av_encode(AVFormatContext **output_files,
          AVPacket pkt;
          double ipts_min;
          double opts_min;
-+        AVPlaylistContext *pl_ctx;
-+        int stream_offset;
++        AVPlaylistContext *pl_ctx = NULL;
++        int stream_offset = 0;
  
      redo:
          ipts_min= 1e100;
-@@ -2234,12 +2246,46 @@ static int av_encode(AVFormatContext **output_files,
+@@ -2234,12 +2250,48 @@ static int av_encode(AVFormatContext **output_files,
          if (do_pkt_dump) {
              av_pkt_dump_log(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump);
          }
 +
-+        pl_ctx = NULL;
++        stream_offset = 0;
 +        if (is && is->iformat && is->iformat->long_name && is->priv_data &&
 +        !strncmp(is->iformat->long_name, "CONCAT", 6))
 +            pl_ctx = is->priv_data;
 +        if (pl_ctx) {
++            unsigned int stream_total = 0;
 +            if (pkt.stream_index >= nb_istreams &&
 +                pkt.stream_index < is->nb_streams &&
 +                pkt.stream_index > 0 &&
@@ -88,9 +93,10 @@ index 2686e1d..b2bbcd6 100644
 +                ist->next_pts        = AV_NOPTS_VALUE;
 +                input_files_ts_scale[file_index][pkt.stream_index] = 0.0L;
 +            }
-+            stream_offset = pkt.stream_index - av_playlist_localstidx_from_streamidx(pl_ctx, pkt.stream_index);
-+        } else {
-+            stream_offset = 0;
++            for (i = 0; pkt.stream_index >= stream_total; ++i) {
++                stream_offset = stream_total;
++                stream_total = pl_ctx->nb_streams_list[i];
++            }
 +        }
 +
          /* the following test is needed in case new streams appear
@@ -104,7 +110,7 @@ index 2686e1d..b2bbcd6 100644
          if (ist->discard)
              goto discard_packet;
  
-@@ -2271,8 +2317,7 @@ static int av_encode(AVFormatContext **output_files,
+@@ -2271,8 +2323,7 @@ static int av_encode(AVFormatContext **output_files,
          }
  
          //fprintf(stderr,"read #%d.%d size=%d\n", ist->file_index, ist->index, pkt.size);
@@ -114,7 +120,7 @@ index 2686e1d..b2bbcd6 100644
              if (verbose >= 0)
                  fprintf(stderr, "Error while decoding stream #%d.%d\n",
                          ist->file_index, ist->index);
-@@ -2293,7 +2338,7 @@ static int av_encode(AVFormatContext **output_files,
+@@ -2293,7 +2344,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/libavformat/avplaylist.c
==============================================================================
--- concat/libavformat/avplaylist.c	Wed Aug 26 08:32:17 2009	(r5293)
+++ concat/libavformat/avplaylist.c	Wed Aug 26 08:42:54 2009	(r5294)
@@ -145,14 +145,3 @@ void av_playlist_relative_paths(char **f
             flist[i] = full_file_path;
     }
 }
-
-int av_playlist_localstidx_from_streamidx(AVPlaylistContext *ctx, int stream_index)
-{
-    unsigned int i, stream_total, stream_offset;
-    stream_total = stream_offset = 0;
-    for (i = 0; stream_index >= stream_total; ++i) {
-        stream_offset = stream_total;
-        stream_total = ctx->nb_streams_list[i];
-    }
-    return stream_index - stream_offset;
-}

Modified: concat/libavformat/avplaylist.h
==============================================================================
--- concat/libavformat/avplaylist.h	Wed Aug 26 08:32:17 2009	(r5293)
+++ concat/libavformat/avplaylist.h	Wed Aug 26 08:42:54 2009	(r5294)
@@ -77,11 +77,4 @@ int av_playlist_split_encodedstring(cons
  */
 int av_playlist_add_path(AVPlaylistContext *ctx, const char *itempath);
 
-/** @brief Calculates the local stream index which corresponds to a global stream index.
- *  @param ctx AVPlaylistContext within which the list of playlist elements and durations are stored.
- *  @param stream_index Global stream index, the index of the stream within the playlist demuxer.
- *  @return Returns the local stream index, the index of the stream within the child demuxer.
- */
-int av_playlist_localstidx_from_streamidx(AVPlaylistContext *ctx, int stream_index);
-
 #endif /* AVFORMAT_AVPLAYLIST_H */

Modified: concat/libavformat/concatgen.c
==============================================================================
--- concat/libavformat/concatgen.c	Wed Aug 26 08:32:17 2009	(r5293)
+++ concat/libavformat/concatgen.c	Wed Aug 26 08:42:54 2009	(r5294)
@@ -57,7 +57,7 @@ int ff_concatgen_read_packet(AVFormatCon
                 int streams_offset = 0;
                 if (ctx->pe_curidx > 0)
                     streams_offset = ctx->nb_streams_list[ctx->pe_curidx - 1];
-                stream_index = av_playlist_localstidx_from_streamidx(ctx, pkt->stream_index);
+                stream_index = ff_playlist_localstidx_from_streamidx(ctx, pkt->stream_index);
                 pkt->stream_index = stream_index + streams_offset;
                 if (!ic->streams[stream_index]->codec->has_b_frames ||
                     ic->streams[stream_index]->codec->codec->id == CODEC_ID_MPEG1VIDEO) {

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Wed Aug 26 08:32:17 2009	(r5293)
+++ concat/libavformat/playlist.c	Wed Aug 26 08:42:54 2009	(r5294)
@@ -150,3 +150,14 @@ int ff_playlist_stream_index_from_time(A
         *localpts = pts-(total-ctx->durations[i-1]);
     return i;
 }
+
+int ff_playlist_localstidx_from_streamidx(AVPlaylistContext *ctx, int stream_index)
+{
+    unsigned int i, stream_total, stream_offset;
+    stream_total = stream_offset = 0;
+    for (i = 0; stream_index >= stream_total; ++i) {
+        stream_offset = stream_total;
+        stream_total = ctx->nb_streams_list[i];
+    }
+    return stream_index - stream_offset;
+}

Modified: concat/libavformat/playlist.h
==============================================================================
--- concat/libavformat/playlist.h	Wed Aug 26 08:32:17 2009	(r5293)
+++ concat/libavformat/playlist.h	Wed Aug 26 08:42:54 2009	(r5294)
@@ -68,5 +68,12 @@ int ff_playlist_stream_index_from_time(A
                                        int64_t pts,
                                        int64_t *localpts);
 
+/** @brief Calculates the local stream index which corresponds to a global stream index.
+ *  @param ctx AVPlaylistContext within which the list of playlist elements and durations are stored.
+ *  @param stream_index Global stream index, the index of the stream within the playlist demuxer.
+ *  @return Returns the local stream index, the index of the stream within the child demuxer.
+ */
+int ff_playlist_localstidx_from_streamidx(AVPlaylistContext *ctx, int stream_index);
+
 #endif /* AVFORMAT_PLAYLIST_H */
 


More information about the FFmpeg-soc mailing list