[subtitles-plugin] Is it possible to change the PIDS in a recording on the fly?

Message ID 43283F93.7080207@welho.com
State New
Headers

Commit Message

Petri Helin Sept. 14, 2005, 3:19 p.m. UTC
  On Wed, Sep 14, 2005 at 05:15:27PM +0300, Niko Mikkila wrote:

>>On Wed, 14 Sep 2005 15:40:41 +0300
>>Petri Helin <petri.j.helin@welho.com> wrote:
>>    
>>
>>>I have been trying to modify the subtitles plugin to cope with the 
>>>dynamic subtitling currently in use in Finland. But with no luck so far. 
>>>I can record the subtitles if the stream with the right PID is already 
>>>present when the recording starts, but not if the recording starts too 
>>>early.
>>>      
>>>
>>How does this come up in practice? Personally, I have never missed finnish
>>subtitles, or at least not for the tens of programs recorded this summer.
>>I don't know about subtitle streams for other languages though.
>>    
>>
Do you mean the dynamic subtitling? I think that the solution YLE is 
using goes like this:
- you have a fixed PID with every possible language for every channel, 
for example on TV1 finnish is 1027, swedish 1028, on YLE Teema finnish 
is 4027, swedish is 4028, spanish is 4031 and french is... can't 
remember now
- the finnish stream is always present(?) and others only during the 
program that has subtitles for that language
=> This means that if you have finnish selected either as first or 
second subtitling language, it will be always present in the recording. 
But since you cannot select more than two subtitling languages, that 
doesn't cover all the possibilities.

I like to use the subtitles on the same language as the audio is, if 
that is possible (like to keep up those language skills;). YLE Teema 
sends couple of programs that have subtitling other than finnish or swedish.

Marko Mäkelä wrote:

>Me neither.  There's a known issue that you cannot select the subtitle
>language while watching a recording.  I recorded one short series from
>YLE FST that had both Finnish and Swedish subtitles.  When I start
>watching the recordings from a random position, I sometimes get Swedish
>and sometimes Finnish subtitles.  Both are present in the recording,
>perhaps because I have included both languages in the configuration.
>  
>
Actually I have created a crude hack that enables the changing of 
subtitles during replay. Attached is a version for subtitles plugin 
0.3.8. Please try that one and tell me if it is of any help.
  

Patch

--- subtitles-0.3.8-vanilla/subfilter.c 2005-08-22 20:01:04.000000000 +0300
+++ subtitles-0.3.8/subfilter.c 2005-08-22 20:31:55.000000000 +0300
@@ -284,6 +284,7 @@ 
 {
  private:
     tChannelID currentChannelId;
+    int isReplaying;

     cSubtitlesReceiver *selectedReceiver;
     cSubtitlesReceiver *primaryReceiver;
@@ -317,6 +318,7 @@ 
     primaryReplay = NULL;
     secondaryReplay = NULL;
     device = Device;
+    isReplaying = 0;
 }

 cSubtitlesChangedHandler::~cSubtitlesChangedHandler()
@@ -345,12 +347,14 @@ 

        primaryReplay = new cDvbSubtitlesReplay(1000,0x28);
        secondaryReplay = new cDvbSubtitlesReplay(900,0x29);
+       isReplaying = 1;
     }
     else
     {
        // replaying stops
        DELETENULL(primaryReplay);
        DELETENULL(secondaryReplay);
+       isReplaying = 0;
     }

 }
@@ -387,11 +391,33 @@ 
 void cSubtitlesChangedHandler::SubtitlingUpdate(const cSubtitleChannel* newChannel)
 {

-    if (!newChannel || primaryReplay || secondaryReplay)
+    if (!newChannel)
        return;

     cMutexLock lock(&mutex);

+// Added this if-block to allow user to change the subtitles during replay
+    if (primaryReplay || secondaryReplay || isReplaying)
+    {
+        if (newChannel->GetUserLanguage() == gSubtitlesConfiguration.language || newChannel->GetUserLanguage() == -1)
+       {
+            DELETENULL(primaryReplay);
+            DELETENULL(secondaryReplay);
+            primaryReplay = new cDvbSubtitlesReplay(900,0x28);
+        }
+        else if (newChannel->GetUserLanguage() == gSubtitlesConfiguration.language2) {
+            DELETENULL(primaryReplay);
+            DELETENULL(secondaryReplay);
+            secondaryReplay = new cDvbSubtitlesReplay(1000,0x29);
+        }
+        else
+       {
+            DELETENULL(primaryReplay);
+            DELETENULL(secondaryReplay);
+        }
+        return;
+    }
+
     if (device != NULL && newChannel->GetId()==currentChannelId)
     {
        if (newChannel->GetUserLanguage() == USE_PREFERRED_LANGUAGES)
@@ -648,6 +674,8 @@ 
     asprintf(&titlebuf, "%s - %s", channel->Name(), tr("Choose Language"));
     cOsdMenu::SetTitle(titlebuf);
     free(titlebuf);
+    // This should be changed so that it knows when replaying
+    // and won't use last tuned channel as base for sub information
     channelId = channel->GetChannelID();

     Setup();
@@ -682,7 +710,7 @@ 
        const tSubtitleStream* stream;
        stream = schannel->GetByLanguage(i);

-       if (stream != NULL || showAll)
+        if (stream != NULL || showAll || i==gSubtitlesConfiguration.language || i==gSubtitlesConfiguration.language2)
        {
            Add(new cLanguageItem(languages[i],i), userLanguage == i);
        }