Origin commit data
------------------
Branch: master
Commit: b4bf02c39c
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-01-19 (Fri, 19 Jan 2018)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2018-01-19 08:44:03 +01:00
49 changed files with 772 additions and 520 deletions

View File

@@ -54,7 +54,8 @@ static cAudio *gThiz = NULL;
static ao_device *adevice = NULL; static ao_device *adevice = NULL;
static ao_sample_format sformat; static ao_sample_format sformat;
static AVCodecContext *c= NULL; static AVCodecContext *c = NULL;
static AVCodecParameters *p = NULL;
cAudio::cAudio(void *, void *, void *) cAudio::cAudio(void *, void *, void *)
{ {
@@ -356,28 +357,31 @@ void cAudio::run()
lt_info("%s: nb_streams: %d, should be 1!\n", __func__, avfc->nb_streams); lt_info("%s: nb_streams: %d, should be 1!\n", __func__, avfc->nb_streams);
goto out; goto out;
} }
if (avfc->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO) p = avfc->streams[0]->codecpar;
lt_info("%s: stream 0 no audio codec? 0x%x\n", __func__, avfc->streams[0]->codec->codec_type); if (p->codec_type != AVMEDIA_TYPE_AUDIO)
lt_info("%s: stream 0 no audio codec? 0x%x\n", __func__, p->codec_type);
c = avfc->streams[0]->codec; codec = avcodec_find_decoder(p->codec_id);
codec = avcodec_find_decoder(c->codec_id);
if (!codec) { if (!codec) {
lt_info("%s: Codec for %s not found\n", __func__, avcodec_get_name(c->codec_id)); lt_info("%s: Codec for %s not found\n", __func__, avcodec_get_name(p->codec_id));
goto out; goto out;
} }
if (c)
av_free(c);
c = avcodec_alloc_context3(codec);
if (avcodec_open2(c, codec, NULL) < 0) { if (avcodec_open2(c, codec, NULL) < 0) {
lt_info("%s: avcodec_open2() failed\n", __func__); lt_info("%s: avcodec_open2() failed\n", __func__);
goto out; goto out;
} }
frame = av_frame_alloc(); frame = av_frame_alloc();
if (!frame) { if (!frame) {
lt_info("%s: avcodec_alloc_frame failed\n", __func__); lt_info("%s: av_frame_alloc failed\n", __func__);
goto out2; goto out2;
} }
/* output sample rate, channels, layout could be set here if necessary */ /* output sample rate, channels, layout could be set here if necessary */
o_ch = c->channels; /* 2 */ o_ch = p->channels; /* 2 */
o_sr = c->sample_rate; /* 48000 */ o_sr = p->sample_rate; /* 48000 */
o_layout = c->channel_layout; /* AV_CH_LAYOUT_STEREO */ o_layout = p->channel_layout; /* AV_CH_LAYOUT_STEREO */
if (sformat.channels != o_ch || sformat.rate != o_sr || if (sformat.channels != o_ch || sformat.rate != o_sr ||
sformat.byte_format != AO_FMT_NATIVE || sformat.bits != 16 || adevice == NULL) sformat.byte_format != AO_FMT_NATIVE || sformat.bits != 16 || adevice == NULL)
{ {
@@ -405,10 +409,10 @@ void cAudio::run()
#endif #endif
av_get_sample_fmt_string(tmp, sizeof(tmp), c->sample_fmt); av_get_sample_fmt_string(tmp, sizeof(tmp), c->sample_fmt);
lt_info("decoding %s, sample_fmt %d (%s) sample_rate %d channels %d\n", lt_info("decoding %s, sample_fmt %d (%s) sample_rate %d channels %d\n",
avcodec_get_name(c->codec_id), c->sample_fmt, tmp, c->sample_rate, c->channels); avcodec_get_name(p->codec_id), c->sample_fmt, tmp, p->sample_rate, p->channels);
swr = swr_alloc_set_opts(swr, swr = swr_alloc_set_opts(swr,
o_layout, AV_SAMPLE_FMT_S16, o_sr, /* output */ o_layout, AV_SAMPLE_FMT_S16, o_sr, /* output */
c->channel_layout, c->sample_fmt, c->sample_rate, /* input */ p->channel_layout, c->sample_fmt, p->sample_rate, /* input */
0, NULL); 0, NULL);
if (! swr) { if (! swr) {
lt_info("could not alloc resample context\n"); lt_info("could not alloc resample context\n");
@@ -422,15 +426,15 @@ void cAudio::run()
avcodec_decode_audio4(c, frame, &gotframe, &avpkt); avcodec_decode_audio4(c, frame, &gotframe, &avpkt);
if (gotframe && thread_started) { if (gotframe && thread_started) {
int out_linesize; int out_linesize;
obuf_sz = av_rescale_rnd(swr_get_delay(swr, c->sample_rate) + obuf_sz = av_rescale_rnd(swr_get_delay(swr, p->sample_rate) +
frame->nb_samples, o_sr, c->sample_rate, AV_ROUND_UP); frame->nb_samples, o_sr, p->sample_rate, AV_ROUND_UP);
if (obuf_sz > obuf_sz_max) { if (obuf_sz > obuf_sz_max) {
lt_info("obuf_sz: %d old: %d\n", obuf_sz, obuf_sz_max); lt_info("obuf_sz: %d old: %d\n", obuf_sz, obuf_sz_max);
av_free(obuf); av_free(obuf);
if (av_samples_alloc(&obuf, &out_linesize, o_ch, if (av_samples_alloc(&obuf, &out_linesize, o_ch,
frame->nb_samples, AV_SAMPLE_FMT_S16, 1) < 0) { frame->nb_samples, AV_SAMPLE_FMT_S16, 1) < 0) {
lt_info("av_samples_alloc failed\n"); lt_info("av_samples_alloc failed\n");
av_free_packet(&avpkt); av_packet_unref(&avpkt);
break; /* while (thread_started) */ break; /* while (thread_started) */
} }
obuf_sz_max = obuf_sz; obuf_sz_max = obuf_sz;
@@ -443,7 +447,7 @@ void cAudio::run()
obuf_sz, AV_SAMPLE_FMT_S16, 1); obuf_sz, AV_SAMPLE_FMT_S16, 1);
ao_play(adevice, (char *)obuf, o_buf_sz); ao_play(adevice, (char *)obuf, o_buf_sz);
} }
av_free_packet(&avpkt); av_packet_unref(&avpkt);
} }
// ao_close(adevice); /* can take long :-( */ // ao_close(adevice); /* can take long :-( */
av_free(obuf); av_free(obuf);
@@ -452,6 +456,7 @@ void cAudio::run()
av_frame_free(&frame); av_frame_free(&frame);
out2: out2:
avcodec_close(c); avcodec_close(c);
av_free(c);
c = NULL; c = NULL;
out: out:
avformat_close_input(&avfc); avformat_close_input(&avfc);

View File

@@ -30,6 +30,7 @@
extern "C" { extern "C" {
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
#include <libavutil/imgutils.h>
#include <libswscale/swscale.h> #include <libswscale/swscale.h>
} }
@@ -79,10 +80,12 @@ cVideo::cVideo(int, void *, void *, unsigned int)
buf_in = 0; buf_in = 0;
buf_out = 0; buf_out = 0;
pig_x = pig_y = pig_w = pig_h = 0; pig_x = pig_y = pig_w = pig_h = 0;
pig_changed = false;
display_aspect = DISPLAY_AR_16_9; display_aspect = DISPLAY_AR_16_9;
display_crop = DISPLAY_AR_MODE_LETTERBOX; display_crop = DISPLAY_AR_MODE_LETTERBOX;
v_format = VIDEO_FORMAT_MPEG2; v_format = VIDEO_FORMAT_MPEG2;
output_h = 0; output_h = 0;
stillpicture = false;
} }
cVideo::~cVideo(void) cVideo::~cVideo(void)
@@ -163,6 +166,18 @@ int cVideo::setBlank(int)
return 1; return 1;
} }
int cVideo::GetVideoSystem()
{
int current_video_system = VIDEO_STD_1080I50;
if(dec_w < 720)
current_video_system = VIDEO_STD_PAL;
else if(dec_w > 720 && dec_w <= 1280)
current_video_system = VIDEO_STD_720P50;
return current_video_system;
}
int cVideo::SetVideoSystem(int system, bool) int cVideo::SetVideoSystem(int system, bool)
{ {
int h; int h;
@@ -196,25 +211,13 @@ int cVideo::SetVideoSystem(int system, bool)
lt_info("%s: unhandled value %d\n", __func__, system); lt_info("%s: unhandled value %d\n", __func__, system);
return 0; return 0;
} }
v_std = (VIDEO_STD) system; // v_std = (VIDEO_STD) system;
output_h = h; output_h = h;
if (display_aspect < DISPLAY_AR_RAW && output_h > 0) /* don't know what to do with this */ if (display_aspect < DISPLAY_AR_RAW && output_h > 0) /* don't know what to do with this */
glfb->setOutputFormat(aspect_ratios[display_aspect], output_h, display_crop); glfb->setOutputFormat(aspect_ratios[display_aspect], output_h, display_crop);
return 0; return 0;
} }
int cVideo::GetVideoSystem()
{
int current_video_system = VIDEO_STD_1080I50;
if(dec_w < 720)
current_video_system = VIDEO_STD_PAL;
else if(dec_w > 720 && dec_w <= 1280)
current_video_system = VIDEO_STD_720P50;
return 0;
}
int cVideo::getPlayState(void) int cVideo::getPlayState(void)
{ {
return VIDEO_PLAYING; return VIDEO_PLAYING;
@@ -224,11 +227,17 @@ void cVideo::SetVideoMode(analog_mode_t)
{ {
} }
void cVideo::ShowPicture(const char *fname, const char *) void cVideo::ShowPicture(const char *fname)
{ {
lt_info("%s(%s)\n", __func__, fname); lt_info("%s(%s)\n", __func__, fname);
if (access(fname, R_OK)) if (access(fname, R_OK))
return; return;
still_m.lock();
stillpicture = true;
buf_num = 0;
buf_in = 0;
buf_out = 0;
still_m.unlock();
unsigned int i; unsigned int i;
int stream_id = -1; int stream_id = -1;
@@ -236,6 +245,7 @@ void cVideo::ShowPicture(const char *fname, const char *)
int len; int len;
AVFormatContext *avfc = NULL; AVFormatContext *avfc = NULL;
AVCodecContext *c = NULL; AVCodecContext *c = NULL;
AVCodecParameters *p = NULL;
AVCodec *codec; AVCodec *codec;
AVFrame *frame, *rgbframe; AVFrame *frame, *rgbframe;
AVPacket avpkt; AVPacket avpkt;
@@ -250,17 +260,18 @@ void cVideo::ShowPicture(const char *fname, const char *)
goto out_close; goto out_close;
} }
for (i = 0; i < avfc->nb_streams; i++) { for (i = 0; i < avfc->nb_streams; i++) {
if (avfc->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if (avfc->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
stream_id = i; stream_id = i;
break; break;
} }
} }
if (stream_id < 0) if (stream_id < 0)
goto out_close; goto out_close;
c = avfc->streams[stream_id]->codec; p = avfc->streams[stream_id]->codecpar;
codec = avcodec_find_decoder(c->codec_id); codec = avcodec_find_decoder(p->codec_id);
if (!avcodec_open2(c, codec, NULL) < 0) { c = avcodec_alloc_context3(codec);
lt_info("%s: Could not find/open the codec, id 0x%x\n", __func__, c->codec_id); if (avcodec_open2(c, codec, NULL) < 0) {
lt_info("%s: Could not find/open the codec, id 0x%x\n", __func__, p->codec_id);
goto out_close; goto out_close;
} }
frame = av_frame_alloc(); frame = av_frame_alloc();
@@ -277,15 +288,15 @@ void cVideo::ShowPicture(const char *fname, const char *)
len = avcodec_decode_video2(c, frame, &got_frame, &avpkt); len = avcodec_decode_video2(c, frame, &got_frame, &avpkt);
if (len < 0) { if (len < 0) {
lt_info("%s: avcodec_decode_video2 %d\n", __func__, len); lt_info("%s: avcodec_decode_video2 %d\n", __func__, len);
av_free_packet(&avpkt); av_packet_unref(&avpkt);
goto out_free; goto out_free;
} }
if (avpkt.size > len) if (avpkt.size > len)
lt_info("%s: WARN: pkt->size %d != len %d\n", __func__, avpkt.size, len); lt_info("%s: WARN: pkt->size %d != len %d\n", __func__, avpkt.size, len);
if (got_frame) { if (got_frame) {
unsigned int need = avpicture_get_size(PIX_FMT_RGB32, c->width, c->height); unsigned int need = av_image_get_buffer_size(AV_PIX_FMT_RGB32, c->width, c->height, 1);
struct SwsContext *convert = sws_getContext(c->width, c->height, c->pix_fmt, struct SwsContext *convert = sws_getContext(c->width, c->height, c->pix_fmt,
c->width, c->height, PIX_FMT_RGB32, c->width, c->height, AV_PIX_FMT_RGB32,
SWS_BICUBIC, 0, 0, 0); SWS_BICUBIC, 0, 0, 0);
if (!convert) if (!convert)
lt_info("%s: ERROR setting up SWS context\n", __func__); lt_info("%s: ERROR setting up SWS context\n", __func__);
@@ -294,8 +305,8 @@ void cVideo::ShowPicture(const char *fname, const char *)
SWFramebuffer *f = &buffers[buf_in]; SWFramebuffer *f = &buffers[buf_in];
if (f->size() < need) if (f->size() < need)
f->resize(need); f->resize(need);
avpicture_fill((AVPicture *)rgbframe, &(*f)[0], PIX_FMT_RGB32, av_image_fill_arrays(rgbframe->data, rgbframe->linesize, &(*f)[0], AV_PIX_FMT_RGB32,
c->width, c->height); c->width, c->height, 1);
sws_scale(convert, frame->data, frame->linesize, 0, c->height, sws_scale(convert, frame->data, frame->linesize, 0, c->height,
rgbframe->data, rgbframe->linesize); rgbframe->data, rgbframe->linesize);
sws_freeContext(convert); sws_freeContext(convert);
@@ -308,7 +319,7 @@ void cVideo::ShowPicture(const char *fname, const char *)
buf_in %= VDEC_MAXBUFS; buf_in %= VDEC_MAXBUFS;
buf_num++; buf_num++;
if (buf_num > (VDEC_MAXBUFS - 1)) { if (buf_num > (VDEC_MAXBUFS - 1)) {
lt_debug("%s: buf_num overflow\n", __func__); lt_info("%s: buf_num overflow\n", __func__);
buf_out++; buf_out++;
buf_out %= VDEC_MAXBUFS; buf_out %= VDEC_MAXBUFS;
buf_num--; buf_num--;
@@ -316,9 +327,10 @@ void cVideo::ShowPicture(const char *fname, const char *)
buf_m.unlock(); buf_m.unlock();
} }
} }
av_free_packet(&avpkt); av_packet_unref(&avpkt);
out_free: out_free:
avcodec_close(c); avcodec_close(c);
av_free(c);
av_frame_free(&frame); av_frame_free(&frame);
av_frame_free(&rgbframe); av_frame_free(&rgbframe);
out_close: out_close:
@@ -328,6 +340,10 @@ void cVideo::ShowPicture(const char *fname, const char *)
void cVideo::StopPicture() void cVideo::StopPicture()
{ {
lt_info("%s\n", __func__);
still_m.lock();
stillpicture = false;
still_m.unlock();
} }
void cVideo::Standby(unsigned int) void cVideo::Standby(unsigned int)
@@ -351,7 +367,32 @@ void cVideo::getPictureInfo(int &width, int &height, int &rate)
{ {
width = dec_w; width = dec_w;
height = dec_h; height = dec_h;
switch (dec_r) {
case 23://23.976fps
rate = VIDEO_FRAME_RATE_23_976;
break;
case 24:
rate = VIDEO_FRAME_RATE_24;
break;
case 25:
rate = VIDEO_FRAME_RATE_25;
break;
case 29://29,976fps
rate = VIDEO_FRAME_RATE_29_97;
break;
case 30:
rate = VIDEO_FRAME_RATE_30;
break;
case 50:
rate = VIDEO_FRAME_RATE_50;
break;
case 60:
rate = VIDEO_FRAME_RATE_60;
break;
default:
rate = dec_r; rate = dec_r;
break;
}
} }
void cVideo::SetSyncMode(AVSYNC_TYPE) void cVideo::SetSyncMode(AVSYNC_TYPE)
@@ -407,6 +448,7 @@ void cVideo::run(void)
{ {
lt_info("====================== start decoder thread ================================\n"); lt_info("====================== start decoder thread ================================\n");
AVCodec *codec; AVCodec *codec;
AVCodecParameters *p = NULL;
AVCodecContext *c= NULL; AVCodecContext *c= NULL;
AVFormatContext *avfc = NULL; AVFormatContext *avfc = NULL;
AVInputFormat *inp; AVInputFormat *inp;
@@ -447,20 +489,21 @@ void cVideo::run(void)
lt_info("%s: nb_streams %d, should be 1 => retry\n", __func__, avfc->nb_streams); lt_info("%s: nb_streams %d, should be 1 => retry\n", __func__, avfc->nb_streams);
if (av_read_frame(avfc, &avpkt) < 0) if (av_read_frame(avfc, &avpkt) < 0)
lt_info("%s: av_read_frame < 0\n", __func__); lt_info("%s: av_read_frame < 0\n", __func__);
av_free_packet(&avpkt); av_packet_unref(&avpkt);
if (! thread_running) if (! thread_running)
goto out; goto out;
} }
if (avfc->streams[0]->codec->codec_type != AVMEDIA_TYPE_VIDEO) p = avfc->streams[0]->codecpar;
lt_info("%s: no video codec? 0x%x\n", __func__, avfc->streams[0]->codec->codec_type); if (p->codec_type != AVMEDIA_TYPE_VIDEO)
lt_info("%s: no video codec? 0x%x\n", __func__, p->codec_type);
c = avfc->streams[0]->codec; codec = avcodec_find_decoder(p->codec_id);
codec = avcodec_find_decoder(c->codec_id);
if (!codec) { if (!codec) {
lt_info("%s: Codec for %s not found\n", __func__, avcodec_get_name(c->codec_id)); lt_info("%s: Codec for %s not found\n", __func__, avcodec_get_name(p->codec_id));
goto out; goto out;
} }
c = avcodec_alloc_context3(codec);
if (avcodec_open2(c, codec, NULL) < 0) { if (avcodec_open2(c, codec, NULL) < 0) {
lt_info("%s: Could not open codec\n", __func__); lt_info("%s: Could not open codec\n", __func__);
goto out; goto out;
@@ -488,16 +531,17 @@ void cVideo::run(void)
lt_info("%s: avcodec_decode_video2 %d\n", __func__, len); lt_info("%s: avcodec_decode_video2 %d\n", __func__, len);
warn_d = time(NULL); warn_d = time(NULL);
} }
av_free_packet(&avpkt); av_packet_unref(&avpkt);
continue; continue;
} }
if (avpkt.size > len) if (avpkt.size > len)
lt_info("%s: WARN: pkt->size %d != len %d\n", __func__, avpkt.size, len); lt_info("%s: WARN: pkt->size %d != len %d\n", __func__, avpkt.size, len);
if (got_frame) { still_m.lock();
unsigned int need = avpicture_get_size(PIX_FMT_RGB32, c->width, c->height); if (got_frame && ! stillpicture) {
unsigned int need = av_image_get_buffer_size(AV_PIX_FMT_RGB32, c->width, c->height, 1);
convert = sws_getCachedContext(convert, convert = sws_getCachedContext(convert,
c->width, c->height, c->pix_fmt, c->width, c->height, c->pix_fmt,
c->width, c->height, PIX_FMT_RGB32, c->width, c->height, AV_PIX_FMT_RGB32,
SWS_BICUBIC, 0, 0, 0); SWS_BICUBIC, 0, 0, 0);
if (!convert) if (!convert)
lt_info("%s: ERROR setting up SWS context\n", __func__); lt_info("%s: ERROR setting up SWS context\n", __func__);
@@ -506,8 +550,8 @@ void cVideo::run(void)
SWFramebuffer *f = &buffers[buf_in]; SWFramebuffer *f = &buffers[buf_in];
if (f->size() < need) if (f->size() < need)
f->resize(need); f->resize(need);
avpicture_fill((AVPicture *)rgbframe, &(*f)[0], PIX_FMT_RGB32, av_image_fill_arrays(rgbframe->data, rgbframe->linesize, &(*f)[0], AV_PIX_FMT_RGB32,
c->width, c->height); c->width, c->height, 1);
sws_scale(convert, frame->data, frame->linesize, 0, c->height, sws_scale(convert, frame->data, frame->linesize, 0, c->height,
rgbframe->data, rgbframe->linesize); rgbframe->data, rgbframe->linesize);
if (dec_w != c->width || dec_h != c->height) { if (dec_w != c->width || dec_h != c->height) {
@@ -521,6 +565,8 @@ void cVideo::run(void)
f->height(c->height); f->height(c->height);
int64_t vpts = av_frame_get_best_effort_timestamp(frame); int64_t vpts = av_frame_get_best_effort_timestamp(frame);
if (v_format == VIDEO_FORMAT_MPEG2) if (v_format == VIDEO_FORMAT_MPEG2)
vpts += 90000*4/10; /* 400ms */
else
vpts += 90000*3/10; /* 300ms */ vpts += 90000*3/10; /* 300ms */
f->pts(vpts); f->pts(vpts);
AVRational a = av_guess_sample_aspect_ratio(avfc, avfc->streams[0], frame); AVRational a = av_guess_sample_aspect_ratio(avfc, avfc->streams[0], frame);
@@ -529,7 +575,7 @@ void cVideo::run(void)
buf_in %= VDEC_MAXBUFS; buf_in %= VDEC_MAXBUFS;
buf_num++; buf_num++;
if (buf_num > (VDEC_MAXBUFS - 1)) { if (buf_num > (VDEC_MAXBUFS - 1)) {
lt_debug("%s: buf_num overflow\n", __func__); lt_info("%s: buf_num overflow\n", __func__);
buf_out++; buf_out++;
buf_out %= VDEC_MAXBUFS; buf_out %= VDEC_MAXBUFS;
buf_num--; buf_num--;
@@ -540,12 +586,15 @@ void cVideo::run(void)
lt_debug("%s: time_base: %d/%d, ticks: %d rate: %d pts 0x%" PRIx64 "\n", __func__, lt_debug("%s: time_base: %d/%d, ticks: %d rate: %d pts 0x%" PRIx64 "\n", __func__,
c->time_base.num, c->time_base.den, c->ticks_per_frame, dec_r, c->time_base.num, c->time_base.den, c->ticks_per_frame, dec_r,
av_frame_get_best_effort_timestamp(frame)); av_frame_get_best_effort_timestamp(frame));
} } else
av_free_packet(&avpkt); lt_info("%s: got_frame: %d stillpicture: %d\n", __func__, got_frame, stillpicture);
still_m.unlock();
av_packet_unref(&avpkt);
} }
sws_freeContext(convert); sws_freeContext(convert);
out2: out2:
avcodec_close(c); avcodec_close(c);
av_free(c);
av_frame_free(&frame); av_frame_free(&frame);
av_frame_free(&rgbframe); av_frame_free(&rgbframe);
out: out:
@@ -554,35 +603,59 @@ void cVideo::run(void)
av_free(pIOCtx); av_free(pIOCtx);
/* reset output buffers */ /* reset output buffers */
bufpos = 0; bufpos = 0;
still_m.lock();
if (!stillpicture) {
buf_num = 0; buf_num = 0;
buf_in = 0; buf_in = 0;
buf_out = 0; buf_out = 0;
}
still_m.unlock();
lt_info("======================== end decoder thread ================================\n"); lt_info("======================== end decoder thread ================================\n");
} }
static bool swscale(unsigned char *src, unsigned char *dst, int sw, int sh, int dw, int dh) static bool swscale(unsigned char *src, unsigned char *dst, int sw, int sh, int dw, int dh, AVPixelFormat sfmt)
{ {
bool ret = false; bool ret = false;
int len = 0;
struct SwsContext *scale = NULL; struct SwsContext *scale = NULL;
AVFrame *sframe, *dframe; scale = sws_getCachedContext(scale, sw, sh, sfmt, dw, dh, AV_PIX_FMT_RGB32, SWS_BICUBIC, 0, 0, 0);
scale = sws_getCachedContext(scale, sw, sh, PIX_FMT_RGB32, dw, dh, PIX_FMT_RGB32, SWS_BICUBIC, 0, 0, 0);
if (!scale) { if (!scale) {
lt_info_c("%s: ERROR setting up SWS context\n", __func__); lt_info_c("%s: ERROR setting up SWS context\n", __func__);
return false; return ret;
} }
sframe = av_frame_alloc(); AVFrame *sframe = av_frame_alloc();
dframe = av_frame_alloc(); AVFrame *dframe = av_frame_alloc();
if (!sframe || !dframe) { if (sframe && dframe) {
len = av_image_fill_arrays(sframe->data, sframe->linesize, &(src)[0], sfmt, sw, sh, 1);
if(len>-1)
ret = true;
if(ret && (len = av_image_fill_arrays(dframe->data, dframe->linesize, &(dst)[0], AV_PIX_FMT_RGB32, dw, dh, 1)<0))
ret = false;
if(ret && (len = sws_scale(scale, sframe->data, sframe->linesize, 0, sh, dframe->data, dframe->linesize)<0))
ret = false;
else
ret = true;
}else{
lt_info_c("%s: could not alloc sframe (%p) or dframe (%p)\n", __func__, sframe, dframe); lt_info_c("%s: could not alloc sframe (%p) or dframe (%p)\n", __func__, sframe, dframe);
goto out; ret = false;
} }
avpicture_fill((AVPicture *)sframe, &(src[0]), PIX_FMT_RGB32, sw, sh);
avpicture_fill((AVPicture *)dframe, &(dst[0]), PIX_FMT_RGB32, dw, dh); if(sframe){
sws_scale(scale, sframe->data, sframe->linesize, 0, sh, dframe->data, dframe->linesize);
out:
av_frame_free(&sframe); av_frame_free(&sframe);
sframe = NULL;
}
if(dframe){
av_frame_free(&dframe); av_frame_free(&dframe);
dframe = NULL;
}
if(scale){
sws_freeContext(scale); sws_freeContext(scale);
scale = NULL;
}
lt_info_c("%s: %s scale %ix%i to %ix%i ,len %i\n",ret?" ":"ERROR",__func__, sw, sh, dw, dh,len);
return ret; return ret;
} }
@@ -613,24 +686,40 @@ bool cVideo::GetScreenImage(unsigned char * &data, int &xres, int &yres, bool ge
xres = vid_w * a.num / a.den; xres = vid_w * a.num / a.den;
} }
} }
if(video.empty()){
get_video=false;
xres = osd_w;
yres = osd_h;
}
if (get_osd) if (get_osd)
osd = glfb->getOSDBuffer(); osd = glfb->getOSDBuffer();
unsigned int need = avpicture_get_size(PIX_FMT_RGB32, xres, yres); unsigned int need = av_image_get_buffer_size(AV_PIX_FMT_RGB32, xres, yres, 1);
data = (unsigned char *)realloc(data, need); /* will be freed by caller */ data = (unsigned char *)realloc(data, need); /* will be freed by caller */
if (data == NULL) /* out of memory? */ if (data == NULL) /* out of memory? */
return false; return false;
if (get_video) { if (get_video) {
if (vid_w != xres || vid_h != yres) /* scale video into data... */ //memcpy dont work with copy BGR24 to RGB32
swscale(&video[0], data, vid_w, vid_h, xres, yres); if (vid_w != xres || vid_h != yres){ /* scale video into data... */
else /* get_video and no fancy scaling needed */ bool ret = swscale(&video[0], data, vid_w, vid_h, xres, yres, AV_PIX_FMT_RGB32);
if(!ret){
free(data);
return false;
}
//memcpy dont work with copy BGR24 to RGB32
} else { /* get_video and no fancy scaling needed */
memcpy(data, &video[0], xres * yres * sizeof(uint32_t)); memcpy(data, &video[0], xres * yres * sizeof(uint32_t));
} }
}
if (get_osd && (osd_w != xres || osd_h != yres)) { if (get_osd && (osd_w != xres || osd_h != yres)) {
/* rescale osd */ /* rescale osd */
s_osd.resize(need); s_osd.resize(need);
swscale(&(*osd)[0], &s_osd[0], osd_w, osd_h, xres, yres); bool ret = swscale(&(*osd)[0], &s_osd[0], osd_w, osd_h, xres, yres,AV_PIX_FMT_RGB32);
if(!ret){
free(data);
return false;
}
osd = &s_osd; osd = &s_osd;
} }

