[MPlayer-cvslog] r34744 - trunk/libmpdemux/demux_ogg.c

reimar subversion at mplayerhq.hu
Sun Feb 19 17:07:35 CET 2012


Author: reimar
Date: Sun Feb 19 17:07:35 2012
New Revision: 34744

Log:
Fix -aid/-vid selection with -demuxer ogg.

The demuxer code conflicted with the generic code
in new_sh_*, so remove everything except the -1
(default) handling.

Modified:
   trunk/libmpdemux/demux_ogg.c

Modified: trunk/libmpdemux/demux_ogg.c
==============================================================================
--- trunk/libmpdemux/demux_ogg.c	Sun Feb 19 16:58:25 2012	(r34743)
+++ trunk/libmpdemux/demux_ogg.c	Sun Feb 19 17:07:35 2012	(r34744)
@@ -513,6 +513,7 @@ static int demux_ogg_add_packet(demux_st
         // We jump nothing for FLAC. Ain't this great? Packet contents have to be
         // handled differently for each and every stream type. The joy! The joy!
         if (!os->flac && (*pack->packet & PACKET_TYPE_HEADER) &&
+                ds->sh &&
                 (ds != d->audio || ((sh_audio_t*)ds->sh)->format != FOURCC_VORBIS || os->hdr_packets >= NUM_VORBIS_HDR_PACKETS ) &&
                 (ds != d->video || (((sh_video_t*)ds->sh)->format != FOURCC_THEORA)))
             return 0;
@@ -780,7 +781,6 @@ int demux_ogg_open(demuxer_t *demuxer)
     stream_t *s;
     char *buf;
     int np, s_no, n_audio = 0, n_video = 0;
-    int audio_id = -1, video_id = -1, text_id = -1;
     ogg_sync_state *sync;
     ogg_page *page;
     ogg_packet pack;
@@ -1101,8 +1101,6 @@ int demux_ogg_open(demuxer_t *demuxer)
                 ogg_d->subs[ogg_d->num_sub].samplerate = AV_RL64(&st->time_unit) / 10;
                 ogg_d->subs[ogg_d->num_sub].text       = 1;
                 ogg_d->subs[ogg_d->num_sub].id         = ogg_d->n_text;
-                if (demuxer->sub->id == ogg_d->n_text)
-                    text_id = ogg_d->num_sub;
                 new_sh_sub(demuxer, ogg_d->n_text, NULL);
                 ogg_d->n_text++;
                 ogg_d->text_ids = realloc_struct(ogg_d->text_ids, ogg_d->n_text, sizeof(*ogg_d->text_ids));
@@ -1125,28 +1123,24 @@ int demux_ogg_open(demuxer_t *demuxer)
             if (sh_a) {
                 // If the audio stream is not defined we took the first one
                 if (demuxer->audio->id == -1) {
-                    demuxer->audio->id = n_audio - 1;
+                    demuxer->audio->id = ogg_d->num_sub;
+                    demuxer->audio->sh = sh_a;
                     //if (sh_a->wf) print_wave_header(sh_a->wf, MSGL_INFO);
                 }
                 /// Is it the stream we want
-                if (demuxer->audio->id == n_audio - 1) {
-                    demuxer->audio->sh = sh_a;
-                    sh_a->ds = demuxer->audio;
+                if (demuxer->audio->sh == sh_a) {
                     ds = demuxer->audio;
-                    audio_id = ogg_d->num_sub;
                 }
             }
             if (sh_v) {
                 /// Also for video
                 if (demuxer->video->id == -1) {
-                    demuxer->video->id = n_video - 1;
+                    demuxer->video->id = ogg_d->num_sub;
+                    demuxer->video->sh = sh_v;
                     //if (sh_v->bih) print_video_header(sh_v->bih, MSGL_INFO);
                 }
-                if (demuxer->video->id == n_video - 1) {
-                    demuxer->video->sh = sh_v;
-                    sh_v->ds = demuxer->video;
+                if (demuxer->video->sh == sh_v) {
                     ds = demuxer->video;
-                    video_id = ogg_d->num_sub;
                 }
             }
             /// Add the header packets if the stream isn't seekable
@@ -1165,24 +1159,12 @@ int demux_ogg_open(demuxer_t *demuxer)
         goto err_out;
     }
 
-    if (!n_video || video_id < 0)
+    if (!demuxer->video->sh)
         demuxer->video->id = -2;
-    else
-        demuxer->video->id = video_id;
-    if (!n_audio || audio_id < 0)
+    if (!demuxer->audio->sh)
         demuxer->audio->id = -2;
-    else
-        demuxer->audio->id = audio_id;
-    /* Disable the subs only if there are no text streams at all.
-       Otherwise the stream to display might be chosen later when the comment
-       packet is encountered and the user used -slang instead of -sid. */
-    if (!ogg_d->n_text)
+    if (!demuxer->sub->sh)
         demuxer->sub->id = -2;
-    else if (text_id >= 0) {
-        demuxer->sub->id = text_id;
-        mp_msg(MSGT_DEMUX, MSGL_V,
-               "Ogg demuxer: Displaying subtitle stream id %d\n", text_id);
-    }
 
     ogg_d->final_granulepos   = 0;
     ogg_d->initial_granulepos = MP_NOPTS_VALUE;


More information about the MPlayer-cvslog mailing list