1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

If a recording starts and the channel's audio PID data has more language code information than the EPG's component data, the code from the channel is taken

This commit is contained in:
Klaus Schmidinger 2006-02-19 13:27:51 +01:00
parent 1781a77e0b
commit 47519e0536
4 changed files with 49 additions and 25 deletions

View File

@ -4351,3 +4351,5 @@ Video Disk Recorder Revision History
are available (suggested by Andreas Brugger).
- When setting the audio track descriptions, the language codes are now also set
in case this is a replay session (based on a patch from Rolf Ahrenberg).
- If a recording starts and the channel's audio PID data has more language code
information than the EPG's component data, the code from the channel is taken.

13
epg.c
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
* $Id: epg.c 1.60 2006/02/19 11:15:44 kls Exp $
* $Id: epg.c 1.61 2006/02/19 12:50:26 kls Exp $
*/
#include "epg.h"
@ -84,6 +84,17 @@ void cComponents::SetComponent(int Index, uchar Stream, uchar Type, const char *
p->description = strcpyrealloc(p->description, !isempty(Description) ? Description : NULL);
}
tComponent *cComponents::GetComponent(int Index, uchar Stream, uchar Type)
{
for (int i = 0; i < numComponents; i++) {
if (components[i].stream == Stream && components[i].type == Type) {
if (!Index--)
return &components[i];
}
}
return NULL;
}
// --- cEvent ----------------------------------------------------------------
cEvent::cEvent(u_int16_t EventID)

3
epg.h
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
* $Id: epg.h 1.31 2006/02/18 14:42:25 kls Exp $
* $Id: epg.h 1.32 2006/02/19 12:51:41 kls Exp $
*/
#ifndef __EPG_H
@ -42,6 +42,7 @@ public:
void SetComponent(int Index, const char *s);
void SetComponent(int Index, uchar Stream, uchar Type, const char *Language, const char *Description);
tComponent *Component(int Index) const { return (Index < numComponents) ? &components[Index] : NULL; }
tComponent *GetComponent(int Index, uchar Stream, uchar Type); // Gets the Index'th component of Stream and Type, skipping other components
};
class cSchedule;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.c 1.136 2006/02/18 16:03:40 kls Exp $
* $Id: recording.c 1.137 2006/02/19 13:09:29 kls Exp $
*/
#include "recording.h"
@ -259,30 +259,40 @@ void cResumeFile::Delete(void)
cRecordingInfo::cRecordingInfo(const cChannel *Channel, const cEvent *Event)
{
channelID = Channel ? Channel->GetChannelID() : tChannelID::InvalidID;
if (Event) {
event = Event;
ownEvent = NULL;
}
else {
event = ownEvent = new cEvent(0);
ownEvent = Event ? NULL : new cEvent(0);
event = ownEvent ? ownEvent : Event;
if (Channel) {
cComponents *Components = NULL;
// Since the EPG data's component records can carry only a single
// language code, let's see whether the channel's PID data has
// more information:
cComponents *Components = (cComponents *)event->Components();
if (!Components)
Components = new cComponents;
for (int i = 0; i < MAXAPIDS; i++) {
if (*Channel->Alang(i)) {
if (!Components)
Components = new cComponents;
Components->SetComponent(Components->NumComponents(), 2, 3, Channel->Alang(i), NULL);
const char *s = Channel->Alang(i);
if (*s) {
tComponent *Component = Components->GetComponent(i, 2, 3);
if (!Component)
Components->SetComponent(Components->NumComponents(), 2, 3, s, NULL);
else if (strlen(s) > strlen(Component->language))
strn0cpy(Component->language, s, sizeof(Component->language));
}
}
// There's no "multiple languages" for Dolby Digital tracks, but
// we do the same procedure here, too, in case there is no component
// information at all:
for (int i = 0; i < MAXDPIDS; i++) {
if (*Channel->Dlang(i)) {
if (!Components)
Components = new cComponents;
Components->SetComponent(Components->NumComponents(), 2, 5, Channel->Dlang(i), NULL);
const char *s = Channel->Dlang(i);
if (*s) {
tComponent *Component = Components->GetComponent(i, 2, 5);
if (!Component)
Components->SetComponent(Components->NumComponents(), 2, 5, s, NULL);
else if (strlen(s) > strlen(Component->language))
strn0cpy(Component->language, s, sizeof(Component->language));
}
}
ownEvent->SetComponents(Components);
}
if (Components != event->Components())
((cEvent *)event)->SetComponents(Components);
}
}