Skip to content
This repository
Browse code

dvdplayer: sub_id in ffmpeg has been depreciated and doesn't work

  • Loading branch information...
commit 8967acd26032c9daeec2f3a1656372eebb6647f5 1 parent 3d2b0a8
Joakim Plate authored April 11, 2013
1  xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
@@ -60,7 +60,6 @@ bool CDVDOverlayCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &optio
60 60
   m_pCodecContext->debug_mv = 0;
61 61
   m_pCodecContext->debug = 0;
62 62
   m_pCodecContext->workaround_bugs = FF_BUG_AUTODETECT;
63  
-  m_pCodecContext->sub_id = hints.identifier;
64 63
   m_pCodecContext->codec_tag = hints.codec_tag;
65 64
   m_pCodecContext->time_base.num = 1;
66 65
   m_pCodecContext->time_base.den = DVD_TIME_BASE;
3  xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.h
@@ -207,11 +207,8 @@ class CDemuxStreamSubtitle : public CDemuxStream
207 207
 public:
208 208
   CDemuxStreamSubtitle() : CDemuxStream()
209 209
   {
210  
-    identifier = 0;
211 210
     type = STREAM_SUBTITLE;
212 211
   }
213  
-
214  
-  int identifier;
215 212
 };
216 213
 
217 214
 class CDemuxStreamTeletext : public CDemuxStream
1  xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -1046,7 +1046,6 @@ void CDVDDemuxFFmpeg::AddStream(int iId)
1046 1046
         {
1047 1047
           CDemuxStreamSubtitleFFmpeg* st = new CDemuxStreamSubtitleFFmpeg(this, pStream);
1048 1048
           m_streams[iId] = st;
1049  
-          st->identifier = pStream->codec->sub_id;
1050 1049
 	    
1051 1050
           if(m_dllAvUtil.av_dict_get(pStream->metadata, "title", NULL, 0))
1052 1051
             st->m_description = m_dllAvUtil.av_dict_get(pStream->metadata, "title", NULL, 0)->value;
8  xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp
@@ -316,7 +316,13 @@ void CDVDDemuxHTSP::SubscriptionStart (htsmsg_t *m)
316 316
       uint32_t composition_id = 0, ancillary_id = 0;
317 317
       htsmsg_get_u32(sub, "composition_id", &composition_id);
318 318
       htsmsg_get_u32(sub, "ancillary_id"  , &ancillary_id);
319  
-      st.s->identifier = (composition_id & 0xffff) | ((ancillary_id & 0xffff) << 16);
  319
+      if(composition_id || ancillary_id)
  320
+      {
  321
+        st.s->ExtraData = new uint8_t[4];
  322
+        st.s->ExtraSize = 4;
  323
+        ((uint16_t*)st.s->ExtraData)[0] = composition_id;
  324
+        ((uint16_t*)st.s->ExtraData)[1] = ancillary_id;
  325
+      }
320 326
     } else if(!strcmp(type, "TEXTSUB")) {
321 327
       st.s = new CDemuxStreamSubtitle();
322 328
       st.s->codec = CODEC_ID_TEXT;
8  xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPVRClient.cpp
@@ -419,7 +419,13 @@ void CDVDDemuxPVRClient::RequestStreams()
419 419
       {
420 420
         st = new CDemuxStreamSubtitlePVRClient(this);
421 421
       }
422  
-      st->identifier = props.stream[i].iIdentifier;
  422
+      if(props.stream[i].iIdentifier)
  423
+      {
  424
+        st->ExtraData = new uint8_t[4];
  425
+        st->ExtraSize = 4;
  426
+        ((uint16_t*)st->ExtraData)[0] = (props.stream[i].iIdentifier >> 0) & 0xFFFFu;
  427
+        ((uint16_t*)st->ExtraData)[1] = (props.stream[i].iIdentifier >> 4) & 0xFFFFu;
  428
+      }
423 429
       m_streams[i] = st;
424 430
     }
