av_init_packet(&c->audio_pkt[i]); c->audio_pkt[i].size     = 0; c->audio_pkt[i].data     = c->audio_buf[i]; c->audio_pkt[i].stream_index = c->ast[i]->index; c->audio_pkt[i].flags |= PKT_FLAG_KEY;
static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame){    const uint8_t* as_pack;    const DVprofile* sys;    int freq, smpls, quant, i, ach;    sys = dv_frame_profile(frame);    as_pack = dv_extract_pack(frame, dv_audio_source);    if (!as_pack || !sys) {    /* No audio ? */        c->ach = 0;	return -1;    }        smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */    freq = (as_pack[4] >> 3) & 0x07; /* 0 - 48KHz, 1 - 44,1kHz, 2 - 32 kHz */    quant = as_pack[4] & 0x07; /* 0 - 16bit linear, 1 - 12bit nonlinear */    ach = (quant && freq == 2) ? 2 : 1;    /* Dynamic handling of the audio streams in DV */    for (i=0; i<ach; i++) {       if (!c->ast[i]) {           c->ast[i] = av_new_stream(c->fctx, 0);	   if (!c->ast[i])	       break;	   av_set_pts_info(c->ast[i], 64, 1, 30000);	   c->ast[i]->codec.codec_type = CODEC_TYPE_AUDIO;	   c->ast[i]->codec.codec_id = CODEC_ID_PCM_S16LE;       }       c->ast[i]->codec.sample_rate = dv_audio_frequency[freq];       c->ast[i]->codec.channels = 2;       c->ast[i]->codec.bit_rate = 2 * dv_audio_frequency[freq] * 16;       c->ast[i]->start_time = 0;    }    c->ach = i;        return (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */;}