mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 15:02:58 +02:00
libeplayer3: make ffmpeg data available to manager, output and writer
This commit is contained in:
@@ -388,6 +388,8 @@ static void FFMPEGThread(Context_t * context)
|
||||
avOut.width = videoTrack->width;
|
||||
avOut.height = videoTrack->height;
|
||||
avOut.type = "video";
|
||||
avOut.stream = videoTrack->stream;
|
||||
avOut.avfc = avContext;
|
||||
|
||||
if (context->output->video->Write(context, &avOut) < 0) {
|
||||
ffmpeg_err("writing data to video device failed\n");
|
||||
@@ -416,6 +418,8 @@ static void FFMPEGThread(Context_t * context)
|
||||
avOut.width = 0;
|
||||
avOut.height = 0;
|
||||
avOut.type = "audio";
|
||||
avOut.stream = audioTrack->stream;
|
||||
avOut.avfc = avContext;
|
||||
|
||||
if (context->output->audio->Write(context, &avOut) < 0)
|
||||
ffmpeg_err("(raw pcm) writing data to audio device failed\n");
|
||||
@@ -541,6 +545,8 @@ static void FFMPEGThread(Context_t * context)
|
||||
avOut.width = 0;
|
||||
avOut.height = 0;
|
||||
avOut.type = "audio";
|
||||
avOut.stream = audioTrack->stream;
|
||||
avOut.avfc = avContext;
|
||||
|
||||
if (context->output->audio->Write(context, &avOut) < 0)
|
||||
ffmpeg_err("writing data to audio device failed\n");
|
||||
@@ -560,6 +566,8 @@ static void FFMPEGThread(Context_t * context)
|
||||
avOut.width = 0;
|
||||
avOut.height = 0;
|
||||
avOut.type = "audio";
|
||||
avOut.stream = audioTrack->stream;
|
||||
avOut.avfc = avContext;
|
||||
|
||||
if (context->output->audio->Write(context, &avOut) < 0)
|
||||
ffmpeg_err("(aac) writing data to audio device failed\n");
|
||||
@@ -575,6 +583,8 @@ static void FFMPEGThread(Context_t * context)
|
||||
avOut.width = 0;
|
||||
avOut.height = 0;
|
||||
avOut.type = "audio";
|
||||
avOut.stream = audioTrack->stream;
|
||||
avOut.avfc = avContext;
|
||||
|
||||
if (context->output->audio->Write(context, &avOut) < 0)
|
||||
ffmpeg_err("writing data to audio device failed\n");
|
||||
@@ -890,6 +900,9 @@ int container_ffmpeg_update_tracks(Context_t * context, char *filename)
|
||||
*/
|
||||
memset(&track, 0, sizeof(track));
|
||||
|
||||
track.avfc = avContext;
|
||||
track.stream = stream;
|
||||
|
||||
switch (stream->codec->codec_type) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
ffmpeg_printf(10, "CODEC_TYPE_VIDEO %d\n", stream->codec->codec_type);
|
||||
@@ -937,7 +950,7 @@ int container_ffmpeg_update_tracks(Context_t * context, char *filename)
|
||||
|
||||
track.Name = "und";
|
||||
track.Encoding = encoding;
|
||||
track.stream = stream;
|
||||
track.avfc = avContext;
|
||||
track.Id = stream->id;
|
||||
|
||||
if (stream->duration == AV_NOPTS_VALUE) {
|
||||
@@ -971,7 +984,6 @@ int container_ffmpeg_update_tracks(Context_t * context, char *filename)
|
||||
ffmpeg_printf(10, "Language %s\n", track.Name);
|
||||
|
||||
track.Encoding = encoding;
|
||||
track.stream = stream;
|
||||
track.Id = stream->id;
|
||||
track.duration = (double) stream->duration * av_q2d(stream->time_base) * 1000.0;
|
||||
#if 0
|
||||
@@ -1160,7 +1172,6 @@ int container_ffmpeg_update_tracks(Context_t * context, char *filename)
|
||||
ffmpeg_printf(10, "Language %s\n", track.Name);
|
||||
|
||||
track.Encoding = encoding;
|
||||
track.stream = stream;
|
||||
track.Id = stream->id;
|
||||
track.duration = (double) stream->duration * av_q2d(stream->time_base) * 1000.0;
|
||||
|
||||
|
@@ -49,6 +49,8 @@ typedef struct Track_s {
|
||||
int width;
|
||||
int height;
|
||||
|
||||
/* context from ffmpeg */
|
||||
AVFormatContext *avfc;
|
||||
/* stream from ffmpeg */
|
||||
AVStream *stream;
|
||||
/* codec extra data (header or some other stuff) */
|
||||
|
@@ -4,6 +4,12 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <libavutil/avutil.h>
|
||||
#include <libavutil/time.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libswresample/swresample.h>
|
||||
#include <libavutil/opt.h>
|
||||
|
||||
typedef enum {
|
||||
OUTPUT_INIT,
|
||||
OUTPUT_ADD,
|
||||
@@ -44,6 +50,11 @@ typedef struct {
|
||||
unsigned int height;
|
||||
|
||||
char *type;
|
||||
|
||||
/* context from ffmpeg */
|
||||
AVFormatContext *avfc;
|
||||
/* stream from ffmpeg */
|
||||
AVStream *stream;
|
||||
} AudioVideoOut_t;
|
||||
|
||||
struct Context_s;
|
||||
|
@@ -4,6 +4,12 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <libavutil/avutil.h>
|
||||
#include <libavutil/time.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libswresample/swresample.h>
|
||||
#include <libavutil/opt.h>
|
||||
|
||||
typedef enum { eNone, eAudio, eVideo, eGfx } eWriterType_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -18,6 +24,10 @@ typedef struct {
|
||||
unsigned int Width;
|
||||
unsigned int Height;
|
||||
unsigned char Version;
|
||||
/* context from ffmpeg */
|
||||
AVFormatContext *avfc;
|
||||
/* stream from ffmpeg */
|
||||
AVStream *stream;
|
||||
} WriterAVCallData_t;
|
||||
|
||||
typedef struct WriterCaps_s {
|
||||
|
@@ -902,6 +902,8 @@ static int Write(Context_t *context, AudioVideoOut_t *out)
|
||||
unsigned char audio = 0;
|
||||
Writer_t *writer;
|
||||
WriterAVCallData_t call;
|
||||
call.stream = out->stream;
|
||||
call.avfc = out->avfc;
|
||||
|
||||
if (out == NULL) {
|
||||
linuxdvb_err("null pointer passed\n");
|
||||
|
Reference in New Issue
Block a user