View File

@@ -157,8 +157,8 @@ class cVideo : public Thread
/* aspect ratio */ /* aspect ratio */
int getAspectRatio(void); int getAspectRatio(void);
void getPictureInfo(int &width, int &height, int &rate);
int setAspectRatio(int aspect, int mode); int setAspectRatio(int aspect, int mode);
void getPictureInfo(int &width, int &height, int &rate);
/* cropping mode */ /* cropping mode */
int setCroppingMode(int x = 0 /*vidDispMode_t x = VID_DISPMODE_NORM*/); int setCroppingMode(int x = 0 /*vidDispMode_t x = VID_DISPMODE_NORM*/);
@@ -170,20 +170,22 @@ class cVideo : public Thread
int getBlank(void); int getBlank(void);
int setBlank(int enable); int setBlank(int enable);
/* set video_system */
int SetVideoSystem(int video_system, bool remember = true);
int GetVideoSystem();
/* change video play state. Parameters are all unused. */ /* change video play state. Parameters are all unused. */
int Start(void *PcrChannel = NULL, unsigned short PcrPid = 0, unsigned short VideoPid = 0, void *x = NULL); int Start(void *PcrChannel = NULL, unsigned short PcrPid = 0, unsigned short VideoPid = 0, void *x = NULL);
int Stop(bool blank = true); int Stop(bool blank = true);
bool Pause(void); bool Pause(void);
/* set video_system */
int SetVideoSystem(int video_system, bool remember = true);
int GetVideoSystem();
int SetStreamType(VIDEO_FORMAT type); int SetStreamType(VIDEO_FORMAT type);
void ShowPicture(const char * fname);
void SetSyncMode(AVSYNC_TYPE mode); void SetSyncMode(AVSYNC_TYPE mode);
bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; }; bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; };
void SetCECAutoView(bool) { return; }; void SetCECAutoView(bool) { return; };
void SetCECAutoStandby(bool) { return; }; void SetCECAutoStandby(bool) { return; };
void ShowPicture(const char * fname, const char * destname = NULL);
void StopPicture(); void StopPicture();
void Standby(unsigned int bOn); void Standby(unsigned int bOn);
void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600, int startx = 0, int starty = 0, int endx = 1279, int endy = 719); void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600, int startx = 0, int starty = 0, int endx = 1279, int endy = 719);
@@ -218,6 +220,9 @@ class cVideo : public Thread
int pig_y; int pig_y;
int pig_w; int pig_w;
int pig_h; int pig_h;
bool pig_changed;
Mutex still_m;
bool stillpicture;
}; };
#endif #endif

