Ticket #229: new_flac_in_ogg.diff

File new_flac_in_ogg.diff, 1.7 KB (added by reimar, 13 years ago)

support new flac-in-ogg in native demuxer

  • libmpdemux/demux_ogg.c

     
    393393#endif /* HAVE_OGGTHEORA */
    394394  } else if (os->flac) {
    395395     /* we pass complete packets to flac, mustn't strip the header! */
     396     if (os->flac == 2 && pack->packet[0] != 0xff)
     397       return NULL;
    396398  } else {
    397399    if(*pack->packet & PACKET_TYPE_HEADER)
    398400      os->hdr_packets++;
     
    565567  if (ds == d->video && ((sh_audio_t*)ds->sh)->format == FOURCC_THEORA)
    566568     context = ((sh_video_t *)ds->sh)->context;
    567569  data = demux_ogg_read_packet(os,pack,context,&pts,&flags,samplesize);
     570  if (!data)
     571    return 0;
    568572
    569573  /// Clear subtitles if necessary (for broken files)
    570574  if ((clear_sub > 0) && (pts >= clear_sub)) {
     
    10091013        ogg_d->subs[ogg_d->num_sub].flac = 1;
    10101014        sh_a->wf = NULL;
    10111015        mp_msg(MSGT_DEMUX,MSGL_INFO,"[Ogg] stream %d: audio (FLAC), -aid %d\n",ogg_d->num_sub,n_audio-1);
     1016    } else if (pack.bytes >= 51 && !strncmp(&pack.packet[1], "FLAC", 4)) {
     1017        sh_a = new_sh_audio_aid(demuxer,ogg_d->num_sub, n_audio);
     1018        sh_a->format =  mmioFOURCC('f', 'L', 'a', 'C');
     1019        ogg_d->subs[ogg_d->num_sub].id = n_audio;
     1020        n_audio++;
     1021        ogg_d->subs[ogg_d->num_sub].flac = 2;
     1022        sh_a->wf = calloc(1, sizeof(WAVEFORMATEX) + 34);
     1023        sh_a->wf->wFormatTag = sh_a->format;
     1024        sh_a->wf->cbSize = 34;
     1025        memcpy(&sh_a->wf[1], &pack.packet[17], 34);
     1026        mp_msg(MSGT_DEMUX,MSGL_INFO,"[Ogg] stream %d: audio (FLAC, variant 2), -aid %d\n",ogg_d->num_sub,n_audio-1);
    10121027
    10131028      /// Check for old header
    10141029    } else if(pack.bytes >= 142 && ! strncmp(&pack.packet[1],"Direct Show Samples embedded in Ogg",35) ) {