425 431
     else
5  xbmc/cores/dvdplayer/DVDStreamInfo.cpp
@@ -67,7 +67,6 @@ void CDVDStreamInfo::Clear()
67 67
   bitrate    = 0;
68 68
   bitspersample = 0;
69 69
 
70  
-  identifier = 0;
71 70
   orientation = 0;
72 71
 }
73 72
 
@@ -108,7 +107,6 @@ bool CDVDStreamInfo::Equal(const CDVDStreamInfo& right, bool withextradata)
108 107
   ||  bitspersample != right.bitspersample ) return false;
109 108
 
110 109
   // SUBTITLE
111  
-  if( identifier != right.identifier ) return false;
112 110
 
113 111
   return true;
114 112
 }
@@ -166,7 +164,6 @@ void CDVDStreamInfo::Assign(const CDVDStreamInfo& right, bool withextradata)
166 164
   bitspersample = right.bitspersample;
167 165
 
168 166
   // SUBTITLE
169  
-  identifier = right.identifier;
170 167
 }
171 168
 
172 169
 void CDVDStreamInfo::Assign(const CDemuxStream& right, bool withextradata)
@@ -211,7 +208,5 @@ void CDVDStreamInfo::Assign(const CDemuxStream& right, bool withextradata)
211 208
   }
212 209
   else if(  right.type == STREAM_SUBTITLE )
213 210
   {
214  
-    const CDemuxStreamSubtitle *stream = static_cast<const CDemuxStreamSubtitle*>(&right);
215  
-    identifier = stream->identifier;
216 211
   }
217 212
 }
1  xbmc/cores/dvdplayer/DVDStreamInfo.h
@@ -83,7 +83,6 @@ class CDVDStreamInfo
83 83
   int bitspersample;
84 84
 
85 85
   // SUBTITLE
86  
-  int identifier;
87 86
 
88 87
   // CODEC EXTRADATA
89 88
   void*        extradata; // extra data for codec to use

12 notes on commit 8967acd

Sam Stenvall

I just spent an eternity bisecting and came to the conclusion that this is the commit that broke subtitles (both DVB and teletext) when watching live TV.

References:

http://forum.xbmc.org/showthread.php?tid=169386
http://trac.xbmc.org/ticket/14520

Joakim Plate
Collaborator

are you running external ffmpeg perhaps?

Sam Stenvall

No, I'm not crazy :-) If it matters, I configure XBMC with this script:

#!/bin/sh

./configure --disable-joystick --disable-ssh --disable-nfs \
--disable-airplay --disable-upnp --disable-mysql --disable-optical-drive \
--disable-avahi --disable-samba

exit 0
Sam Stenvall

I'm thinking it has something to do with how the stream identifier is split into a composition and ancillary ID, though I wasn't able to find any definite definition of how those values should be stored in the extradata field.

Edit: what I said was regarding DVDDemuxPVRClient, I guess DVDDemuxHTSP is what is used when watching live TV using pvr.hts.

Lars Op den Kamp
Collaborator

DVDDemuxHTSP is not used by pvr.hts. it's used by our old htsp vfs handler. the add-on uses DVDDemuxPVRClient

Sam Stenvall

@opdenkamp: that explains a lot of things. Is anyone actually using that part of the code?

Lars Op den Kamp
Collaborator

no idea, but it's been a candidate for my "to be removed" list for a while now but forgot to do it. feel free to nuke it

Joakim Plate
Collaborator

please don't.. i use it. It's way easier and quicker to get setup for getting live tv.

Joakim Plate
Collaborator

I've added my fix in: 27d94da

Lars Op den Kamp
Collaborator

heh you have just become the maintainer for that file @elupus ;-)

iLLiac4

Cool does this mean that it is fixed now and it will be included in prebuild packages?

Please sign in to comment.
Something went wrong with that request. Please try again.