avdevice: do not use AVFrame accessor
authorMuhammad Faiz <mfcc64@gmail.com>
Sat, 22 Apr 2017 08:56:47 +0000 (15:56 +0700)
committerMuhammad Faiz <mfcc64@gmail.com>
Sun, 23 Apr 2017 07:35:08 +0000 (14:35 +0700)
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
libavdevice/alsa_enc.c
libavdevice/lavfi.c
libavdevice/pulse_audio_enc.c

index bddc61f..0bef625 100644 (file)
@@ -130,7 +130,7 @@ static int audio_write_frame(AVFormatContext *s1, int stream_index,
     pkt.data     = (*frame)->data[0];
     pkt.size     = (*frame)->nb_samples * s->frame_size;
     pkt.dts      = (*frame)->pkt_dts;
-    pkt.duration = av_frame_get_pkt_duration(*frame);
+    pkt.duration = (*frame)->pkt_duration;
     return audio_write_packet(s1, &pkt);
 }
 
index eca3f15..ede391f 100644 (file)
@@ -376,7 +376,7 @@ static int create_subcc_packet(AVFormatContext *avctx, AVFrame *frame,
     memcpy(lavfi->subcc_packet.data, sd->data, sd->size);
     lavfi->subcc_packet.stream_index = stream_idx;
     lavfi->subcc_packet.pts = frame->pts;
-    lavfi->subcc_packet.pos = av_frame_get_pkt_pos(frame);
+    lavfi->subcc_packet.pos = frame->pkt_pos;
     return 0;
 }
 
@@ -440,15 +440,15 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
 
         av_image_copy_to_buffer(pkt->data, size, (const uint8_t **)frame->data, frame->linesize,
                                 frame->format, frame->width, frame->height, 1);
-    } else if (av_frame_get_channels(frame) /* FIXME test audio */) {
+    } else if (frame->channels /* FIXME test audio */) {
         size = frame->nb_samples * av_get_bytes_per_sample(frame->format) *
-                                   av_frame_get_channels(frame);
+                                   frame->channels;
         if ((ret = av_new_packet(pkt, size)) < 0)
             return ret;
         memcpy(pkt->data, frame->data[0], size);
     }
 
-    frame_metadata = av_frame_get_metadata(frame);
+    frame_metadata = frame->metadata;
     if (frame_metadata) {
         uint8_t *metadata;
         AVDictionaryEntry *e = NULL;
@@ -479,7 +479,7 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
 
     pkt->stream_index = stream_idx;
     pkt->pts = frame->pts;
-    pkt->pos = av_frame_get_pkt_pos(frame);
+    pkt->pos = frame->pkt_pos;
     pkt->size = size;
     av_frame_unref(frame);
     return size;
index 6fb634e..0efcf0f 100644 (file)
@@ -681,9 +681,9 @@ static int pulse_write_frame(AVFormatContext *h, int stream_index,
                AVERROR(EINVAL) : 0;
 
     pkt.data     = (*frame)->data[0];
-    pkt.size     = (*frame)->nb_samples * av_get_bytes_per_sample((*frame)->format) * av_frame_get_channels(*frame);
+    pkt.size     = (*frame)->nb_samples * av_get_bytes_per_sample((*frame)->format) * (*frame)->channels;
     pkt.dts      = (*frame)->pkt_dts;
-    pkt.duration = av_frame_get_pkt_duration(*frame);
+    pkt.duration = (*frame)->pkt_duration;
     return pulse_write_packet(h, &pkt);
 }