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

Fixed editing PES recordings

This commit is contained in:
Klaus Schmidinger 2009-01-24 13:16:43 +01:00
parent a02868c90c
commit c5553f9187
3 changed files with 22 additions and 2 deletions

View File

@ -5959,3 +5959,7 @@ Video Disk Recorder Revision History
- Added an 'int' typecast to calculations involving FramesPerSecond() to avoid - Added an 'int' typecast to calculations involving FramesPerSecond() to avoid
compiler warnings. compiler warnings.
- Fixed detecting frames for pure audio recordings. - Fixed detecting frames for pure audio recordings.
- Fixed editing PES recordings. The frame type in the index.vdr file generated for
the edited PES recording is set to 1 for I-frames and 2 for all others (P- and
B-frames). The exact frame type doesn't matter for VDR, it only needs to know if
it's an I-frame or not.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: recording.c 2.7 2009/01/24 11:31:16 kls Exp $ * $Id: recording.c 2.8 2009/01/24 13:11:04 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -1432,6 +1432,19 @@ void cIndexFile::ConvertFromPes(tIndexTs *IndexTs, int Count)
} }
} }
void cIndexFile::ConvertToPes(tIndexTs *IndexTs, int Count)
{
tIndexPes IndexPes;
while (Count-- > 0) {
IndexPes.offset = uint32_t(IndexTs->offset);
IndexPes.type = IndexTs->independent ? 1 : 2; // I_FRAME : "not I_FRAME" (exact frame type doesn't matter)
IndexPes.number = IndexTs->number;
IndexPes.reserved = 0;
memcpy(IndexTs, &IndexPes, sizeof(*IndexTs));
IndexTs++;
}
}
bool cIndexFile::CatchUp(int Index) bool cIndexFile::CatchUp(int Index)
{ {
// returns true unless something really goes wrong, so that 'index' becomes NULL // returns true unless something really goes wrong, so that 'index' becomes NULL
@ -1491,6 +1504,8 @@ bool cIndexFile::Write(bool Independent, uint16_t FileNumber, off_t FileOffset)
{ {
if (f >= 0) { if (f >= 0) {
tIndexTs i(FileOffset, Independent, FileNumber); tIndexTs i(FileOffset, Independent, FileNumber);
if (isPesRecording)
ConvertToPes(&i, 1);
if (safe_write(f, &i, sizeof(i)) < 0) { if (safe_write(f, &i, sizeof(i)) < 0) {
LOG_ERROR_STR(fileName); LOG_ERROR_STR(fileName);
close(f); close(f);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: recording.h 2.2 2009/01/18 11:02:00 kls Exp $ * $Id: recording.h 2.3 2009/01/24 13:05:03 kls Exp $
*/ */
#ifndef __RECORDING_H #ifndef __RECORDING_H
@ -229,6 +229,7 @@ private:
cResumeFile resumeFile; cResumeFile resumeFile;
cMutex mutex; cMutex mutex;
void ConvertFromPes(tIndexTs *IndexTs, int Count); void ConvertFromPes(tIndexTs *IndexTs, int Count);
void ConvertToPes(tIndexTs *IndexTs, int Count);
bool CatchUp(int Index = -1); bool CatchUp(int Index = -1);
public: public:
cIndexFile(const char *FileName, bool Record, bool IsPesRecording = false); cIndexFile(const char *FileName, bool Record, bool IsPesRecording = false);