View File

@@ -200,10 +200,11 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
const char *mix_dev = getenv("MIX_DEVICE"); const char *mix_dev = getenv("MIX_DEVICE");
lt_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian); lt_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian);
if (clipfd > -1) { if (clipfd > -1) {
lt_info("%s: clipfd already opened (%d)\n", __FUNCTION__, clipfd); lt_info("%s: clipfd already opened (%d)\n", __func__, clipfd);
return -1; return -1;
} }
mixer_num = -1; mixer_num = -1;
mixer_fd = -1;
/* a different DSP device can be given with DSP_DEVICE and MIX_DEVICE /* a different DSP device can be given with DSP_DEVICE and MIX_DEVICE
* if this device cannot be opened, we fall back to the internal OSS device * if this device cannot be opened, we fall back to the internal OSS device
* Example: * Example:

View File

@@ -351,7 +351,7 @@ void cVideo::closeDevice(void)
{ {
lt_debug("%s\n", __func__); lt_debug("%s\n", __func__);
/* looks like sometimes close is unhappy about non-empty buffers */ /* looks like sometimes close is unhappy about non-empty buffers */
Start(); // Start();
if (fd >= 0) if (fd >= 0)
close(fd); close(fd);
fd = -1; fd = -1;
@@ -602,6 +602,8 @@ void cVideo::StopPicture()
lt_debug("%s\n", __func__); lt_debug("%s\n", __func__);
stillpicture = false; stillpicture = false;
Stop(1); Stop(1);
closeDevice();
openDevice();
} }
void cVideo::Standby(unsigned int bOn) void cVideo::Standby(unsigned int bOn)

View File

