comparison rdt.c @ 4134:d74875f9b3d4 libavformat

Change audio_pkt_cnt from an array into a single field, since only a single member of the array is ever used (compare to RMDemuxContext->audio_pkt_cnt). See "[PATCH] oops I broke rdt.c" mailinglist thread.
author rbultje
date Sun, 28 Dec 2008 05:55:09 +0000
parents 90a12fced519
children fd0fc1e26d82
comparison
equal deleted inserted replaced
4133:90a12fced519 4134:d74875f9b3d4
83 AVFormatContext *rmctx; 83 AVFormatContext *rmctx;
84 RMStream *rmst[MAX_STREAMS]; 84 RMStream *rmst[MAX_STREAMS];
85 uint8_t *mlti_data; 85 uint8_t *mlti_data;
86 unsigned int mlti_data_size; 86 unsigned int mlti_data_size;
87 char buffer[RTP_MAX_PACKET_LENGTH + FF_INPUT_BUFFER_PADDING_SIZE]; 87 char buffer[RTP_MAX_PACKET_LENGTH + FF_INPUT_BUFFER_PADDING_SIZE];
88 int audio_pkt_cnt[MAX_STREAMS]; /**< remaining audio packets in rmdec */ 88 int audio_pkt_cnt; /**< remaining audio packets in rmdec */
89 }; 89 };
90 90
91 void 91 void
92 ff_rdt_calc_response_and_checksum(char response[41], char chksum[9], 92 ff_rdt_calc_response_and_checksum(char response[41], char chksum[9],
93 const char *challenge) 93 const char *challenge)
305 res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[0], len, pkt, 305 res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[0], len, pkt,
306 &seq, &flags, timestamp); 306 &seq, &flags, timestamp);
307 pos = url_ftell(&pb); 307 pos = url_ftell(&pb);
308 if (res < 0) 308 if (res < 0)
309 return res; 309 return res;
310 rdt->audio_pkt_cnt[st->id] = res; 310 rdt->audio_pkt_cnt = res;
311 if (rdt->audio_pkt_cnt[st->id] > 0 && 311 if (rdt->audio_pkt_cnt > 0 &&
312 st->codec->codec_id == CODEC_ID_AAC) { 312 st->codec->codec_id == CODEC_ID_AAC) {
313 memcpy (rdt->buffer, buf + pos, len - pos); 313 memcpy (rdt->buffer, buf + pos, len - pos);
314 rdt->rmctx->pb = av_alloc_put_byte (rdt->buffer, len - pos, 0, 314 rdt->rmctx->pb = av_alloc_put_byte (rdt->buffer, len - pos, 0,
315 NULL, NULL, NULL, NULL); 315 NULL, NULL, NULL, NULL);
316 } 316 }
317 } else { 317 } else {
318 ff_rm_retrieve_cache (rdt->rmctx, rdt->rmctx->pb, st, rdt->rmst[0], pkt); 318 ff_rm_retrieve_cache (rdt->rmctx, rdt->rmctx->pb, st, rdt->rmst[0], pkt);
319 if (rdt->audio_pkt_cnt[st->id] == 0 && 319 if (rdt->audio_pkt_cnt == 0 &&
320 st->codec->codec_id == CODEC_ID_AAC) 320 st->codec->codec_id == CODEC_ID_AAC)
321 av_freep(&rdt->rmctx->pb); 321 av_freep(&rdt->rmctx->pb);
322 } 322 }
323 pkt->stream_index = st->index; 323 pkt->stream_index = st->index;
324 pkt->pts = *timestamp; 324 pkt->pts = *timestamp;
325 325
326 return rdt->audio_pkt_cnt[st->id] > 0; 326 return rdt->audio_pkt_cnt > 0;
327 } 327 }
328 328
329 int 329 int
330 ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt, 330 ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt,
331 const uint8_t *buf, int len) 331 const uint8_t *buf, int len)