aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/segafilm.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2015-06-23 13:48:08 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-06-24 14:45:09 +0100
commitded5957d75def70d2f1fc1c1eae079230004974b (patch)
tree96f074c04010dd6923e1b5272575207fc8d59f77 /libavformat/segafilm.c
parent5a79bf0284a37855636390e620d189a964214c9e (diff)
downloadffmpeg-ded5957d75def70d2f1fc1c1eae079230004974b.tar.gz
segafilm: Remove deplanarization hack
Signed-off-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavformat/segafilm.c')
-rw-r--r--libavformat/segafilm.c50
1 files changed, 2 insertions, 48 deletions
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index 04b817789d..420919708c 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -61,10 +61,6 @@ typedef struct FilmDemuxContext {
unsigned int base_clock;
unsigned int version;
-
- /* buffer used for interleaving stereo PCM data */
- unsigned char *stereo_buffer;
- int stereo_buffer_size;
} FilmDemuxContext;
static int film_probe(AVProbeData *p)
@@ -80,7 +76,6 @@ static int film_read_close(AVFormatContext *s)
FilmDemuxContext *film = s->priv_data;
av_freep(&film->sample_table);
- av_freep(&film->stereo_buffer);
return 0;
}
@@ -96,8 +91,6 @@ static int film_read_header(AVFormatContext *s)
unsigned int audio_frame_counter;
film->sample_table = NULL;
- film->stereo_buffer = NULL;
- film->stereo_buffer_size = 0;
/* load the main FILM header */
if (avio_read(pb, scratch, 16) != 16)
@@ -131,9 +124,9 @@ static int film_read_header(AVFormatContext *s)
film->audio_type = AV_CODEC_ID_ADPCM_ADX;
else if (film->audio_channels > 0) {
if (film->audio_bits == 8)
- film->audio_type = AV_CODEC_ID_PCM_S8;
+ film->audio_type = AV_CODEC_ID_PCM_S8_PLANAR;
else if (film->audio_bits == 16)
- film->audio_type = AV_CODEC_ID_PCM_S16BE;
+ film->audio_type = AV_CODEC_ID_PCM_S16BE_PLANAR;
else
film->audio_type = AV_CODEC_ID_NONE;
} else
@@ -265,8 +258,6 @@ static int film_read_packet(AVFormatContext *s,
AVIOContext *pb = s->pb;
film_sample *sample;
int ret = 0;
- int i;
- int left, right;
if (film->current_sample >= film->sample_count)
return AVERROR(EIO);
@@ -283,43 +274,6 @@ static int film_read_packet(AVFormatContext *s,
if (av_new_packet(pkt, sample->sample_size))
return AVERROR(ENOMEM);
avio_read(pb, pkt->data, sample->sample_size);
- } else if ((sample->stream == film->audio_stream_index) &&
- (film->audio_channels == 2) &&
- (film->audio_type != AV_CODEC_ID_ADPCM_ADX)) {
- /* stereo PCM needs to be interleaved */
-
- if (av_new_packet(pkt, sample->sample_size))
- return AVERROR(ENOMEM);
-
- /* make sure the interleave buffer is large enough */
- if (sample->sample_size > film->stereo_buffer_size) {
- av_free(film->stereo_buffer);
- film->stereo_buffer_size = sample->sample_size;
- film->stereo_buffer = av_malloc(film->stereo_buffer_size);
- if (!film->stereo_buffer) {
- film->stereo_buffer_size = 0;
- return AVERROR(ENOMEM);
- }
- }
-
- pkt->pos= avio_tell(pb);
- ret = avio_read(pb, film->stereo_buffer, sample->sample_size);
- if (ret != sample->sample_size)
- ret = AVERROR(EIO);
-
- left = 0;
- right = sample->sample_size / 2;
- for (i = 0; i < sample->sample_size; ) {
- if (film->audio_bits == 8) {
- pkt->data[i++] = film->stereo_buffer[left++];
- pkt->data[i++] = film->stereo_buffer[right++];
- } else {
- pkt->data[i++] = film->stereo_buffer[left++];
- pkt->data[i++] = film->stereo_buffer[left++];
- pkt->data[i++] = film->stereo_buffer[right++];
- pkt->data[i++] = film->stereo_buffer[right++];
- }
- }
} else {
ret= av_get_packet(pb, pkt, sample->sample_size);
if (ret != sample->sample_size)