@@ -103,8 +103,7 @@ static void update_finish_timeout()
/* On some STBs PTS readed from decoder is invalid after seek or at start /* On some STBs PTS readed from decoder is invalid after seek or at start
* this is the reason for additional validation when we what to close immediately * this is the reason for additional validation when we what to close immediately
*/ */
if (!progressive_playback && 0 == ret && currPts >= maxInjectedPts && if (!progressive_playback && 0 == ret && currPts >= maxInjectedPts && ((currPts - maxInjectedPts) / 90000) < 2)
((currPts - maxInjectedPts) / 90000) < 2)
{ {
/* close immediately /* close immediately
*/ */

View File

@@ -1108,7 +1108,7 @@ static void FFMPEGThread(Context_t *context)
printf("{\"log\":\"Frame read error: '%s'\"}\n", errbuf); printf("{\"log\":\"Frame read error: '%s'\"}\n", errbuf);
} }
/* /*
if( ffmpegStatus == AVERROR(EAGAIN) ) if(ffmpegStatus == AVERROR(EAGAIN))
{ {
continue; continue;
} }
@@ -1261,8 +1261,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, int
avContextTab[AVIdx]->interrupt_callback.callback = interrupt_cb; avContextTab[AVIdx]->interrupt_callback.callback = interrupt_cb;
avContextTab[AVIdx]->interrupt_callback.opaque = context->playback; avContextTab[AVIdx]->interrupt_callback.opaque = context->playback;
#ifdef SAM_CUSTOM_IO #ifdef SAM_CUSTOM_IO
if (0 == strstr(filename, "://") || if (0 == strstr(filename, "://") || 0 == strncmp(filename, "file://", 7))
0 == strncmp(filename, "file://", 7))
{ {
AVIOContext *avio_ctx = container_ffmpeg_get_avio_context(filename, 4096); AVIOContext *avio_ctx = container_ffmpeg_get_avio_context(filename, 4096);
if (avio_ctx) if (avio_ctx)
@@ -1334,8 +1333,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, int
* unless uri contain param wich can be understandable * unless uri contain param wich can be understandable
* only by librtmp * only by librtmp
*/ */
if (strstr(filename, " token=") || if (strstr(filename, " token=") || strstr(filename, " jtv="))
strstr(filename, " jtv="))
{ {
rtmpProtoImplType = RTMP_LIBRTMP; rtmpProtoImplType = RTMP_LIBRTMP;
} }
@@ -1479,8 +1477,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, int
} }
} }
} }
else if (0 == strncmp(filename, "http://", 7) || else if (0 == strncmp(filename, "http://", 7) || 0 == strncmp(filename, "https://", 8))
0 == strncmp(filename, "https://", 8))
{ {
av_dict_set(&avio_opts, "timeout", "20000000", 0); //20sec av_dict_set(&avio_opts, "timeout", "20000000", 0); //20sec
av_dict_set(&avio_opts, "reconnect", "1", 0); av_dict_set(&avio_opts, "reconnect", "1", 0);
@@ -1532,8 +1529,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, int
if (avContextTab[AVIdx] != NULL && avContextTab[AVIdx]->pb != NULL && !context->playback->isTSLiveMode) if (avContextTab[AVIdx] != NULL && avContextTab[AVIdx]->pb != NULL && !context->playback->isTSLiveMode)
{ {
ffmpeg_real_read_org = avContextTab[AVIdx]->pb->read_packet; ffmpeg_real_read_org = avContextTab[AVIdx]->pb->read_packet;
if (0 == AVIdx && strstr(filename, "://") != 0 && if (0 == AVIdx && strstr(filename, "://") != 0 && strncmp(filename, "file://", 7) != 0)
strncmp(filename, "file://", 7) != 0)
{ {
if (ffmpeg_buf_size > 0 && ffmpeg_buf_size > FILLBUFDIFF + FILLBUFPAKET) if (ffmpeg_buf_size > 0 && ffmpeg_buf_size > FILLBUFDIFF + FILLBUFPAKET)
{ {
@@ -1601,7 +1597,7 @@ int32_t container_ffmpeg_init(Context_t *context, PlayFiles_t *playFilesNames)
avformat_network_init(); avformat_network_init();
// SULGE DEBUG ENABLED // SULGE DEBUG ENABLED
// make ffmpeg silen // make ffmpeg silen
// av_log_set_level( AV_LOG_DEBUG ); // av_log_set_level(AV_LOG_DEBUG);
av_log_set_callback(ffmpeg_silen_callback); av_log_set_callback(ffmpeg_silen_callback);
context->playback->abortRequested = 0; context->playback->abortRequested = 0;
int32_t res = container_ffmpeg_init_av_context(context, playFilesNames->szFirstFile, 0); int32_t res = container_ffmpeg_init_av_context(context, playFilesNames->szFirstFile, 0);
@@ -1961,10 +1957,10 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
} }
*/ */
} }
else if (get_codecpar(stream)->codec_id == AV_CODEC_ID_WMAV1 else if (get_codecpar(stream)->codec_id == AV_CODEC_ID_WMAV1 ||
|| get_codecpar(stream)->codec_id == AV_CODEC_ID_WMAV2 get_codecpar(stream)->codec_id == AV_CODEC_ID_WMAV2 ||
|| get_codecpar(stream)->codec_id == AV_CODEC_ID_WMAPRO get_codecpar(stream)->codec_id == AV_CODEC_ID_WMAPRO ||
|| get_codecpar(stream)->codec_id == AV_CODEC_ID_WMALOSSLESS) //if (get_codecpar(stream)->extradata_size > 0) get_codecpar(stream)->codec_id == AV_CODEC_ID_WMALOSSLESS) //if (get_codecpar(stream)->extradata_size > 0)
{ {
ffmpeg_printf(10, "Create WMA ExtraData\n"); ffmpeg_printf(10, "Create WMA ExtraData\n");
uint16_t channels = get_codecpar(stream)->channels; uint16_t channels = get_codecpar(stream)->channels;
@@ -2509,7 +2505,7 @@ static int32_t container_ffmpeg_get_length(Context_t *context, int64_t *length)
static int32_t container_ffmpeg_switch_audio(Context_t *context, int32_t *arg) static int32_t container_ffmpeg_switch_audio(Context_t *context, int32_t *arg)
{ {
ffmpeg_printf(10, "track %d\n", *arg); ffmpeg_printf(10, "track %d\n", *arg);
/* Hellmaster1024: nothing to do here!*/ /* Hellmaster1024: nothing to do here! */
int64_t sec = -5; int64_t sec = -5;
context->playback->Command(context, PLAYBACK_SEEK, (void *)&sec); context->playback->Command(context, PLAYBACK_SEEK, (void *)&sec);
return cERR_CONTAINER_FFMPEG_NO_ERROR; return cERR_CONTAINER_FFMPEG_NO_ERROR;

View File

@@ -465,7 +465,7 @@ static inline const uint8_t *align_get_bits(GetBitContext *s)
#define GET_RL_VLC(level, run, name, gb, table, bits, \ #define GET_RL_VLC(level, run, name, gb, table, bits, \
max_depth, need_update) \ max_depth, need_update) \
do { \ do { \
int n, nb_bits; \ int n, nb_bits; \
unsigned int index; \ unsigned int index; \
\ \
@@ -498,7 +498,7 @@ do { \
} \ } \
run = table[index].run; \ run = table[index].run; \
SKIP_BITS(name, gb, n); \ SKIP_BITS(name, gb, n); \
} while (0) } while (0)
static inline int decode012(GetBitContext *gb) static inline int decode012(GetBitContext *gb)
{ {

View File

@@ -30,7 +30,7 @@
#endif #endif
#ifndef NEG_SSR32 #ifndef NEG_SSR32
# define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s))) # define NEG_SSR32(a,s) (((int32_t)(a))>>(32-(s)))
#endif #endif
#ifndef sign_extend #ifndef sign_extend

View File

@@ -36,8 +36,7 @@ void avpriv_align_put_bits(PutBitContext *s)
put_bits(s, s->bit_left & 7, 0); put_bits(s, s->bit_left & 7, 0);
} }
void avpriv_put_string(PutBitContext *pb, const char *string, void avpriv_put_string(PutBitContext *pb, const char *string, int terminate_string)
int terminate_string)
{ {
while (*string) while (*string)
{ {

View File

@@ -1,7 +1,7 @@
#ifndef COMMON_H_ #ifndef COMMON_H_
#define COMMON_H_ #define COMMON_H_
#include<stdint.h> #include <stdint.h>
#include "container.h" #include "container.h"
#include "output.h" #include "output.h"

View File

@@ -86,7 +86,6 @@ typedef struct TrackDescription_s
int32_t aspect_ratio_num; int32_t aspect_ratio_num;
int32_t aspect_ratio_den; int32_t aspect_ratio_den;
int progressive; int progressive;
} TrackDescription_t; } TrackDescription_t;
typedef struct Manager_s typedef struct Manager_s
@@ -94,7 +93,6 @@ typedef struct Manager_s
char *Name; char *Name;
int (* Command)(/*Context_t*/void *, ManagerCmd_t, void *); int (* Command)(/*Context_t*/void *, ManagerCmd_t, void *);
char **Capabilities; char **Capabilities;
} Manager_t; } Manager_t;
typedef struct ManagerHandler_s typedef struct ManagerHandler_s

View File

@@ -2,6 +2,7 @@
#define OUTPUT_H_ #define OUTPUT_H_
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
typedef enum typedef enum
{ {
@@ -69,7 +70,6 @@ typedef struct Output_s
int32_t (* Command)(/*Context_t*/void *, OutputCmd_t, void *); int32_t (* Command)(/*Context_t*/void *, OutputCmd_t, void *);
int32_t (* Write)(/*Context_t*/void *, void *privateData); int32_t (* Write)(/*Context_t*/void *, void *privateData);
char **Capabilities; char **Capabilities;
} Output_t; } Output_t;
extern Output_t LinuxDvbOutput; extern Output_t LinuxDvbOutput;

View File

@@ -3,7 +3,28 @@
#include <sys/types.h> #include <sys/types.h>
#include <stdint.h> #include <stdint.h>
typedef enum {PLAYBACK_OPEN, PLAYBACK_CLOSE, PLAYBACK_PLAY, PLAYBACK_STOP, PLAYBACK_PAUSE, PLAYBACK_CONTINUE, PLAYBACK_FLUSH, PLAYBACK_TERM, PLAYBACK_FASTFORWARD, PLAYBACK_SEEK, PLAYBACK_SEEK_ABS, PLAYBACK_PTS, PLAYBACK_LENGTH, PLAYBACK_SWITCH_AUDIO, PLAYBACK_SWITCH_SUBTITLE, PLAYBACK_INFO, PLAYBACK_SLOWMOTION, PLAYBACK_FASTBACKWARD, PLAYBACK_GET_FRAME_COUNT, PLAYBACK_METADATA} PlaybackCmd_t; typedef enum {
PLAYBACK_OPEN,
PLAYBACK_CLOSE,
PLAYBACK_PLAY,
PLAYBACK_STOP,
PLAYBACK_PAUSE,
PLAYBACK_CONTINUE,
PLAYBACK_FLUSH,
PLAYBACK_TERM,
PLAYBACK_FASTFORWARD,
PLAYBACK_SEEK,
PLAYBACK_SEEK_ABS,
PLAYBACK_PTS,
PLAYBACK_LENGTH,
PLAYBACK_SWITCH_AUDIO,
PLAYBACK_SWITCH_SUBTITLE,
PLAYBACK_INFO,
PLAYBACK_SLOWMOTION,
PLAYBACK_FASTBACKWARD,
PLAYBACK_GET_FRAME_COUNT,
PLAYBACK_METADATA
} PlaybackCmd_t;
typedef struct PlaybackHandler_s typedef struct PlaybackHandler_s
{ {

View File

@@ -119,8 +119,7 @@ static void *TermThreadFun(void *arg)
FD_SET(g_pfd[0], &readfds); FD_SET(g_pfd[0], &readfds);
FD_SET(fd, &readfds); FD_SET(fd, &readfds);
nfds = fd > g_pfd[0] ? fd + 1 : g_pfd[0] + 1; nfds = fd > g_pfd[0] ? fd + 1 : g_pfd[0] + 1;
while (select(nfds, &readfds, NULL, NULL, NULL) == -1 while (select(nfds, &readfds, NULL, NULL, NULL) == -1 && errno == EINTR)
&& errno == EINTR)
{ {
/* Restart if interrupted by signal */ /* Restart if interrupted by signal */
continue; continue;
@@ -128,7 +127,7 @@ static void *TermThreadFun(void *arg)
if (FD_ISSET(fd, &readfds)) if (FD_ISSET(fd, &readfds))
{ {
/* /*
if ( (cl = accept(fd, NULL, NULL)) == -1) if ((cl = accept(fd, NULL, NULL)) == -1)
{ {
perror("TermThreadFun accept error"); perror("TermThreadFun accept error");
goto finish; goto finish;
@@ -475,6 +474,7 @@ static int HandleTracks(const Manager_t *ptrManager, const PlaybackCmd_t playbac
return commandRetVal; return commandRetVal;
} }
#endif #endif
static void UpdateVideoTrack() static void UpdateVideoTrack()
{ {
HandleTracks(g_player->manager->video, (PlaybackCmd_t) - 1, "vc"); HandleTracks(g_player->manager->video, (PlaybackCmd_t) - 1, "vc");

View File

@@ -61,8 +61,6 @@ if (debug_level >= level) printf("[%s:%s] \n" fmt, __FILE__, __FUNCTION__, ## x)
#define cERR_AUDIO_MGR_NO_ERROR 0 #define cERR_AUDIO_MGR_NO_ERROR 0
#define cERR_AUDIO_MGR_ERROR -1 #define cERR_AUDIO_MGR_ERROR -1
static const char FILENAME[] = __FILE__;
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
/* ***************************** */ /* ***************************** */
@@ -85,7 +83,7 @@ static int CurrentTrack = 0; //TRACK[0] as default.
static int ManagerAdd(Context_t *context, Track_t track) static int ManagerAdd(Context_t *context, Track_t track)
{ {
audio_mgr_printf(10, "%s::%s name=\"%s\" encoding=\"%s\" id=%d\n", FILENAME, __FUNCTION__, track.Name, track.Encoding, track.Id); audio_mgr_printf(10, "%s::%s name=\"%s\" encoding=\"%s\" id=%d\n", __FILE__, __FUNCTION__, track.Name, track.Encoding, track.Id);
if (Tracks == NULL) if (Tracks == NULL)
{ {
Tracks = malloc(sizeof(Track_t) * TRACKWRAP); Tracks = malloc(sizeof(Track_t) * TRACKWRAP);
@@ -97,7 +95,7 @@ static int ManagerAdd(Context_t *context, Track_t track)
} }
if (Tracks == NULL) if (Tracks == NULL)
{ {
audio_mgr_err("%s:%s malloc failed\n", FILENAME, __FUNCTION__); audio_mgr_err("%s:%s malloc failed\n", __FILE__, __FUNCTION__);
return cERR_AUDIO_MGR_ERROR; return cERR_AUDIO_MGR_ERROR;
} }
int i = 0; int i = 0;
@@ -116,14 +114,14 @@ static int ManagerAdd(Context_t *context, Track_t track)
} }
else else
{ {
audio_mgr_err("%s:%s TrackCount out if range %d - %d\n", FILENAME, __FUNCTION__, TrackCount, TRACKWRAP); audio_mgr_err("%s:%s TrackCount out if range %d - %d\n", __FILE__, __FUNCTION__, TrackCount, TRACKWRAP);
return cERR_AUDIO_MGR_ERROR; return cERR_AUDIO_MGR_ERROR;
} }
if (TrackCount > 0) if (TrackCount > 0)
{ {
context->playback->isAudio = 1; context->playback->isAudio = 1;
} }
audio_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); audio_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
return cERR_AUDIO_MGR_NO_ERROR; return cERR_AUDIO_MGR_NO_ERROR;
} }
@@ -131,13 +129,13 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
{ {
int i = 0, j = 0; int i = 0, j = 0;
char **tracklist = NULL; char **tracklist = NULL;
audio_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); audio_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
if (Tracks != NULL) if (Tracks != NULL)
{ {
tracklist = malloc(sizeof(char *) * ((TrackCount * 2) + 1)); tracklist = malloc(sizeof(char *) * ((TrackCount * 2) + 1));
if (tracklist == NULL) if (tracklist == NULL)
{ {
audio_mgr_err("%s:%s malloc failed\n", FILENAME, __FUNCTION__); audio_mgr_err("%s:%s malloc failed\n", __FILE__, __FUNCTION__);
return NULL; return NULL;
} }
for (i = 0, j = 0; i < TrackCount; i++, j += 2) for (i = 0, j = 0; i < TrackCount; i++, j += 2)
@@ -146,13 +144,13 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
continue; continue;
size_t len = strlen(Tracks[i].Name) + 20; size_t len = strlen(Tracks[i].Name) + 20;
char tmp[len]; char tmp[len];
snprintf(tmp, len, "%d %s\n", Tracks[i].Id, Tracks[i].Name); snprintf(tmp, len, "%d %s", Tracks[i].Id, Tracks[i].Name);
tracklist[j] = strdup(tmp); tracklist[j] = strdup(tmp);
tracklist[j + 1] = strdup(Tracks[i].Encoding); tracklist[j + 1] = strdup(Tracks[i].Encoding);
} }
tracklist[j] = NULL; tracklist[j] = NULL;
} }
audio_mgr_printf(10, "%s::%s return %p (%d - %d)\n", FILENAME, __FUNCTION__, tracklist, j, TrackCount); audio_mgr_printf(10, "%s::%s return %p (%d - %d)\n", __FILE__, __FUNCTION__, tracklist, j, TrackCount);
return tracklist; return tracklist;
} }
@@ -161,13 +159,13 @@ static TrackDescription_t *ManagerList(Context_t *context __attribute__((unused
{ {
int i = 0; int i = 0;
TrackDescription_t *tracklist = NULL; TrackDescription_t *tracklist = NULL;
audio_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); audio_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
if (Tracks != NULL) if (Tracks != NULL)
{ {
tracklist = malloc(sizeof(TrackDescription_t) * ((TrackCount) + 1)); tracklist = malloc(sizeof(TrackDescription_t) * ((TrackCount) + 1));
if (tracklist == NULL) if (tracklist == NULL)
{ {
audio_mgr_err("%s:%s malloc failed\n", FILENAME, __FUNCTION__); audio_mgr_err("%s:%s malloc failed\n", __FILE__, __FUNCTION__);
return NULL; return NULL;
} }
int j = 0; int j = 0;
@@ -184,7 +182,7 @@ static TrackDescription_t *ManagerList(Context_t *context __attribute__((unused
} }
tracklist[j].Id = -1; tracklist[j].Id = -1;
} }
//audio_mgr_printf(10, "%s::%s return %p (%d - %d)\n", FILENAME, __FUNCTION__, tracklist, j, TrackCount); //audio_mgr_printf(10, "%s::%s return %p (%d - %d)\n", __FILE__, __FUNCTION__, tracklist, j, TrackCount);
return tracklist; return tracklist;
} }
#endif #endif
@@ -192,7 +190,7 @@ static TrackDescription_t *ManagerList(Context_t *context __attribute__((unused
static int ManagerDel(Context_t *context) static int ManagerDel(Context_t *context)
{ {
int i = 0; int i = 0;
audio_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); audio_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
if (Tracks != NULL) if (Tracks != NULL)
{ {
for (i = 0; i < TrackCount; i++) for (i = 0; i < TrackCount; i++)
@@ -204,13 +202,13 @@ static int ManagerDel(Context_t *context)
} }
else else
{ {
audio_mgr_err("%s::%s nothing to delete!\n", FILENAME, __FUNCTION__); audio_mgr_err("%s::%s nothing to delete!\n", __FILE__, __FUNCTION__);
return cERR_AUDIO_MGR_ERROR; return cERR_AUDIO_MGR_ERROR;
} }
TrackCount = 0; TrackCount = 0;
CurrentTrack = 0; CurrentTrack = 0;
context->playback->isAudio = 0; context->playback->isAudio = 0;
audio_mgr_printf(10, "%s::%s return no error\n", FILENAME, __FUNCTION__); audio_mgr_printf(10, "%s::%s return no error\n", __FILE__, __FUNCTION__);
return cERR_AUDIO_MGR_NO_ERROR; return cERR_AUDIO_MGR_NO_ERROR;
} }
@@ -218,7 +216,7 @@ static int Command(void *_context, ManagerCmd_t command, void *argument)
{ {
Context_t *context = (Context_t *) _context; Context_t *context = (Context_t *) _context;
int ret = cERR_AUDIO_MGR_NO_ERROR; int ret = cERR_AUDIO_MGR_NO_ERROR;
audio_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); audio_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
switch (command) switch (command)
{ {
case MANAGER_ADD: case MANAGER_ADD:
@@ -235,7 +233,7 @@ static int Command(void *_context, ManagerCmd_t command, void *argument)
} }
case MANAGER_GET: case MANAGER_GET:
{ {
audio_mgr_printf(20, "%s::%s MANAGER_GET\n", FILENAME, __FUNCTION__); audio_mgr_printf(20, "%s::%s MANAGER_GET\n", __FILE__, __FUNCTION__);
if ((TrackCount > 0) && (CurrentTrack >= 0)) if ((TrackCount > 0) && (CurrentTrack >= 0))
{ {
*((int *)argument) = (int)Tracks[CurrentTrack].Id; *((int *)argument) = (int)Tracks[CurrentTrack].Id;
@@ -268,7 +266,7 @@ static int Command(void *_context, ManagerCmd_t command, void *argument)
} }
case MANAGER_GET_TRACK: case MANAGER_GET_TRACK:
{ {
audio_mgr_printf(20, "%s::%s MANAGER_GET_TRACK\n", FILENAME, __FUNCTION__); audio_mgr_printf(20, "%s::%s MANAGER_GET_TRACK\n", __FILE__, __FUNCTION__);
if ((TrackCount > 0) && (CurrentTrack >= 0)) if ((TrackCount > 0) && (CurrentTrack >= 0))
{ {
*((Track_t **)argument) = (Track_t *) &Tracks[CurrentTrack]; *((Track_t **)argument) = (Track_t *) &Tracks[CurrentTrack];
@@ -306,7 +304,7 @@ static int Command(void *_context, ManagerCmd_t command, void *argument)
case MANAGER_SET: case MANAGER_SET:
{ {
int i; int i;
audio_mgr_printf(20, "%s::%s MANAGER_SET id=%d\n", FILENAME, __FUNCTION__, *((int *)argument)); audio_mgr_printf(20, "%s::%s MANAGER_SET id=%d\n", __FILE__, __FUNCTION__, *((int *)argument));
for (i = 0; i < TrackCount; i++) for (i = 0; i < TrackCount; i++)
{ {
if (Tracks[i].Id == *((int *)argument)) if (Tracks[i].Id == *((int *)argument))
@@ -317,7 +315,7 @@ static int Command(void *_context, ManagerCmd_t command, void *argument)
} }
if (i == TrackCount) if (i == TrackCount)
{ {
audio_mgr_err("%s::%s track id %d unknown\n", FILENAME, __FUNCTION__, *((int *)argument)); audio_mgr_err("%s::%s track id %d unknown\n", __FILE__, __FUNCTION__, *((int *)argument));
ret = cERR_AUDIO_MGR_ERROR; ret = cERR_AUDIO_MGR_ERROR;
} }
break; break;
@@ -337,11 +335,11 @@ static int Command(void *_context, ManagerCmd_t command, void *argument)
break; break;
} }
default: default:
audio_mgr_err("%s::%s ContainerCmd %d not supported!\n", FILENAME, __FUNCTION__, command); audio_mgr_err("%s::%s ContainerCmd %d not supported!\n", __FILE__, __FUNCTION__, command);
ret = cERR_AUDIO_MGR_ERROR; ret = cERR_AUDIO_MGR_ERROR;
break; break;
} }
audio_mgr_printf(10, "%s:%s: returning %d\n", FILENAME, __FUNCTION__, ret); audio_mgr_printf(10, "%s:%s: returning %d\n", __FILE__, __FUNCTION__, ret);
return ret; return ret;
} }

View File

@@ -33,7 +33,6 @@
#define TRACKWRAP 20 #define TRACKWRAP 20
//#define SAM_WITH_DEBUG
#ifdef SAM_WITH_DEBUG #ifdef SAM_WITH_DEBUG
#define SUBTITLE_MGR_DEBUG #define SUBTITLE_MGR_DEBUG
#else #else
@@ -60,14 +59,12 @@ if (debug_level >= level) printf(x); } while (0)
#define cERR_SUBTITLE_MGR_NO_ERROR 0 #define cERR_SUBTITLE_MGR_NO_ERROR 0
#define cERR_SUBTITLE_MGR_ERROR -1 #define cERR_SUBTITLE_MGR_ERROR -1
static const char FILENAME[] = __FILE__;
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
/* ***************************** */ /* ***************************** */
/* ***************************** */ /* ***************************** */
/* Varaibles */ /* Variables */
/* ***************************** */ /* ***************************** */
static Track_t *Tracks = NULL; static Track_t *Tracks = NULL;
@@ -82,23 +79,23 @@ static int CurrentTrack = -1; //no as default.
/* Functions */ /* Functions */
/* ***************************** */ /* ***************************** */
static int ManagerAdd(Context_t * context __attribute__((unused)), Track_t track) static int ManagerAdd(Context_t *context __attribute__((unused)), Track_t track)
{ {
subtitle_mgr_printf(10, "%s::%s %s %s %d\n", __FILE__, __FUNCTION__, track.Name, track.Encoding, track.Id);
subtitle_mgr_printf(10, "%s::%s %s %s %d\n", FILENAME, __FUNCTION__,
track.Name, track.Encoding, track.Id);
if (Tracks == NULL) if (Tracks == NULL)
{ {
Tracks = malloc(sizeof(Track_t) * TRACKWRAP); Tracks = malloc(sizeof(Track_t) * TRACKWRAP);
int i; int i;
for (i = 0; i < TRACKWRAP; i++) for (i = 0; i < TRACKWRAP; i++)
{
Tracks[i].Id = -1; Tracks[i].Id = -1;
} }
}
if (Tracks == NULL) if (Tracks == NULL)
{ {
subtitle_mgr_err("%s:%s malloc failed\n", FILENAME, __FUNCTION__); subtitle_mgr_err("%s:%s malloc failed\n", __FILE__, __FUNCTION__);
return cERR_SUBTITLE_MGR_ERROR; return cERR_SUBTITLE_MGR_ERROR;
} }
@@ -119,23 +116,26 @@ static int ManagerAdd(Context_t * context __attribute__((unused)), Track_t track
} }
else else
{ {
subtitle_mgr_err("%s:%s TrackCount out if range %d - %d\n", __FILE__, __FUNCTION__, TrackCount, TRACKWRAP);
subtitle_mgr_err("%s:%s TrackCount out if range %d - %d\n",
FILENAME, __FUNCTION__, TrackCount, TRACKWRAP);
return cERR_SUBTITLE_MGR_ERROR; return cERR_SUBTITLE_MGR_ERROR;
} }
subtitle_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); if (TrackCount > 0)
{
// context->playback->isSubtitle = 1;
}
subtitle_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
return cERR_SUBTITLE_MGR_NO_ERROR; return cERR_SUBTITLE_MGR_NO_ERROR;
} }
static char **ManagerList(Context_t * context __attribute__ ((unused))) static char **ManagerList(Context_t *context __attribute__((unused)))
{ {
char **tracklist = NULL; char **tracklist = NULL;
int i = 0, j = 0; int i = 0, j = 0;
subtitle_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); subtitle_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
if (Tracks != NULL) if (Tracks != NULL)
{ {
@@ -143,18 +143,20 @@ static char **ManagerList(Context_t * context __attribute__ ((unused)))
if (tracklist == NULL) if (tracklist == NULL)
{ {
subtitle_mgr_err("%s:%s malloc failed\n", FILENAME, subtitle_mgr_err("%s:%s malloc failed\n", __FILE__, __FUNCTION__);
__FUNCTION__);
return NULL; return NULL;
} }
for (i = 0, j = 0; i < TrackCount; i++, j += 2) for (i = 0, j = 0; i < TrackCount; i++, j += 2)
{ {
if (Tracks[i].pending) if (Tracks[i].pending)
{
continue; continue;
}
size_t len = strlen(Tracks[i].Name) + 20; size_t len = strlen(Tracks[i].Name) + 20;
char tmp[len]; char tmp[len];
snprintf(tmp, len, "%d %s\n", Tracks[i].Id, Tracks[i].Name); snprintf(tmp, len, "%d %s", Tracks[i].Id, Tracks[i].Name);
tracklist[j] = strdup(tmp); tracklist[j] = strdup(tmp);
tracklist[j + 1] = strdup(Tracks[i].Encoding); tracklist[j + 1] = strdup(Tracks[i].Encoding);
} }
@@ -162,18 +164,16 @@ static char **ManagerList(Context_t * context __attribute__ ((unused)))
tracklist[j] = NULL; tracklist[j] = NULL;
} }
subtitle_mgr_printf(10, "%s::%s return %p (%d - %d)\n", FILENAME, subtitle_mgr_printf(10, "%s::%s return %p (%d - %d)\n", __FILE__, __FUNCTION__, tracklist, j, TrackCount);
__FUNCTION__, tracklist, j, TrackCount);
return tracklist; return tracklist;
} }
static int ManagerDel(Context_t * context __attribute__((unused))) static int ManagerDel(Context_t *context __attribute__((unused)))
{ {
int i = 0; int i = 0;
subtitle_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); subtitle_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
if (Tracks != NULL) if (Tracks != NULL)
{ {
@@ -187,16 +187,15 @@ static int ManagerDel(Context_t * context __attribute__((unused)))
} }
else else
{ {
subtitle_mgr_err("%s::%s nothing to delete!\n", FILENAME, subtitle_mgr_err("%s::%s nothing to delete!\n", __FILE__, __FUNCTION__);
__FUNCTION__);
return cERR_SUBTITLE_MGR_ERROR; return cERR_SUBTITLE_MGR_ERROR;
} }
TrackCount = 0; TrackCount = 0;
CurrentTrack = -1; CurrentTrack = -1;
// context->playback->isSubtitle = 0;
subtitle_mgr_printf(10, "%s::%s return no error\n", FILENAME, subtitle_mgr_printf(10, "%s::%s return no error\n", __FILE__, __FUNCTION__);
__FUNCTION__);
return cERR_SUBTITLE_MGR_NO_ERROR; return cERR_SUBTITLE_MGR_NO_ERROR;
} }
@@ -205,8 +204,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
{ {
int ret = cERR_SUBTITLE_MGR_NO_ERROR; int ret = cERR_SUBTITLE_MGR_NO_ERROR;
subtitle_mgr_printf(50, "%s::%s %d\n", FILENAME, __FUNCTION__, subtitle_mgr_printf(50, "%s::%s %d\n", __FILE__, __FUNCTION__, command);
command);
switch (command) switch (command)
{ {
@@ -219,75 +217,100 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
case MANAGER_LIST: case MANAGER_LIST:
{ {
container_ffmpeg_update_tracks(context, context->playback->uri, 0); container_ffmpeg_update_tracks(context, context->playback->uri, 0);
*((char ***) argument) = (char **) ManagerList(context); *((char ** *)argument) = (char **)ManagerList(context);
break; break;
} }
case MANAGER_GET: case MANAGER_GET:
{ {
if (TrackCount > 0 && CurrentTrack >= 0) if (TrackCount > 0 && CurrentTrack >= 0)
*((int *) argument) = (int) Tracks[CurrentTrack].Id; {
*((int *)argument) = (int)Tracks[CurrentTrack].Id;
}
else else
*((int *) argument) = (int) -1; {
*((int *)argument) = (int) - 1;
}
break;
}
case MANAGER_GET_TRACK_DESC:
{
if ((TrackCount > 0) && (CurrentTrack >= 0))
{
TrackDescription_t *track = malloc(sizeof(TrackDescription_t));
*((TrackDescription_t **)argument) = track;
if (track)
{
memset(track, 0, sizeof(TrackDescription_t));
track->Id = Tracks[CurrentTrack].Id;
track->Name = strdup(Tracks[CurrentTrack].Name);
track->Encoding = strdup(Tracks[CurrentTrack].Encoding);
}
}
else
{
*((TrackDescription_t **)argument) = NULL;
}
break; break;
} }
case MANAGER_GET_TRACK: case MANAGER_GET_TRACK:
{ {
//subtitle_mgr_printf(20, "%s::%s MANAGER_GET_TRACK\n", FILENAME, __FUNCTION__);
if ((TrackCount > 0) && (CurrentTrack >= 0)) if ((TrackCount > 0) && (CurrentTrack >= 0))
{ {
subtitle_mgr_printf(120, "return %d, %p\n", CurrentTrack, *((Track_t **)argument) = (Track_t *) &Tracks[CurrentTrack];
&Tracks[CurrentTrack]);
*((Track_t **) argument) =
(Track_t *) & Tracks[CurrentTrack];
} }
else else
{ {
subtitle_mgr_printf(20, "return NULL\n"); *((Track_t **)argument) = NULL;
*((Track_t **) argument) = NULL;
} }
break; break;
} }
case MANAGER_GETENCODING: case MANAGER_GETENCODING:
{ {
if (TrackCount > 0 && CurrentTrack >= 0) if (TrackCount > 0 && CurrentTrack >= 0)
*((char **) argument) = {
(char *) strdup(Tracks[CurrentTrack].Encoding); *((char **)argument) = (char *)strdup(Tracks[CurrentTrack].Encoding);
}
else else
*((char **) argument) = (char *) strdup(""); {
*((char **)argument) = (char *)strdup("");
}
break; break;
} }
case MANAGER_GETNAME: case MANAGER_GETNAME:
{ {
if (TrackCount > 0 && CurrentTrack >= 0) if (TrackCount > 0 && CurrentTrack >= 0)
*((char **) argument) = {
(char *) strdup(Tracks[CurrentTrack].Name); *((char **)argument) = (char *)strdup(Tracks[CurrentTrack].Name);
}
else else
*((char **) argument) = (char *) strdup(""); {
*((char **)argument) = (char *)strdup("");
}
break; break;
} }
case MANAGER_SET: case MANAGER_SET:
{ {
int i; int i;
subtitle_mgr_printf(20, "%s::%s MANAGER_SET id=%d\n", FILENAME, subtitle_mgr_printf(20, "%s::%s MANAGER_SET id=%d\n", __FILE__, __FUNCTION__, *((int *)argument));
__FUNCTION__, *((int *) argument));
if (*((int *) argument) < 0) if (*((int *)argument) < 0)
{ {
CurrentTrack = -1; CurrentTrack = -1;
break; break;
} }
for (i = 0; i < TrackCount; i++) for (i = 0; i < TrackCount; i++)
if (Tracks[i].Id == *((int *) argument)) {
if (Tracks[i].Id == *((int *)argument))
{ {
CurrentTrack = i; CurrentTrack = i;
break; break;
} }
}
if (i == TrackCount) if (i == TrackCount)
{ {
subtitle_mgr_err("%s::%s track id %d unknown\n", FILENAME, subtitle_mgr_err("%s::%s track id %d unknown\n", __FILE__, __FUNCTION__, *((int *)argument));
__FUNCTION__, *((int *) argument));
ret = cERR_SUBTITLE_MGR_ERROR; ret = cERR_SUBTITLE_MGR_ERROR;
} }
break; break;
@@ -301,24 +324,22 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
{ {
int i; int i;
for (i = 0; i < TrackCount; i++) for (i = 0; i < TrackCount; i++)
//if (!Tracks[i].is_static) {
Tracks[i].pending = 1; Tracks[i].pending = 1;
}
break; break;
} }
default: default:
subtitle_mgr_err("%s:%s: ConatinerCmd not supported!", FILENAME, subtitle_mgr_err("%s:%s: ContainerCmd not supported!", __FILE__, __FUNCTION__);
__FUNCTION__);
ret = cERR_SUBTITLE_MGR_ERROR; ret = cERR_SUBTITLE_MGR_ERROR;
break; break;
} }
subtitle_mgr_printf(50, "%s:%s: returning %d\n", FILENAME, subtitle_mgr_printf(50, "%s:%s: returning %d\n", __FILE__, __FUNCTION__, ret);
__FUNCTION__, ret);
return ret; return ret;
} }
struct Manager_s SubtitleManager = struct Manager_s SubtitleManager =
{ {
"Subtitle", "Subtitle",

View File

@@ -59,8 +59,6 @@ if (debug_level >= level) printf(x); } while (0)
#define cERR_VIDEO_MGR_NO_ERROR 0 #define cERR_VIDEO_MGR_NO_ERROR 0
#define cERR_VIDEO_MGR_ERROR -1 #define cERR_VIDEO_MGR_ERROR -1
static const char FILENAME[] = __FILE__;
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
/* ***************************** */ /* ***************************** */
@@ -85,7 +83,7 @@ static void (* updatedTrackInfoFnc)(void) = NULL;
static int ManagerAdd(Context_t *context, Track_t track) static int ManagerAdd(Context_t *context, Track_t track)
{ {
video_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); video_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
if (Tracks == NULL) if (Tracks == NULL)
{ {
Tracks = malloc(sizeof(Track_t) * TRACKWRAP); Tracks = malloc(sizeof(Track_t) * TRACKWRAP);
@@ -97,7 +95,7 @@ static int ManagerAdd(Context_t *context, Track_t track)
} }
if (Tracks == NULL) if (Tracks == NULL)
{ {
video_mgr_err("%s:%s malloc failed\n", FILENAME, __FUNCTION__); video_mgr_err("%s:%s malloc failed\n", __FILE__, __FUNCTION__);
return cERR_VIDEO_MGR_ERROR; return cERR_VIDEO_MGR_ERROR;
} }
int i; int i;
@@ -116,14 +114,14 @@ static int ManagerAdd(Context_t *context, Track_t track)
} }
else else
{ {
video_mgr_err("%s:%s TrackCount out if range %d - %d\n", FILENAME, __FUNCTION__, TrackCount, TRACKWRAP); video_mgr_err("%s:%s TrackCount out if range %d - %d\n", __FILE__, __FUNCTION__, TrackCount, TRACKWRAP);
return cERR_VIDEO_MGR_ERROR; return cERR_VIDEO_MGR_ERROR;
} }
if (TrackCount > 0) if (TrackCount > 0)
{ {
context->playback->isVideo = 1; context->playback->isVideo = 1;
} }
video_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); video_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
return cERR_VIDEO_MGR_NO_ERROR; return cERR_VIDEO_MGR_NO_ERROR;
} }
@@ -131,13 +129,13 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
{ {
int i = 0, j = 0; int i = 0, j = 0;
char **tracklist = NULL; char **tracklist = NULL;
video_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); video_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
if (Tracks != NULL) if (Tracks != NULL)
{ {
tracklist = malloc(sizeof(char *) * ((TrackCount * 2) + 1)); tracklist = malloc(sizeof(char *) * ((TrackCount * 2) + 1));
if (tracklist == NULL) if (tracklist == NULL)
{ {
video_mgr_err("%s:%s malloc failed\n", FILENAME, __FUNCTION__); video_mgr_err("%s:%s malloc failed\n", __FILE__, __FUNCTION__);
return NULL; return NULL;
} }
for (i = 0, j = 0; i < TrackCount; i++, j += 2) for (i = 0, j = 0; i < TrackCount; i++, j += 2)
@@ -154,14 +152,14 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
} }
tracklist[j] = NULL; tracklist[j] = NULL;
} }
video_mgr_printf(10, "%s::%s return %p (%d - %d)\n", FILENAME, __FUNCTION__, tracklist, j, TrackCount); video_mgr_printf(10, "%s::%s return %p (%d - %d)\n", __FILE__, __FUNCTION__, tracklist, j, TrackCount);
return tracklist; return tracklist;
} }
static int ManagerDel(Context_t *context) static int ManagerDel(Context_t *context)
{ {
int i = 0; int i = 0;
video_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); video_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
if (Tracks != NULL) if (Tracks != NULL)
{ {
for (i = 0; i < TrackCount; i++) for (i = 0; i < TrackCount; i++)
@@ -173,13 +171,13 @@ static int ManagerDel(Context_t *context)
} }
else else
{ {
video_mgr_err("%s::%s nothing to delete!\n", FILENAME, __FUNCTION__); video_mgr_err("%s::%s nothing to delete!\n", __FILE__, __FUNCTION__);
return cERR_VIDEO_MGR_ERROR; return cERR_VIDEO_MGR_ERROR;
} }
TrackCount = 0; TrackCount = 0;
CurrentTrack = 0; CurrentTrack = 0;
context->playback->isVideo = 0; context->playback->isVideo = 0;
video_mgr_printf(10, "%s::%s return no error\n", FILENAME, __FUNCTION__); video_mgr_printf(10, "%s::%s return no error\n", __FILE__, __FUNCTION__);
return cERR_VIDEO_MGR_NO_ERROR; return cERR_VIDEO_MGR_NO_ERROR;
} }
@@ -187,7 +185,7 @@ static int Command(void *_context, ManagerCmd_t command, void *argument)
{ {
Context_t *context = (Context_t *) _context; Context_t *context = (Context_t *) _context;
int ret = cERR_VIDEO_MGR_NO_ERROR; int ret = cERR_VIDEO_MGR_NO_ERROR;
video_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); video_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
switch (command) switch (command)
{ {
case MANAGER_ADD: case MANAGER_ADD:
@@ -242,7 +240,7 @@ static int Command(void *_context, ManagerCmd_t command, void *argument)
} }
case MANAGER_GET_TRACK: case MANAGER_GET_TRACK:
{ {
video_mgr_printf(20, "%s::%s MANAGER_GET_TRACK\n", FILENAME, __FUNCTION__); video_mgr_printf(20, "%s::%s MANAGER_GET_TRACK\n", __FILE__, __FUNCTION__);
if ((TrackCount > 0) && (CurrentTrack >= 0)) if ((TrackCount > 0) && (CurrentTrack >= 0))
{ {
*((Track_t **)argument) = (Track_t *) &Tracks[CurrentTrack]; *((Track_t **)argument) = (Track_t *) &Tracks[CurrentTrack];
@@ -290,7 +288,7 @@ static int Command(void *_context, ManagerCmd_t command, void *argument)
} }
if (i == TrackCount) if (i == TrackCount)
{ {
video_mgr_err("%s::%s track id %d unknown\n", FILENAME, __FUNCTION__, *((int *)argument)); video_mgr_err("%s::%s track id %d unknown\n", __FILE__, __FUNCTION__, *((int *)argument));
ret = cERR_VIDEO_MGR_ERROR; ret = cERR_VIDEO_MGR_ERROR;
} }
break; break;
@@ -321,11 +319,11 @@ static int Command(void *_context, ManagerCmd_t command, void *argument)
break; break;
} }
default: default:
video_mgr_err("%s::%s ContainerCmd %d not supported!\n", FILENAME, __FUNCTION__, command); video_mgr_err("%s::%s ContainerCmd %d not supported!\n", __FILE__, __FUNCTION__, command);
ret = cERR_VIDEO_MGR_ERROR; ret = cERR_VIDEO_MGR_ERROR;
break; break;
} }
video_mgr_printf(10, "%s:%s: returning %d\n", FILENAME, __FUNCTION__, ret); video_mgr_printf(10, "%s:%s: returning %d\n", __FILE__, __FUNCTION__, ret);
return ret; return ret;
} }

