libeplayer3: sync with tdt git commit 06fe782fd6

This ports this commit:
    Author: Matthias <matthias@Build-VM.(none)>
    Date:   Fri Oct 26 19:54:46 2012 +0200

        [libeplayer3] enable wav payback (16 bit le)
This commit is contained in:
Stefan Seyfried
2012-11-03 17:22:40 +01:00
parent 0e96784ad9
commit 09f394fbef
3 changed files with 44 additions and 3 deletions

View File

@@ -201,6 +201,12 @@ static char* Codec2Encoding(enum CodecID id, int* version)
return "A_IPCM"; //return "A_VORBIS";
case CODEC_ID_FLAC: //86030
return "A_IPCM"; //return "A_FLAC";
#if LIBAVCODEC_VERSION_MAJOR > 54 || (LIBAVCODEC_VERSION_MAJOR == 54 && LIBAVCODEC_VERSION_MINOR > 24)
case AV_CODEC_ID_PCM_S16LE:
#else
case CODEC_ID_PCM_S16LE:
#endif
return "A_PCM";
/* subtitle */
case CODEC_ID_SSA:
return "S_TEXT/ASS"; /* Hellmaster1024: seems to be ASS instead of SSA */
@@ -548,8 +554,35 @@ if(!context->playback->BackWard && audioMute)
#endif
ffmpeg_printf(200, "AudioTrack index = %d\n",index);
if (audioTrack->inject_raw_pcm == 1){
ffmpeg_printf(200,"write audio raw pcm\n");
if (audioTrack->inject_as_pcm == 1)
pcmPrivateData_t extradata;
extradata.uNoOfChannels = ((AVStream*) audioTrack->stream)->codec->channels;
extradata.uSampleRate = ((AVStream*) audioTrack->stream)->codec->sample_rate;
extradata.uBitsPerSample = 16;
extradata.bLittleEndian = 1;
avOut.data = packet.data;
avOut.len = packet.size;
avOut.pts = pts;
avOut.extradata = &extradata;
avOut.extralen = sizeof(extradata);
avOut.frameRate = 0;
avOut.timeScale = 0;
avOut.width = 0;
avOut.height = 0;
avOut.type = "audio";
#ifdef reverse_playback_3
if (!context->playback->BackWard)
#endif
if (context->output->audio->Write(context, &avOut) < 0)
{
ffmpeg_err("(raw pcm) writing data to audio device failed\n");
}
}
else if (audioTrack->inject_as_pcm == 1)
{
int bytesDone = 0;
unsigned int samples_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
@@ -987,7 +1020,12 @@ int container_ffmpeg_init(Context_t *context, char * filename)
else {
track.duration = (double) stream->duration * av_q2d(stream->time_base) * 1000.0;
}
if(!strncmp(encoding, "A_PCM", 5))
{
track.inject_raw_pcm = 1;
ffmpeg_printf(10, " Handle inject_raw_pcm = %d\n", track.inject_as_pcm);
}
if(!strncmp(encoding, "A_IPCM", 6))
{
track.inject_as_pcm = 1;
@@ -1785,7 +1823,7 @@ static int Command(void *_context, ContainerCmd_t command, void * argument)
return ret;
}
static char *FFMPEG_Capabilities[] = {"avi", "mkv", "mp4", "ts", "mov", "flv", "flac", "mp3", "mpg", "m2ts", "vob", "wmv","wma", "asf", "mp2", "m4v", "m4a", "divx", "dat", "mpeg", "trp", "mts", "vdr", "ogg", NULL };
static char *FFMPEG_Capabilities[] = {"avi", "mkv", "mp4", "ts", "mov", "flv", "flac", "mp3", "mpg", "m2ts", "vob", "wmv","wma", "asf", "mp2", "m4v", "m4a", "divx", "dat", "mpeg", "trp", "mts", "vdr", "ogg", "wav", NULL };
Container_t FFMPEGContainer = {
"FFMPEG",

View File

@@ -55,6 +55,7 @@ typedef struct Track_s {
/* If player2 or the elf do not support decoding of audio codec set this.
* AVCodec is than used for softdecoding and stream will be injected as PCM */
int inject_as_pcm;
int inject_raw_pcm;
} Track_t;
typedef struct Manager_s {

View File

@@ -53,6 +53,7 @@ typedef struct Writer_s {
} Writer_t;
extern Writer_t WriterAudioIPCM;
extern Writer_t WriterAudioPCM;
extern Writer_t WriterAudioMP3;
extern Writer_t WriterAudioMPEGL3;
extern Writer_t WriterAudioAC3;
@@ -76,6 +77,7 @@ extern Writer_t WriterFramebuffer;
static Writer_t * AvailableWriter[] = {
&WriterAudioIPCM,
&WriterAudioPCM,
&WriterAudioMP3,
&WriterAudioMPEGL3,
&WriterAudioAC3,