diff --git a/mythtv/libs/libmythtv/recorders/NuppelVideoRecorder.cpp b/mythtv/libs/libmythtv/recorders/NuppelVideoRecorder.cpp
index b1598a7..919f790 100644
|
a
|
b
|
void NuppelVideoRecorder::InitBuffers(void)
|
| 930 | 930 | |
| 931 | 931 | if (!video_buffer_size) |
| 932 | 932 | { |
| 933 | | video_buffer_size = |
| 934 | | buffersize(picture_format == AV_PIX_FMT_YUV422P ? FMT_YUV422P : FMT_YV12, |
| 935 | | w_out, h_out); |
| | 933 | if (picture_format == AV_PIX_FMT_YUV422P) |
| | 934 | video_buffer_size = w_out * h_out * 2; |
| | 935 | else |
| | 936 | video_buffer_size = w_out * h_out * 3 / 2; |
| 936 | 937 | } |
| 937 | 938 | |
| 938 | 939 | if (width >= 480 || height > 288) |
| … |
… |
void NuppelVideoRecorder::WriteVideo(VideoFrame *frame, bool skipsync,
|
| 2877 | 2878 | lzo_uint out_len = OUT_LEN; |
| 2878 | 2879 | struct rtframeheader frameheader; |
| 2879 | 2880 | int raw = 0, compressthis = compression; |
| 2880 | | uint8_t *planes[3] = { |
| 2881 | | frame->buf + frame->offsets[0], |
| 2882 | | frame->buf + frame->offsets[1], |
| 2883 | | frame->buf + frame->offsets[2] }; |
| | 2881 | uint8_t *planes[3]; |
| | 2882 | int len = frame->size; |
| 2884 | 2883 | int fnum = frame->frameNumber; |
| 2885 | 2884 | long long timecode = frame->timecode; |
| | 2885 | unsigned char *buf = frame->buf; |
| 2886 | 2886 | |
| 2887 | 2887 | memset(&frameheader, 0, sizeof(frameheader)); |
| 2888 | 2888 | |
| | 2889 | planes[0] = buf; |
| | 2890 | planes[1] = planes[0] + frame->width * frame->height; |
| | 2891 | planes[2] = planes[1] + (frame->width * frame->height) / |
| | 2892 | (picture_format == AV_PIX_FMT_YUV422P ? 2 : 4); |
| | 2893 | |
| 2889 | 2894 | if (lf == 0) |
| 2890 | 2895 | { // this will be triggered every new file |
| 2891 | 2896 | lf = fnum; |
| … |
… |
void NuppelVideoRecorder::WriteVideo(VideoFrame *frame, bool skipsync,
|
| 2944 | 2949 | if (useavcodec) |
| 2945 | 2950 | { |
| 2946 | 2951 | MythAVFrame mpa_picture; |
| 2947 | | AVPictureFill(mpa_picture, frame); |
| | 2952 | |
| | 2953 | switch (picture_format) |
| | 2954 | { |
| | 2955 | case AV_PIX_FMT_YUV420P: |
| | 2956 | case AV_PIX_FMT_YUV422P: |
| | 2957 | case AV_PIX_FMT_YUVJ420P: |
| | 2958 | mpa_picture->linesize[0] = w_out; |
| | 2959 | mpa_picture->linesize[1] = w_out / 2; |
| | 2960 | mpa_picture->linesize[2] = w_out / 2; |
| | 2961 | break; |
| | 2962 | } |
| | 2963 | mpa_picture->data[0] = planes[0]; |
| | 2964 | mpa_picture->data[1] = planes[1]; |
| | 2965 | mpa_picture->data[2] = planes[2]; |
| | 2966 | mpa_picture->linesize[0] = frame->width; |
| | 2967 | mpa_picture->linesize[1] = frame->width / 2; |
| | 2968 | mpa_picture->linesize[2] = frame->width / 2; |
| 2948 | 2969 | |
| 2949 | 2970 | if (wantkeyframe) |
| 2950 | 2971 | mpa_picture->pict_type = AV_PICTURE_TYPE_I; |
| … |
… |
void NuppelVideoRecorder::WriteVideo(VideoFrame *frame, bool skipsync,
|
| 2956 | 2977 | AVPacket packet; |
| 2957 | 2978 | av_init_packet(&packet); |
| 2958 | 2979 | packet.data = (uint8_t *)strm; |
| 2959 | | packet.size = frame->size; |
| | 2980 | packet.size = len; |
| 2960 | 2981 | |
| 2961 | 2982 | int got_packet = 0; |
| 2962 | 2983 | |
| … |
… |
void NuppelVideoRecorder::WriteVideo(VideoFrame *frame, bool skipsync,
|
| 3000 | 3021 | tmp = rtjc->Compress(strm, planes); |
| 3001 | 3022 | } |
| 3002 | 3023 | else |
| 3003 | | tmp = frame->size; |
| | 3024 | tmp = len; |
| 3004 | 3025 | |
| 3005 | 3026 | // here is lzo compression afterwards |
| 3006 | 3027 | if (compressthis) |
| 3007 | 3028 | { |
| 3008 | 3029 | int r = 0; |
| 3009 | 3030 | if (raw) |
| 3010 | | r = lzo1x_1_compress((unsigned char*)frame->buf, frame->size, |
| | 3031 | r = lzo1x_1_compress((unsigned char*)buf, len, |
| 3011 | 3032 | out, &out_len, wrkmem); |
| 3012 | 3033 | else |
| 3013 | 3034 | r = lzo1x_1_compress((unsigned char *)strm, tmp, out, |
| … |
… |
void NuppelVideoRecorder::WriteVideo(VideoFrame *frame, bool skipsync,
|
| 3031 | 3052 | if (mpa_vidcodec->id == AV_CODEC_ID_RAWVIDEO) |
| 3032 | 3053 | { |
| 3033 | 3054 | frameheader.comptype = '0'; |
| 3034 | | frameheader.packetlength = frame->size; |
| | 3055 | frameheader.packetlength = len; |
| 3035 | 3056 | WriteFrameheader(&frameheader); |
| 3036 | | ringBuffer->Write(frame->buf, frame->size); |
| | 3057 | ringBuffer->Write(buf, len); |
| 3037 | 3058 | } |
| 3038 | 3059 | else if (hardware_encode) |
| 3039 | 3060 | { |
| 3040 | 3061 | frameheader.comptype = '4'; |
| 3041 | | frameheader.packetlength = frame->size; |
| | 3062 | frameheader.packetlength = len; |
| 3042 | 3063 | WriteFrameheader(&frameheader); |
| 3043 | | ringBuffer->Write(frame->buf, frame->size); |
| | 3064 | ringBuffer->Write(buf, len); |
| 3044 | 3065 | } |
| 3045 | 3066 | else |
| 3046 | 3067 | { |
| … |
… |
void NuppelVideoRecorder::WriteVideo(VideoFrame *frame, bool skipsync,
|
| 3062 | 3083 | else |
| 3063 | 3084 | { |
| 3064 | 3085 | frameheader.comptype = '0'; // raw YUV420 |
| 3065 | | frameheader.packetlength = frame->size; |
| | 3086 | frameheader.packetlength = len; |
| 3066 | 3087 | WriteFrameheader(&frameheader); |
| 3067 | | ringBuffer->Write(frame->buf, frame->size); // we write buf directly |
| | 3088 | ringBuffer->Write(buf, len); // we write buf directly |
| 3068 | 3089 | } |
| 3069 | 3090 | } |
| 3070 | 3091 | else |