View File

@@ -58,7 +58,7 @@
#define LINUXDVB_SILENT #define LINUXDVB_SILENT
#endif #endif
static short debug_level = 20; static unsigned short debug_level = 20;
static const char FILENAME[] = __FILE__; static const char FILENAME[] = __FILE__;
@@ -426,7 +426,7 @@ int LinuxDvbReverseDiscontinuity(Context_t *context __attribute__((unused)), int
int ret = cERR_LINUXDVB_NO_ERROR; int ret = cERR_LINUXDVB_NO_ERROR;
// int dis_type = VIDEO_DISCONTINUITY_CONTINUOUS_REVERSE | *surplus; // int dis_type = VIDEO_DISCONTINUITY_CONTINUOUS_REVERSE | *surplus;
// linuxdvb_printf(50, "\n"); // linuxdvb_printf(50, "\n");
// if (ioctl( videofd, VIDEO_DISCONTINUITY, (void*) dis_type) == -1) // if (ioctl(videofd, VIDEO_DISCONTINUITY, (void*) dis_type) == -1)
// { // {
// linuxdvb_err("ioctl failed with errno %d\n", errno); // linuxdvb_err("ioctl failed with errno %d\n", errno);
// linuxdvb_err("VIDEO_DISCONTINUITY: %s\n", strerror(errno)); // linuxdvb_err("VIDEO_DISCONTINUITY: %s\n", strerror(errno));
@@ -475,7 +475,7 @@ int LinuxDvbFlush(Context_t *context __attribute__((unused)), char *type)
// unsigned char video = !strcmp("video", type); // unsigned char video = !strcmp("video", type);
// unsigned char audio = !strcmp("audio", type); // unsigned char audio = !strcmp("audio", type);
// linuxdvb_printf(10, "v%d a%d\n", video, audio); // linuxdvb_printf(10, "v%d a%d\n", video, audio);
// if ( (video && videofd != -1) || (audio && audiofd != -1) ) { // if ((video && videofd != -1) || (audio && audiofd != -1)) {
// getLinuxDVBMutex(FILENAME, __FUNCTION__,__LINE__); // getLinuxDVBMutex(FILENAME, __FUNCTION__,__LINE__);
// if (video && videofd != -1) { // if (video && videofd != -1) {
// if (ioctl(videofd, VIDEO_FLUSH, NULL) == -1) // if (ioctl(videofd, VIDEO_FLUSH, NULL) == -1)
@@ -723,7 +723,7 @@ int LinuxDvbSwitch(Context_t *context, char *type)
if (writer == NULL) if (writer == NULL)
{ {
linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding); linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding);
// if (ioctl( audiofd, AUDIO_SET_BYPASS_MODE, (void*) AUDIO_ENCODING_MP3) == -1) // if (ioctl(audiofd, AUDIO_SET_BYPASS_MODE, (void*) AUDIO_ENCODING_MP3) == -1)
// { // {
// linuxdvb_err("ioctl failed with errno %d\n", errno); // linuxdvb_err("ioctl failed with errno %d\n", errno);
// linuxdvb_err("AUDIO_SET_BYPASS_MODE: %s\n", strerror(errno)); // linuxdvb_err("AUDIO_SET_BYPASS_MODE: %s\n", strerror(errno));
@@ -771,7 +771,7 @@ int LinuxDvbSwitch(Context_t *context, char *type)
if (writer == NULL) if (writer == NULL)
{ {
linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding); linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding);
// if (ioctl( videofd, VIDEO_SET_STREAMTYPE, (void*) VIDEO_ENCODING_AUTO) == -1) // if (ioctl(videofd, VIDEO_SET_STREAMTYPE, (void*) VIDEO_ENCODING_AUTO) == -1)
// { // {
// linuxdvb_err("ioctl failed with errno %d\n", errno); // linuxdvb_err("ioctl failed with errno %d\n", errno);
// linuxdvb_err("VIDEO_SET_STREAMTYPE: %s\n", strerror(errno)); // linuxdvb_err("VIDEO_SET_STREAMTYPE: %s\n", strerror(errno));

View File

@@ -59,7 +59,7 @@ static const char FILENAME[] = __FILE__;
#ifdef LINUXDVB_DEBUG #ifdef LINUXDVB_DEBUG
#define linuxdvb_printf(level, fmt, x...) do { \ #define linuxdvb_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x ); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define linuxdvb_printf(x...) #define linuxdvb_printf(x...)
#endif #endif

View File

@@ -57,8 +57,6 @@ if (debug_level >= level) fprintf(stderr, x); } while (0)
#define cERR_OUTPUT_NO_ERROR 0 #define cERR_OUTPUT_NO_ERROR 0
#define cERR_OUTPUT_INTERNAL_ERROR -1 #define cERR_OUTPUT_INTERNAL_ERROR -1
static const char *FILENAME = "output.c";
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
/* ***************************** */ /* ***************************** */
@@ -85,7 +83,7 @@ static Output_t *AvailableOutput[] =
static void printOutputCapabilities() static void printOutputCapabilities()
{ {
int i, j; int i, j;
output_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); output_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
output_printf(10, "Capabilities:\n"); output_printf(10, "Capabilities:\n");
for (i = 0; AvailableOutput[i] != NULL; i++) for (i = 0; AvailableOutput[i] != NULL; i++)
{ {
@@ -105,7 +103,7 @@ static void printOutputCapabilities()
static void OutputAdd(Context_t *context, char *port) static void OutputAdd(Context_t *context, char *port)
{ {
int i, j; int i, j;
output_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); output_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
for (i = 0; AvailableOutput[i] != NULL; i++) for (i = 0; AvailableOutput[i] != NULL; i++)
{ {
for (j = 0; AvailableOutput[i]->Capabilities[j] != NULL; j++) for (j = 0; AvailableOutput[i]->Capabilities[j] != NULL; j++)
@@ -134,7 +132,7 @@ static void OutputAdd(Context_t *context, char *port)
static void OutputDel(Context_t *context, char *port) static void OutputDel(Context_t *context, char *port)
{ {
output_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); output_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
if (!strcmp("audio", port)) if (!strcmp("audio", port))
{ {
context->output->audio = NULL; context->output->audio = NULL;
@@ -153,7 +151,7 @@ static int Command(void *_context, OutputCmd_t command, void *argument)
{ {
Context_t *context = (Context_t *) _context; Context_t *context = (Context_t *) _context;
int ret = cERR_OUTPUT_NO_ERROR; int ret = cERR_OUTPUT_NO_ERROR;
output_printf(10, "%s::%s Command %d\n", FILENAME, __FUNCTION__, command); output_printf(10, "%s::%s Command %d\n", __FILE__, __FUNCTION__, command);
switch (command) switch (command)
{ {
case OUTPUT_OPEN: case OUTPUT_OPEN:
@@ -542,11 +540,11 @@ static int Command(void *_context, OutputCmd_t command, void *argument)
} }
} }
default: default:
output_err("%s::%s OutputCmd %d not supported!\n", FILENAME, __FUNCTION__, command); output_err("%s::%s OutputCmd %d not supported!\n", __FILE__, __FUNCTION__, command);
ret = cERR_OUTPUT_INTERNAL_ERROR; ret = cERR_OUTPUT_INTERNAL_ERROR;
break; break;
} }
output_printf(10, "%s::%s exiting with value %d\n", FILENAME, __FUNCTION__, ret); output_printf(10, "%s::%s exiting with value %d\n", __FILE__, __FUNCTION__, ret);
return ret; return ret;
} }

View File

@@ -68,8 +68,6 @@ if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x);
#define cERR_SUBTITLE_NO_ERROR 0 #define cERR_SUBTITLE_NO_ERROR 0
#define cERR_SUBTITLE_ERROR -1 #define cERR_SUBTITLE_ERROR -1
static const char FILENAME[] = __FILE__;
/* /*
Number, Style, Name,, MarginL, MarginR, MarginV, Effect,, Text Number, Style, Name,, MarginL, MarginR, MarginV, Effect,, Text

View File

@@ -106,6 +106,7 @@ static uint8_t brcm_divx311_sequence_header[] =
/* ***************************** */ /* ***************************** */
/* MISC Functions */ /* MISC Functions */
/* ***************************** */ /* ***************************** */
static int reset() static int reset()
{ {
initialHeader = 1; initialHeader = 1;

View File

@@ -69,6 +69,7 @@ if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x);
#else #else
#define h263_err(fmt, x...) #define h263_err(fmt, x...)
#endif #endif
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
/* ***************************** */ /* ***************************** */

View File

@@ -266,8 +266,7 @@ static int32_t writeData(void *_call)
iov[1].iov_len = fixed_buffersize; iov[1].iov_len = fixed_buffersize;
writev_with_retry(call->fd, iov, 2); writev_with_retry(call->fd, iov, 2);
fixed_buffertimestamp += fixed_bufferduration; fixed_buffertimestamp += fixed_bufferduration;
int g_fd_dump = open("/hdd/lpcm/ffmpeg.pes", O_CREAT | int g_fd_dump = open("/hdd/lpcm/ffmpeg.pes", O_CREAT | O_RDWR | O_APPEND, S_IRUSR | S_IWUSR);
O_RDWR | O_APPEND, S_IRUSR | S_IWUSR);
writev_with_retry(g_fd_dump, iov, 2); writev_with_retry(g_fd_dump, iov, 2);
close(g_fd_dump); close(g_fd_dump);
} }

View File

@@ -100,6 +100,7 @@ static video_codec_data_t videocodecdata = {0, 0};
/* ***************************** */ /* ***************************** */
/* MISC Functions */ /* MISC Functions */
/* ***************************** */ /* ***************************** */
static int reset() static int reset()
{ {
initialHeader = 1; initialHeader = 1;
@@ -153,8 +154,8 @@ static int writeData(void *_call)
} }
} }
uint8_t needFrameStartCode = 0; uint8_t needFrameStartCode = 0;
if (sizeof(Vc1FrameStartCode) >= call->len if (sizeof(Vc1FrameStartCode) >= call->len ||
|| memcmp(call->data, Vc1FrameStartCode, sizeof(Vc1FrameStartCode)) != 0) memcmp(call->data, Vc1FrameStartCode, sizeof(Vc1FrameStartCode)) != 0)
{ {
needFrameStartCode = 1; needFrameStartCode = 1;
PacketLength += sizeof(Vc1FrameStartCode); PacketLength += sizeof(Vc1FrameStartCode);

View File

@@ -98,6 +98,7 @@ static video_codec_data_t videocodecdata = {0, 0};
/* ***************************** */ /* ***************************** */
/* MISC Functions */ /* MISC Functions */
/* ***************************** */ /* ***************************** */
static int reset() static int reset()
{ {
initialHeader = 1; initialHeader = 1;
@@ -159,8 +160,8 @@ static int writeData(void *_call)
} }
} }
uint8_t needFrameStartCode = 0; uint8_t needFrameStartCode = 0;
if (sizeof(Vc1FrameStartCode) >= call->len if (sizeof(Vc1FrameStartCode) >= call->len ||
|| memcmp(call->data, Vc1FrameStartCode, sizeof(Vc1FrameStartCode)) != 0) memcmp(call->data, Vc1FrameStartCode, sizeof(Vc1FrameStartCode)) != 0)
{ {
needFrameStartCode = 1; needFrameStartCode = 1;
PacketLength += sizeof(Vc1FrameStartCode); PacketLength += sizeof(Vc1FrameStartCode);

View File

@@ -99,6 +99,7 @@ static Writer_t *AvailableWriter[] =
/* ***************************** */ /* ***************************** */
/* Functions */ /* Functions */
/* ***************************** */ /* ***************************** */
ssize_t write_with_retry(int fd, const void *buf, size_t size) ssize_t write_with_retry(int fd, const void *buf, size_t size)
{ {
ssize_t ret; ssize_t ret;

View File

@@ -52,6 +52,7 @@
/* ***************************** */ /* ***************************** */
/* Makros/Constants */ /* Makros/Constants */
/* ***************************** */ /* ***************************** */
#ifdef SAM_WITH_DEBUG #ifdef SAM_WITH_DEBUG
#define H264_DEBUG #define H264_DEBUG
#else #else

View File

@@ -103,7 +103,7 @@ static const unsigned char Metadata[] =
}; };
/* ***************************** */ /* ***************************** */
/* Varaibles */ /* Variables */
/* ***************************** */ /* ***************************** */
static int initialHeader = 1; static int initialHeader = 1;

View File

@@ -207,8 +207,7 @@ static int writeData(void *_call)
{ {
unsigned int PesLength; unsigned int PesLength;
unsigned int PrivateHeaderLength; unsigned int PrivateHeaderLength;
PrivateHeaderLength = InsertVideoPrivateDataHeader(&PesHeader[HeaderLength], PrivateHeaderLength = InsertVideoPrivateDataHeader(&PesHeader[HeaderLength], call->len);
call->len);
/* Update PesLength */ /* Update PesLength */
PesLength = PesHeader[PES_LENGTH_BYTE_0] + PesLength = PesHeader[PES_LENGTH_BYTE_0] +
(PesHeader[PES_LENGTH_BYTE_1] << 8) + PrivateHeaderLength; (PesHeader[PES_LENGTH_BYTE_1] << 8) + PrivateHeaderLength;

View File

@@ -175,9 +175,9 @@ static int PlaybackOpen(Context_t *context, PlayFiles_t *pFiles)
return cERR_PLAYBACK_ERROR; return cERR_PLAYBACK_ERROR;
} }
pFiles->szFirstFile = context->playback->uri; pFiles->szFirstFile = context->playback->uri;
if ((context->container->Command(context, CONTAINER_ADD, extension) < 0) if ((context->container->Command(context, CONTAINER_ADD, extension) < 0) ||
|| (!context->container->selectedContainer) (!context->container->selectedContainer) ||
|| (context->container->selectedContainer->Command(context, CONTAINER_INIT, pFiles) < 0)) (context->container->selectedContainer->Command(context, CONTAINER_INIT, pFiles) < 0))
{ {
playback_err("CONTAINER_ADD failed\n"); playback_err("CONTAINER_ADD failed\n");
return cERR_PLAYBACK_ERROR; return cERR_PLAYBACK_ERROR;
@@ -409,6 +409,111 @@ static int32_t PlaybackTerminate(Context_t *context)
return ret; return ret;
} }
static int PlaybackFastForward(Context_t *context, int *speed)
{
int32_t ret = cERR_PLAYBACK_NO_ERROR;
playback_printf(10, "speed %d\n", *speed);
/* Audio only forwarding not supported */
if (context->playback->isVideo && !context->playback->isHttp && !context->playback->BackWard && (!context->playback->isPaused || context->playback->isPlaying))
{
if ((*speed <= 0) || (*speed > cMaxSpeed_ff))
{
playback_err("speed %d out of range (1 - %d) \n", *speed, cMaxSpeed_ff);
return cERR_PLAYBACK_ERROR;
}
context->playback->isForwarding = 1;
context->playback->Speed = *speed;
playback_printf(20, "Speed: %d x {%d}\n", *speed, context->playback->Speed);
context->output->Command(context, OUTPUT_FASTFORWARD, NULL);
}
else
{
playback_err("fast forward not possible\n");
ret = cERR_PLAYBACK_ERROR;
}
playback_printf(10, "exiting with value %d\n", ret);
return ret;
}
static int PlaybackFastBackward(Context_t *context, int *speed)
{
int32_t ret = cERR_PLAYBACK_NO_ERROR;
playback_printf(10, "speed = %d\n", *speed);
/* Audio only reverse play not supported */
if (context->playback->isVideo && !context->playback->isForwarding &&
(!context->playback->isPaused || context->playback->isPlaying))
{
if ((*speed > 0) || (*speed < cMaxSpeed_fr))
{
playback_err("speed %d out of range (0 - %d) \n", *speed, cMaxSpeed_fr);
return cERR_PLAYBACK_ERROR;
}
if (*speed == 0)
{
context->playback->BackWard = 0;
context->playback->Speed = 0; /* reverse end */
}
else
{
context->playback->isSeeking = 1;
context->playback->Speed = *speed;
context->playback->BackWard = 2 ^ (*speed);
playback_printf(1, "S %d B %f\n", context->playback->Speed, context->playback->BackWard);
}
context->output->Command(context, OUTPUT_AUDIOMUTE, "1");
context->output->Command(context, OUTPUT_CLEAR, NULL);
if (context->output->Command(context, OUTPUT_REVERSE, NULL) < 0)
{
playback_err("OUTPUT_REVERSE failed\n");
context->playback->BackWard = 0;
context->playback->Speed = 1;
context->playback->isSeeking = 0;
ret = cERR_PLAYBACK_ERROR;
}
}
else
{
playback_err("fast backward not possible\n");
ret = cERR_PLAYBACK_ERROR;
}
context->playback->isSeeking = 0;
playback_printf(10, "exiting with value %d\n", ret);
return ret;
}
static int32_t PlaybackSlowMotion(Context_t *context, int *speed)
{
int32_t ret = cERR_PLAYBACK_NO_ERROR;
playback_printf(10, "\n");
//Audio only forwarding not supported
if (context->playback->isVideo && !context->playback->isHttp && context->playback->isPlaying)
{
if (context->playback->isPaused)
PlaybackContinue(context);
switch (*speed)
{
case 2:
context->playback->SlowMotion = 2;
break;
case 4:
context->playback->SlowMotion = 4;
break;
case 8:
context->playback->SlowMotion = 8;
break;
}
playback_printf(20, "SlowMotion: %d x {%d}\n", *speed, context->playback->SlowMotion);
context->output->Command(context, OUTPUT_SLOWMOTION, NULL);
}
else
{
playback_err("slowmotion not possible\n");
ret = cERR_PLAYBACK_ERROR;
}
playback_printf(10, "exiting with value %d\n", ret);
return ret;
}
static int32_t PlaybackSeek(Context_t *context, int64_t *pos, uint8_t absolute) static int32_t PlaybackSeek(Context_t *context, int64_t *pos, uint8_t absolute)
{ {
int32_t ret = cERR_PLAYBACK_NO_ERROR; int32_t ret = cERR_PLAYBACK_NO_ERROR;
@@ -678,6 +783,21 @@ static int32_t Command(void *_context, PlaybackCmd_t command, void *argument)
ret = PlaybackInfo(context, (char **)argument); ret = PlaybackInfo(context, (char **)argument);
break; break;
} }
case PLAYBACK_SLOWMOTION:
{
ret = PlaybackSlowMotion(context, (int *)argument);
break;
}
case PLAYBACK_FASTBACKWARD:
{
ret = PlaybackFastBackward(context, (int *)argument);
break;
}
case PLAYBACK_FASTFORWARD:
{
ret = PlaybackFastForward(context, (int *)argument);
break;
}
case PLAYBACK_GET_FRAME_COUNT: case PLAYBACK_GET_FRAME_COUNT:
{ {
ret = PlaybackGetFrameCount(context, (uint64_t *)argument); ret = PlaybackGetFrameCount(context, (uint64_t *)argument);