summaryrefslogtreecommitdiff
path: root/libavformat/pmpdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-02 00:51:11 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-02 00:51:11 +0100
commit7b0b10ce4186eaa1cd3c0a2bfbb86307d65eecfd (patch)
treea9a937af698ca14ef06ec2c07453f474aa5ca3c7 /libavformat/pmpdec.c
parent8b08f81949bcfa6fec42ff3f1c9bef5be8140300 (diff)
parent04403ec2e405a3cfcfbdd45f1274be30c652e462 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (25 commits) rtpenc: Add support for G726 audio rtpdec: Interpret the different G726 names as bits_per_coded_sample rtpenc: Change rtp_send_samples to handle sample sizes other than even bytes rtpenc: Cast a rescaling parameter to int64_t h264: cap max has_b_frames at MAX_DELAYED_PIC_COUNT - 1. ARM: fix indentation in ff_dsputil_init_neon() ARM: NEON put/avg_pixels8/16 cosmetics ARM: add remaining NEON avg_pixels8/16 functions ARM: clean up NEON put/avg_pixels macros fate: split acodec-pcm into individual tests swscale: #include "libavutil/mathematics.h" pmpdec: don't use deprecated av_set_pts_info. rv34: align temporary block of "dct" coefs Add PlayStation Portable PMP format demuxer proto: Realign struct initializers proto: Use .priv_data_size to allocate the private context mmsh: Properly clean up if the second ffurl_alloc failed rtmp: Clean up properly if the handshake failed md5proto: Remove the get_file_handle function applehttpproto: Use the close function if the open function fails ... Conflicts: libavcodec/vble.c libavformat/mmsh.c libavformat/pmpdec.c libavformat/udp.c tests/ref/acodec/pcm Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/pmpdec.c')
-rw-r--r--libavformat/pmpdec.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/libavformat/pmpdec.c b/libavformat/pmpdec.c
index 88b8998ad9..3d54484314 100644
--- a/libavformat/pmpdec.c
+++ b/libavformat/pmpdec.c
@@ -38,7 +38,8 @@ static int pmp_probe(AVProbeData *p) {
return 0;
}
-static int pmp_header(AVFormatContext *s, AVFormatParameters *ap) {
+static int pmp_header(AVFormatContext *s, AVFormatParameters *ap)
+{
PMPContext *pmp = s->priv_data;
AVIOContext *pb = s->pb;
int tb_num, tb_den;
@@ -93,7 +94,6 @@ static int pmp_header(AVFormatContext *s, AVFormatParameters *ap) {
AVStream *ast = avformat_new_stream(s, NULL);
if (!ast)
return AVERROR(ENOMEM);
- ast->id = i;
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = audio_codec_id;
ast->codec->channels = channels;
@@ -111,7 +111,8 @@ static int pmp_header(AVFormatContext *s, AVFormatParameters *ap) {
return 0;
}
-static int pmp_packet(AVFormatContext *s, AVPacket *pkt) {
+static int pmp_packet(AVFormatContext *s, AVPacket *pkt)
+{
PMPContext *pmp = s->priv_data;
AVIOContext *pb = s->pb;
int ret = 0;
@@ -128,14 +129,18 @@ static int pmp_packet(AVFormatContext *s, AVPacket *pkt) {
av_fast_malloc(&pmp->packet_sizes,
&pmp->packet_sizes_alloc,
num_packets * sizeof(*pmp->packet_sizes));
+ if (!pmp->packet_sizes_alloc) {
+ av_log(s, AV_LOG_ERROR, "Cannot (re)allocate packet buffer\n");
+ return AVERROR(ENOMEM);
+ }
for (i = 0; i < num_packets; i++)
pmp->packet_sizes[i] = avio_rl32(pb);
}
ret = av_get_packet(pb, pkt, pmp->packet_sizes[pmp->current_packet]);
if (ret >= 0) {
ret = 0;
- // FIXME: this is a hack that should be remove once
- // compute_pkt_fields can handle
+ // FIXME: this is a hack that should be removed once
+ // compute_pkt_fields() can handle timestamps properly
if (pmp->cur_stream == 0)
pkt->dts = s->streams[0]->cur_dts++;
pkt->stream_index = pmp->cur_stream;
@@ -146,8 +151,8 @@ static int pmp_packet(AVFormatContext *s, AVPacket *pkt) {
return ret;
}
-static int pmp_seek(AVFormatContext *s, int stream_index,
- int64_t ts, int flags) {
+static int pmp_seek(AVFormatContext *s, int stream_index, int64_t ts, int flags)
+{
PMPContext *pmp = s->priv_data;
pmp->cur_stream = 0;
// fallback to default seek now