trancode: fix the video stream pts/dts - h264 works with ffmpeg now
This commit is contained in:
parent
f2bbfa40e5
commit
a51677e999
1 changed files with 8 additions and 9 deletions
|
@ -927,14 +927,14 @@ transcoder_stream_audio(transcoder_stream_t *ts, th_pkt_t *pkt)
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void send_video_packet(transcoder_stream_t *ts, th_pkt_t *pkt, uint8_t *out, int length, AVCodecContext *octx)
|
static void send_video_packet(transcoder_stream_t *ts, th_pkt_t *pkt, AVPacket *epkt, AVCodecContext *octx)
|
||||||
{
|
{
|
||||||
streaming_message_t *sm;
|
streaming_message_t *sm;
|
||||||
th_pkt_t *n;
|
th_pkt_t *n;
|
||||||
|
|
||||||
if (length <= 0) {
|
if (epkt->size <= 0) {
|
||||||
if (length) {
|
if (epkt->size) {
|
||||||
tvhlog(LOG_ERR, "transcode", "Unable to encode video (%d)", length);
|
tvhlog(LOG_ERR, "transcode", "Unable to encode video (%d)", epkt->size);
|
||||||
ts->ts_index = 0;
|
ts->ts_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -944,7 +944,7 @@ static void send_video_packet(transcoder_stream_t *ts, th_pkt_t *pkt, uint8_t *o
|
||||||
if (!octx->coded_frame)
|
if (!octx->coded_frame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
n = pkt_alloc(out, length, octx->coded_frame->pkt_pts, octx->coded_frame->pkt_dts);
|
n = pkt_alloc(epkt->data, epkt->size, epkt->pts, epkt->dts);
|
||||||
|
|
||||||
switch (octx->coded_frame->pict_type) {
|
switch (octx->coded_frame->pict_type) {
|
||||||
case AV_PICTURE_TYPE_I:
|
case AV_PICTURE_TYPE_I:
|
||||||
|
@ -984,6 +984,7 @@ static void send_video_packet(transcoder_stream_t *ts, th_pkt_t *pkt, uint8_t *o
|
||||||
n->pkt_header = pktbuf_alloc(octx->extradata, octx->extradata_size);
|
n->pkt_header = pktbuf_alloc(octx->extradata, octx->extradata_size);
|
||||||
else {
|
else {
|
||||||
if (octx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
|
if (octx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
|
||||||
|
uint8_t *out = epkt->data;
|
||||||
uint32_t *mpeg2_header = (uint32_t *)out;
|
uint32_t *mpeg2_header = (uint32_t *)out;
|
||||||
if (*mpeg2_header == 0xb3010000) { // SEQ_START_CODE
|
if (*mpeg2_header == 0xb3010000) { // SEQ_START_CODE
|
||||||
// Need to determine lentgh of header.
|
// Need to determine lentgh of header.
|
||||||
|
@ -1287,10 +1288,8 @@ transcoder_stream_video(transcoder_stream_t *ts, th_pkt_t *pkt)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (got_output) {
|
if (got_output)
|
||||||
send_video_packet(ts, pkt, packet2.data, packet2.size, octx);
|
send_video_packet(ts, pkt, &packet2, octx);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
av_free_packet(&packet2);
|
av_free_packet(&packet2);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue