X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Frdt.c;h=33b0eb827e8e9cadfe4e288c6a157baad463afd8;hb=c231987662194d009dd91bfc57c678e0e70ca161;hp=dfb31d15f0723ccb107a7c382dd3fec3c9da39bc;hpb=2912e87a6c9264d556734e2bf94a99c64cf9b102;p=ffmpeg diff --git a/libavformat/rdt.c b/libavformat/rdt.c index dfb31d15f07..33b0eb827e8 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -293,7 +293,7 @@ ff_rdt_parse_header(const uint8_t *buf, int len, static int rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st, AVPacket *pkt, uint32_t *timestamp, - const uint8_t *buf, int len, int flags) + const uint8_t *buf, int len, uint16_t rtp_seq, int flags) { int seq = 1, res; AVIOContext pb; @@ -309,7 +309,7 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st, if (res < 0) return res; if (res > 0) { - if (st->codec->codec_id == CODEC_ID_AAC) { + if (st->codec->codec_id == AV_CODEC_ID_AAC) { memcpy (rdt->buffer, buf + pos, len - pos); rdt->rmctx->pb = avio_alloc_context (rdt->buffer, len - pos, 0, NULL, NULL, NULL, NULL); @@ -322,7 +322,7 @@ get_cache: ff_rm_retrieve_cache (rdt->rmctx, rdt->rmctx->pb, st, rdt->rmst[st->index], pkt); if (rdt->audio_pkt_cnt == 0 && - st->codec->codec_id == CODEC_ID_AAC) + st->codec->codec_id == AV_CODEC_ID_AAC) av_freep(&rdt->rmctx->pb); } pkt->stream_index = st->index; @@ -348,7 +348,7 @@ ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt, timestamp= 0; ///< Should not be used if buf is NULL, but should be set to the timestamp of the packet returned.... rv= s->parse_packet(s->ic, s->dynamic_protocol_context, s->streams[s->prev_stream_id], - pkt, ×tamp, NULL, 0, flags); + pkt, ×tamp, NULL, 0, 0, flags); return rv; } @@ -375,7 +375,7 @@ ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt, rv = s->parse_packet(s->ic, s->dynamic_protocol_context, s->streams[s->prev_stream_id], - pkt, ×tamp, buf, len, flags); + pkt, ×tamp, buf, len, 0, flags); return rv; } @@ -419,22 +419,20 @@ rdt_parse_sdp_line (AVFormatContext *s, int st_index, for (n = 0; n < s->nb_streams; n++) if (s->streams[n]->id == stream->id) { - int count = s->streams[n]->index + 1; + int count = s->streams[n]->index + 1, err; if (first == -1) first = n; if (rdt->nb_rmst < count) { - RMStream **rmst= av_realloc(rdt->rmst, count*sizeof(*rmst)); - if (!rmst) - return AVERROR(ENOMEM); - memset(rmst + rdt->nb_rmst, 0, - (count - rdt->nb_rmst) * sizeof(*rmst)); - rdt->rmst = rmst; + if ((err = av_reallocp(&rdt->rmst, + count * sizeof(*rdt->rmst))) < 0) { + rdt->nb_rmst = 0; + return err; + } + memset(rdt->rmst + rdt->nb_rmst, 0, + (count - rdt->nb_rmst) * sizeof(*rdt->rmst)); rdt->nb_rmst = count; } rdt->rmst[s->streams[n]->index] = ff_rm_alloc_rmstream(); rdt_load_mdpr(rdt, s->streams[n], (n - first) * 2); - - if (s->streams[n]->codec->codec_id == CODEC_ID_AAC) - s->streams[n]->codec->frame_size = 1; // FIXME } } @@ -459,8 +457,9 @@ add_dstream(AVFormatContext *s, AVStream *orig_st) { AVStream *st; - if (!(st = av_new_stream(s, orig_st->id))) + if (!(st = avformat_new_stream(s, NULL))) return NULL; + st->id = orig_st->id; st->codec->codec_type = orig_st->codec->codec_type; st->first_dts = orig_st->first_dts; @@ -483,7 +482,7 @@ real_parse_asm_rulebook(AVFormatContext *s, AVStream *orig_st, * is set and once for if it isn't. We only read the first because we * don't care much (that's what the "odd" variable is for). * Each rule contains a set of one or more statements, optionally - * preceeded by a single condition. If there's a condition, the rule + * preceded by a single condition. If there's a condition, the rule * starts with a '#'. Multiple conditions are merged between brackets, * so there are never multiple conditions spread out over separate * statements. Generally, these conditions are bitrate limits (min/max) @@ -523,7 +522,11 @@ rdt_new_context (void) { PayloadContext *rdt = av_mallocz(sizeof(PayloadContext)); - av_open_input_stream(&rdt->rmctx, NULL, "", &ff_rdt_demuxer, NULL); + int ret = avformat_open_input(&rdt->rmctx, "", &ff_rdt_demuxer, NULL); + if (ret < 0) { + av_free(rdt); + return NULL; + } return rdt; } @@ -539,20 +542,20 @@ rdt_free_context (PayloadContext *rdt) av_freep(&rdt->rmst[i]); } if (rdt->rmctx) - av_close_input_stream(rdt->rmctx); + avformat_close_input(&rdt->rmctx); av_freep(&rdt->mlti_data); av_freep(&rdt->rmst); av_free(rdt); } #define RDT_HANDLER(n, s, t) \ -static RTPDynamicProtocolHandler ff_rdt_ ## n ## _handler = { \ +static RTPDynamicProtocolHandler rdt_ ## n ## _handler = { \ .enc_name = s, \ .codec_type = t, \ - .codec_id = CODEC_ID_NONE, \ + .codec_id = AV_CODEC_ID_NONE, \ .parse_sdp_a_line = rdt_parse_sdp_line, \ - .open = rdt_new_context, \ - .close = rdt_free_context, \ + .alloc = rdt_new_context, \ + .free = rdt_free_context, \ .parse_packet = rdt_parse_packet \ } @@ -563,8 +566,8 @@ RDT_HANDLER(audio, "x-pn-realaudio", AVMEDIA_TYPE_AUDIO); void av_register_rdt_dynamic_payload_handlers(void) { - ff_register_dynamic_payload_handler(&ff_rdt_video_handler); - ff_register_dynamic_payload_handler(&ff_rdt_audio_handler); - ff_register_dynamic_payload_handler(&ff_rdt_live_video_handler); - ff_register_dynamic_payload_handler(&ff_rdt_live_audio_handler); + ff_register_dynamic_payload_handler(&rdt_video_handler); + ff_register_dynamic_payload_handler(&rdt_audio_handler); + ff_register_dynamic_payload_handler(&rdt_live_video_handler); + ff_register_dynamic_payload_handler(&rdt_live_audio_handler); }