• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/ap/gpl/minidlna/ffmpeg-0.5.1/libavformat/

Lines Matching refs:nut

27 #include "nut.h"
92 static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_checksum, uint64_t startcode)
184 static int decode_main_header(NUTContext *nut){
185 AVFormatContext *s= nut->avf;
192 end= get_packetheader(nut, bc, 1, MAIN_STARTCODE);
198 nut->max_distance = ff_get_v(bc);
199 if(nut->max_distance > 65536){
200 av_log(s, AV_LOG_DEBUG, "max_distance %d\n", nut->max_distance);
201 nut->max_distance= 65536;
204 GET_V(nut->time_base_count, tmp>0 && tmp<INT_MAX / sizeof(AVRational))
205 nut->time_base= av_malloc(nut->time_base_count * sizeof(AVRational));
207 for(i=0; i<nut->time_base_count; i++){
208 GET_V(nut->time_base[i].num, tmp>0 && tmp<(1ULL<<31))
209 GET_V(nut->time_base[i].den, tmp>0 && tmp<(1ULL<<31))
210 if(av_gcd(nut->time_base[i].num, nut->time_base[i].den) != 1){
249 nut->frame_code[i].flags= FLAG_INVALID;
253 nut->frame_code[i].flags = tmp_flags ;
254 nut->frame_code[i].pts_delta = tmp_pts ;
255 nut->frame_code[i].stream_id = tmp_stream;
256 nut->frame_code[i].size_mul = tmp_mul ;
257 nut->frame_code[i].size_lsb = tmp_size+j;
258 nut->frame_code[i].reserved_count = tmp_res ;
259 nut->frame_code[i].header_idx = tmp_head_idx;
262 assert(nut->frame_code['N'].flags == FLAG_INVALID);
266 GET_V(nut->header_count, tmp<128U)
267 nut->header_count++;
268 for(i=1; i<nut->header_count; i++){
269 GET_V(nut->header_len[i], tmp>0 && tmp<256);
270 rem -= nut->header_len[i];
275 nut->header[i]= av_malloc(nut->header_len[i]);
276 get_buffer(bc, nut->header[i], nut->header_len[i]);
278 assert(nut->header_len[0]==0);
286 nut->stream = av_mallocz(sizeof(StreamContext)*stream_count);
294 static int decode_stream_header(NUTContext *nut){
295 AVFormatContext *s= nut->avf;
302 end= get_packetheader(nut, bc, 1, STREAM_STARTCODE);
305 GET_V(stream_id, tmp < s->nb_streams && !nut->stream[tmp].time_base);
306 stc= &nut->stream[stream_id];
339 GET_V(stc->time_base_id , tmp < nut->time_base_count);
371 stc->time_base= &nut->time_base[stc->time_base_id];
389 static int decode_info_header(NUTContext *nut){
390 AVFormatContext *s= nut->avf;
401 end= get_packetheader(nut, bc, 1, INFO_STARTCODE);
411 int64_t start= chapter_start / nut->time_base_count;
413 nut->time_base[chapter_start % nut->time_base_count],
466 static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
467 AVFormatContext *s= nut->avf;
471 nut->last_syncpoint_pos= url_ftell(bc)-8;
473 end= get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE);
477 *back_ptr= nut->last_syncpoint_pos - 16*ff_get_v(bc);
481 ff_nut_reset_ts(nut, nut->time_base[tmp % nut->time_base_count], tmp / nut->time_base_count);
488 *ts= tmp / s->nb_streams * av_q2d(nut->time_base[tmp % s->nb_streams])*AV_TIME_BASE;
489 ff_nut_add_sp(nut, nut->last_syncpoint_pos, *back_ptr, *ts);
494 static int find_and_decode_index(NUTContext *nut){
495 AVFormatContext *s= nut->avf;
511 end= get_packetheader(nut, bc, 1, INDEX_STARTCODE);
593 NUTContext *nut = s->priv_data;
598 nut->avf= s;
608 }while(decode_main_header(nut) < 0);
618 if(decode_stream_header(nut) >= 0)
632 nut->next_startcode= startcode;
638 decode_info_header(nut);
645 find_and_decode_index(nut);
648 assert(nut->next_startcode == SYNCPOINT_STARTCODE);
653 static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, uint8_t *header_idx, int frame_code){
654 AVFormatContext *s= nut->avf;
660 if(url_ftell(bc) > nut->last_syncpoint_pos + nut->max_distance){
661 av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", url_ftell(bc), nut->last_syncpoint_pos, nut->max_distance);
665 flags = nut->frame_code[frame_code].flags;
666 size_mul = nut->frame_code[frame_code].size_mul;
667 size = nut->frame_code[frame_code].size_lsb;
668 *stream_id = nut->frame_code[frame_code].stream_id;
669 pts_delta = nut->frame_code[frame_code].pts_delta;
670 reserved_count = nut->frame_code[frame_code].reserved_count;
671 *header_idx = nut->frame_code[frame_code].header_idx;
680 stc= &nut->stream[*stream_id];
702 if(*header_idx >= (unsigned)nut->header_count){
708 size -= nut->header_len[*header_idx];
712 }else if(size > 2*nut->max_distance || FFABS(stc->last_pts - *pts) > stc->max_pts_distance){
723 static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
724 AVFormatContext *s= nut->avf;
731 size= decode_frame_header(nut, &pts, &stream_id, &header_idx, frame_code);
735 stc= &nut->stream[stream_id];
750 av_new_packet(pkt, size + nut->header_len[header_idx]);
751 memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
753 get_buffer(bc, pkt->data + nut->header_len[header_idx], size);
765 NUTContext *nut = s->priv_data;
772 uint64_t tmp= nut->next_startcode;
773 nut->next_startcode=0;
791 skip= get_packetheader(nut, bc, 0, tmp);
795 if(decode_info_header(nut)<0)
799 if(decode_syncpoint(nut, &ts, &back_ptr)<0)
803 ret= decode_frame(nut, pkt, frame_code);
811 tmp= find_any_startcode(bc, nut->last_syncpoint_pos+1);
815 nut->next_startcode= tmp;
821 NUTContext *nut = s->priv_data;
830 assert(nut->next_startcode == 0);
834 }while(decode_syncpoint(nut, &pts, &back_ptr) < 0);
836 assert(nut->last_syncpoint_pos == *pos_arg);
846 NUTContext *nut = s->priv_data;
862 av_tree_find(nut->syncpoints, &dummy, ff_nut_sp_pts_cmp, next_node);
871 av_tree_find(nut->syncpoints, &dummy, ff_nut_sp_pos_cmp, next_node);
879 sp= av_tree_find(nut->syncpoints, &dummy, ff_nut_sp_pos_cmp, NULL);
892 nut->stream[i].skip_until_key_frame=1;
899 NUTContext *nut = s->priv_data;
901 av_freep(&nut->time_base);
902 av_freep(&nut->stream);
909 "nut",
917 .extensions = "nut",