Lines Matching refs:nsv

225     NSVContext *nsv = s->priv_data;  in nsv_resync()  local
230 av_dlog(s, "%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, avio_tell(pb), nsv->state); in nsv_resync()
237 nsv->state = NSV_UNSYNC; in nsv_resync()
248 nsv->state = NSV_FOUND_BEEF; in nsv_resync()
254 nsv->state = NSV_FOUND_NSVF; in nsv_resync()
259 nsv->state = NSV_FOUND_NSVS; in nsv_resync()
270 NSVContext *nsv = s->priv_data; in nsv_parse_NSVf_header() local
281 nsv->state = NSV_UNSYNC; /* in case we fail */ in nsv_parse_NSVf_header()
286 nsv->NSVf_end = size; in nsv_parse_NSVf_header()
293 nsv->duration = duration = avio_rl32(pb); /* in ms */ in nsv_parse_NSVf_header()
346 nsv->index_entries = table_entries_used; in nsv_parse_NSVf_header()
349 nsv->nsvs_file_offset = av_malloc((unsigned)table_entries_used * sizeof(uint32_t)); in nsv_parse_NSVf_header()
350 if (!nsv->nsvs_file_offset) in nsv_parse_NSVf_header()
354 nsv->nsvs_file_offset[i] = avio_rl32(pb) + size; in nsv_parse_NSVf_header()
358 nsv->nsvs_timestamps = av_malloc((unsigned)table_entries_used*sizeof(uint32_t)); in nsv_parse_NSVf_header()
359 if (!nsv->nsvs_timestamps) in nsv_parse_NSVf_header()
362 nsv->nsvs_timestamps[i] = avio_rl32(pb); in nsv_parse_NSVf_header()
369 …avio_seek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra byt… in nsv_parse_NSVf_header()
373 nsv->state = NSV_HAS_READ_NSVF; in nsv_parse_NSVf_header()
379 NSVContext *nsv = s->priv_data; in nsv_parse_NSVs_header() local
416 nsv->avsync = avio_rl16(pb); in nsv_parse_NSVs_header()
417 nsv->framerate = framerate; in nsv_parse_NSVs_header()
425 nsv->vtag = vtag; in nsv_parse_NSVs_header()
426 nsv->atag = atag; in nsv_parse_NSVs_header()
427 nsv->vwidth = vwidth; in nsv_parse_NSVs_header()
428 nsv->vheight = vwidth; in nsv_parse_NSVs_header()
449 st->duration = av_rescale(nsv->duration, framerate.num, 1000*framerate.den); in nsv_parse_NSVs_header()
451 for(i=0;i<nsv->index_entries;i++) { in nsv_parse_NSVs_header()
452 if(nsv->nsvs_timestamps) { in nsv_parse_NSVs_header()
453 av_add_index_entry(st, nsv->nsvs_file_offset[i], nsv->nsvs_timestamps[i], in nsv_parse_NSVs_header()
456 … int64_t ts = av_rescale(i*nsv->duration/nsv->index_entries, framerate.num, 1000*framerate.den); in nsv_parse_NSVs_header()
457 av_add_index_entry(st, nsv->nsvs_file_offset[i], ts, 0, 0, AVINDEX_KEYFRAME); in nsv_parse_NSVs_header()
480 st->duration = (int64_t)nsv->duration * framerate.num; in nsv_parse_NSVs_header()
483 … if (nsv->vtag != vtag || nsv->atag != atag || nsv->vwidth != vwidth || nsv->vheight != vwidth) { in nsv_parse_NSVs_header()
489 nsv->state = NSV_HAS_READ_NSVS; in nsv_parse_NSVs_header()
493 nsv->state = NSV_UNSYNC; in nsv_parse_NSVs_header()
499 NSVContext *nsv = s->priv_data; in nsv_read_header() local
505 nsv->state = NSV_UNSYNC; in nsv_read_header()
506 nsv->ahead[0].data = nsv->ahead[1].data = NULL; in nsv_read_header()
511 if (nsv->state == NSV_FOUND_NSVF) { in nsv_read_header()
517 if (nsv->state == NSV_FOUND_NSVS) { in nsv_read_header()
535 NSVContext *nsv = s->priv_data; in nsv_read_chunk() local
548 if (nsv->ahead[0].data || nsv->ahead[1].data) in nsv_read_chunk()
555 for (i = 0; i < NSV_MAX_RESYNC_TRIES && nsv->state < NSV_FOUND_NSVS && !err; i++) in nsv_read_chunk()
559 if (nsv->state == NSV_FOUND_NSVS) in nsv_read_chunk()
563 if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF) in nsv_read_chunk()
590 nsv->state = NSV_UNSYNC; in nsv_read_chunk()
602 pkt = &nsv->ahead[NSV_ST_VIDEO]; in nsv_read_chunk()
606 …pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a … in nsv_read_chunk()
615 pkt = &nsv->ahead[NSV_ST_AUDIO]; in nsv_read_chunk()
647 …pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a … in nsv_read_chunk()
648 if( nsv->state == NSV_HAS_READ_NSVS && st[NSV_ST_VIDEO] ) { in nsv_read_chunk()
651 pkt->dts *= (int64_t)1000 * nsv->framerate.den; in nsv_read_chunk()
652 pkt->dts += (int64_t)nsv->avsync * nsv->framerate.num; in nsv_read_chunk()
653 av_dlog(s, "NSV AUDIO: sync:%d, dts:%"PRId64, nsv->avsync, pkt->dts); in nsv_read_chunk()
658 nsv->state = NSV_UNSYNC; in nsv_read_chunk()
665 NSVContext *nsv = s->priv_data; in nsv_read_packet() local
671 if (!nsv->ahead[0].data && !nsv->ahead[1].data) in nsv_read_packet()
678 if (nsv->ahead[i].data) { in nsv_read_packet()
681 memcpy(pkt, &nsv->ahead[i], sizeof(AVPacket)); in nsv_read_packet()
682 nsv->ahead[i].data = NULL; /* we ate that one */ in nsv_read_packet()
693 NSVContext *nsv = s->priv_data; in nsv_read_seek() local
706 nsv->state = NSV_UNSYNC; in nsv_read_seek()
712 NSVContext *nsv = s->priv_data; in nsv_read_close() local
714 av_freep(&nsv->nsvs_file_offset); in nsv_read_close()
715 av_freep(&nsv->nsvs_timestamps); in nsv_read_close()
716 if (nsv->ahead[0].data) in nsv_read_close()
717 av_free_packet(&nsv->ahead[0]); in nsv_read_close()
718 if (nsv->ahead[1].data) in nsv_read_close()
719 av_free_packet(&nsv->ahead[1]); in nsv_read_close()