aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2009-09-16 11:35:01 +0000
committerPeter Ross <pross@xvid.org>2009-09-16 11:35:01 +0000
commit2d423666c0c01e26c64ab515078c0120945a85dc (patch)
tree53096a782d7e2534cb7ddb7e3936ced44864b867
parentfa77dd639da796b32d84bed2a00d64b2dd434707 (diff)
downloadffmpeg-2d423666c0c01e26c64ab515078c0120945a85dc.tar.gz
Make mov LPCM and AAC parsing functions public
Originally committed as revision 19878 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/isom.h4
-rw-r--r--libavformat/mov.c35
2 files changed, 24 insertions, 15 deletions
diff --git a/libavformat/isom.h b/libavformat/isom.h
index 445a900b05..7799a09257 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -137,4 +137,8 @@ typedef struct MOVContext {
int itunes_metadata; ///< metadata are itunes style
} MOVContext;
+int ff_mp4_read_descr_len(ByteIOContext *pb);
+int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom);
+enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags);
+
#endif /* AVFORMAT_ISOM_H */
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 05fdfa3336..dc22597624 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -358,7 +358,7 @@ static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0;
}
-static int mp4_read_descr_len(ByteIOContext *pb)
+int ff_mp4_read_descr_len(ByteIOContext *pb)
{
int len = 0;
int count = 4;
@@ -371,12 +371,12 @@ static int mp4_read_descr_len(ByteIOContext *pb)
return len;
}
-static int mp4_read_descr(MOVContext *c, ByteIOContext *pb, int *tag)
+int mp4_read_descr(AVFormatContext *fc, ByteIOContext *pb, int *tag)
{
int len;
*tag = get_byte(pb);
- len = mp4_read_descr_len(pb);
- dprintf(c->fc, "MPEG4 description: tag=0x%02x len=%d\n", *tag, len);
+ len = ff_mp4_read_descr_len(pb);
+ dprintf(fc, "MPEG4 description: tag=0x%02x len=%d\n", *tag, len);
return len;
}
@@ -393,24 +393,24 @@ static const AVCodecTag mp4_audio_types[] = {
{ CODEC_ID_NONE, AOT_NULL },
};
-static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom)
{
AVStream *st;
int tag, len;
- if (c->fc->nb_streams < 1)
+ if (fc->nb_streams < 1)
return 0;
- st = c->fc->streams[c->fc->nb_streams-1];
+ st = fc->streams[fc->nb_streams-1];
get_be32(pb); /* version + flags */
- len = mp4_read_descr(c, pb, &tag);
+ len = mp4_read_descr(fc, pb, &tag);
if (tag == MP4ESDescrTag) {
get_be16(pb); /* ID */
get_byte(pb); /* priority */
} else
get_be16(pb); /* ID */
- len = mp4_read_descr(c, pb, &tag);
+ len = mp4_read_descr(fc, pb, &tag);
if (tag == MP4DecConfigDescrTag) {
int object_type_id = get_byte(pb);
get_byte(pb); /* stream type */
@@ -419,10 +419,10 @@ static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
get_be32(pb); /* avg bitrate */
st->codec->codec_id= ff_codec_get_id(ff_mp4_obj_type, object_type_id);
- dprintf(c->fc, "esds object type id %d\n", object_type_id);
- len = mp4_read_descr(c, pb, &tag);
+ dprintf(fc, "esds object type id %d\n", object_type_id);
+ len = mp4_read_descr(fc, pb, &tag);
if (tag == MP4DecSpecificDescrTag) {
- dprintf(c->fc, "Specific MPEG4 header len=%d\n", len);
+ dprintf(fc, "Specific MPEG4 header len=%d\n", len);
if((uint64_t)len > (1<<30))
return -1;
st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
@@ -441,7 +441,7 @@ static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
st->codec->sample_rate = ff_mpa_freq_tab[cfg.sampling_index];
else
st->codec->sample_rate = cfg.sample_rate; // ext sample rate ?
- dprintf(c->fc, "mp4a config channels %d obj %d ext obj %d "
+ dprintf(fc, "mp4a config channels %d obj %d ext obj %d "
"sample rate %d ext sample rate %d\n", st->codec->channels,
cfg.object_type, cfg.ext_object_type,
cfg.sample_rate, cfg.ext_sample_rate);
@@ -454,6 +454,11 @@ static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0;
}
+static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+{
+ return ff_mov_read_esds(c->fc, pb, atom);
+}
+
static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
{
const int num = get_be32(pb);
@@ -760,7 +765,7 @@ static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
* Compute codec id for 'lpcm' tag.
* See CoreAudioTypes and AudioStreamBasicDescription at Apple.
*/
-static enum CodecID mov_get_lpcm_codec_id(int bps, int flags)
+enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags)
{
if (flags & 1) { // floating point
if (flags & 2) { // big endian
@@ -998,7 +1003,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
sc->bytes_per_frame = get_be32(pb); /* bytes per audio packet if constant */
sc->samples_per_frame = get_be32(pb); /* lpcm frames per audio packet if constant */
if (format == MKTAG('l','p','c','m'))
- st->codec->codec_id = mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags);
+ st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags);
}
}