[FFmpeg-devel] [PATCH] Remove pointless, complex and probably wrong pts-handling in ea demuxer.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Apr 7 22:29:45 CEST 2011


FFmpeg can and/or should figure out pts for audio on its own better
than what the demuxer does.
---
 libavformat/electronicarts.c |   21 ---------------------
 1 files changed, 0 insertions(+), 21 deletions(-)

diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index 6585bbe..a91224d 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -69,7 +69,6 @@ typedef struct EaDemuxContext {
 
     enum CodecID audio_codec;
     int audio_stream_index;
-    int audio_frame_counter;
 
     int bytes;
     int sample_rate;
@@ -449,7 +448,6 @@ static int ea_read_header(AVFormatContext *s,
             st->codec->bits_per_coded_sample / 4;
         st->codec->block_align = st->codec->channels*st->codec->bits_per_coded_sample;
         ea->audio_stream_index = st->index;
-        ea->audio_frame_counter = 0;
     }
 
     return 1;
@@ -493,25 +491,6 @@ static int ea_read_packet(AVFormatContext *s,
             if (ret < 0)
                 return ret;
             pkt->stream_index = ea->audio_stream_index;
-            pkt->pts = 90000;
-            pkt->pts *= ea->audio_frame_counter;
-            pkt->pts /= ea->sample_rate;
-
-            switch (ea->audio_codec) {
-            case CODEC_ID_ADPCM_EA:
-                /* 2 samples/byte, 1 or 2 samples per frame depending
-                 * on stereo; chunk also has 12-byte header */
-                ea->audio_frame_counter += ((chunk_size - 12) * 2) /
-                    ea->num_channels;
-                break;
-            case CODEC_ID_PCM_S16LE_PLANAR:
-            case CODEC_ID_MP3:
-                ea->audio_frame_counter += num_samples;
-                break;
-            default:
-                ea->audio_frame_counter += chunk_size /
-                    (ea->bytes * ea->num_channels);
-            }
 
             packet_read = 1;
             break;
-- 
1.7.4.1



More information about the ffmpeg-devel mailing list