Commit fc0fdd84 authored by multrus's avatar multrus
Browse files

[cleanup] accept USE_RTPDUMP

parent 93859eb2
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -172,7 +172,6 @@
/* #################### Start NON-BE switches ############################ */
/* any switch which is non-be wrt. TS 26.258 V3.0 */

#define USE_RTPDUMP                                     /* FhG: RTPDUMP format (rtptools standard) instead of custom format */
#define FIX_1521_SBA_LOUDNESS_STEREO                    /* FhG: issue 1521: Fix loudness for SBA to stereo rendering */
#define FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API            /* Expose Payload Type setting in RTP Header */
#define FIX_2500_RENDCONF_REFACTOR                      /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */
+0 −55
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@
#include <stdbool.h>  // bool type
#include "ivas_rtp_file.h"
#include "ivas_error_utils.h"
#ifdef USE_RTPDUMP
#include "rtpdump.h"

struct IVAS_RTP_FILE
@@ -46,13 +45,6 @@ struct IVAS_RTP_FILE
    uint32_t offset_ms;
};

#else  // USE_RTPDUMP
struct IVAS_RTP_FILE
{
    bool isFileWriter;
    FILE *f_rtpstream;
};
#endif // USE_RTPDUMP

static ivas_error IvasRtpFile_Open(
    const char *filePath,           /* i : path to CA config file                */
@@ -60,7 +52,6 @@ static ivas_error IvasRtpFile_Open(
    IVAS_RTP_FILE_HANDLE *phRtpFile /* o : pointer to an IVAS file reader handle */
)
{
#ifdef USE_RTPDUMP
    RTPDUMP_HANDLE f_rtpstream;
    RTPDUMP_ERROR rderr;
    if ( isFileWriter )
@@ -75,17 +66,6 @@ static ivas_error IvasRtpFile_Open(
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_FILE_OPEN, "rtpdump open error %d", rderr );
    }
#else // USE_RTPDUMP
    FILE *f_rtpstream;
    char *mode = isFileWriter ? "wb" : "rb";

    f_rtpstream = fopen( filePath, mode );
    if ( f_rtpstream == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_FILE_OPEN, "could not open: %s\n", filePath );
    }

#endif // USE_RTPDUMP
    *phRtpFile = calloc( 1, sizeof( struct IVAS_RTP_FILE ) );
    if ( *phRtpFile != NULL )
    {
@@ -104,11 +84,7 @@ static ivas_error IvasRtpFile_Close(
    {
        if ( ( *phReader )->f_rtpstream != NULL )
        {
#ifdef USE_RTPDUMP
            RTPDUMP_Close( &( *phReader )->f_rtpstream, 1 );
#else  // USE_RTPDUMP
            fclose( ( *phReader )->f_rtpstream );
#endif // USE_RTPDUMP
            ( *phReader )->f_rtpstream = NULL;
        }
        free( *phReader );
@@ -126,7 +102,6 @@ static ivas_error IvasRtpFile_Write(
    ivas_error error = IVAS_ERR_OK;
    if ( hRtpFile->isFileWriter )
    {
#ifdef USE_RTPDUMP
        RTPDUMP_RTPPACKET pkt;
        RTPDUMP_SetDefaultRtpPacketHeader( &pkt );
        numBytes = ( numBytes > sizeof( pkt.data ) ) ? sizeof( pkt.data ) : numBytes;
@@ -135,11 +110,6 @@ static ivas_error IvasRtpFile_Write(
        pkt.payloadSize = (unsigned short) ( numBytes - pkt.headerSize );
        /* compute time offset in ms from RTP timestamp (16kHz clock) */
        error = ( RTPDUMP_WritePacket( hRtpFile->f_rtpstream, &pkt, pkt.timeStamp / 16 ) != RTPDUMP_NO_ERROR ) ? IVAS_ERR_FAILED_FILE_WRITE : IVAS_ERR_OK;
#else  // USE_RTPDUMP
        uint32_t length = (uint32_t) numBytes; /* Max packet length is < 32 bits*/
        fwrite( &length, sizeof( uint32_t ), 1, hRtpFile->f_rtpstream );
        fwrite( packet, sizeof( uint8_t ), numBytes, hRtpFile->f_rtpstream );
#endif // USE_RTPDUMP
    }
    else
    {
@@ -156,15 +126,11 @@ static ivas_error IvasRtpFile_Read(
)
{
    size_t nread = 0;
#ifndef USE_RTPDUMP
    uint32_t length = 0;
#endif // USE_RTPDUMP
    if ( hRtpFile->isFileWriter )
    {
        return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "File open for writing cannot be read" );
    }

#ifdef USE_RTPDUMP
    RTPDUMP_RTPPACKET pd;
    RTPDUMP_ERROR rderr = RTPDUMP_ReadPacket( hRtpFile->f_rtpstream, &pd, &hRtpFile->offset_ms );
    if ( rderr == RTPDUMP_READ_ENDOFFILE )
@@ -184,27 +150,6 @@ static ivas_error IvasRtpFile_Read(
    }
    memcpy( packet, pd.data, nread );
    *numBytes = nread;
#else // USE_RTPDUMP
    nread = fread( &length, sizeof( uint32_t ), 1, hRtpFile->f_rtpstream ); /* Read Packet Length */
    if ( nread == 0 )
    {
        return IVAS_ERR_END_OF_FILE;
    }

    *numBytes = length;
    if ( ( *numBytes ) > capacity )
    {
        fprintf( stderr, "RTP packet > buffer capacity %lu bytes\n", capacity );
        return IVAS_ERR_INVALID_OUTPUT_BUFFER_SIZE;
    }

    nread = fread( packet, sizeof( uint8_t ), ( *numBytes ), hRtpFile->f_rtpstream ); /* Read Packet */
    if ( nread < ( *numBytes ) )
    {
        return IVAS_ERR_END_OF_FILE;
    }

#endif // USE_RTPDUMP
    return IVAS_ERR_OK;
}

+0 −2
Original line number Diff line number Diff line
@@ -281,7 +281,6 @@ RTPDUMP_OpenForWriting( RTPDUMP_HANDLE *phRTPDUMP, const char *filename )
    return RTPDUMP_NO_ERROR;
}

#ifdef USE_RTPDUMP
RTPDUMP_ERROR
RTPDUMP_SetHeaderInfo( RTPDUMP_HANDLE hRTPDUMP,
                       uint32_t source,
@@ -352,7 +351,6 @@ RTPDUMP_GetHeaderInfo( RTPDUMP_HANDLE hRTPDUMP,

    return RTPDUMP_NO_ERROR;
}
#endif

RTPDUMP_ERROR
RTPDUMP_ReadPacket( RTPDUMP_HANDLE hRTPDUMP,
+0 −2
Original line number Diff line number Diff line
@@ -85,7 +85,6 @@ extern "C"
    RTPDUMP_ERROR
    RTPDUMP_OpenForWriting( RTPDUMP_HANDLE *phRTPDUMP, const char *filename );

#ifdef USE_RTPDUMP
    RTPDUMP_ERROR
    RTPDUMP_SetHeaderInfo( RTPDUMP_HANDLE hRTPDUMP,
                           uint32_t source,
@@ -99,7 +98,6 @@ extern "C"
                           uint16_t *port,
                           uint32_t *startSeconds,
                           uint32_t *startMicroSeconds );
#endif

    RTPDUMP_ERROR
    RTPDUMP_ReadPacket( RTPDUMP_HANDLE hRTPDUMP,